Source/WebCore: https://bugs.webkit.org/show_bug.cgi?id=94326
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Aug 2012 14:28:22 +0000 (14:28 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Aug 2012 14:28:22 +0000 (14:28 +0000)
Reviewed by Vsevolod Vlasov.

Loading code on demand (upon the panel access).

* WebCore.gypi:
* inspector/front-end/AuditsPanel.js:
* inspector/front-end/CodeMirrorTextEditor.js:
(WebInspector.CodeMirrorTextEditor):
(WebInspector.CodeMirrorTextEditor.prototype._toRange):
* inspector/front-end/ElementsPanel.js:
* inspector/front-end/ExtensionServer.js:
(WebInspector.ExtensionServer.prototype._onCreatePanel):
* inspector/front-end/Panel.js:
(WebInspector.Panel):
(WebInspector.PanelDescriptor):
(WebInspector.PanelDescriptor.prototype.panel):
* inspector/front-end/ResourcesPanel.js:
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame):
* inspector/front-end/TimelinePanel.js:
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:
(WebInspector._panelDescriptors):
(WebInspector.doLoadedDone):
* inspector/front-end/utilities.js:

Source/WebKit/chromium: Web Inspector: load panels code on demand
https://bugs.webkit.org/show_bug.cgi?id=94326

Reviewed by Vsevolod Vlasov.

* WebKit.gyp:
* scripts/concatenate_js_files.py:
(OrderedJSFilesExtractor.handle_starttag):
* scripts/inline_js_imports.py:
(main):

LayoutTests: Web Inspector: load panels code on demand
https://bugs.webkit.org/show_bug.cgi?id=94326

Reviewed by Vsevolod Vlasov.

Loading code on demand (upon the panel access);

* http/tests/inspector/resource-tree/resource-tree-non-unique-url.html:
* inspector/database-table-name-excaping.html:
* inspector/timeline-dfs.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125897 268f45cc-cd09-0410-ab3c-d52691b4dbfc

27 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/resource-tree/resource-tree-non-unique-url.html
LayoutTests/inspector/database-table-name-excaping.html
LayoutTests/inspector/styles/styles-invalid-color-values.html
LayoutTests/inspector/timeline-dfs.html
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/inspector/compile-front-end.py
Source/WebCore/inspector/front-end/AuditsPanel.js
Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js
Source/WebCore/inspector/front-end/Color.js
Source/WebCore/inspector/front-end/ElementsPanel.js
Source/WebCore/inspector/front-end/ExtensionServer.js
Source/WebCore/inspector/front-end/Panel.js
Source/WebCore/inspector/front-end/ResourcesPanel.js
Source/WebCore/inspector/front-end/SettingsScreen.js
Source/WebCore/inspector/front-end/SourceFrame.js
Source/WebCore/inspector/front-end/Spectrum.js
Source/WebCore/inspector/front-end/StylesSidebarPane.js
Source/WebCore/inspector/front-end/TimelinePanel.js
Source/WebCore/inspector/front-end/inspector.html
Source/WebCore/inspector/front-end/inspector.js
Source/WebCore/inspector/front-end/utilities.js
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/scripts/concatenate_js_files.py
Source/WebKit/chromium/scripts/inline_js_imports.py

index 2da69d1..e4cd7e4 100644 (file)
@@ -1,3 +1,16 @@
+2012-08-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: load panels code on demand
+        https://bugs.webkit.org/show_bug.cgi?id=94326
+
+        Reviewed by Vsevolod Vlasov.
+
+        Loading code on demand (upon the panel access);
+
+        * http/tests/inspector/resource-tree/resource-tree-non-unique-url.html:
+        * inspector/database-table-name-excaping.html:
+        * inspector/timeline-dfs.html:
+
 2012-08-17  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r125880.
