Changeset 120311 in webkit
- Timestamp:
- Jun 14, 2012 3:34:26 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r120308 r120311 1 2012-06-14 Jan Keromnes <janx@linux.com> 2 3 Web Inspector: Implement ExtensionPanel.show() method 4 https://bugs.webkit.org/show_bug.cgi?id=88473 5 6 Add output for ExtensionPanel callbacks, and use ExtensionPanel.show() 7 to show the panel. Fix expected. 8 9 Reviewed by Pavel Feldman. 10 11 * inspector/extensions/extensions-panel-expected.txt: 12 * inspector/extensions/extensions-panel.html: 13 1 14 2012-06-14 David Barr <davidbarr@chromium.org> 2 15 -
trunk/LayoutTests/inspector/extensions/extensions-panel-expected.txt
r100735 r120311 1 CONSOLE MESSAGE: line 8: hello 1 2 Tests WebInspector extension API 2 3 … … 19 20 } 20 21 createStatusBarButton : <function> 22 show : <function> 21 23 } 22 24 Extension panel size correct 25 Panel shown 23 26 RUNNING TEST: extension_testStatusBarButtons 24 27 Created a status bar button, dump follows: … … 30 33 update : <function> 31 34 } 35 Panel hidden 32 36 button1 clicked 33 37 Status bar buttons state: -
trunk/LayoutTests/inspector/extensions/extensions-panel.html
r100735 r120311 4 4 <script src="../../http/tests/inspector/extensions-test.js"></script> 5 5 <script type="text/javascript"> 6 function logMessage() 7 { 8 console.log("hello"); 9 } 6 10 7 11 function initialize_extensionsPanelTest() … … 53 57 panel.statusBarItems[index].click(); 54 58 } 59 60 InspectorTest.clickOnURL = function() 61 { 62 WebInspector.showPanel("console"); 63 var xpathResult = document.evaluate("//a[starts-with(., 'extensions-panel.html')]", 64 WebInspector.panels.console.element, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null); 65 var click = document.createEvent("MouseEvent"); 66 click.initMouseEvent("click", true, true); 67 xpathResult.singleNodeValue.dispatchEvent(click); 68 } 55 69 } 56 70 … … 63 77 output("Panel created"); 64 78 dumpObject(panel); 65 // This will force extension iframe to be really loaded and will cause waitForPanel() callback below. 66 extension_showPanel("extension"); 79 panel.onHidden.addListener(function() { 80 output("Panel hidden"); 81 }); 82 panel.onShown.addListener(function(window) { 83 output("Panel shown"); 84 }); 85 86 // This is not authorized and therefore should not produce any output 87 panel.show(); 88 extension_showPanel("console"); 89 90 function handleOpenResource(resource, lineNumber) 91 { 92 // This will force extension iframe to be really loaded and will cause waitForPanel() callback below. 93 panel.show(); 94 } 95 webInspector.panels.setOpenResourceHandler(handleOpenResource); 96 evaluateOnFrontend("WebInspector.openAnchorLocationRegistry._activeHandler = 'test extension'"); 97 webInspector.inspectedWindow.eval("logMessage()", function() { 98 evaluateOnFrontend("InspectorTest.clickOnURL();"); 99 }); 67 100 } 68 101 // The panel code is expected to report its size via InspectorTest.panelCallback() -
trunk/Source/WebCore/ChangeLog
r120309 r120311 1 2012-06-14 Jan Keromnes <janx@linux.com> 2 3 Web Inspector: Implement ExtensionPanel.show() method 4 https://bugs.webkit.org/show_bug.cgi?id=88473 5 6 Implemented ExtensionPanel.show() API method to allow extension 7 developers to show their panel when needed. 8 9 Reviewed by Pavel Feldman. 10 11 Tests for this method are in: 12 LayoutTests/inspector/extensions/extensions-panel.html 13 14 * inspector/front-end/ExtensionAPI.js: 15 (defineCommonExtensionSymbols): 16 (injectedExtensionAPI.ExtensionPanelImpl.prototype.createStatusBarButton): 17 (injectedExtensionAPI.ExtensionPanelImpl.prototype.show): 18 * inspector/front-end/ExtensionServer.js: 19 (WebInspector.ExtensionServer): 20 (WebInspector.ExtensionServer.prototype._onShowPanel): 21 1 22 2012-06-14 Kent Tamura <tkent@chromium.org> 2 23 -
trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js
r118492 r120311 85 85 SetSidebarHeight: "setSidebarHeight", 86 86 SetSidebarPage: "setSidebarPage", 87 ShowPanel: "showPanel", 87 88 StopAuditCategoryRun: "stopAuditCategoryRun", 88 89 Unsubscribe: "unsubscribe", … … 101 102 var commands = apiPrivate.Commands; 102 103 var events = apiPrivate.Events; 104 var userAction = false; 103 105 104 106 // Here and below, all constructors are private to API implementation. … … 306 308 function callbackWrapper(message) 307 309 { 308 callback.call(null, new Resource(message.resource), message.lineNumber); 310 // Allow the panel to show itself when handling the event. 311 userAction = true; 312 try { 313 callback.call(null, new Resource(message.resource), message.lineNumber); 314 } finally { 315 userAction = false; 316 } 309 317 } 310 318 extensionServer.registerHandler(events.OpenResource, callbackWrapper); … … 395 403 extensionServer.sendRequest(request); 396 404 return new Button(id); 405 }, 406 407 show: function() 408 { 409 if (!userAction) 410 return; 411 412 var request = { 413 command: commands.ShowPanel, 414 id: this._id 415 }; 416 extensionServer.sendRequest(request); 397 417 } 398 418 }; -
trunk/Source/WebCore/inspector/front-end/ExtensionServer.js
r117293 r120311 67 67 this._registerHandler(commands.SetSidebarContent, this._onSetSidebarContent.bind(this)); 68 68 this._registerHandler(commands.SetSidebarPage, this._onSetSidebarPage.bind(this)); 69 this._registerHandler(commands.ShowPanel, this._onShowPanel.bind(this)); 69 70 this._registerHandler(commands.StopAuditCategoryRun, this._onStopAuditCategoryRun.bind(this)); 70 71 this._registerHandler(commands.Subscribe, this._onSubscribe.bind(this)); … … 203 204 WebInspector.addPanel(panel); 204 205 return this._status.OK(); 206 }, 207 208 _onShowPanel: function(message) 209 { 210 // Note: WebInspector.showPanel already sanitizes input. 211 WebInspector.showPanel(message.id); 205 212 }, 206 213
Note: See TracChangeset
for help on using the changeset viewer.