Title: [95289] trunk/Source
Revision
95289
Author
[email protected]
Date
2011-09-16 06:30:21 -0700 (Fri, 16 Sep 2011)

Log Message

2011-09-16  Andrey Kosyakov  <[email protected]>

        Web Inspector: [Extensions API] support extensions for remote inspector front-end
        https://bugs.webkit.org/show_bug.cgi?id=67840

        Reviewed by Pavel Feldman.

        - Merge ExtensionCommon.js into ExtensionAPI.js
        - refactor building of extension API for better reuse
        - expose interface for extension registration

        * WebCore.gypi:
        * WebCore.vcproj/WebCore.vcproj:
        * inspector/front-end/ExtensionAPI.js:
        (defineCommonExtensionSymbols):
        (buildExtensionAPIInjectedScript):
        * inspector/front-end/ExtensionCommon.js:
        * inspector/front-end/ExtensionServer.js:
        (WebInspector.ExtensionServer.prototype._addExtensions):
        (WebInspector.ExtensionServer.prototype._addExtension):
        (WebInspector.ExtensionServer.prototype._buildExtensionAPIScript):
        (WebInspector.ExtensionServer.prototype._onWindowMessage):
        (WebInspector.ExtensionServer.prototype._registerExtension):
        (WebInspector.ExtensionServer.prototype._expandResourcePath):
        * inspector/front-end/WebKit.qrc:
        * inspector/front-end/inspector.html:

2011-09-16  Andrey Kosyakov  <[email protected]>

        Web Inspector: [Extensions API] support extensions for remote inspector front-end
        https://bugs.webkit.org/show_bug.cgi?id=67840

        Reviewed by Pavel Feldman.

        - expose extension API as a single, standalone file for easy reuse in remote extension scripts.

        * WebKit.gyp:
        * scripts/generate_devtools_extension_api.py: Added.
        * scripts/generate_devtools_zip.py:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95288 => 95289)


--- trunk/Source/WebCore/ChangeLog	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/ChangeLog	2011-09-16 13:30:21 UTC (rev 95289)
@@ -1,3 +1,30 @@
+2011-09-16  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: [Extensions API] support extensions for remote inspector front-end
+        https://bugs.webkit.org/show_bug.cgi?id=67840
+
+        Reviewed by Pavel Feldman.
+
+        - Merge ExtensionCommon.js into ExtensionAPI.js
+        - refactor building of extension API for better reuse
+        - expose interface for extension registration
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/front-end/ExtensionAPI.js:
+        (defineCommonExtensionSymbols):
+        (buildExtensionAPIInjectedScript):
+        * inspector/front-end/ExtensionCommon.js:
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._addExtensions):
+        (WebInspector.ExtensionServer.prototype._addExtension):
+        (WebInspector.ExtensionServer.prototype._buildExtensionAPIScript):
+        (WebInspector.ExtensionServer.prototype._onWindowMessage):
+        (WebInspector.ExtensionServer.prototype._registerExtension):
+        (WebInspector.ExtensionServer.prototype._expandResourcePath):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+
 2011-09-16  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: change WebInspector.currentPanel getter/setter to functions.

Modified: trunk/Source/WebCore/WebCore.gypi (95288 => 95289)


--- trunk/Source/WebCore/WebCore.gypi	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/WebCore.gypi	2011-09-16 13:30:21 UTC (rev 95289)
@@ -6349,9 +6349,7 @@
             'inspector/front-end/ElementsTreeOutline.js',
             'inspector/front-end/EmptyView.js',
             'inspector/front-end/EventListenersSidebarPane.js',
-            'inspector/front-end/ExtensionAPI.js',
             'inspector/front-end/ExtensionAuditCategory.js',
-            'inspector/front-end/ExtensionCommon.js',
             'inspector/front-end/ExtensionPanel.js',
             'inspector/front-end/ExtensionRegistryStub.js',
             'inspector/front-end/ExtensionServer.js',
@@ -6455,12 +6453,16 @@
             'inspector/front-end/popover.css',
             'inspector/front-end/textViewer.css',
             '<@(webinspector_standalone_css_files)',
