Title: [144428] trunk/Source/WebCore
Revision
144428
Author
[email protected]
Date
2013-03-01 01:37:46 -0800 (Fri, 01 Mar 2013)

Log Message

Web Inspector: fix code-mirror experiment to work in debug mode
https://bugs.webkit.org/show_bug.cgi?id=111064

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

No new tests: no change in behaviour.

Improve importScript function to try load a script from the root
directory iff its loading from the given path failed.

* inspector/front-end/utilities.js:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144427 => 144428)


--- trunk/Source/WebCore/ChangeLog	2013-03-01 09:18:52 UTC (rev 144427)
+++ trunk/Source/WebCore/ChangeLog	2013-03-01 09:37:46 UTC (rev 144428)
@@ -1,3 +1,17 @@
+2013-03-01  Andrey Lushnikov  <[email protected]>
+
+        Web Inspector: fix code-mirror experiment to work in debug mode
+        https://bugs.webkit.org/show_bug.cgi?id=111064
+
+        Reviewed by Pavel Feldman.
+
+        No new tests: no change in behaviour.
+
+        Improve importScript function to try load a script from the root
+        directory iff its loading from the given path failed.
+
+        * inspector/front-end/utilities.js:
+
 2013-03-01  Andrey Adaikin  <[email protected]>
 
         Web Inspector: [Canvas] capture a WebGL extension by it's name in lower case

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


--- trunk/Source/WebCore/inspector/front-end/utilities.js	2013-03-01 09:18:52 UTC (rev 144427)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js	2013-03-01 09:37:46 UTC (rev 144428)
@@ -980,10 +980,17 @@
 {
     if (_importedScripts[scriptName])
         return;
+    var xhr = new XMLHttpRequest();
     _importedScripts[scriptName] = true;
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", scriptName, false);
-    xhr.send(null);
+    try {
+        xhr.open("GET", scriptName, false);
+        xhr.send(null);
+    } catch (e) {
+        // Try to load file from the root directory
+        scriptName = scriptName.split("/").reverse()[0];
+        xhr.open("GET", scriptName, false);
+        xhr.send(null);
+    }
     var sourceURL = WebInspector.ParsedURL.completeURL(window.location.href, scriptName); 
     window.eval(xhr.responseText + "\n//@ sourceURL=" + sourceURL);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to