Web Inspector: breakpoints are not restored upon reload for scripts with script mapping.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2013 09:20:21 +0000 (09:20 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2013 09:20:21 +0000 (09:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107799

Source/WebCore:

The problem is that source mapping is set after UISourceCode gets into the workspace.
Breakpoint manager will now only restore breakpoints upon setting the source maps.

Reviewed by Alexander Pavlov.

* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype._uiSourceCodeAdded):
(WebInspector.BreakpointManager.prototype._uiSourceCodeMappingChanged):
* inspector/front-end/CompilerScriptMapping.js:
(WebInspector.CompilerScriptMapping.prototype.get addScript.get this):
(WebInspector.CompilerScriptMapping.prototype.get addScript):

LayoutTests:

Reviewed by Alexander Pavlov.

* inspector/debugger/breakpoint-manager.html:

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

LayoutTests/ChangeLog
LayoutTests/inspector/debugger/breakpoint-manager.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/BreakpointManager.js
Source/WebCore/inspector/front-end/CompilerScriptMapping.js

index b725fce..f0ba63c 100644 (file)
@@ -1,3 +1,12 @@
+2013-01-24  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: breakpoints are not restored upon reload for scripts with script mapping.
+        https://bugs.webkit.org/show_bug.cgi?id=107799
+
+        Reviewed by Alexander Pavlov.
+
+        * inspector/debugger/breakpoint-manager.html:
+
 2013-01-24  Mihnea Ovidenie  <mihnea@adobe.com>
 
         [CSSRegions] Add test cases for auto-size regions and window resize
index 57851ea..3e325a8 100644 (file)
@@ -119,19 +119,19 @@ function test()
         _addUISourceCode: function(url)
         {
             var uiSourceCode = new WebInspector.UISourceCode(this, url, url, url, WebInspector.resourceTypes.Script, false);
-            uiSourceCode.setSourceMapping(defaultMapping);
             uiSourceCodes[url] = uiSourceCode;
             this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
+            uiSourceCode.setSourceMapping(defaultMapping);
             return uiSourceCode;
         },
 
         _addTemporaryUISourceCode: function(url)
         {
             var uiSourceCode = new WebInspector.UISourceCode(this, "temporary:" + url, url, url, WebInspector.resourceTypes.Script, false);
-            uiSourceCode.setSourceMapping(defaultMapping);
             uiSourceCodes[url] = uiSourceCode;
             temporaryUISourceCodes[url] = uiSourceCode;
             this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeAdded, uiSourceCode);
+            uiSourceCode.setSourceMapping(defaultMapping);
             return uiSourceCode;
         },
 
index 2f55aaf..5c11ddd 100644 (file)
@@ -1,3 +1,20 @@
+2013-01-24  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: breakpoints are not restored upon reload for scripts with script mapping.
+        https://bugs.webkit.org/show_bug.cgi?id=107799
+
+        The problem is that source mapping is set after UISourceCode gets into the workspace.
+        Breakpoint manager will now only restore breakpoints upon setting the source maps.
+
+        Reviewed by Alexander Pavlov.
+
+        * inspector/front-end/BreakpointManager.js:
+        (WebInspector.BreakpointManager.prototype._uiSourceCodeAdded):
+        (WebInspector.BreakpointManager.prototype._uiSourceCodeMappingChanged):
+        * inspector/front-end/CompilerScriptMapping.js:
+        (WebInspector.CompilerScriptMapping.prototype.get addScript.get this):
+        (WebInspector.CompilerScriptMapping.prototype.get addScript):
+
 2013-01-24  Kent Tamura  <tkent@chromium.org>
 
         Refactoring: Use AtomicString for an InputType::create argument
index a8f9a14..29173d4 100644 (file)
@@ -94,7 +94,7 @@ WebInspector.BreakpointManager.prototype = {
     {
         var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data);
         if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script || uiSourceCode.contentType() === WebInspector.resourceTypes.Document) {
-            this._restoreBreakpoints(uiSourceCode);
+            uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged, this._uiSourceCodeMappingChanged, this);
             uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormatted, this);
         }
     },
@@ -109,6 +109,15 @@ WebInspector.BreakpointManager.prototype = {
     },
 
     /**
+     * @param {WebInspector.Event} event
+     */
+    _uiSourceCodeMappingChanged: function(event)
+    {
+        var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.target);
+        this._restoreBreakpoints(uiSourceCode);
+    },
+
+    /**
      * @param {WebInspector.UISourceCode} uiSourceCode
      * @param {number} lineNumber
      * @param {string} condition
index 7236dcf..e6e4d33 100644 (file)
@@ -101,6 +101,9 @@ WebInspector.CompilerScriptMapping.prototype = {
             return;
         }
 
+        this._sourceMapForScriptId[script.scriptId] = sourceMap;
+        this._scriptForSourceMap.put(sourceMap, script);
+
         var sourceURLs = sourceMap.sources();
         for (var i = 0; i < sourceURLs.length; ++i) {
             var sourceURL = sourceURLs[i];
@@ -123,8 +126,6 @@ WebInspector.CompilerScriptMapping.prototype = {
                 uiSourceCode.isContentScript = script.isContentScript;
             }
         }
-        this._sourceMapForScriptId[script.scriptId] = sourceMap;
-        this._scriptForSourceMap.put(sourceMap, script);
         script.pushSourceMapping(this);
     },