Title: [144605] trunk/Source
Revision
144605
Author
[email protected]
Date
2013-03-04 00:37:42 -0800 (Mon, 04 Mar 2013)

Log Message

Web Inspector: add runtime flag to determine if inspector's source files were flattened.
https://bugs.webkit.org/show_bug.cgi?id=111184

Patch by Andrey Lushnikov <[email protected]> on 2013-03-04
Reviewed by Pavel Feldman.

Source/WebCore:

- Add a file "buildSystemOnly.js" which will be included into
devtools.html only by GYP build system. This script sets a single flag
which essentially means that inspector source files were run
through a build system and flattened.
- Update "importScript" and "registerRequiredCSS" functions to correct
paths according to the "flattenImports" flag.

No new tests: no change in behaviour.

* WebCore.gypi:
* inspector/front-end/CodeMirrorTextEditor.js:
(WebInspector.CodeMirrorTextEditor):
* inspector/front-end/View.js:
(WebInspector.View.prototype.registerRequiredCSS):
* inspector/front-end/buildSystemOnly.js: Added.
* inspector/front-end/utilities.js:

Source/WebKit/chromium:

Included "buildSystemOnly.js" in devtools.html by generate_devtools_html.py script.

* WebKit.gyp:
* scripts/generate_devtools_html.py: Add script tag to include buildSystemOnly.js
(write_devtools_html):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144604 => 144605)


--- trunk/Source/WebCore/ChangeLog	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebCore/ChangeLog	2013-03-04 08:37:42 UTC (rev 144605)
@@ -1,3 +1,27 @@
+2013-03-04  Andrey Lushnikov  <[email protected]>
+
+        Web Inspector: add runtime flag to determine if inspector's source files were flattened.
+        https://bugs.webkit.org/show_bug.cgi?id=111184
+
+        Reviewed by Pavel Feldman.
+
+        - Add a file "buildSystemOnly.js" which will be included into
+        devtools.html only by GYP build system. This script sets a single flag
+        which essentially means that inspector source files were run
+        through a build system and flattened.
+        - Update "importScript" and "registerRequiredCSS" functions to correct
+        paths according to the "flattenImports" flag.
+
+        No new tests: no change in behaviour.
+
+        * WebCore.gypi:
+        * inspector/front-end/CodeMirrorTextEditor.js:
+        (WebInspector.CodeMirrorTextEditor):
+        * inspector/front-end/View.js:
+        (WebInspector.View.prototype.registerRequiredCSS):
+        * inspector/front-end/buildSystemOnly.js: Added.
+        * inspector/front-end/utilities.js:
+
 2013-03-04  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Fix front-end compilation

Modified: trunk/Source/WebCore/WebCore.gypi (144604 => 144605)


--- trunk/Source/WebCore/WebCore.gypi	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebCore/WebCore.gypi	2013-03-04 08:37:42 UTC (rev 144605)
@@ -5431,11 +5431,12 @@
             'inspector/front-end/inspectorSyntaxHighlight.css',
             'inspector/front-end/popover.css',
             '<@(webinspector_modules_js_files)',
-            '<@(webinspector_standalone_css_files)',
+            '<@(webinspector_standalone_files)',
         ],
