Title: [115827] trunk/Source/WebKit/chromium
Revision
115827
Author
[email protected]
Date
2012-05-02 07:10:01 -0700 (Wed, 02 May 2012)

Log Message

Web Inspector: TypeError: Cannot call method 'createLiveLocation' of undefined
https://bugs.webkit.org/show_bug.cgi?id=85371

Standard extension scripts injected to the Chromium background page should have
correct script data which means that context debug id should be already set on
the context where they are compiled before the compilation. This patch moves
assignment of context debug id earlier where it is known that no scripts have
been evaluated in the context.

Reviewed by Pavel Feldman.

* src/FrameLoaderClientImpl.cpp:
(WebKit::FrameLoaderClientImpl::dispatchDidClearWindowObjectInWorld):
(WebKit::FrameLoaderClientImpl::didCreateScriptContext):
* src/WebDevToolsAgentImpl.cpp:
(WebKit::WebDevToolsAgentImpl::didCreateScriptContext):
* src/WebDevToolsAgentImpl.h:
(WebDevToolsAgentImpl):
* src/WebDevToolsAgentPrivate.h:
(WebDevToolsAgentPrivate):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (115826 => 115827)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-02 14:09:49 UTC (rev 115826)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-02 14:10:01 UTC (rev 115827)
@@ -1,3 +1,26 @@
+2012-05-02  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: TypeError: Cannot call method 'createLiveLocation' of undefined
+        https://bugs.webkit.org/show_bug.cgi?id=85371
+
+        Standard extension scripts injected to the Chromium background page should have
+        correct script data which means that context debug id should be already set on
+        the context where they are compiled before the compilation. This patch moves
+        assignment of context debug id earlier where it is known that no scripts have
+        been evaluated in the context.
+
+        Reviewed by Pavel Feldman.
+
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::FrameLoaderClientImpl::dispatchDidClearWindowObjectInWorld):
+        (WebKit::FrameLoaderClientImpl::didCreateScriptContext):
+        * src/WebDevToolsAgentImpl.cpp:
+        (WebKit::WebDevToolsAgentImpl::didCreateScriptContext):
+        * src/WebDevToolsAgentImpl.h:
+        (WebDevToolsAgentImpl):
+        * src/WebDevToolsAgentPrivate.h:
+        (WebDevToolsAgentPrivate):
+
 2012-05-02  Tommy Widenflycht  <[email protected]>
 
         MediaStream API: Changing webkitGetUserMedia to take an object instead of a string

Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (115826 => 115827)


--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2012-05-02 14:09:49 UTC (rev 115826)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2012-05-02 14:10:01 UTC (rev 115827)
@@ -135,10 +135,6 @@
 {
     if (m_webFrame->client())
         m_webFrame->client()->didClearWindowObject(m_webFrame);
-
-    WebViewImpl* webview = m_webFrame->viewImpl();
-    if (webview->devToolsAgentPrivate())
-        webview->devToolsAgentPrivate()->didClearWindowObject(m_webFrame);
 }
 
 void FrameLoaderClientImpl::documentElementAvailable()
@@ -150,6 +146,9 @@
 #if USE(V8)
 void FrameLoaderClientImpl::didCreateScriptContext(v8::Handle<v8::Context> context, int extensionGroup, int worldId)
 {
+    WebViewImpl* webview = m_webFrame->viewImpl();
+    if (webview->devToolsAgentPrivate())
+        webview->devToolsAgentPrivate()->didCreateScriptContext(m_webFrame, worldId);
     if (m_webFrame->client())
         m_webFrame->client()->didCreateScriptContext(m_webFrame, context, extensionGroup, worldId);
 }

Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp (115826 => 115827)


--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp	2012-05-02 14:09:49 UTC (rev 115826)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp	2012-05-02 14:10:01 UTC (rev 115827)
@@ -415,10 +415,12 @@
     ClientMessageLoopAdapter::didNavigate();
 }
 
-void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe)
+void WebDevToolsAgentImpl::didCreateScriptContext(WebFrameImpl* webframe, int worldId)
 {
-    WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame());
-    if (proxy && webframe->frame()->script()->canExecuteScripts(NotAboutToExecuteScript))
+    // Skip non main world contexts.
+    if (worldId)
+        return;
+    if (WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(webframe->frame()))
         proxy->setContextDebugId(m_hostId);
 }
 

Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h (115826 => 115827)


--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h	2012-05-02 14:09:49 UTC (rev 115826)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h	2012-05-02 14:10:01 UTC (rev 115827)
@@ -71,7 +71,7 @@
     virtual ~WebDevToolsAgentImpl();
 
     // WebDevToolsAgentPrivate implementation.
-    virtual void didClearWindowObject(WebFrameImpl*);
+    virtual void didCreateScriptContext(WebFrameImpl*, int worldId);
     virtual void mainFrameViewCreated(WebFrameImpl*);
     virtual bool metricsOverridden();
     virtual void webViewResized();

Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h (115826 => 115827)


--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h	2012-05-02 14:09:49 UTC (rev 115826)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h	2012-05-02 14:10:01 UTC (rev 115827)
@@ -41,9 +41,10 @@
 public:
 
     // Notification from FrameLoaderClientImpl:
-    // The window object for the frame has been cleared of any extra properties
-    // that may have been set by script from the previously loaded document.
-    virtual void didClearWindowObject(WebFrameImpl*) = 0;
+    // New context has been created for a given world in given frame. Any
+    // processing hat needs to happen before the first script is evaluated
+    // in this context should be done here.
+    virtual void didCreateScriptContext(WebFrameImpl*, int worldId) = 0;
 
     // A new FrameView has been created for the specified WebFrame using
     // the Frame::createView() call.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to