Title: [123902] trunk/Source
Revision
123902
Author
[email protected]
Date
2012-07-27 12:02:47 -0700 (Fri, 27 Jul 2012)

Log Message

Web Inspector: Allow front_end to be loaded into an iframe
https://bugs.webkit.org/show_bug.cgi?id=92437

Patch by John J. Barton <[email protected]> on 2012-07-27
Reviewed by Pavel Feldman.

This change only affects 'embedders' of the inspector/front_end. No change of function for WebKit ports.

* inspector/front-end/ExtensionAPI.js:
Replace window.top with window.parent two places. When WebInspector is loaded as the main window content,
then extension iframes have window.top === window.parent; when WebInspector is loaded as an iframe, then
extensions are iframes in iframes and we need to use a relative address window.parent.
(injectedExtensionAPI.ExtensionViewImpl.dispatchShowEvent):
(injectedExtensionAPI.ExtensionViewImpl):
(injectedExtensionAPI.ExtensionServerClient):
WebKit/chromium/scripts/generate_devtools_extension_api.py:
The current number of frames is used in a dynamically created identifier. Again we replace 'top' by
window.parent.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123901 => 123902)


--- trunk/Source/WebCore/ChangeLog	2012-07-27 18:54:55 UTC (rev 123901)
+++ trunk/Source/WebCore/ChangeLog	2012-07-27 19:02:47 UTC (rev 123902)
@@ -1,3 +1,23 @@
+2012-07-27  John J. Barton  <[email protected]>
+
+        Web Inspector: Allow front_end to be loaded into an iframe
+        https://bugs.webkit.org/show_bug.cgi?id=92437
+
+        Reviewed by Pavel Feldman.
+
+        This change only affects 'embedders' of the inspector/front_end. No change of function for WebKit ports.
+
+        * inspector/front-end/ExtensionAPI.js: 
+        Replace window.top with window.parent two places. When WebInspector is loaded as the main window content, 
+        then extension iframes have window.top === window.parent; when WebInspector is loaded as an iframe, then
+        extensions are iframes in iframes and we need to use a relative address window.parent.
+        (injectedExtensionAPI.ExtensionViewImpl.dispatchShowEvent):
+        (injectedExtensionAPI.ExtensionViewImpl):
+        (injectedExtensionAPI.ExtensionServerClient):
+        WebKit/chromium/scripts/generate_devtools_extension_api.py:
+        The current number of frames is used in a dynamically created identifier. Again we replace 'top' by 
+        window.parent.
+
 2012-07-27  Vivek Galatage  <[email protected]>
 
         Web Inspector: InspectorPageAgent should ascertain document to be non-null in updateViewMetrics()

Modified: trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js (123901 => 123902)


--- trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js	2012-07-27 18:54:55 UTC (rev 123901)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js	2012-07-27 19:02:47 UTC (rev 123902)
@@ -348,7 +348,7 @@
     function dispatchShowEvent(message)
     {
         var frameIndex = message.arguments[0];
-        this._fire(window.top.frames[frameIndex]);
+        this._fire(window.parent.frames[frameIndex]);
     }
     this._onShown_ = new EventSink(events.ViewShown + id, dispatchShowEvent);
     this._onHidden_ = new EventSink(events.ViewHidden + id);
@@ -738,7 +738,7 @@
     this._port.addEventListener("message", this._onMessage.bind(this), false);
     this._port.start();
 
-    top.postMessage("registerExtension", [ channel.port2 ], "*");
+    window.parent.postMessage("registerExtension", [ channel.port2 ], "*");
 }
 
 ExtensionServerClient.prototype = {

Modified: trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py (123901 => 123902)


--- trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py	2012-07-27 18:54:55 UTC (rev 123901)
+++ trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py	2012-07-27 19:02:47 UTC (rev 123902)
@@ -41,7 +41,7 @@
     output.write("""
         var tabId;
         var extensionInfo = {};
-        platformExtensionAPI(injectedExtensionAPI("remote-" + top.frames.length));
+        platformExtensionAPI(injectedExtensionAPI("remote-" + window.parent.frames.length));
     })();""")
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to