Title: [97952] trunk
Revision
97952
Author
podivi...@chromium.org
Date
2011-10-20 02:33:02 -0700 (Thu, 20 Oct 2011)

Log Message

Web Inspector: encode source map url as source map page url query parameter.
https://bugs.webkit.org/show_bug.cgi?id=70327

Reviewed by Pavel Feldman.

Source/WebCore:

* inspector/front-end/CompilerSourceMappingProvider.js:
(WebInspector.CompilerSourceMappingProvider):
(WebInspector.CompilerSourceMappingProvider.prototype.loadSourceMapping.frameLoaded):
(WebInspector.CompilerSourceMappingProvider.prototype.loadSourceMapping):
(WebInspector.CompilerSourceMappingProvider.prototype.loadSourceCode):
(WebInspector.CompilerSourceMappingProvider.prototype._sendRequest):
* inspector/front-end/RawSourceCode.js:
(WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiSourceCodeList):

LayoutTests:

* http/tests/inspector/compiler-source-mapping-provider.html:
* http/tests/inspector/resources/compiler-source-mapping-provider/app-map.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97951 => 97952)


--- trunk/LayoutTests/ChangeLog	2011-10-20 09:10:06 UTC (rev 97951)
+++ trunk/LayoutTests/ChangeLog	2011-10-20 09:33:02 UTC (rev 97952)
@@ -1,3 +1,13 @@
+2011-10-18  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: encode source map url as source map page url query parameter.
+        https://bugs.webkit.org/show_bug.cgi?id=70327
+
+        Reviewed by Pavel Feldman.
+
+        * http/tests/inspector/compiler-source-mapping-provider.html:
+        * http/tests/inspector/resources/compiler-source-mapping-provider/app-map.html:
+
 2011-10-20  Yuzo Fujishima  <y...@google.com>
 
         [chromium] Yet another test expectation change for platform/chromium/compositing/zoom-animator-scale-test2.html

Modified: trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-provider.html (97951 => 97952)


--- trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-provider.html	2011-10-20 09:10:06 UTC (rev 97951)
+++ trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-provider.html	2011-10-20 09:33:02 UTC (rev 97952)
@@ -9,7 +9,7 @@
     InspectorTest.runTestSuite([
         function testLoad(next)
         {
-            var provider = new WebInspector.CompilerSourceMappingProvider("http://localhost:8000/inspector/resources/compiler-source-mapping-provider/app-map");
+            var provider = new WebInspector.CompilerSourceMappingProvider("http://localhost:8000/inspector/resources/compiler-source-mapping-provider/app-map.html?sourceMap=app-map");
             var sourceMapping;
             provider.loadSourceMapping(didLoadSourceMapping);
             function didLoadSourceMapping(sourceMappingArg)

Modified: trunk/LayoutTests/http/tests/inspector/resources/compiler-source-mapping-provider/app-map.html (97951 => 97952)


--- trunk/LayoutTests/http/tests/inspector/resources/compiler-source-mapping-provider/app-map.html	2011-10-20 09:10:06 UTC (rev 97951)
+++ trunk/LayoutTests/http/tests/inspector/resources/compiler-source-mapping-provider/app-map.html	2011-10-20 09:33:02 UTC (rev 97952)
@@ -3,7 +3,19 @@
 
 function handleMessage(event)
 {
-    var url = ""
+    var requestId = event.data.id;
+    var method = event.data.method;
+    if (method === "loadSourceMap") {
+        var queryParameters = parseQueryString(window.location.toString());
+        sendRequest(event, queryParameters.sourceMap);
+    } else if (method === "loadSourceCode") {
+        var sourceCodeURL = event.data.params[0];
+        sendRequest(event, sourceCodeURL);
+    }
+}
+
+function sendRequest(event, url)
+{
     var request = new XMLHttpRequest();
     request.open("GET", url, true);
     request._onreadystatechange_ = function()
@@ -17,4 +29,16 @@
     }
     request.send();
 }
+
+function parseQueryString(url)
+{
+    var query = url.split("?")[1];
+    var parameters = query.split("&");
+    var result = {};
+    for (var i = 0; i < parameters.length; ++i) {
+        var parameter = parameters[i].split("=");
+        result[parameter[0]] = parameter[1];
+    }
+    return result;
+}
 </script>

Modified: trunk/LayoutTests/inspector/debugger/raw-source-code.html (97951 => 97952)


--- trunk/LayoutTests/inspector/debugger/raw-source-code.html	2011-10-20 09:10:06 UTC (rev 97951)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code.html	2011-10-20 09:33:02 UTC (rev 97952)
@@ -375,7 +375,7 @@
             function checkMapping()
             {
                 var sourceMapping = rawSourceCode.sourceMapping;
-                uiSourceCodeList = sourceMapping.uiSourceCodeList;
+                uiSourceCodeList = sourceMapping.uiSourceCodeList();
                 var uiSourceCodeByURL = {};
                 for (var i = 0; i < uiSourceCodeList.length; ++i)
                     uiSourceCodeByURL[uiSourceCodeList[i].url] = uiSourceCodeList[i];

Modified: trunk/Source/WebCore/ChangeLog (97951 => 97952)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 09:10:06 UTC (rev 97951)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 09:33:02 UTC (rev 97952)
@@ -1,3 +1,19 @@
+2011-10-18  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: encode source map url as source map page url query parameter.
+        https://bugs.webkit.org/show_bug.cgi?id=70327
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/CompilerSourceMappingProvider.js:
+        (WebInspector.CompilerSourceMappingProvider):
+        (WebInspector.CompilerSourceMappingProvider.prototype.loadSourceMapping.frameLoaded):
+        (WebInspector.CompilerSourceMappingProvider.prototype.loadSourceMapping):
+        (WebInspector.CompilerSourceMappingProvider.prototype.loadSourceCode):
+        (WebInspector.CompilerSourceMappingProvider.prototype._sendRequest):
+        * inspector/front-end/RawSourceCode.js:
+        (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiSourceCodeList):
+
 2011-10-19  Alexander Pavlov  <apav...@chromium.org>
 
         Web Inspector: The "x" in "980px x 36px" looks weird in the inspector node callout

Modified: trunk/Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js (97951 => 97952)


--- trunk/Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js	2011-10-20 09:10:06 UTC (rev 97951)
+++ trunk/Source/WebCore/inspector/front-end/CompilerSourceMappingProvider.js	2011-10-20 09:33:02 UTC (rev 97952)
@@ -30,16 +30,15 @@
 
 /**
  * @constructor
- * @param {string} sourceMappingURL
+ * @param {string} sourceMappingPageURL
  */
-WebInspector.CompilerSourceMappingProvider = function(sourceMappingURL)
+WebInspector.CompilerSourceMappingProvider = function(sourceMappingPageURL)
 {
     if (!this._initialized) {
         window.addEventListener("message", this._onMessage, true);
         WebInspector.CompilerSourceMappingProvider.prototype._initialized = true;
     }
-    this._sourceMappingURL = sourceMappingURL;
-    this._frameURL = this._sourceMappingURL + ".html";
+    this._sourceMappingPageURL = sourceMappingPageURL;
 }
 
 WebInspector.CompilerSourceMappingProvider.prototype = {
@@ -49,7 +48,7 @@
     loadSourceMapping: function(callback)
     {
         this._frame = document.createElement("iframe");
-        this._frame.src = ""
+        this._frame.src = ""
         function frameLoaded()
         {
             function didLoadData(error, result)
@@ -72,7 +71,7 @@
                 else
                     callback(null);
             }
-            this._sendRequest("loadData", [this._sourceMappingURL], didLoadData);
+            this._sendRequest("loadSourceMap", [], didLoadData);
         }
         this._frame.addEventListener("load", frameLoaded.bind(this), true);
         // FIXME: remove iframe from the document when it is not needed anymore.
@@ -95,16 +94,16 @@
             }
             callback(result);
         }
-        this._sendRequest("loadData", [sourceURL], didSendRequest, timeout);
+        this._sendRequest("loadSourceCode", [sourceURL], didSendRequest, timeout);
     },
 
     _sendRequest: function(method, parameters, callback, timeout)
     {
         var requestId = this._requestId++;
-        var timerId = setTimeout(this._cancelRequest.bind(this, requestId), timeout || 50);
+        var timerId = setTimeout(this._cancelRequest.bind(this, requestId), timeout || 5000);
         this._requests[requestId] = { callback: callback, timerId: timerId };
         var requestData = { id: requestId, method: method, params: parameters };
-        this._frame.contentWindow.postMessage(requestData, this._frameURL);
+        this._frame.contentWindow.postMessage(requestData, this._sourceMappingPageURL);
     },
 
     _onMessage: function(event)

Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (97951 => 97952)


--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2011-10-20 09:10:06 UTC (rev 97951)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2011-10-20 09:33:02 UTC (rev 97952)
@@ -404,7 +404,7 @@
     /**
      * @return {Array.<WebInspector.UISourceCode>}
      */
-    get uiSourceCodeList()
+    uiSourceCodeList: function()
     {
         return this._uiSourceCodeList;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to