Title: [138506] trunk
Revision
138506
Author
[email protected]
Date
2012-12-27 08:32:02 -0800 (Thu, 27 Dec 2012)

Log Message

Web Inspector: [Regression] Can not set breakpoints in scripts loaded with source map.
https://bugs.webkit.org/show_bug.cgi?id=105801

Reviewed by Alexander Pavlov.

Source/WebCore:

ResourceScriptMapping now pushes itself to script's source mappings in addScript method.
Binding script to uiSourceCode loaded later is only triggering updateLocations() now.

* inspector/front-end/ResourceScriptMapping.js:
(WebInspector.ResourceScriptMapping.prototype.addScript):
(WebInspector.ResourceScriptMapping.prototype._bindUISourceCodeToScripts):
* inspector/front-end/Script.js:
(WebInspector.Script.prototype.disableSourceMapping):
(WebInspector.Script.prototype.enableSourceMapping):
(WebInspector.Script.prototype.pushSourceMapping):
(WebInspector.Script.prototype.popSourceMapping):
(WebInspector.Script.prototype.updateLocations):

LayoutTests:

* http/tests/inspector/compiler-script-mapping-expected.txt:
* http/tests/inspector/compiler-script-mapping.html:
* http/tests/inspector/debugger-test.js:
(initialize_DebuggerTest):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138505 => 138506)


--- trunk/LayoutTests/ChangeLog	2012-12-27 16:29:37 UTC (rev 138505)
+++ trunk/LayoutTests/ChangeLog	2012-12-27 16:32:02 UTC (rev 138506)
@@ -1,3 +1,15 @@
+2012-12-27  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: [Regression] Can not set breakpoints in scripts loaded with source map.
+        https://bugs.webkit.org/show_bug.cgi?id=105801
+
+        Reviewed by Alexander Pavlov.
+
+        * http/tests/inspector/compiler-script-mapping-expected.txt:
+        * http/tests/inspector/compiler-script-mapping.html:
+        * http/tests/inspector/debugger-test.js:
+        (initialize_DebuggerTest):
+
 2012-12-27  Christophe Dumez  <[email protected]>
 
         [EFL][WK2] Regression(135935) layout tests snapshots are flaky

Modified: trunk/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt (138505 => 138506)


--- trunk/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt	2012-12-27 16:29:37 UTC (rev 138505)
+++ trunk/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt	2012-12-27 16:32:02 UTC (rev 138506)
@@ -13,6 +13,8 @@
 
 Running: testCompilerScriptMapping
 
+Running: testCompilerScriptMappingWhenResourceWasLoadedAfterSource
+
 Running: testInlinedSourceMap
 
 Running: testSourceMapCouldNotBeLoaded

Modified: trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html (138505 => 138506)


--- trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html	2012-12-27 16:29:37 UTC (rev 138505)
+++ trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html	2012-12-27 16:32:02 UTC (rev 138506)
@@ -205,6 +205,67 @@
             }
         },
 
+        function testCompilerScriptMappingWhenResourceWasLoadedAfterSource(next)
+        {
+            var script;
+            WebInspector.debuggerModel._reset();
+            var mapping = createCompilerScriptMapping();
+            var originalUISourceCode;
+            step1();
+
+            function step1()
+            {
+                InspectorTest.waitForWorkspaceTemporaryUISourceCodeAddedEvent(function() { });
+                script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, "");
+                script.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json";
+                defaultScriptMapping.addScript(script);
+                resourceScriptMapping.addScript(script);
+                InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUISourceCodeAdded);
+                mapping.addScript(script);
+                InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalResourceUISourceCodeAdded);
+                InspectorTest.addMockUISourceCodeToWorkspace("compiled.js", WebInspector.resourceTypes.Script, "");
+                afterScriptAdded();
+            }
+
+            function originalResourceUISourceCodeAdded(uiSourceCode) {
+                originalUISourceCode = uiSourceCode;
+            }
+
+            function firstUISourceCodeAdded(uiSourceCode)
+            {
+                InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(function() { });
+            }
+
+            function afterScriptAdded(uiSourceCode)
+            {
+                var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForURL("http://localhost:8000/inspector/resources/source1.js");
+                var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForURL("http://localhost:8000/inspector/resources/source2.js");
+
+                InspectorTest.checkUILocation(uiSourceCode1, 4, 4, script.rawLocationToUILocation(0, 81));
+                InspectorTest.checkUILocation(uiSourceCode1, 5, 4, script.rawLocationToUILocation(0, 93));
+                InspectorTest.checkUILocation(uiSourceCode2, 7, 4, script.rawLocationToUILocation(1, 151));
+                InspectorTest.checkUILocation(originalUISourceCode, 1, 200, script.rawLocationToUILocation(1, 200));
+
+                InspectorTest.checkRawLocation(script, 0, 42, uiSourceCode1.uiLocationToRawLocation(3, 10));
+                InspectorTest.checkRawLocation(script, 1, 85, uiSourceCode2.uiLocationToRawLocation(0, 0));
+                InspectorTest.checkRawLocation(script, 1, 110, uiSourceCode2.uiLocationToRawLocation(5, 2));
+
+                uiSourceCode1.requestContent(didRequestContent1);
+
+                function didRequestContent1(content, contentEncoded, mimeType)
+                {
+                    InspectorTest.assertEquals(0, content.indexOf("window.addEventListener"));
+                    uiSourceCode2.requestContent(didRequestContent2);
+                }
+
+                function didRequestContent2(content, contentEncoded, mimeType)
+                {
+                    InspectorTest.assertEquals(0, content.indexOf("function ClickHandler()"));
+                    next();
+                }
+            }
+        },
+
         function testInlinedSourceMap(next)
         {
             WebInspector.debuggerModel._reset();

Modified: trunk/LayoutTests/http/tests/inspector/debugger-test.js (138505 => 138506)


--- trunk/LayoutTests/http/tests/inspector/debugger-test.js	2012-12-27 16:29:37 UTC (rev 138505)
+++ trunk/LayoutTests/http/tests/inspector/debugger-test.js	2012-12-27 16:32:02 UTC (rev 138506)
@@ -313,9 +313,10 @@
 
 InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber, location)
 {
-    InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect uiSourceCode");
-    InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineNumber");
-    InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect columnNumber");
+    InspectorTest.assertEquals(uiSourceCode, location.uiSourceCode, "Incorrect uiSourceCode, expected '" + (uiSourceCode ? uiSourceCode.url : null) + "'," +
+                                                                    " but got '" + (location.uiSourceCode ? location.uiSourceCode.url : null) + "'");
+    InspectorTest.assertEquals(lineNumber, location.lineNumber, "Incorrect lineNumber, expected '" + lineNumber + "', but got '" + location.lineNumber + "'");
+    InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect columnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber + "'");
 };
 
 };