-        'webinspector_standalone_css_files': [
+        'webinspector_standalone_files': [
             'inspector/front-end/auditsPanel.css',
             'inspector/front-end/breadcrumbList.css',
+            'inspector/front-end/buildSystemOnly.js',
             'inspector/front-end/cm/cmdevtools.css',
             'inspector/front-end/cm/codemirror.css',
             'inspector/front-end/cssNamedFlows.css',

Modified: trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js (144604 => 144605)


--- trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	2013-03-04 08:37:42 UTC (rev 144605)
@@ -47,8 +47,8 @@
     this._delegate = delegate;
     this._url = url;
 
-    this.registerRequiredCSS("codemirror.css");
-    this.registerRequiredCSS("cmdevtools.css");
+    this.registerRequiredCSS("cm/codemirror.css");
+    this.registerRequiredCSS("cm/cmdevtools.css");
 
     this._codeMirror = window.CodeMirror(this.element, {
         lineNumbers: true,

Modified: trunk/Source/WebCore/inspector/front-end/View.js (144604 => 144605)


--- trunk/Source/WebCore/inspector/front-end/View.js	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebCore/inspector/front-end/View.js	2013-03-04 08:37:42 UTC (rev 144605)
@@ -299,6 +299,8 @@
 
     registerRequiredCSS: function(cssFile)
     {
+        if (window.flattenImports)
+            cssFile = cssFile.split("/").reverse()[0];
         this._cssFiles.push(cssFile);
     },
 

Added: trunk/Source/WebCore/inspector/front-end/buildSystemOnly.js (0 => 144605)


--- trunk/Source/WebCore/inspector/front-end/buildSystemOnly.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/buildSystemOnly.js	2013-03-04 08:37:42 UTC (rev 144605)
@@ -0,0 +1,6 @@
+/**
+ * This flag notifies inspector that it was deployed with the help
+ * of a build system. Build system flattenes all css and js files,
+ * so in this case inspector has to correct paths for dynamic resource loading.
+ */
+window.flattenImports = true;

Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (144604 => 144605)


--- trunk/Source/WebCore/inspector/front-end/utilities.js	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js	2013-03-04 08:37:42 UTC (rev 144605)
@@ -982,15 +982,10 @@
         return;
     var xhr = new XMLHttpRequest();
     _importedScripts[scriptName] = true;
-    try {
-        xhr.open("GET", scriptName, false);
-        xhr.send(null);
-    } catch (e) {
-        // Try to load file from the root directory
+    if (window.flattenImports)
         scriptName = scriptName.split("/").reverse()[0];
-        xhr.open("GET", scriptName, false);
-        xhr.send(null);
-    }
+    xhr.open("GET", scriptName, false);
+    xhr.send(null);
     var sourceURL = WebInspector.ParsedURL.completeURL(window.location.href, scriptName); 
     window.eval(xhr.responseText + "\n//@ sourceURL=" + sourceURL);
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (144604 => 144605)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-03-04 08:37:42 UTC (rev 144605)
@@ -1,3 +1,16 @@
+2013-03-04  Andrey Lushnikov  <[email protected]>
+
+        Web Inspector: add runtime flag to determine if inspector's source files were flattened.
+        https://bugs.webkit.org/show_bug.cgi?id=111184
+
+        Reviewed by Pavel Feldman.
+
+        Included "buildSystemOnly.js" in devtools.html by generate_devtools_html.py script.
+
+        * WebKit.gyp:
+        * scripts/generate_devtools_html.py: Add script tag to include buildSystemOnly.js
+        (write_devtools_html):
+
 2013-03-03  Alexandre Elias  <[email protected]>
 
         [chromium] Remove WebLayerTreeView::setViewportSize call

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (144604 => 144605)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2013-03-04 08:37:42 UTC (rev 144605)
@@ -956,7 +956,7 @@
                             '<(PRODUCT_DIR)/resources/inspector/ScriptFormatterWorker.js',
                             '<(PRODUCT_DIR)/resources/inspector/devTools.css',
                             '<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js',
-                            '<@(webinspector_standalone_css_files)',
+                            '<@(webinspector_standalone_files)',
                         ],
                         'images': [
                             '<@(webinspector_image_files)',
@@ -1251,7 +1251,7 @@
                     'copies': [{
                         'destination': '<(PRODUCT_DIR)/resources/inspector',
                         'files': [
-                            '<@(webinspector_standalone_css_files)',
+                            '<@(webinspector_standalone_files)',
                         ],
                     }],
                 },

Modified: trunk/Source/WebKit/chromium/scripts/generate_devtools_html.py (144604 => 144605)


--- trunk/Source/WebKit/chromium/scripts/generate_devtools_html.py	2013-03-04 08:36:11 UTC (rev 144604)
+++ trunk/Source/WebKit/chromium/scripts/generate_devtools_html.py	2013-03-04 08:37:42 UTC (rev 144605)
@@ -57,6 +57,8 @@
                 devtools_file.write(generate_include_tag("devTools.css"))
                 devtools_file.write(generate_include_tag("DevTools.js"))
         devtools_file.write(line)
+        if '<head>' in line:
+            devtools_file.write(generate_include_tag("buildSystemOnly.js"))
 
 
 def main(argv):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to