Title: [133592] trunk
Revision
133592
Author
[email protected]
Date
2012-11-06 05:57:59 -0800 (Tue, 06 Nov 2012)

Log Message

Web Inspector: Breakpoint is not removed when it was set in non-formatted mode and then removed while in formatted mode.
https://bugs.webkit.org/show_bug.cgi?id=100595

Reviewed by Yury Semikhatsky.

Source/WebCore:

Breakpoints in storage are now updated/removed by file name saved from primary location when they were created,
not by the name returned by UISourceCode (as this one could change when UISourceCode is formatted).
SourceFileId is now used across BreakpointManager to specify file name.
And breakpointStorageId is now used to specify (fileName, lineNumber) pair.

* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.sourceFileId):
(WebInspector.BreakpointManager.prototype._restoreBreakpoints):
(WebInspector.BreakpointManager.prototype._uiSourceCodeRemoved): Removed redundant check.
(WebInspector.BreakpointManager.prototype.breakpointLocationsForUISourceCode):
(WebInspector.BreakpointManager.Breakpoint):
(WebInspector.BreakpointManager.Breakpoint.prototype._breakpointStorageId):
(WebInspector.BreakpointManager.Storage.prototype._restoreBreakpoints):
(set WebInspector.BreakpointManager.Storage.Item):

LayoutTests:

* inspector/debugger/script-formatter-breakpoints-expected.txt:
* inspector/debugger/script-formatter-breakpoints.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (133591 => 133592)


--- trunk/LayoutTests/ChangeLog	2012-11-06 13:55:01 UTC (rev 133591)
+++ trunk/LayoutTests/ChangeLog	2012-11-06 13:57:59 UTC (rev 133592)
@@ -1,3 +1,13 @@
+2012-11-06  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Breakpoint is not removed when it was set in non-formatted mode and then removed while in formatted mode.
+        https://bugs.webkit.org/show_bug.cgi?id=100595
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/script-formatter-breakpoints-expected.txt:
+        * inspector/debugger/script-formatter-breakpoints.html:
+
 2012-11-06  Alexis Menard  <[email protected]>
 
         Add an extra test for background-position parsing.

Modified: trunk/LayoutTests/inspector/debugger/script-formatter-breakpoints-expected.txt (133591 => 133592)


--- trunk/LayoutTests/inspector/debugger/script-formatter-breakpoints-expected.txt	2012-11-06 13:55:01 UTC (rev 133591)
+++ trunk/LayoutTests/inspector/debugger/script-formatter-breakpoints-expected.txt	2012-11-06 13:57:59 UTC (rev 133592)
@@ -19,5 +19,11 @@
     script-formatter-breakpoints.html:11
     var f=0;
 Script execution resumed.
+
+Running: testBreakpointSetInOriginalAndRemovedInFormatted
+Adding breakpoint.
+Formatting.
+Removing breakpoint.
+Unformatting.
 Debugger was disabled.
 

Modified: trunk/LayoutTests/inspector/debugger/script-formatter-breakpoints.html (133591 => 133592)


--- trunk/LayoutTests/inspector/debugger/script-formatter-breakpoints.html	2012-11-06 13:55:01 UTC (rev 133591)
+++ trunk/LayoutTests/inspector/debugger/script-formatter-breakpoints.html	2012-11-06 13:57:59 UTC (rev 133592)
@@ -21,13 +21,11 @@
     InspectorTest.runDebuggerTestSuite([
         function testBreakpointsInOriginalAndFormattedSource(next)
         {
-            var root;
             InspectorTest.showScriptSource("script-formatter-breakpoints.html", didShowScriptSource);
 
             function didShowScriptSource(frame)
             {
                 sourceFrame = frame;
-                root = sourceFrame._url.substr(0, sourceFrame._url.lastIndexOf("/") + 1);
                 InspectorTest.setBreakpoint(sourceFrame, 10, "", true);
                 InspectorTest.waitUntilPaused(pausedInF1);
                 InspectorTest.evaluateInPageWithTimeout("f1()");
@@ -58,8 +56,35 @@
                 dumpBreakpointSidebarPane("while paused in pretty printed");
                 sourceFrame._uiSourceCode.setFormatted(false);
                 dumpBreakpointSidebarPane("while paused in raw");
+                InspectorTest.removeBreakpoint(sourceFrame, 10);
                 InspectorTest.resumeExecution(next);
             }
+        },
+
+        function testBreakpointSetInOriginalAndRemovedInFormatted(next)
+        {
+            InspectorTest.showScriptSource("script-formatter-breakpoints.html", didShowScriptSource);
+
+            function didShowScriptSource(frame)
+            {
+                sourceFrame = frame;
+                InspectorTest.addResult("Adding breakpoint.");
+                InspectorTest.setBreakpoint(sourceFrame, 10, "", true);
+                InspectorTest.addSniffer(WebInspector.UISourceCode.prototype, "updateLiveLocations", didFormatPage);
+                InspectorTest.addResult("Formatting.");
+                sourceFrame._uiSourceCode.setFormatted(true);
+            }
+
+            function didFormatPage()
+            {
+                InspectorTest.addResult("Removing breakpoint.");
+                InspectorTest.removeBreakpoint(sourceFrame, 17);
+                InspectorTest.addResult("Unformatting.");
+                sourceFrame._uiSourceCode.setFormatted(false);
+                var breakpoints = WebInspector.breakpointManager._storage._setting.get();
+                InspectorTest.assertEquals(breakpoints.length, 0, "There should not be any breakpoints in the storage.");
+                next();
+            }
         }
     ]);
 