Modified: trunk/Source/WebCore/ChangeLog (138505 => 138506)


--- trunk/Source/WebCore/ChangeLog	2012-12-27 16:29:37 UTC (rev 138505)
+++ trunk/Source/WebCore/ChangeLog	2012-12-27 16:32:02 UTC (rev 138506)
@@ -1,3 +1,23 @@
+2012-12-27  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: [Regression] Can not set breakpoints in scripts loaded with source map.
+        https://bugs.webkit.org/show_bug.cgi?id=105801
+
+        Reviewed by Alexander Pavlov.
+
+        ResourceScriptMapping now pushes itself to script's source mappings in addScript method.
+        Binding script to uiSourceCode loaded later is only triggering updateLocations() now.
+
+        * inspector/front-end/ResourceScriptMapping.js:
+        (WebInspector.ResourceScriptMapping.prototype.addScript):
+        (WebInspector.ResourceScriptMapping.prototype._bindUISourceCodeToScripts):
+        * inspector/front-end/Script.js:
+        (WebInspector.Script.prototype.disableSourceMapping):
+        (WebInspector.Script.prototype.enableSourceMapping):
+        (WebInspector.Script.prototype.pushSourceMapping):
+        (WebInspector.Script.prototype.popSourceMapping):
+        (WebInspector.Script.prototype.updateLocations):
+
 2012-12-27  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: remove support for legacy heap graph node format

Modified: trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js (138505 => 138506)


--- trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js	2012-12-27 16:29:37 UTC (rev 138505)
+++ trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js	2012-12-27 16:32:02 UTC (rev 138506)
@@ -77,7 +77,8 @@
     {
         if (script.isAnonymousScript() || script.isDynamicScript())
             return;
-
+        script.pushSourceMapping(this);
+        
         var scriptsForSourceURL = script.isInlineScript() ? this._inlineScriptsForSourceURL : this._nonInlineScriptsForSourceURL;
         scriptsForSourceURL[script.sourceURL] = scriptsForSourceURL[script.sourceURL] || [];
         scriptsForSourceURL[script.sourceURL].push(script);
@@ -85,7 +86,7 @@
         var uiSourceCode = this._workspaceUISourceCodeForScript(script);
         if (!uiSourceCode)
             return;
-            
+
         this._bindUISourceCodeToScripts(uiSourceCode, [script]);
     },
 
@@ -170,7 +171,7 @@
         var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode);
         uiSourceCode.setScriptFile(scriptFile);
         for (var i = 0; i < scripts.length; ++i)
-            scripts[i].pushSourceMapping(this);
+            scripts[i].updateLocations();
         uiSourceCode.setSourceMapping(this);
     },
 

Modified: trunk/Source/WebCore/inspector/front-end/Script.js (138505 => 138506)


--- trunk/Source/WebCore/inspector/front-end/Script.js	2012-12-27 16:29:37 UTC (rev 138505)
+++ trunk/Source/WebCore/inspector/front-end/Script.js	2012-12-27 16:32:02 UTC (rev 138506)
@@ -255,7 +255,7 @@
         this._disabledSourceMappings = this._disabledSourceMappings || new Map();
         this._disabledSourceMappings.put(sourceMapping, true);
         if (this._sourceMappingsDiffer(oldSourceMappings,this._enabledSourceMappings()))
-            this._updateLocations();
+            this.updateLocations();
     },
 
     /**
@@ -268,7 +268,7 @@
         if (!this._disabledSourceMappings.size())
             delete this._disabledSourceMappings;
         if (this._sourceMappingsDiffer(oldSourceMappings,this._enabledSourceMappings()))
-            this._updateLocations();
+            this.updateLocations();
     },
 
     /**
@@ -277,16 +277,16 @@
     pushSourceMapping: function(sourceMapping)
     {
         this._sourceMappings.push(sourceMapping);
-        this._updateLocations();
+        this.updateLocations();
     },
 
     popSourceMapping: function()
     {
         this._sourceMappings.pop();
-        this._updateLocations();
+        this.updateLocations();
     },
 
-    _updateLocations: function()
+    updateLocations: function()
     {
         for (var i = 0; i < this._locations.length; ++i)
             this._locations[i].update();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to