Title: [102171] trunk/Source/WebKit/chromium
Revision
102171
Author
[email protected]
Date
2011-12-06 13:06:22 -0800 (Tue, 06 Dec 2011)

Log Message

[chromium] Guard access to WebKitPlatformSupport::currentThread with a null check
https://bugs.webkit.org/show_bug.cgi?id=73937

Reviewed by Adam Barth.

Though |currentThread| is never null in production code, it is null in
unit tests (such as Chromium's unit_tests) that call WebKit::initialize()
without first constructing a MessageLoop.

* src/WebKit.cpp:
(WebKit::initialize):
(WebKit::shutdown):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (102170 => 102171)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-12-06 21:00:29 UTC (rev 102170)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-12-06 21:06:22 UTC (rev 102171)
@@ -1,3 +1,18 @@
+2011-12-06  Adam Klein  <[email protected]>
+
+        [chromium] Guard access to WebKitPlatformSupport::currentThread with a null check
+        https://bugs.webkit.org/show_bug.cgi?id=73937
+
+        Reviewed by Adam Barth.
+
+        Though |currentThread| is never null in production code, it is null in
+        unit tests (such as Chromium's unit_tests) that call WebKit::initialize()
+        without first constructing a MessageLoop.
+
+        * src/WebKit.cpp:
+        (WebKit::initialize):
+        (WebKit::shutdown):
+
 2011-12-06  Alexandre Elias  <[email protected]>
 
         [chromium] Apply sent deltas on finishCommit

Modified: trunk/Source/WebKit/chromium/src/WebKit.cpp (102170 => 102171)


--- trunk/Source/WebKit/chromium/src/WebKit.cpp	2011-12-06 21:00:29 UTC (rev 102170)
+++ trunk/Source/WebKit/chromium/src/WebKit.cpp	2011-12-06 21:06:22 UTC (rev 102171)
@@ -93,9 +93,12 @@
     WebCore::V8BindingPerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
 
 #if ENABLE(MUTATION_OBSERVERS)
-    ASSERT(!s_endOfTaskRunner);
-    s_endOfTaskRunner = new EndOfTaskRunner;
-    webKitPlatformSupport->currentThread()->addTaskObserver(s_endOfTaskRunner);
+    // currentThread will always be non-null in production, but can be null in Chromium unit tests.
+    if (WebThread* currentThread = webKitPlatformSupport->currentThread()) {
+        ASSERT(!s_endOfTaskRunner);
+        s_endOfTaskRunner = new EndOfTaskRunner;
+        currentThread->addTaskObserver(s_endOfTaskRunner);
+    }
 #endif
 }
 
@@ -127,6 +130,7 @@
 {
 #if ENABLE(MUTATION_OBSERVERS)
     if (s_endOfTaskRunner) {
+        ASSERT(s_webKitPlatformSupport->currentThread());
         s_webKitPlatformSupport->currentThread()->removeTaskObserver(s_endOfTaskRunner);
         delete s_endOfTaskRunner;
         s_endOfTaskRunner = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to