Modified: trunk/Source/WebCore/ChangeLog (133591 => 133592)


--- trunk/Source/WebCore/ChangeLog	2012-11-06 13:55:01 UTC (rev 133591)
+++ trunk/Source/WebCore/ChangeLog	2012-11-06 13:57:59 UTC (rev 133592)
@@ -1,3 +1,25 @@
+2012-11-06  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Breakpoint is not removed when it was set in non-formatted mode and then removed while in formatted mode.
+        https://bugs.webkit.org/show_bug.cgi?id=100595
+
+        Reviewed by Yury Semikhatsky.
+
+        Breakpoints in storage are now updated/removed by file name saved from primary location when they were created,
+        not by the name returned by UISourceCode (as this one could change when UISourceCode is formatted).
+        SourceFileId is now used across BreakpointManager to specify file name.
+        And breakpointStorageId is now used to specify (fileName, lineNumber) pair.
+
+        * inspector/front-end/BreakpointManager.js:
+        (WebInspector.BreakpointManager.sourceFileId):
+        (WebInspector.BreakpointManager.prototype._restoreBreakpoints):
+        (WebInspector.BreakpointManager.prototype._uiSourceCodeRemoved): Removed redundant check.
+        (WebInspector.BreakpointManager.prototype.breakpointLocationsForUISourceCode):
+        (WebInspector.BreakpointManager.Breakpoint):
+        (WebInspector.BreakpointManager.Breakpoint.prototype._breakpointStorageId):
+        (WebInspector.BreakpointManager.Storage.prototype._restoreBreakpoints):
+        (set WebInspector.BreakpointManager.Storage.Item):
+
 2012-11-06  Keishi Hattori  <[email protected]>
 
         The "Rect" class in WebCore/Resources/pagepopups/pickerCommon.js should be renamed

Modified: trunk/Source/WebCore/inspector/front-end/BreakpointManager.js (133591 => 133592)


--- trunk/Source/WebCore/inspector/front-end/BreakpointManager.js	2012-11-06 13:55:01 UTC (rev 133591)
+++ trunk/Source/WebCore/inspector/front-end/BreakpointManager.js	2012-11-06 13:57:59 UTC (rev 133592)
@@ -58,7 +58,7 @@
     BreakpointRemoved: "breakpoint-removed"
 }
 
-WebInspector.BreakpointManager.breakpointStorageId = function(uiSourceCode)
+WebInspector.BreakpointManager.sourceFileId = function(uiSourceCode)
 {
     return uiSourceCode.formatted() ? "deobfuscated:" + uiSourceCode.url : uiSourceCode.url;
 }
@@ -69,7 +69,7 @@
      */
     _restoreBreakpoints: function(uiSourceCode)
     {
-        var sourceFileId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode);
+        var sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode);
         if (!sourceFileId || this._sourceFilesWithRestoredBreakpoints[sourceFileId])
             return;
         this._sourceFilesWithRestoredBreakpoints[sourceFileId] = true;
