Title: [106846] trunk/Source/WebCore
Revision
106846
Author
[email protected]
Date
2012-02-06 13:55:47 -0800 (Mon, 06 Feb 2012)

Log Message

Before accessing a frame's script controller in V8 bindings, first check that the frame actually exists
https://bugs.webkit.org/show_bug.cgi?id=77370

Reviewed by Adam Barth.

I don't have a working reproduction of the crash yet. As soon as I have
one,  I will add new layout tests.

* bindings/v8/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::addListener):
* bindings/v8/ScheduledAction.cpp:
(WebCore::ScheduledAction::execute):
* bindings/v8/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::restore):
* page/DOMTimer.cpp:
(WebCore::DOMTimer::DOMTimer): remove temporary debug code

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106845 => 106846)


--- trunk/Source/WebCore/ChangeLog	2012-02-06 21:43:27 UTC (rev 106845)
+++ trunk/Source/WebCore/ChangeLog	2012-02-06 21:55:47 UTC (rev 106846)
@@ -1,3 +1,22 @@
+2012-02-06  Jochen Eisinger  <[email protected]>
+
+        Before accessing a frame's script controller in V8 bindings, first check that the frame actually exists
+        https://bugs.webkit.org/show_bug.cgi?id=77370
+
+        Reviewed by Adam Barth.
+
+        I don't have a working reproduction of the crash yet. As soon as I have
+        one,  I will add new layout tests.
+
+        * bindings/v8/PageScriptDebugServer.cpp:
+        (WebCore::PageScriptDebugServer::addListener):
+        * bindings/v8/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::execute):
+        * bindings/v8/ScriptCachedFrameData.cpp:
+        (WebCore::ScriptCachedFrameData::restore):
+        * page/DOMTimer.cpp:
+        (WebCore::DOMTimer::DOMTimer): remove temporary debug code
+
 2012-02-06  James Robinson  <[email protected]>
 
         Support detaching TextureManager from ManagedTexture

Modified: trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp (106845 => 106846)


--- trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp	2012-02-06 21:43:27 UTC (rev 106845)
+++ trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp	2012-02-06 21:55:47 UTC (rev 106846)
@@ -76,10 +76,12 @@
 
 void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page)
 {
+    V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame());
+    if (!proxy)
+        return;
     ScriptController* scriptController = page->mainFrame()->script();
     if (!scriptController->canExecuteScripts(NotAboutToExecuteScript))
         return;
-    V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame());
 
     v8::HandleScope scope;
     v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();

Modified: trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp (106845 => 106846)


--- trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp	2012-02-06 21:43:27 UTC (rev 106845)
+++ trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp	2012-02-06 21:55:47 UTC (rev 106846)
@@ -96,6 +96,8 @@
 {
     if (context->isDocument()) {
         Frame* frame = static_cast<Document*>(context)->frame();
+        if (!frame)
+            return;
         ScriptController* scriptController = frame->script();
         if (!scriptController->canExecuteScripts(AboutToExecuteScript))
             return;

Modified: trunk/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp (106845 => 106846)


--- trunk/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp	2012-02-06 21:43:27 UTC (rev 106845)
+++ trunk/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp	2012-02-06 21:55:47 UTC (rev 106846)
@@ -59,7 +59,7 @@
     if (m_context.get().IsEmpty())
         return;
 
-    if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+    if (!frame || !frame->script()->canExecuteScripts(NotAboutToExecuteScript))
         return;
 
     v8::HandleScope handleScope;

Modified: trunk/Source/WebCore/page/DOMTimer.cpp (106845 => 106846)


--- trunk/Source/WebCore/page/DOMTimer.cpp	2012-02-06 21:43:27 UTC (rev 106845)
+++ trunk/Source/WebCore/page/DOMTimer.cpp	2012-02-06 21:55:47 UTC (rev 106846)
@@ -27,7 +27,6 @@
 #include "config.h"
 #include "DOMTimer.h"
 
-#include "Document.h"
 #include "InspectorInstrumentation.h"
 #include "ScheduledAction.h"
 #include "ScriptExecutionContext.h"
@@ -71,9 +70,6 @@
     , m_originalInterval(interval)
     , m_shouldForwardUserGesture(shouldForwardUserGesture(interval, m_nestingLevel))
 {
-    // FIXME: remove once we found out the root cause for http://webkit.org/b/77370
-    if (scriptExecutionContext()->isDocument() && !static_cast<Document*>(scriptExecutionContext())->frame())
-        CRASH();
     scriptExecutionContext()->addTimeout(m_timeoutId, this);
 
     double intervalMilliseconds = intervalClampedToMinimum(interval, context->minimumTimerInterval());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to