index 37f18ca..ae4eb23 100644 (file)
@@ -13,13 +13,12 @@ function loadIframe()
 
 function test()
 {
-    InspectorTest.addSniffer(WebInspector.ResourcesPanel.prototype, "_resourceAdded", onResource, true);
     WebInspector.showPanel("resources");
+    InspectorTest.addSniffer(WebInspector.FrameTreeElement.prototype, "appendResource", onResource, true);
 
     var cssRequestsCount = 0;
-    function onResource(event)
+    function onResource(resource)
     {
-        var resource = event.data;
         if (resource.url.match(/\.css$/) && ++cssRequestsCount === 2) {
             InspectorTest.addResult("Resources Tree:");
             InspectorTest.dumpResourcesTree();
index 2e76654..6e950de 100644 (file)
@@ -5,6 +5,7 @@
 
 function test()
 {
+    WebInspector.showPanel("resources");
     var tableName = "table-name-with-dashes-and-\"quotes\"";
     var escapedTableName = WebInspector.DatabaseTableView.prototype._escapeTableName(tableName, "", true);
     InspectorTest.addResult("Original value: " + tableName);
index 1c0200b..6ee4a20 100644 (file)
@@ -40,7 +40,7 @@ function test()
         InspectorTest.addResult("");
         InspectorTest.addResult("color: " + colorString);
         InspectorTest.addResult("  simple: " + color.simple);
-        var cf = WebInspector.StylesSidebarPane.ColorFormat;
+        var cf = WebInspector.Color.Format;
         for (var colorFormatKey in cf) {
             var colorFormat = cf[colorFormatKey];
             // Simple colors do not have RGBA and HSLA representations.
index d5e4316..bee1528 100644 (file)
@@ -5,6 +5,8 @@
 
 var test = function()
 {
+    WebInspector.showPanel("timeline");
+
     function dumper(record)
     {
         InspectorTest.addResult(record.name);
index 9f4d9c7..8b4378d 100644 (file)
@@ -1,3 +1,33 @@
+2012-08-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        https://bugs.webkit.org/show_bug.cgi?id=94326
+
+        Reviewed by Vsevolod Vlasov.
+
+        Loading code on demand (upon the panel access).
+
+        * WebCore.gypi:
+        * inspector/front-end/AuditsPanel.js:
+        * inspector/front-end/CodeMirrorTextEditor.js:
+        (WebInspector.CodeMirrorTextEditor):
+        (WebInspector.CodeMirrorTextEditor.prototype._toRange):
+        * inspector/front-end/ElementsPanel.js:
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onCreatePanel):
+        * inspector/front-end/Panel.js:
+        (WebInspector.Panel):
+        (WebInspector.PanelDescriptor):
+        (WebInspector.PanelDescriptor.prototype.panel):
+        * inspector/front-end/ResourcesPanel.js:
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame):
+        * inspector/front-end/TimelinePanel.js:
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/inspector.js:
+        (WebInspector._panelDescriptors):
+        (WebInspector.doLoadedDone):
+        * inspector/front-end/utilities.js:
+
 2012-08-17  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r125880.
index 1c30b6a..6f5a213 100644 (file)
         'webinspector_files': [
             'inspector/front-end/inspector.html',
             'inspector/front-end/AdvancedSearchController.js',
-            'inspector/front-end/ApplicationCacheItemsView.js',
             'inspector/front-end/ApplicationCacheModel.js',
-            'inspector/front-end/AuditCategories.js',
-            'inspector/front-end/AuditFormatters.js',
-            'inspector/front-end/AuditLauncherView.js',
-            'inspector/front-end/AuditResultView.js',
-            'inspector/front-end/AuditRules.js',
-            'inspector/front-end/AuditsPanel.js',
             'inspector/front-end/BottomUpProfileDataGridTree.js',
             'inspector/front-end/BreakpointManager.js',
             'inspector/front-end/BreakpointsSidebarPane.js',
             'inspector/front-end/CallStackSidebarPane.js',
             'inspector/front-end/Checkbox.js',
-            'inspector/front-end/CodeMirrorTextEditor.js',
             'inspector/front-end/Color.js',
             'inspector/front-end/CompilerScriptMapping.js',
             'inspector/front-end/ConsoleMessage.js',
             'inspector/front-end/CSSSelectorProfileView.js',
             'inspector/front-end/CSSStyleModel.js',
             'inspector/front-end/Database.js',
-            'inspector/front-end/DatabaseQueryView.js',
-            'inspector/front-end/DatabaseTableView.js',
             'inspector/front-end/DataGrid.js',
             'inspector/front-end/DebuggerModel.js',
             'inspector/front-end/DebuggerScriptMapping.js',
             'inspector/front-end/DefaultTextEditor.js',
             'inspector/front-end/Dialog.js',
-            'inspector/front-end/DirectoryContentView.js',
             'inspector/front-end/DOMAgent.js',
             'inspector/front-end/DOMBreakpointsSidebarPane.js',
             'inspector/front-end/DOMExtension.js',
             'inspector/front-end/DOMPresentationUtils.js',
             'inspector/front-end/DOMStorage.js',
-            'inspector/front-end/DOMStorageItemsView.js',
             'inspector/front-end/DOMSyntaxHighlighter.js',
             'inspector/front-end/Drawer.js',
-            'inspector/front-end/ElementsPanel.js',
             '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/ExtensionPanel.js',
             'inspector/front-end/ExtensionServer.js',
             'inspector/front-end/ExtensionView.js',
             'inspector/front-end/FileManager.js',
-            'inspector/front-end/FileContentView.js',
             'inspector/front-end/FileSystemModel.js',
-            'inspector/front-end/FileSystemView.js',
             'inspector/front-end/FileUtils.js',
             'inspector/front-end/FilteredItemSelectionDialog.js',
             'inspector/front-end/FontView.js',
             'inspector/front-end/HelpScreen.js',
             'inspector/front-end/ImageView.js',
             'inspector/front-end/IndexedDBModel.js',
-            'inspector/front-end/IndexedDBViews.js',
             'inspector/front-end/InspectorBackend.js',
             'inspector/front-end/InspectorFrontendAPI.js',
             'inspector/front-end/InspectorFrontendHostStub.js',
             'inspector/front-end/jsdifflib.js',
             'inspector/front-end/KeyboardShortcut.js',
             'inspector/front-end/Linkifier.js',
-            'inspector/front-end/MemoryStatistics.js',
-            'inspector/front-end/MetricsSidebarPane.js',
             'inspector/front-end/NativeMemorySnapshotView.js',
             'inspector/front-end/NavigatorOverlayController.js',
             'inspector/front-end/NavigatorView.js',
             'inspector/front-end/ProfilesPanel.js',
             'inspector/front-end/ProgressBar.js',
             'inspector/front-end/PropertiesSection.js',
-            'inspector/front-end/PropertiesSidebarPane.js',
             'inspector/front-end/RawSourceCode.js',
             'inspector/front-end/RemoteObject.js',
             'inspector/front-end/RequestCookiesView.js',
             'inspector/front-end/ResourceUtils.js',
             'inspector/front-end/ResourceView.js',
             'inspector/front-end/ResourceWebSocketFrameView.js',
-            'inspector/front-end/ResourcesPanel.js',
             'inspector/front-end/RevisionHistoryView.js',
             'inspector/front-end/SASSSourceMapping.js',
             'inspector/front-end/ScopeChainSidebarPane.js',
             'inspector/front-end/SplitView.js',
             'inspector/front-end/StatusBarButton.js',
             'inspector/front-end/StylesPanel.js',
-            'inspector/front-end/StylesSidebarPane.js',
             'inspector/front-end/TabbedEditorContainer.js',
             'inspector/front-end/TabbedPane.js',
             'inspector/front-end/TestController.js',
             'inspector/front-end/TextEditorHighlighter.js',
             'inspector/front-end/TextEditorModel.js',
             'inspector/front-end/TextPrompt.js',
-            'inspector/front-end/TimelineFrameController.js',
-            'inspector/front-end/TimelineManager.js',
-            'inspector/front-end/TimelineModel.js',
-            'inspector/front-end/TimelinePresentationModel.js',
-            'inspector/front-end/TimelineOverviewPane.js',
             'inspector/front-end/TimelineGrid.js',
-            'inspector/front-end/TimelinePanel.js',
+            'inspector/front-end/TimelineManager.js',
             'inspector/front-end/Toolbar.js',
             'inspector/front-end/TopDownProfileDataGridTree.js',
             'inspector/front-end/treeoutline.js',
             'inspector/front-end/inspector.css',
             'inspector/front-end/inspectorSyntaxHighlight.css',
             'inspector/front-end/popover.css',
+            '<@(webinspector_modules_js_files)',
             '<@(webinspector_standalone_css_files)',
-            '<@(webinspector_standalone_js_files)',
         ],
         'webinspector_standalone_css_files': [
             'inspector/front-end/auditsPanel.css',
             'inspector/front-end/textPrompt.css',
             'inspector/front-end/timelinePanel.css',
         ],
-        'webinspector_standalone_js_files': [
+        'webinspector_elements_js_files': [
+            'inspector/front-end/ElementsPanel.js',
+            'inspector/front-end/EventListenersSidebarPane.js',
+            'inspector/front-end/MetricsSidebarPane.js',
+            'inspector/front-end/PropertiesSidebarPane.js',
+            'inspector/front-end/StylesSidebarPane.js',
+        ],
+        'webinspector_resources_js_files': [
+            'inspector/front-end/ApplicationCacheItemsView.js',
+            'inspector/front-end/DOMStorageItemsView.js',
+            'inspector/front-end/DatabaseQueryView.js',
+            'inspector/front-end/DatabaseTableView.js',
+            'inspector/front-end/DirectoryContentView.js',
+            'inspector/front-end/FileContentView.js',
+            'inspector/front-end/FileSystemView.js',
+            'inspector/front-end/IndexedDBViews.js',
+            'inspector/front-end/ResourcesPanel.js',
+        ],
+        'webinspector_timeline_js_files': [
+            'inspector/front-end/MemoryStatistics.js',
+            'inspector/front-end/TimelineFrameController.js',
+            'inspector/front-end/TimelineModel.js',
+            'inspector/front-end/TimelinePresentationModel.js',
+            'inspector/front-end/TimelineOverviewPane.js',
+            'inspector/front-end/TimelinePanel.js',
+        ],
+        'webinspector_audits_js_files': [
+            'inspector/front-end/AuditCategories.js',
+            'inspector/front-end/AuditFormatters.js',
+            'inspector/front-end/AuditLauncherView.js',
+            'inspector/front-end/AuditResultView.js',
+            'inspector/front-end/AuditRules.js',
+            'inspector/front-end/AuditsPanel.js',
+        ],
+        'webinspector_codemirror_js_files': [
+            'inspector/front-end/CodeMirrorTextEditor.js',
             'inspector/front-end/cm/codemirror.js',
             'inspector/front-end/cm/css.js',
             'inspector/front-end/cm/htmlmixed.js',
             'inspector/front-end/cm/javascript.js',
             'inspector/front-end/cm/xml.js',
         ],
+        'webinspector_modules_js_files': [
+            '<@(webinspector_elements_js_files)',
+            '<@(webinspector_resources_js_files)',
+            '<@(webinspector_timeline_js_files)',
+            '<@(webinspector_audits_js_files)',
+            '<@(webinspector_codemirror_js_files)',
+        ],
         'webinspector_uglifyjs_files': [
             'inspector/front-end/UglifyJS/parse-js.js',
         ],
index e6b498e..2377646 100755 (executable)
@@ -95,7 +95,6 @@ modules = [
             "SnippetStorage.js",
             "SourceMapping.js",
             "TimelineManager.js",
-            "TimelineModel.js",
             "RawSourceCode.js",
             "RemoteObject.js",
             "Resource.js",
@@ -163,7 +162,6 @@ modules = [
             "DOMBreakpointsSidebarPane.js",
             "DOMPresentationUtils.js",
             "ElementsTreeOutline.js",
-            "EventListenersSidebarPane.js",
             "FilteredItemSelectionDialog.js",
             "GoToLineDialog.js",
             "NavigatorOverlayController.js",
@@ -172,7 +170,6 @@ modules = [
             "JavaScriptSource.js",
             "ObjectPopoverHelper.js",
             "ObjectPropertiesSection.js",
-            "PropertiesSidebarPane.js",
             "SourceFrame.js",
             "TimelineGrid.js",
             "UISourceCodeFrame.js",
@@ -182,9 +179,11 @@ modules = [
         "target_name": "elements",
         "dependencies": ["components"],
         "sources": [
-            "StylesSidebarPane.js",
-            "MetricsSidebarPane.js",
             "ElementsPanel.js",
+            "EventListenersSidebarPane.js",
+            "MetricsSidebarPane.js",
+            "PropertiesSidebarPane.js",
+            "StylesSidebarPane.js",
         ]
     },
     {
@@ -254,6 +253,7 @@ modules = [
         "dependencies": ["components"],
         "sources": [
             "MemoryStatistics.js",
+            "TimelineModel.js",
             "TimelineOverviewPane.js",
             "TimelinePanel.js",
             "TimelinePresentationModel.js",
index 56bc4a8..0568137 100644 (file)
@@ -586,3 +586,9 @@ WebInspector.AuditRules = {};
 
 // Contributed audit categories should go into this namespace.
 WebInspector.AuditCategories = {};
+
+importScript("AuditCategories.js");
+importScript("AuditFormatters.js");
+importScript("AuditLauncherView.js");
+importScript("AuditResultView.js");
+importScript("AuditRules.js");
index 4f0a088..c9fded1 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+importScript("cm/codemirror.js");
+importScript("cm/css.js");
+importScript("cm/javascript.js");
+importScript("cm/xml.js");
+importScript("cm/htmlmixed.js");
+
 /**
  * @constructor
  * @extends {WebInspector.View}
@@ -41,7 +47,6 @@ WebInspector.CodeMirrorTextEditor = function(url, delegate)
     this._delegate = delegate;
     this._url = url;
 
-    this._loadLibraries();
     this.registerRequiredCSS("codemirror.css");
     this.registerRequiredCSS("cmdevtools.css");
 
@@ -373,26 +378,6 @@ WebInspector.CodeMirrorTextEditor.prototype = {
     _toRange: function(start, end)
     {
         return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch);
-    },
-
-    _loadLibraries: function()
-    {
-        if (window.CodeMirror)
-            return;
-
-        function loadLibrary(file)
-        {
-            var xhr = new XMLHttpRequest();
-            xhr.open("GET", file, false);
-            xhr.send(null);
-            window.eval(xhr.responseText);
-        }
-
-        loadLibrary("codemirror.js");
-        loadLibrary("css.js");
-        loadLibrary("javascript.js");
-        loadLibrary("xml.js");
-        loadLibrary("htmlmixed.js");
     }
 }
 
index b522750..9500c63 100644 (file)
@@ -811,3 +811,14 @@ WebInspector.Color.PageHighlight = {
     Margin: WebInspector.Color.fromRGBA(246, 178, 107, .66),
     MarginLight: WebInspector.Color.fromRGBA(246, 178, 107, .5)
 }
+
+WebInspector.Color.Format = {
+    Original: "original",
+    Nickname: "nickname",
+    HEX: "hex",
+    ShortHEX: "shorthex",
+    RGB: "rgb",
+    RGBA: "rgba",
+    HSL: "hsl",
+    HSLA: "hsla"
+}
index 53c4f33..9746b98 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+importScript("EventListenersSidebarPane.js");
+importScript("MetricsSidebarPane.js");
+importScript("PropertiesSidebarPane.js");
+importScript("StylesSidebarPane.js");
+
 /**
  * @constructor
  * @extends {WebInspector.Panel}
index b209388..f9e763a 100644 (file)
@@ -197,7 +197,7 @@ WebInspector.ExtensionServer.prototype = {
             return this._status.E_EXISTS(id);
 
         var page = this._expandResourcePath(port._extensionOrigin, message.page);
-        var panelDescriptor = new WebInspector.PanelDescriptor(id, message.title, WebInspector.ExtensionPanel.bind(null, id, page));
+        var panelDescriptor = new WebInspector.PanelDescriptor(id, message.title, undefined, undefined, new WebInspector.ExtensionPanel(id, page));
         panelDescriptor.setIconURL(this._expandResourcePath(port._extensionOrigin, message.icon));
         this._clientObjects[id] = panelDescriptor.panel();
         WebInspector.inspectorView.addPanel(panelDescriptor);
index f997eda..e0f965b 100644 (file)
@@ -33,6 +33,7 @@
 WebInspector.Panel = function(name)
 {
     WebInspector.View.call(this);
+    WebInspector.panels[name] = this;
 
     this.element.addStyleClass("panel");
     this.element.addStyleClass(name);
@@ -239,15 +240,17 @@ WebInspector.Panel.prototype.__proto__ = WebInspector.View.prototype;
  * @constructor
  * @param {string} name
  * @param {string} title
- * @param {function(new:WebInspector.Panel)} constructor
- * @param {boolean=} lazyInit
+ * @param {string=} className
+ * @param {string=} scriptName
+ * @param {WebInspector.Panel=} panel
  */
-WebInspector.PanelDescriptor = function(name, title, constructor, lazyInit)
+WebInspector.PanelDescriptor = function(name, title, className, scriptName, panel)
 {
     this._name = name;
     this._title = title;
-    this._constructor = constructor;
-    this._panel = lazyInit ? null : this.panel();
+    this._className = className;
+    this._scriptName = scriptName;
+    this._panel = panel;
 }
 
 WebInspector.PanelDescriptor.prototype = {
@@ -288,9 +291,11 @@ WebInspector.PanelDescriptor.prototype = {
      */
     panel: function()
     {
-        if (!this._panel)
-            this._panel = new this._constructor();
-        WebInspector.panels[this._name] = this._panel;
+        if (this._panel)
+            return this._panel;
+        if (this._scriptName)
+            importScript(this._scriptName);
+        this._panel = new WebInspector[this._className];
         return this._panel;
     }
 }
index b2a6a2b..22aebce 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+importScript("ApplicationCacheItemsView.js");
+importScript("DOMStorageItemsView.js");
+importScript("DatabaseQueryView.js");
+importScript("DatabaseTableView.js");
+importScript("DirectoryContentView.js");
+importScript("IndexedDBViews.js");
+importScript("FileContentView.js");
+importScript("FileSystemView.js");
+
 /**
  * @constructor
  * @extends {WebInspector.Panel}
index bcb4deb..eb67a75 100644 (file)
@@ -259,13 +259,13 @@ WebInspector.GenericSettingsTab = function()
     WebInspector.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisabledChanged, this);
     this._disableJSCheckbox = disableJSElement.getElementsByTagName("input")[0];
     this._updateScriptDisabledCheckbox();
-    
+
     p = this._appendSection(WebInspector.UIString("Elements"));
     p.appendChild(this._createRadioSetting(WebInspector.UIString("Color format"), [
-        [ WebInspector.StylesSidebarPane.ColorFormat.Original, WebInspector.UIString("As authored") ],
-        [ WebInspector.StylesSidebarPane.ColorFormat.HEX, "HEX: #DAC0DE" ],
-        [ WebInspector.StylesSidebarPane.ColorFormat.RGB, "RGB: rgb(128, 255, 255)" ],
-        [ WebInspector.StylesSidebarPane.ColorFormat.HSL, "HSL: hsl(300, 80%, 90%)" ] ], WebInspector.settings.colorFormat));
+        [ WebInspector.Color.Format.Original, WebInspector.UIString("As authored") ],
+        [ WebInspector.Color.Format.HEX, "HEX: #DAC0DE" ],
+        [ WebInspector.Color.Format.RGB, "RGB: rgb(128, 255, 255)" ],
+        [ WebInspector.Color.Format.HSL, "HSL: hsl(300, 80%, 90%)" ] ], WebInspector.settings.colorFormat));
     p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show user agent styles"), WebInspector.settings.showUserAgentStyles));
     p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Word wrap"), WebInspector.settings.domWordWrap));
 
index b27b27c..2f498f3 100644 (file)
@@ -43,9 +43,10 @@ WebInspector.SourceFrame = function(contentProvider)
 
     var textEditorDelegate = new WebInspector.TextEditorDelegateForSourceFrame(this);
 
-    if (WebInspector.experimentsSettings.codemirror.isEnabled())
+    if (WebInspector.experimentsSettings.codemirror.isEnabled()) {
+        importScript("CodeMirrorTextEditor.js");
         this._textEditor = new WebInspector.CodeMirrorTextEditor(this._url, textEditorDelegate);
-    else
+    else
         this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate);
 
     this._currentSearchResultIndex = -1;
index 2afff1b..0c8ce54 100644 (file)
@@ -289,7 +289,7 @@ WebInspector.Spectrum.prototype = {
 
     get outputColorFormat()
     {
-        var cf = WebInspector.StylesSidebarPane.ColorFormat;
+        var cf = WebInspector.Color.Format;
         var format = this._originalFormat;
 
         if (this.hsv[3] === 1) {
index adeaaf5..0b58b6c 100644 (file)
@@ -41,22 +41,22 @@ WebInspector.StylesSidebarPane = function(computedStylePane, setPseudoClassCallb
     this.settingsSelectElement.className = "select-settings";
 
     var option = document.createElement("option");
-    option.value = WebInspector.StylesSidebarPane.ColorFormat.Original;
+    option.value = WebInspector.Color.Format.Original;
     option.label = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "As authored" : "As Authored");
     this.settingsSelectElement.appendChild(option);
 
     option = document.createElement("option");
-    option.value = WebInspector.StylesSidebarPane.ColorFormat.HEX;
+    option.value = WebInspector.Color.Format.HEX;
     option.label = WebInspector.UIString("Hex Colors");
     this.settingsSelectElement.appendChild(option);
 
     option = document.createElement("option");
-    option.value = WebInspector.StylesSidebarPane.ColorFormat.RGB;
+    option.value = WebInspector.Color.Format.RGB;
     option.label = WebInspector.UIString("RGB Colors");
     this.settingsSelectElement.appendChild(option);
 
     option = document.createElement("option");
-    option.value = WebInspector.StylesSidebarPane.ColorFormat.HSL;
+    option.value = WebInspector.Color.Format.HSL;
     option.label = WebInspector.UIString("HSL Colors");
     this.settingsSelectElement.appendChild(option);
 
@@ -103,17 +103,6 @@ WebInspector.StylesSidebarPane = function(computedStylePane, setPseudoClassCallb
     WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAgentStylesSettingChanged.bind(this));
 }
 
-WebInspector.StylesSidebarPane.ColorFormat = {
-    Original: "original",
-    Nickname: "nickname",
-    HEX: "hex",
-    ShortHEX: "shorthex",
-    RGB: "rgb",
-    RGBA: "rgba",
-    HSL: "hsl",
-    HSLA: "hsla"
-}
-
 // Keep in sync with RenderStyleConstants.h PseudoId enum. Array below contains pseudo id names for corresponding enum indexes.
 // First item is empty due to its artificial NOPSEUDO nature in the enum.
 // FIXME: find a way of generating this mapping or getting it from combination of RenderStyleConstants and CSSSelector.cpp at
@@ -1693,7 +1682,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
         valueElement.className = "value";
         this.valueElement = valueElement;
 
-        var cf = WebInspector.StylesSidebarPane.ColorFormat;
+        var cf = WebInspector.Color.Format;
 
         if (value) {
             var self = this;
index bfb6f6a..b6ec0dd 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+importScript("MemoryStatistics.js");
+importScript("TimelineModel.js");
+importScript("TimelineOverviewPane.js");
+importScript("TimelinePresentationModel.js");
+importScript("TimelineFrameController.js");
+
 /**
  * @constructor
  * @extends {WebInspector.Panel}
index 70ea415..deb132d 100644 (file)
@@ -65,7 +65,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="Panel.js"></script>
     <script type="text/javascript" src="InspectorView.js"></script>
     <script type="text/javascript" src="AdvancedSearchController.js"></script>
-    <script type="text/javascript" src="TimelineGrid.js"></script>    
+    <script type="text/javascript" src="TimelineGrid.js"></script>
     <script type="text/javascript" src="ContentProvider.js"></script>
     <script type="text/javascript" src="Resource.js"></script>
     <script type="text/javascript" src="NetworkRequest.js"></script>
@@ -78,19 +78,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="ResourceUtils.js"></script>
     <script type="text/javascript" src="ResourceType.js"></script>
     <script type="text/javascript" src="TimelineManager.js"></script>
-    <script type="text/javascript" src="TimelineModel.js"></script>
     <script type="text/javascript" src="UserAgentSupport.js"></script>
     <script type="text/javascript" src="Database.js"></script>
     <script type="text/javascript" src="DOMStorage.js"></script>
-    <script type="text/javascript" src="DOMStorageItemsView.js"></script>
     <script type="text/javascript" src="DataGrid.js"></script>
     <script type="text/javascript" src="ShowMoreDataGridNode.js"></script>
     <script type="text/javascript" src="CookiesTable.js"></script>
     <script type="text/javascript" src="CookieItemsView.js"></script>
     <script type="text/javascript" src="ApplicationCacheModel.js"></script>
-    <script type="text/javascript" src="ApplicationCacheItemsView.js"></script>
     <script type="text/javascript" src="IndexedDBModel.js"></script>
-    <script type="text/javascript" src="IndexedDBViews.js"></script>
     <script type="text/javascript" src="Spectrum.js"></script>
     <script type="text/javascript" src="SidebarPane.js"></script>
     <script type="text/javascript" src="ElementsTreeOutline.js"></script>
@@ -107,20 +103,14 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="ScopeChainSidebarPane.js"></script>
     <script type="text/javascript" src="WatchExpressionsSidebarPane.js"></script>
     <script type="text/javascript" src="WorkersSidebarPane.js"></script>
-    <script type="text/javascript" src="MetricsSidebarPane.js"></script>
-    <script type="text/javascript" src="PropertiesSidebarPane.js"></script>
-    <script type="text/javascript" src="EventListenersSidebarPane.js"></script>
     <script type="text/javascript" src="Color.js"></script>
     <script type="text/javascript" src="CSSCompletions.js"></script>
     <script type="text/javascript" src="CSSKeywordCompletions.js"></script>
-    <script type="text/javascript" src="StylesSidebarPane.js"></script>
     <script type="text/javascript" src="PanelEnablerView.js"></script>
     <script type="text/javascript" src="StatusBarButton.js"></script>
-    <script type="text/javascript" src="ElementsPanel.js"></script>
     <script type="text/javascript" src="NetworkPanel.js"></script>
     <script type="text/javascript" src="TextEditor.js"></script>
     <script type="text/javascript" src="DefaultTextEditor.js"></script>
-    <script type="text/javascript" src="CodeMirrorTextEditor.js"></script>
     <script type="text/javascript" src="SourceFrame.js"></script>
     <script type="text/javascript" src="UISourceCodeFrame.js"></script>
     <script type="text/javascript" src="ResourceView.js"></script>
@@ -131,7 +121,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="ScriptsPanel.js"></script>
     <script type="text/javascript" src="RevisionHistoryView.js"></script>
     <script type="text/javascript" src="ScriptsNavigator.js"></script>
-    <script type="text/javascript" src="ResourcesPanel.js"></script>
     <script type="text/javascript" src="ProfilesPanel.js"></script>
     <script type="text/javascript" src="ConsolePanel.js"></script>
     <script type="text/javascript" src="ExtensionAPI.js"></script>
@@ -139,12 +128,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="ExtensionServer.js"></script>
     <script type="text/javascript" src="ExtensionView.js"></script>
     <script type="text/javascript" src="ExtensionPanel.js"></script>
-    <script type="text/javascript" src="AuditsPanel.js"></script>
-    <script type="text/javascript" src="AuditResultView.js"></script>
-    <script type="text/javascript" src="AuditLauncherView.js"></script>
-    <script type="text/javascript" src="AuditRules.js"></script>
-    <script type="text/javascript" src="AuditCategories.js"></script>
-    <script type="text/javascript" src="AuditFormatters.js"></script>
     <script type="text/javascript" src="NetworkItemView.js"></script>
     <script type="text/javascript" src="EmptyView.js"></script>
     <script type="text/javascript" src="RequestHeadersView.js"></script>
@@ -163,15 +146,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="SourceCSSTokenizer.js"></script>
     <script type="text/javascript" src="SourceHTMLTokenizer.js"></script>
     <script type="text/javascript" src="SourceJavaScriptTokenizer.js"></script>
-    <script type="text/javascript" src="DirectoryContentView.js"></script>
-    <script type="text/javascript" src="FileContentView.js"></script>
     <script type="text/javascript" src="FileSystemModel.js"></script>
-    <script type="text/javascript" src="FileSystemView.js"></script>
     <script type="text/javascript" src="FileUtils.js"></script>
     <script type="text/javascript" src="FontView.js"></script>
     <script type="text/javascript" src="ImageView.js"></script>
-    <script type="text/javascript" src="DatabaseTableView.js"></script>
-    <script type="text/javascript" src="DatabaseQueryView.js"></script>
     <script type="text/javascript" src="ProfileLauncherView.js"></script>
     <script type="text/javascript" src="ProfileDataGridTree.js"></script>
     <script type="text/javascript" src="BottomUpProfileDataGridTree.js"></script>
@@ -203,10 +181,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="SASSSourceMapping.js"></script>
     <script type="text/javascript" src="ScriptsSearchScope.js"></script>
     <script type="text/javascript" src="DOMAgent.js"></script>
-    <script type="text/javascript" src="TimelinePresentationModel.js"></script>
-    <script type="text/javascript" src="TimelinePanel.js"></script>
-    <script type="text/javascript" src="TimelineOverviewPane.js"></script>
-    <script type="text/javascript" src="TimelineFrameController.js"></script>
     <script type="text/javascript" src="TestController.js"></script>
     <script type="text/javascript" src="Dialog.js"></script>
     <script type="text/javascript" src="GoToLineDialog.js"></script>
@@ -222,7 +196,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="UserMetrics.js"></script>
     <script type="text/javascript" src="JavaScriptContextManager.js"></script>
     <script type="text/javascript" src="HandlerRegistry.js"></script>
-    <script type="text/javascript" src="MemoryStatistics.js"></script>
     <script type="text/javascript" src="SnippetStorage.js"></script>
     <script type="text/javascript" src="ScriptSnippetModel.js"></script>
     <script type="text/javascript" src="StylesPanel.js"></script>
index 6dd1080..634ac79 100644 (file)
@@ -37,14 +37,14 @@ var WebInspector = {
         WebInspector.inspectorView.show(parentElement);
         WebInspector.inspectorView.addEventListener(WebInspector.InspectorView.Events.PanelSelected, this._panelSelected, this);
 
-        var elements = new WebInspector.PanelDescriptor("elements", WebInspector.UIString("Elements"), WebInspector.ElementsPanel, true);
-        var resources = new WebInspector.PanelDescriptor("resources", WebInspector.UIString("Resources"), WebInspector.ResourcesPanel, true);
-        var network = new WebInspector.PanelDescriptor("network", WebInspector.UIString("Network"), WebInspector.NetworkPanel);
-        var scripts = new WebInspector.PanelDescriptor("scripts", WebInspector.UIString("Sources"), WebInspector.ScriptsPanel);
-        var timeline = new WebInspector.PanelDescriptor("timeline", WebInspector.UIString("Timeline"), WebInspector.TimelinePanel, true);
-        var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), WebInspector.ProfilesPanel);
-        var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), WebInspector.AuditsPanel, true);
-        var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), WebInspector.ConsolePanel, true);
+        var elements = new WebInspector.PanelDescriptor("elements", WebInspector.UIString("Elements"), "ElementsPanel", "ElementsPanel.js");
+        var resources = new WebInspector.PanelDescriptor("resources", WebInspector.UIString("Resources"), "ResourcesPanel", "ResourcesPanel.js");
+        var network = new WebInspector.PanelDescriptor("network", WebInspector.UIString("Network"), undefined, undefined, new WebInspector.NetworkPanel());
+        var scripts = new WebInspector.PanelDescriptor("scripts", WebInspector.UIString("Sources"), undefined, undefined, new WebInspector.ScriptsPanel());
+        var timeline = new WebInspector.PanelDescriptor("timeline", WebInspector.UIString("Timeline"), "TimelinePanel", "TimelinePanel.js");
+        var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), undefined, undefined, new WebInspector.ProfilesPanel());
+        var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js");
+        var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), "ConsolePanel");
         var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console];
 
         var panelDescriptors = [];
@@ -458,6 +458,8 @@ WebInspector.doLoadedDone = function()
     PageAgent.canOverrideDeviceMetrics(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceMetrics", null));
     PageAgent.canOverrideGeolocation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideGeolocation", null));
     PageAgent.canOverrideDeviceOrientation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceOrientation", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));
+    if ("debugLoad" in WebInspector.queryParamsObject)
+        WebInspector._doLoadedDoneWithCapabilities();
 }
 
 WebInspector._doLoadedDoneWithCapabilities = function()
index 46898bf..f215ce1 100644 (file)
@@ -781,3 +781,19 @@ StringPool.prototype = {
         }
     }
 }
+
+var _importedScripts = {};
+
+/**
+ * @param {string} scriptName
+ */
+function importScript(scriptName)
+{
+    if (_importedScripts[scriptName])
+        return;
+    _importedScripts[scriptName] = true;
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", scriptName, false);
+    xhr.send(null);
+    window.eval(xhr.responseText + "\n//@ sourceURL=" + scriptName);
+}
index 79cd108..781cd0c 100644 (file)
@@ -1,3 +1,16 @@
+2012-08-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: load panels code on demand
+        https://bugs.webkit.org/show_bug.cgi?id=94326
+
+        Reviewed by Vsevolod Vlasov.
+
+        * WebKit.gyp:
+        * scripts/concatenate_js_files.py:
+        (OrderedJSFilesExtractor.handle_starttag):
+        * scripts/inline_js_imports.py:
+        (main):
+
 2012-08-17  Ian Vollick  <vollick@chromium.org>
 
         [chromium] Add tracing for active composited animations
index bea6f9e..e352bad 100644 (file)
             'conditions': [
                 ['debug_devtools==0', {
                     'dependencies': ['concatenated_devtools_js',
+                                     'concatenated_devtools_elements_js',
+                                     'concatenated_devtools_resources_js',
+                                     'concatenated_devtools_timeline_js',
+                                     'concatenated_devtools_audits_js',
+                                     'concatenated_devtools_codemirror_js',
                                      'concatenated_heap_snapshot_worker_js',
                                      'concatenated_script_formatter_worker_js',
                                      'concatenated_devtools_css'],
             'conditions': [
                 ['debug_devtools==0', {
                     'dependencies': ['concatenated_devtools_js',
+                                     'concatenated_devtools_elements_js',
+                                     'concatenated_devtools_resources_js',
+                                     'concatenated_devtools_timeline_js',
+                                     'concatenated_devtools_audits_js',
+                                     'concatenated_devtools_codemirror_js',
                                      'concatenated_heap_snapshot_worker_js',
                                      'concatenated_script_formatter_worker_js',
                                      'concatenated_devtools_css'],
                 'input_pages': [
                     '<(PRODUCT_DIR)/resources/inspector/devtools.html',
                     '<(PRODUCT_DIR)/resources/inspector/DevTools.js',
+                    '<(PRODUCT_DIR)/resources/inspector/ElementsPanel.js',
+                    '<(PRODUCT_DIR)/resources/inspector/ResourcesPanel.js',
+                    '<(PRODUCT_DIR)/resources/inspector/TimelinePanel.js',
+                    '<(PRODUCT_DIR)/resources/inspector/AuditsPanel.js',
+                    '<(PRODUCT_DIR)/resources/inspector/CodeMirrorTextEditor.js',
                     '<(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_js_files)',
                     '<@(webinspector_standalone_css_files)',
                 ],
                 'images': [
                         'outputs': ['<(PRODUCT_DIR)/resources/inspector/DevTools.js'],
                         'action': ['python', '<@(_script_name)', '<@(_input_page)', '<@(_search_path)', '<@(_outputs)'],
                     }],
-                    'copies': [{
-                        'destination': '<(PRODUCT_DIR)/resources/inspector',
-                        'files': [
-                            '<@(webinspector_standalone_js_files)',
+                },
+                {
+                    'target_name': 'concatenated_devtools_elements_js',
+                    'type': 'none',
+                    'actions': [{
+                        'action_name': 'concatenate_devtools_elements_js',
+                        'script_name': 'scripts/inline_js_imports.py',
+                        'input_file': '../../WebCore/inspector/front-end/ElementsPanel.js',
+                        'inputs': [
+                            '<@(_script_name)',
+                            '<@(webinspector_elements_js_files)',
+                        ],
+                        'search_path': '../../WebCore/inspector/front-end',
+                        'outputs': ['<(PRODUCT_DIR)/resources/inspector/ElementsPanel.js'],
+                        'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'],
+                    }],
+                },
+                {
+                    'target_name': 'concatenated_devtools_resources_js',
+                    'type': 'none',
+                    'actions': [{
+                        'action_name': 'concatenate_devtools_resources_js',
+                        'script_name': 'scripts/inline_js_imports.py',
+                        'input_file': '../../WebCore/inspector/front-end/ResourcesPanel.js',
+                        'inputs': [
+                            '<@(_script_name)',
+                            '<@(webinspector_resources_js_files)',
                         ],
+                        'search_path': '../../WebCore/inspector/front-end',
+                        'outputs': ['<(PRODUCT_DIR)/resources/inspector/ResourcesPanel.js'],
+                        'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'],
+                    }],
+                },
+                {
+                    'target_name': 'concatenated_devtools_timeline_js',
+                    'type': 'none',
+                    'actions': [{
+                        'action_name': 'concatenate_devtools_timeline_js',
+                        'script_name': 'scripts/inline_js_imports.py',
+                        'input_file': '../../WebCore/inspector/front-end/TimelinePanel.js',
+                        'inputs': [
+                            '<@(_script_name)',
+                            '<@(webinspector_resources_js_files)',
+                        ],
+                        'search_path': '../../WebCore/inspector/front-end',
+                        'outputs': ['<(PRODUCT_DIR)/resources/inspector/TimelinePanel.js'],
+                        'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'],
+                    }],
+                },
+                {
+                    'target_name': 'concatenated_devtools_audits_js',
+                    'type': 'none',
+                    'actions': [{
+                        'action_name': 'concatenate_devtools_audits_js',
+                        'script_name': 'scripts/inline_js_imports.py',
+                        'input_file': '../../WebCore/inspector/front-end/AuditsPanel.js',
+                        'inputs': [
+                            '<@(_script_name)',
+                            '<@(webinspector_audits_js_files)',
+                        ],
+                        'search_path': '../../WebCore/inspector/front-end',
+                        'outputs': ['<(PRODUCT_DIR)/resources/inspector/AuditsPanel.js'],
+                        'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'],
+                    }],
+                },
+                {
+                    'target_name': 'concatenated_devtools_codemirror_js',
+                    'type': 'none',
+                    'actions': [{
+                        'action_name': 'concatenate_devtools_codemirror_js',
+                        'script_name': 'scripts/inline_js_imports.py',
+                        'input_file': '../../WebCore/inspector/front-end/CodeMirrorTextEditor.js',
+                        'inputs': [
+                            '<@(_script_name)',
+                            '<@(webinspector_codemirror_js_files)',
+                        ],
+                        'search_path': '../../WebCore/inspector/front-end',
+                        'outputs': ['<(PRODUCT_DIR)/resources/inspector/CodeMirrorTextEditor.js'],
+                        'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)', 'true'],
                     }],
                 },
                 {
index 82cbe86..91c5994 100644 (file)
@@ -55,7 +55,6 @@ class OrderedJSFilesExtractor(HTMLParser):
             if ('type' in attrs_dict and attrs_dict['type'] == 'text/javascript' and 'src' in attrs_dict):
                 self.ordered_js_files.append(attrs_dict['src'])
 
-
 class PathExpander:
 
     def __init__(self, paths):
index 2655016..776a3fc 100644 (file)
@@ -43,12 +43,13 @@ import sys
 def main(argv):
 
     if len(argv) < 3:
-        print('usage: %s input_file imports_dir output_file' % argv[0])
+        print('usage: %s input_file imports_dir output_file no_minify' % argv[0])
         return 1
 
     input_file_name = argv[1]
     imports_dir = argv[2]
     output_file_name = argv[3]
+    no_minify = len(argv) > 4 and argv[4]
 
     input_file = open(input_file_name, 'r')
     input_script = input_file.read()
@@ -66,10 +67,12 @@ def main(argv):
         import_file.close()
         return import_script
 
-    output_script = re.sub(r'importScripts\([\'"]([^\'"]+)[\'"]\)', replace, input_script)
+    output_script = re.sub(r'importScripts?\([\'"]([^\'"]+)[\'"]\)', replace, input_script)
 
     output_file = open(output_file_name, 'w')
-    output_file.write(jsmin.jsmin(output_script))
+    if not no_minify:
+        output_script = jsmin.jsmin(output_script)
+    output_file.write(output_script)
     output_file.close()
 
     # Touch output file directory to make sure that Xcode will copy