@@ -77,7 +77,7 @@
         // Erase provisional breakpoints prior to restoring them.
         for (var debuggerId in this._breakpointForDebuggerId) {
             var breakpoint = this._breakpointForDebuggerId[debuggerId];
-            if (breakpoint._sourceCodeStorageId !== sourceFileId)
+            if (breakpoint._sourceFileId !== sourceFileId)
                 continue;
             this._debuggerModel.removeBreakpoint(debuggerId);
             delete this._breakpointForDebuggerId[debuggerId];
@@ -117,11 +117,11 @@
             return;
         if (uiSourceCode.divergedVersion)
             return;
-        
-        var sourceFileId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode);
+
+        var sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode);
         if (!sourceFileId)
             return;
-        
+
         var breakpoints = this._breakpoints.slice();
         for (var i = 0; i < breakpoints.length; ++i) {
             var breakpoint = breakpoints[i];
@@ -131,14 +131,12 @@
                     breakpoint.remove(true);
             }
         }
-        
+
         delete this._sourceFilesWithRestoredBreakpoints[sourceFileId];
-        
+
         var uiSourceCodes = this._workspace.uiSourceCodes();
-        for (var i = 0; i < uiSourceCodes.length; ++i) {
-            if (WebInspector.BreakpointManager.breakpointStorageId(uiSourceCodes[i]) === sourceFileId)
-                this._restoreBreakpoints(uiSourceCodes[i]);
-        }
+        for (var i = 0; i < uiSourceCodes.length; ++i)
+            this._restoreBreakpoints(uiSourceCodes[i]);
     },
 
     /**
@@ -211,9 +209,9 @@
     {
         function filter(breakpoint, uiLocation)
         {
-            return uiLocation.uiSourceCode === uiSourceCode;   
+            return uiLocation.uiSourceCode === uiSourceCode;
         }
-        
+
         return this._filteredBreakpointLocations(filter);
     },
 
@@ -349,10 +347,10 @@
 {
     this._breakpointManager = breakpointManager;
     this._primaryUILocation = new WebInspector.UILocation(uiSourceCode, lineNumber, 0);
-    this._sourceCodeStorageId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode);
-    /** @type {Array.<WebInspector.Script.Location>} */ 
+    this._sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode);
+    /** @type {Array.<WebInspector.Script.Location>} */
     this._liveLocations = [];
-    /** @type {Object.<string, WebInspector.UILocation>} */ 
+    /** @type {Object.<string, WebInspector.UILocation>} */
     this._uiLocations = {};
 
     // Force breakpoint update.
@@ -472,7 +470,7 @@
             this._breakpointManager._debuggerModel.setBreakpointByScriptLocation(debuggerModelLocation, this._condition, didSetBreakpoint.bind(this));
         else
             this._breakpointManager._debuggerModel.setBreakpointByURL(this._primaryUILocation.uiSourceCode.url, this._primaryUILocation.lineNumber, 0, this._condition, didSetBreakpoint.bind(this));
-        
+
         /**
          * @this {WebInspector.BreakpointManager.Breakpoint}
          * @param {?DebuggerAgent.BreakpointId} breakpointId
@@ -536,7 +534,7 @@
      */
     _breakpointStorageId: function()
     {
-        return WebInspector.BreakpointManager.breakpointStorageId(this._primaryUILocation.uiSourceCode) + ":" + this._primaryUILocation.lineNumber;
+        return this._sourceFileId + ":" + this._primaryUILocation.lineNumber;
     },
 
     _fakeBreakpointAtPrimaryLocation: function()
@@ -572,10 +570,10 @@
     _restoreBreakpoints: function(uiSourceCode)
     {
         this._muted = true;
-        var breakpointStorageId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode);
+        var sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode);
         for (var id in this._breakpoints) {
             var breakpoint = this._breakpoints[id];
-            if (breakpoint.sourceFileId === breakpointStorageId)
+            if (breakpoint.sourceFileId === sourceFileId)
                 this._breakpointManager._innerSetBreakpoint(uiSourceCode, breakpoint.lineNumber, breakpoint.condition, breakpoint.enabled);
         }
         delete this._muted;
@@ -619,7 +617,7 @@
 WebInspector.BreakpointManager.Storage.Item = function(breakpoint)
 {
     var primaryUILocation = breakpoint.primaryUILocation();
-    this.sourceFileId = WebInspector.BreakpointManager.breakpointStorageId(primaryUILocation.uiSourceCode);
+    this.sourceFileId = breakpoint._sourceFileId;
     this.lineNumber = primaryUILocation.lineNumber;
     this.condition = breakpoint.condition();
     this.enabled = breakpoint.enabled();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to