+            '<@(webinspector_extension_api_files)',
         ],
         'webinspector_standalone_css_files': [
             'inspector/front-end/dataGrid.css',
             'inspector/front-end/inspectorCommon.css',
             'inspector/front-end/networkLogView.css',
         ],
+        'webinspector_extension_api_files': [
+            'inspector/front-end/ExtensionAPI.js',
+        ],
         'webinspector_uglifyjs_files': [
             'inspector/front-end/UglifyJS/parse-js.js',
         ],

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (95288 => 95289)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-09-16 13:30:21 UTC (rev 95289)
@@ -68933,10 +68933,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\inspector\front-end\ExtensionCommon.js"
-					>
-				</File>
-				<File
 					RelativePath="..\inspector\front-end\ExtensionPanel.js"
 					>
 				</File>

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


--- trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionAPI.js	2011-09-16 13:30:21 UTC (rev 95289)
@@ -28,9 +28,35 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.injectedExtensionAPI = function(InjectedScriptHost, inspectedWindow, injectedScriptId)
+function defineCommonExtensionSymbols(apiPrivate)
 {
+    if (!apiPrivate.audits)
+        apiPrivate.audits = {};
 
+    apiPrivate.audits.Severity = {
+        Info: "info",
+        Warning: "warning",
+        Severe: "severe"
+    };
+
+    if (!apiPrivate.console)
+        apiPrivate.console = {};
+    apiPrivate.console.Severity = {
+        Tip: "tip",
+        Debug: "debug",
+        Log: "log",
+        Warning: "warning",
+        Error: "error"
+    };
+}
+
+function injectedExtensionAPI(injectedScriptId)
+{
+
+var apiPrivate = {};
+
+defineCommonExtensionSymbols(apiPrivate);
+
 // Here and below, all constructors are private to API implementation.
 // For a public type Foo, if internal fields are present, these are on
 // a private FooImpl type, an instance of FooImpl is used in a closure
@@ -589,3 +615,13 @@
 experimental.webInspector = webInspector;
 
 }
+
+function buildExtensionAPIInjectedScript(platformAPI)
+{
+    return "(function(injectedScriptHost, inspectedWindow, injectedScriptId){ " +
+        defineCommonExtensionSymbols.toString() + ";" +
+        injectedExtensionAPI.toString() + ";" +
+        "injectedExtensionAPI(injectedScriptId);" +
+        (platformAPI || "") +
+        "})";
+}

Deleted: trunk/Source/WebCore/inspector/front-end/ExtensionCommon.js (95288 => 95289)


--- trunk/Source/WebCore/inspector/front-end/ExtensionCommon.js	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionCommon.js	2011-09-16 13:30:21 UTC (rev 95289)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.commonExtensionSymbols = function(apiPrivate)
-{
-
-    if (!apiPrivate.audits)
-        apiPrivate.audits = {};
-
-    apiPrivate.audits.Severity = {
-        Info: "info",
-        Warning: "warning",
-        Severe: "severe"
-    };
-
-    if (!apiPrivate.console)
-        apiPrivate.console = {};
-    apiPrivate.console.Severity = {
-        Tip: "tip",
-        Debug: "debug",
-        Log: "log",
-        Warning: "warning",
-        Error: "error"
-    };
-}
-
-WebInspector.extensionAPI = {};
-
-WebInspector.commonExtensionSymbols(WebInspector.extensionAPI);

Modified: trunk/Source/WebCore/inspector/front-end/ExtensionServer.js (95288 => 95289)


--- trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2011-09-16 13:30:21 UTC (rev 95289)
@@ -525,61 +525,54 @@
 
     _addExtensions: function(extensions)
     {
+        // See ExtensionAPI.js and ExtensionCommon.js for details.
+        InspectorFrontendHost.setExtensionAPI(this._buildExtensionAPIScript());
+        for (var i = 0; i < extensions.length; ++i)
+            this._addExtension(extensions[i].startPage);
+    },
+
+    _addExtension: function(startPage)
+    {
         const urlOriginRegExp = new RegExp("([^:]+:\/\/[^/]*)\/"); // Can't use regexp literal here, MinJS chokes on it.
 
-        // See ExtensionAPI.js and ExtensionCommon.js for details.
-        InspectorFrontendHost.setExtensionAPI(this._buildExtensionAPIInjectedScript());
-        for (var i = 0; i < extensions.length; ++i) {
-            var extension = extensions[i];
-            try {
-                if (!extension.startPage)
-                    return;
-                var originMatch = urlOriginRegExp.exec(extension.startPage);
-                if (!originMatch) {
-                    console.error("Skipping extension with invalid URL: " + extension.startPage);
-                    continue;
-                }
-                this._allowedOrigins[originMatch[1]] = true;
-                var iframe = document.createElement("iframe");
-                iframe.src = ""
-                iframe.style.display = "none";
-                document.body.appendChild(iframe);
-            } catch (e) {
-                console.error("Failed to initialize extension " + extension.startPage + ":" + e);
+        try {
+            var originMatch = urlOriginRegExp.exec(startPage);
+            if (!originMatch) {
+                console.error("Skipping extension with invalid URL: " + startPage);
+                return false;
             }
+            this._allowedOrigins[originMatch[1]] = true;
+            var iframe = document.createElement("iframe");
+            iframe.src = ""
+            iframe.style.display = "none";
+            document.body.appendChild(iframe);
+        } catch (e) {
+            console.error("Failed to initialize extension " + startPage + ":" + e);
+            return false;
         }
+        return true;
     },
 
-    _buildExtensionAPIInjectedScript: function()
+    _buildExtensionAPIScript: function()
     {
-        var resourceTypes = {};
-        var resourceTypeProperties = Object.getOwnPropertyNames(WebInspector.Resource.Type);
-        for (var i = 0; i < resourceTypeProperties.length; ++i) {
-             var propName = resourceTypeProperties[i];
-             var propValue = WebInspector.Resource.Type[propName];
-             if (typeof propValue === "number")
-                 resourceTypes[propName] = WebInspector.Resource.Type.toString(propValue);
-        }
         var platformAPI = WebInspector.buildPlatformExtensionAPI ? WebInspector.buildPlatformExtensionAPI() : "";
-        return "(function(){ " +
-            "var apiPrivate = {};" +
-            "(" + WebInspector.commonExtensionSymbols.toString() + ")(apiPrivate);" +
-            "(" + WebInspector.injectedExtensionAPI.toString() + ").apply(this, arguments);" +
-            platformAPI +
-            "})";
+        return buildExtensionAPIInjectedScript(platformAPI);
     },
 
     _onWindowMessage: function(event)
     {
-        if (event.data !== "registerExtension")
+        if (event.data ="" "registerExtension")
+            this._registerExtension(event.origin, event.ports[0]);
+    },
+
+    _registerExtension: function(origin, port)
+    {
+        if (!this._allowedOrigins.hasOwnProperty(origin)) {
+            if (origin !== location.origin) // Just ignore inspector frames.
+                console.error("Ignoring unauthorized client request from " + origin);
             return;
-        if (!this._allowedOrigins.hasOwnProperty(event.origin)) {
-            if (event.origin !== location.origin) // Just ignore inspector frames.
-                console.error("Ignoring unauthorized client request from " + event.origin);
-            return;
         }
-        var port = event.ports[0];
-        port._extensionOrigin = event.origin;
+        port._extensionOrigin = origin;
         port.addEventListener("message", this._onmessage.bind(this), false);
         port.start();
     },
@@ -620,7 +613,7 @@
     {
         if (!resourcePath)
             return;
-        return extensionPath + escape(this._normalizePath(resourcePath));
+        return extensionPath + this._normalizePath(resourcePath);
     },
 
     _normalizePath: function(path)
@@ -677,3 +670,8 @@
 }
 
 WebInspector.extensionServer = new WebInspector.ExtensionServer();
+
+WebInspector.extensionAPI = {};
+defineCommonExtensionSymbols(WebInspector.extensionAPI);
+
+window.addExtension = WebInspector.extensionServer._addExtension.bind(WebInspector.extensionServer);

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (95288 => 95289)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2011-09-16 13:30:21 UTC (rev 95289)
@@ -48,7 +48,6 @@
     <file>EventListenersSidebarPane.js</file>
     <file>ExtensionAPI.js</file>
     <file>ExtensionAuditCategory.js</file>
-    <file>ExtensionCommon.js</file>
     <file>ExtensionPanel.js</file>
     <file>ExtensionRegistryStub.js</file>
     <file>ExtensionServer.js</file>

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (95288 => 95289)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2011-09-16 13:30:21 UTC (rev 95289)
@@ -117,7 +117,6 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
-    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""

Modified: trunk/Source/WebKit/chromium/ChangeLog (95288 => 95289)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-09-16 13:30:21 UTC (rev 95289)
@@ -1,3 +1,16 @@
+2011-09-16  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: [Extensions API] support extensions for remote inspector front-end
+        https://bugs.webkit.org/show_bug.cgi?id=67840
+
+        Reviewed by Pavel Feldman.
+
+        - expose extension API as a single, standalone file for easy reuse in remote extension scripts.
+
+        * WebKit.gyp:
+        * scripts/generate_devtools_extension_api.py: Added.
+        * scripts/generate_devtools_zip.py:
+
 2011-09-16  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: change WebInspector.currentPanel getter/setter to functions.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (95288 => 95289)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-09-16 13:30:21 UTC (rev 95289)
@@ -823,10 +823,25 @@
             }],
         },
         {
+            'target_name': 'devtools_extension_api',
+            'type': 'none',
+            'actions': [{
+                'action_name': 'devtools_html',
+                'script_name': 'scripts/generate_devtools_extension_api.py',
+                'inputs': [
+                    '<@(_script_name)',
+                    '<@(webinspector_extension_api_files)',
+                ],
+                'outputs': ['<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js'],
+                'action': ['python', '<@(_script_name)', '<@(_outputs)', '<@(webinspector_extension_api_files)'],
+            }],
+        },
+        {
             'target_name': 'generate_devtools_grd',
             'type': 'none',
             'dependencies': [
                 'devtools_html',
+                'devtools_extension_api'
             ],
             'conditions': [
                 ['debug_devtools==0', {
@@ -850,6 +865,7 @@
                     '<(PRODUCT_DIR)/resources/inspector/HeapSnapshotWorker.js',
                     '<(PRODUCT_DIR)/resources/inspector/ScriptFormatterWorker.js',
                     '<(PRODUCT_DIR)/resources/inspector/devTools.css',
+                    '<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js',
                     '<@(webinspector_standalone_css_files)',
                 ],
                 'images': [
@@ -888,6 +904,7 @@
                 'inputs': [
                     '<@(_script_name)',
                     'scripts/generate_devtools_html.py',
+                    'scripts/generate_devtools_extension_api.py',
                     '<@(_inspector_html)',
                     '<@(devtools_files)',
                     '<@(webinspector_files)',
@@ -895,6 +912,7 @@
                     '<@(_workers_files)',
                     '<@(webinspector_image_files)',
                     '<@(devtools_image_files)',
+                    '<@(webinspector_extension_api_files)',
                 ],
                 'search_path': [
                     '../../WebCore/inspector/front-end',
@@ -909,6 +927,7 @@
                 'action': ['python', '<@(_script_name)', '<@(_inspector_html)',
                                      '--devtools-files', '<@(devtools_files)',
                                      '--workers-files', '<@(_workers_files)',
+                                     '--extension-api-files', '<@(webinspector_extension_api_files)',
                                      '--search-path', '<@(_search_path)',
                                      '--image-search-path', '<@(_image_search_path)',
                                      '--output', '<@(_outputs)'],

Added: trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py (0 => 95289)


--- trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py	                        (rev 0)
+++ trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py	2011-09-16 13:30:21 UTC (rev 95289)
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#         * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#         * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#         * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+import sys
+
+
+def write_devtools_extension_api(output, input_names):
+    output.write("""(function() {
+    """)
+    for input_name in input_names:
+        input = open(input_name, 'r')
+        output.write(input.read())
+    output.write("""
+        injectedExtensionAPI("remote-" + top.frames.length);
+
+        chrome = window.chrome || {};
+        chrome.experimental = chrome.experimental || {};
+        chrome.experimental.devtools = chrome.experimental.devtools || {};
+
+        var properties = Object.getOwnPropertyNames(webInspector);
+        for (var i = 0; i < properties.length; ++i) {
+            var descriptor = Object.getOwnPropertyDescriptor(webInspector, properties[i]);
+            Object.defineProperty(chrome.experimental.devtools, properties[i], descriptor);
+        }
+    })();""")
+
+
+def main(argv):
+
+    if len(argv) < 3:
+        print('usage: %s output_js input_files ...' % argv[0])
+        return 1
+
+    output_name = argv[1]
+    output = open(output_name, 'w')
+    write_devtools_extension_api(output, argv[2:])
+    output.close()
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
Property changes on: trunk/Source/WebKit/chromium/scripts/generate_devtools_extension_api.py
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebKit/chromium/scripts/generate_devtools_zip.py (95288 => 95289)


--- trunk/Source/WebKit/chromium/scripts/generate_devtools_zip.py	2011-09-16 13:19:50 UTC (rev 95288)
+++ trunk/Source/WebKit/chromium/scripts/generate_devtools_zip.py	2011-09-16 13:30:21 UTC (rev 95289)
@@ -44,14 +44,16 @@
 import concatenate_css_files
 import concatenate_js_files
 import generate_devtools_html
+import generate_devtools_extension_api
 
 
 class ParsedArgs:
-    def __init__(self, inspector_html, devtools_files, workers_files,
+    def __init__(self, inspector_html, devtools_files, workers_files, extension_api_files,
                  search_dirs, image_search_dirs, output_filename):
         self.inspector_html = inspector_html
         self.devtools_files = devtools_files
         self.workers_files = workers_files
+        self.extension_api_files = extension_api_files
         self.search_dirs = search_dirs
         self.image_search_dirs = image_search_dirs
         self.output_filename = output_filename
@@ -62,16 +64,18 @@
 
     devtools_files_position = argv.index('--devtools-files')
     workers_files_position = argv.index('--workers-files')
+    extension_api_files_position = argv.index('--extension-api-files')
     search_path_position = argv.index('--search-path')
     image_search_path_position = argv.index('--image-search-path')
     output_position = argv.index('--output')
 
     devtools_files = argv[devtools_files_position + 1:workers_files_position]
-    workers_files = argv[workers_files_position + 1:search_path_position]
+    workers_files = argv[workers_files_position + 1:extension_api_files_position]
+    extension_api_files = argv[extension_api_files_position + 1:search_path_position]
     search_dirs = argv[search_path_position + 1:image_search_path_position]
     image_search_dirs = argv[image_search_path_position + 1:output_position]
 
-    return ParsedArgs(inspector_html, devtools_files, workers_files,
+    return ParsedArgs(inspector_html, devtools_files, workers_files, extension_api_files,
                       search_dirs, image_search_dirs, argv[output_position + 1])
 
 
@@ -86,6 +90,11 @@
     zip = zipfile.ZipFile(parsed_args.output_filename, 'w', zipfile.ZIP_DEFLATED)
     zip.writestr("devtools.html", devtools_html.getvalue())
 
+    devtools_extension_api = StringIO.StringIO()
+    generate_devtools_extension_api.write_devtools_extension_api(
+        devtools_extension_api, parsed_args.extension_api_files)
+    zip.writestr("devtools_extension_api.js", devtools_extension_api.getvalue())
+
     css_extractor = concatenate_css_files.OrderedCSSFilesExtractor(
         devtools_html.getvalue())
     js_extractor = concatenate_js_files.OrderedJSFilesExtractor(
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to