Changeset 103411 in webkit
- Timestamp:
- Dec 21, 2011 9:20:43 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r103408 r103411 1 2011-12-20 Andrey Kosyakov <caseq@chromium.org> 2 3 Web Inspector: [Extension API] refactor extension API build code, expose experimental APIs conditionally in chromium 4 https://bugs.webkit.org/show_bug.cgi?id=74941 5 6 Reviewed by Pavel Feldman. 7 8 * http/tests/inspector/extensions-test.js: 9 (initialize_ExtensionsTest.InspectorTest.runExtensionTests): 10 (initialize_ExtensionsTest): 11 * platform/chromium/inspector/extensions/extensions-api-expected.txt: Removed. 12 1 13 2011-12-12 Pavel Podivilov <podivilov@chromium.org> 2 14 -
trunk/LayoutTests/http/tests/inspector/extensions-test.js
r98954 r103411 51 51 pageURL.replace(/\/inspector\/extensions\/[^/]*$/, "/http/tests")) + 52 52 "/inspector/resources/extension-main.html"; 53 WebInspector.addExtensions([{ startPage: extensionURL, name: "test extension" }]);53 WebInspector.addExtensions([{ startPage: extensionURL, name: "test extension", exposeWebInspectorNamespace: true }]); 54 54 }); 55 55 } -
trunk/Source/WebCore/ChangeLog
r103408 r103411 1 2011-12-20 Andrey Kosyakov <caseq@chromium.org> 2 3 Web Inspector: [Extension API] refactor extension API build code, expose experimental APIs conditionally in chromium 4 https://bugs.webkit.org/show_bug.cgi?id=74941 5 6 Reviewed by Pavel Feldman. 7 8 * WebCore.gypi: 9 * inspector/front-end/ExtensionAPI.js: 10 (buildPlatformExtensionAPI.platformExtensionAPI): 11 (buildPlatformExtensionAPI): 12 (buildExtensionAPIInjectedScript): 13 * inspector/front-end/ExtensionServer.js: 14 (WebInspector.ExtensionServer.prototype._addExtensions): 15 (WebInspector.ExtensionServer.prototype._addExtension): 16 (window.addExtension): 17 1 18 2011-12-12 Pavel Podivilov <podivilov@chromium.org> 2 19 -
trunk/Source/WebCore/WebCore.gypi
r103354 r103411 6408 6408 'inspector/front-end/EmptyView.js', 6409 6409 'inspector/front-end/EventListenersSidebarPane.js', 6410 'inspector/front-end/ExtensionAPI.js', 6410 6411 'inspector/front-end/ExtensionAuditCategory.js', 6411 6412 'inspector/front-end/ExtensionPanel.js', … … 6517 6518 'inspector/front-end/popover.css', 6518 6519 '<@(webinspector_standalone_css_files)', 6519 '<@(webinspector_extension_api_files)',6520 6520 ], 6521 6521 'webinspector_standalone_css_files': [ … … 6536 6536 'inspector/front-end/textViewer.css', 6537 6537 'inspector/front-end/timelinePanel.css', 6538 ],6539 'webinspector_extension_api_files': [6540 'inspector/front-end/ExtensionAPI.js',6541 6538 ], 6542 6539 'webinspector_uglifyjs_files': [ -
trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js
r101769 r103411 807 807 var extensionServer = new ExtensionServerClient(); 808 808 809 window.webInspector = new InspectorExtensionAPI(); 810 window.experimental = window.experimental || {}; 811 window.experimental.webInspector = window.webInspector; 812 813 } 814 815 function buildExtensionAPIInjectedScript(platformAPI) 809 return new InspectorExtensionAPI(); 810 } 811 812 // Default implementation; platforms will override. 813 function buildPlatformExtensionAPI() 814 { 815 function platformExtensionAPI(coreAPI) 816 { 817 window.webInspector = coreAPI; 818 } 819 return platformExtensionAPI.toString(); 820 } 821 822 823 function buildExtensionAPIInjectedScript(extensionInfo) 816 824 { 817 825 return "(function(injectedScriptHost, inspectedWindow, injectedScriptId){ " + 818 826 defineCommonExtensionSymbols.toString() + ";" + 819 827 injectedExtensionAPI.toString() + ";" + 820 "injectedExtensionAPI(injectedScriptId);" +821 (platformAPI || "") + ";" +828 buildPlatformExtensionAPI(extensionInfo) + ";" + 829 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + 822 830 "return {};" + 823 831 "})"; -
trunk/Source/WebCore/inspector/front-end/ExtensionServer.js
r103325 r103411 605 605 { 606 606 for (var i = 0; i < extensions.length; ++i) 607 this._addExtension(extensions[i] .startPage, extensions[i].name);608 }, 609 610 _addExtension: function( startPage, name)607 this._addExtension(extensions[i]); 608 }, 609 610 _addExtension: function(extensionInfo) 611 611 { 612 612 const urlOriginRegExp = new RegExp("([^:]+:\/\/[^/]*)\/"); // Can't use regexp literal here, MinJS chokes on it. 613 var startPage = extensionInfo.startPage; 614 var name = extensionInfo.name; 613 615 614 616 try { … … 621 623 if (!this._registeredExtensions[extensionOrigin]) { 622 624 // See ExtensionAPI.js and ExtensionCommon.js for details. 623 InspectorFrontendHost.setInjectedScriptForOrigin(extensionOrigin, this._buildExtensionAPIScript());625 InspectorFrontendHost.setInjectedScriptForOrigin(extensionOrigin, buildExtensionAPIInjectedScript(extensionInfo)); 624 626 this._registeredExtensions[extensionOrigin] = { name: name }; 625 627 } … … 633 635 } 634 636 return true; 635 },636 637 _buildExtensionAPIScript: function()638 {639 var platformAPI = WebInspector.buildPlatformExtensionAPI ? WebInspector.buildPlatformExtensionAPI() : "";640 return buildExtensionAPIInjectedScript(platformAPI);641 637 }, 642 638 … … 753 749 WebInspector.extensionServer = new WebInspector.ExtensionServer(); 754 750 755 window.addExtension = WebInspector.extensionServer._addExtension.bind(WebInspector.extensionServer); 751 window.addExtension = function(page, name) 752 { 753 WebInspector.extensionServer._addExtension({ 754 startPage: page, 755 name: name, 756 }); 757 } -
trunk/Source/WebKit/chromium/ChangeLog
r103351 r103411 1 2011-12-20 Andrey Kosyakov <caseq@chromium.org> 2 3 Web Inspector: [Extension API] refactor extension API build code, expose experimental APIs conditionally in chromium 4 https://bugs.webkit.org/show_bug.cgi?id=74941 5 6 Reviewed by Pavel Feldman. 7 8 * WebKit.gyp: 9 * WebKit.gypi: 10 * scripts/concatenate_js_files.py: 11 (main): 12 * scripts/generate_devtools_extension_api.py: 13 (write_devtools_extension_api): 14 * src/js/DevTools.js: 15 (): 16 1 17 2011-12-20 Nate Chapin <japhet@chromium.org> 2 18 -
trunk/Source/WebKit/chromium/WebKit.gyp
r103215 r103411 918 918 'inputs': [ 919 919 '<@(_script_name)', 920 '<@( webinspector_extension_api_files)',920 '<@(devtools_extension_api_files)', 921 921 ], 922 922 'outputs': ['<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js'], 923 'action': ['python', '<@(_script_name)', '<@(_outputs)', '<@( webinspector_extension_api_files)'],923 'action': ['python', '<@(_script_name)', '<@(_outputs)', '<@(devtools_extension_api_files)'], 924 924 }], 925 925 }, … … 1000 1000 '<@(webinspector_image_files)', 1001 1001 '<@(devtools_image_files)', 1002 '<@( webinspector_extension_api_files)',1002 '<@(devtools_extension_api_files)', 1003 1003 ], 1004 1004 'search_path': [ … … 1013 1013 '--devtools-files', '<@(devtools_files)', 1014 1014 '--workers-files', '<@(_workers_files)', 1015 '--extension-api-files', '<@( webinspector_extension_api_files)',1015 '--extension-api-files', '<@(devtools_extension_api_files)', 1016 1016 '--search-path', '<@(_search_path)', 1017 1017 '--js-search-path', '<@(_js_search_path)', -
trunk/Source/WebKit/chromium/WebKit.gypi
r103293 r103411 35 35 'devtools_js_files': [ 36 36 'src/js/DevTools.js', 37 'src/js/DevToolsExtensionAPI.js', 37 38 'src/js/Tests.js', 38 39 ], 39 40 'devtools_css_files': [ 40 41 'src/js/devTools.css', 42 ], 43 'devtools_extension_api_files': [ 44 '../../WebCore/inspector/front-end/ExtensionAPI.js', 45 'src/js/DevToolsExtensionAPI.js' 41 46 ], 42 47 'devtools_image_files': [ -
trunk/Source/WebKit/chromium/scripts/concatenate_js_files.py
r85071 r103411 88 88 extractor = OrderedJSFilesExtractor(order_html.read()) 89 89 extractor.ordered_js_files.append('DevTools.js') 90 extractor.ordered_js_files.append('DevToolsExtensionAPI.js') 90 91 extractor.ordered_js_files.append('Tests.js') 91 92 -
trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py
r95289 r103411 40 40 output.write(input.read()) 41 41 output.write(""" 42 injectedExtensionAPI("remote-" + top.frames.length); 43 44 chrome = window.chrome || {}; 45 chrome.experimental = chrome.experimental || {}; 46 chrome.experimental.devtools = chrome.experimental.devtools || {}; 47 48 var properties = Object.getOwnPropertyNames(webInspector); 49 for (var i = 0; i < properties.length; ++i) { 50 var descriptor = Object.getOwnPropertyDescriptor(webInspector, properties[i]); 51 Object.defineProperty(chrome.experimental.devtools, properties[i], descriptor); 52 } 42 var tabId; 43 var extensionInfo = {}; 44 platformExtensionAPI(injectedExtensionAPI("remote-" + top.frames.length)); 53 45 })();""") 54 46 -
trunk/Source/WebKit/chromium/src/js/DevTools.js
r101671 r103411 1 1 /* 2 * Copyright (C) 201 0Google Inc. All rights reserved.2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 43 43 })();} 44 44 45 WebInspector.platformExtensionAPI = function(tabId)45 function buildPlatformExtensionAPI(extensionInfo) 46 46 { 47 function getTabId() 48 { 49 return tabId; 50 } 51 webInspector.inspectedWindow.__proto__.__defineGetter__("tabId", getTabId); 52 chrome = window.chrome || {}; 53 chrome.experimental = chrome.experimental || {}; 54 chrome.experimental.devtools = chrome.experimental.devtools || {}; 55 56 var properties = Object.getOwnPropertyNames(webInspector); 57 for (var i = 0; i < properties.length; ++i) { 58 var descriptor = Object.getOwnPropertyDescriptor(webInspector, properties[i]); 59 Object.defineProperty(chrome.experimental.devtools, properties[i], descriptor); 60 } 61 } 62 63 WebInspector.buildPlatformExtensionAPI = function() 64 { 65 return "(" + WebInspector.platformExtensionAPI + ")(" + WebInspector._inspectedTabId + ");"; 47 return "var extensionInfo = " + JSON.stringify(extensionInfo) + ";" + 48 "var tabId = " + WebInspector._inspectedTabId + ";" + 49 platformExtensionAPI.toString(); 66 50 } 67 51
Note: See TracChangeset
for help on using the changeset viewer.