Diff
Modified: trunk/LayoutTests/ChangeLog (120310 => 120311)
--- trunk/LayoutTests/ChangeLog 2012-06-14 10:31:33 UTC (rev 120310)
+++ trunk/LayoutTests/ChangeLog 2012-06-14 10:34:26 UTC (rev 120311)
@@ -1,3 +1,16 @@
+2012-06-14 Jan Keromnes <[email protected]>
+
+ Web Inspector: Implement ExtensionPanel.show() method
+ https://bugs.webkit.org/show_bug.cgi?id=88473
+
+ Add output for ExtensionPanel callbacks, and use ExtensionPanel.show()
+ to show the panel. Fix expected.
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/extensions/extensions-panel-expected.txt:
+ * inspector/extensions/extensions-panel.html:
+
2012-06-14 David Barr <[email protected]>
Add dpcm to css3-images image-resolution
Modified: trunk/LayoutTests/inspector/extensions/extensions-panel-expected.txt (120310 => 120311)
--- trunk/LayoutTests/inspector/extensions/extensions-panel-expected.txt 2012-06-14 10:31:33 UTC (rev 120310)
+++ trunk/LayoutTests/inspector/extensions/extensions-panel-expected.txt 2012-06-14 10:34:26 UTC (rev 120311)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 8: hello
Tests WebInspector extension API
Started extension.
@@ -18,8 +19,10 @@
removeListener : <function>
}
createStatusBarButton : <function>
+ show : <function>
}
Extension panel size correct
+Panel shown
RUNNING TEST: extension_testStatusBarButtons
Created a status bar button, dump follows:
{
@@ -29,6 +32,7 @@
}
update : <function>
}
+Panel hidden
button1 clicked
Status bar buttons state:
status bar item 0, icon: .../inspector/resources/button1.png, tooltip: 'Button One tooltip', disabled: false
Modified: trunk/LayoutTests/inspector/extensions/extensions-panel.html (120310 => 120311)
--- trunk/LayoutTests/inspector/extensions/extensions-panel.html 2012-06-14 10:31:33 UTC (rev 120310)
+++ trunk/LayoutTests/inspector/extensions/extensions-panel.html 2012-06-14 10:34:26 UTC (rev 120311)
@@ -3,6 +3,10 @@
<script src=""
<script src=""
<script type="text/_javascript_">
+function logMessage()
+{
+ console.log("hello");
+}
function initialize_extensionsPanelTest()
{
@@ -52,6 +56,16 @@
var panel = WebInspector.inspectorView.currentPanel();
panel.statusBarItems[index].click();
}
+
+ InspectorTest.clickOnURL = function()
+ {
+ WebInspector.showPanel("console");
+ var xpathResult = document.evaluate("//a[starts-with(., 'extensions-panel.html')]",
+ WebInspector.panels.console.element, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null);
+ var click = document.createEvent("MouseEvent");
+ click.initMouseEvent("click", true, true);
+ xpathResult.singleNodeValue.dispatchEvent(click);
+ }
}
function extension_testCreatePanel(nextTest)
@@ -62,8 +76,27 @@
{
output("Panel created");
dumpObject(panel);
- // This will force extension iframe to be really loaded and will cause waitForPanel() callback below.
- extension_showPanel("extension");
+ panel.onHidden.addListener(function() {
+ output("Panel hidden");
+ });
+ panel.onShown.addListener(function(window) {
+ output("Panel shown");
+ });
+
+ // This is not authorized and therefore should not produce any output
+ panel.show();
+ extension_showPanel("console");
+
+ function handleOpenResource(resource, lineNumber)
+ {
+ // This will force extension iframe to be really loaded and will cause waitForPanel() callback below.
+ panel.show();
+ }
+ webInspector.panels.setOpenResourceHandler(handleOpenResource);
+ evaluateOnFrontend("WebInspector.openAnchorLocationRegistry._activeHandler = 'test extension'");
+ webInspector.inspectedWindow.eval("logMessage()", function() {
+ evaluateOnFrontend("InspectorTest.clickOnURL();");
+ });
}
// The panel code is expected to report its size via InspectorTest.panelCallback()
evaluateOnFrontend("InspectorTest.waitForPanel(reply);", nextTest);
Modified: trunk/Source/WebCore/ChangeLog (120310 => 120311)
--- trunk/Source/WebCore/ChangeLog 2012-06-14 10:31:33 UTC (rev 120310)
+++ trunk/Source/WebCore/ChangeLog 2012-06-14 10:34:26 UTC (rev 120311)
@@ -1,3 +1,24 @@
+2012-06-14 Jan Keromnes <[email protected]>
+
+ Web Inspector: Implement ExtensionPanel.show() method
+ https://bugs.webkit.org/show_bug.cgi?id=88473
+
+ Implemented ExtensionPanel.show() API method to allow extension
+ developers to show their panel when needed.
+
+ Reviewed by Pavel Feldman.
+
+ Tests for this method are in:
+ LayoutTests/inspector/extensions/extensions-panel.html
+
+ * inspector/front-end/ExtensionAPI.js:
+ (defineCommonExtensionSymbols):
+ (injectedExtensionAPI.ExtensionPanelImpl.prototype.createStatusBarButton):
+ (injectedExtensionAPI.ExtensionPanelImpl.prototype.show):
+ * inspector/front-end/ExtensionServer.js:
+ (WebInspector.ExtensionServer):
+ (WebInspector.ExtensionServer.prototype._onShowPanel):
+
2012-06-14 Kent Tamura <[email protected]>
Fix a typo in r120304.
Modified: trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js (120310 => 120311)
--- trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js 2012-06-14 10:31:33 UTC (rev 120310)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js 2012-06-14 10:34:26 UTC (rev 120311)
@@ -84,6 +84,7 @@
SetSidebarContent: "setSidebarContent",
SetSidebarHeight: "setSidebarHeight",
SetSidebarPage: "setSidebarPage",
+ ShowPanel: "showPanel",
StopAuditCategoryRun: "stopAuditCategoryRun",
Unsubscribe: "unsubscribe",
UpdateButton: "updateButton",
@@ -100,6 +101,7 @@
var commands = apiPrivate.Commands;
var events = apiPrivate.Events;
+var userAction = false;
// Here and below, all constructors are private to API implementation.
// For a public type Foo, if internal fields are present, these are on
@@ -305,7 +307,13 @@
else {
function callbackWrapper(message)
{
- callback.call(null, new Resource(message.resource), message.lineNumber);
+ // Allow the panel to show itself when handling the event.
+ userAction = true;
+ try {
+ callback.call(null, new Resource(message.resource), message.lineNumber);
+ } finally {
+ userAction = false;
+ }
}
extensionServer.registerHandler(events.OpenResource, callbackWrapper);
}
@@ -394,6 +402,18 @@
};
extensionServer.sendRequest(request);
return new Button(id);
+ },
+
+ show: function()
+ {
+ if (!userAction)
+ return;
+
+ var request = {
+ command: commands.ShowPanel,
+ id: this._id
+ };
+ extensionServer.sendRequest(request);
}
};
Modified: trunk/Source/WebCore/inspector/front-end/ExtensionServer.js (120310 => 120311)
--- trunk/Source/WebCore/inspector/front-end/ExtensionServer.js 2012-06-14 10:31:33 UTC (rev 120310)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionServer.js 2012-06-14 10:34:26 UTC (rev 120311)
@@ -66,6 +66,7 @@
this._registerHandler(commands.SetSidebarHeight, this._onSetSidebarHeight.bind(this));
this._registerHandler(commands.SetSidebarContent, this._onSetSidebarContent.bind(this));
this._registerHandler(commands.SetSidebarPage, this._onSetSidebarPage.bind(this));
+ this._registerHandler(commands.ShowPanel, this._onShowPanel.bind(this));
this._registerHandler(commands.StopAuditCategoryRun, this._onStopAuditCategoryRun.bind(this));
this._registerHandler(commands.Subscribe, this._onSubscribe.bind(this));
this._registerHandler(commands.Unsubscribe, this._onUnsubscribe.bind(this));
@@ -204,6 +205,12 @@
return this._status.OK();
},
+ _onShowPanel: function(message)
+ {
+ // Note: WebInspector.showPanel already sanitizes input.
+ WebInspector.showPanel(message.id);
+ },
+
_onCreateStatusBarButton: function(message, port)
{
var panel = this._clientObjects[message.panel];