Permalink
Browse files

Web Inspector: Breakpoints are not correctly restored on reload.

https://bugs.webkit.org/show_bug.cgi?id=94209

Reviewed by Pavel Feldman.

Source/WebCore:

BreakpointManager now resets uiLocations on workspace reset (was doing it on GlobalObjectCleared).
Breakpoint manager now calls restoreBreakpoints automatically when uiSourceCode is added to workspace.

* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager):
(WebInspector.BreakpointManager.prototype._uiSourceCodeAdded):
(WebInspector.BreakpointManager.prototype._workspaceReset):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode):
* inspector/front-end/inspector.js:

LayoutTests:

restoreBreakpoints is not called inside the test anymore to test that it is called automatically.

* inspector/debugger/breakpoint-manager-expected.txt:
* inspector/debugger/breakpoint-manager.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information...
Vsevolod Vlasov
Vsevolod Vlasov committed Aug 16, 2012
1 parent 2bd3611 commit 2fd791ad080f8dcae8d4b37ddc720621f1202739
View
@@ -1,3 +1,15 @@
+2012-08-16 Vsevolod Vlasov <vsevik@chromium.org>
+
+ Web Inspector: Breakpoints are not correctly restored on reload.
+ https://bugs.webkit.org/show_bug.cgi?id=94209
+
+ Reviewed by Pavel Feldman.
+
+ restoreBreakpoints is not called inside the test anymore to test that it is called automatically.
+
+ * inspector/debugger/breakpoint-manager-expected.txt:
+ * inspector/debugger/breakpoint-manager.html:
+
2012-08-16 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
[EFL] Gardening after r125592, r125635
@@ -189,6 +189,7 @@ Running: testNavigation
Navigating to B.
Resetting debugger.
+ Resetting workspace.
breakpointRemoved(a.js, 10)
Location disposed: a.js:10
breakpointRemoved(a.js, 20)
@@ -199,6 +200,7 @@ Running: testNavigation
Navigating back to A.
Resetting debugger.
+ Resetting workspace.
breakpointRemoved(b.js, 3)
Location disposed: b.js:3
Resolving provisional breakpoint.
@@ -263,6 +265,7 @@ Running: testProvisionalBreakpointsResolve
breakpointAdded(a.js, 10, foo == bar, true)
Location created: a.js:10
Resetting debugger.
+ Resetting workspace.
breakpointRemoved(a.js, 10)
Location disposed: a.js:10
Resolving provisional breakpoint.
@@ -94,7 +94,6 @@
{
InspectorTest.addResult(" Resetting debugger.");
this._scripts = {};
- this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared);
},
setSourceMapping: function(sourceMapping)
@@ -105,6 +104,27 @@
}
DebuggerModelMock.prototype.__proto__ = WebInspector.Object.prototype;
+ function WorkspaceMock()
+ {
+ }
+
+ WorkspaceMock.prototype = {
+ _addUISourceCode: function(url)
+ {
+ var uiSourceCode = new WebInspector.JavaScriptSource(url, null, null, defaultMapping, false);
+ uiSourceCodes[url] = uiSourceCode;
+ this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
+ return uiSourceCode;
+ },
+
+ reset: function()
+ {
+ InspectorTest.addResult(" Resetting workspace.");
+ this.dispatchEventToListeners(WebInspector.Workspace.Events.WorkspaceReset);
+ }
+ }
+ WorkspaceMock.prototype.__proto__ = WebInspector.Object.prototype;
+
var dummySetting = {
get: function() { return []; },
set: function(breakpoints) { }
@@ -136,10 +156,7 @@
{
breakpointManager._debuggerModel._addScript(url, url);
InspectorTest.addResult(" Adding UISourceCode: " + url + ")");
- var uiSourceCode = new WebInspector.JavaScriptSource(url, null, null, defaultMapping, false);
- uiSourceCodes[url] = uiSourceCode;
- breakpointManager.restoreBreakpoints(uiSourceCode);
- return uiSourceCode;
+ return breakpointManager._workspace._addUISourceCode(url);
}
function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled)
@@ -162,7 +179,8 @@
var sourceMapping = sourceMapping || defaultMapping;
var debuggerModel = new DebuggerModelMock(sourceMapping);
- var breakpointManager = new WebInspector.BreakpointManager(setting, debuggerModel, sourceMapping);
+ var workspaceMock = new WorkspaceMock();
+ var breakpointManager = new WebInspector.BreakpointManager(setting, debuggerModel, workspaceMock);
breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, breakpointAdded);
breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, breakpointRemoved);
InspectorTest.addResult(" Created breakpoints manager");
@@ -289,10 +307,12 @@
InspectorTest.addResult("\n Navigating to B.");
breakpointManager._debuggerModel.reset();
+ breakpointManager._workspace.reset();
var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js");
InspectorTest.addResult("\n Navigating back to A.");
breakpointManager._debuggerModel.reset();
+ breakpointManager._workspace.reset();
InspectorTest.addResult(" Resolving provisional breakpoint.");
var eventData = { breakpointId: "a.js:10", location: { scriptId: "a.js", lineNumber: 11, columnNumber: 5 }};
breakpointManager._debuggerModel.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointResolved, eventData);
@@ -326,6 +346,7 @@
var breakpointManager = createBreakpointManager(serializedBreakpoints);
var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
breakpointManager._debuggerModel.reset();
+ breakpointManager._workspace.reset();
InspectorTest.addResult(" Resolving provisional breakpoint.");
var eventData = { breakpointId: "a.js:10", location: { scriptId: "a.js", lineNumber: 11, columnNumber: 5 }};
breakpointManager._debuggerModel.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointResolved, eventData);
View
@@ -1,3 +1,21 @@
+2012-08-16 Vsevolod Vlasov <vsevik@chromium.org>
+
+ Web Inspector: Breakpoints are not correctly restored on reload.
+ https://bugs.webkit.org/show_bug.cgi?id=94209
+
+ Reviewed by Pavel Feldman.
+
+ BreakpointManager now resets uiLocations on workspace reset (was doing it on GlobalObjectCleared).
+ Breakpoint manager now calls restoreBreakpoints automatically when uiSourceCode is added to workspace.
+
+ * inspector/front-end/BreakpointManager.js:
+ (WebInspector.BreakpointManager):
+ (WebInspector.BreakpointManager.prototype._uiSourceCodeAdded):
+ (WebInspector.BreakpointManager.prototype._workspaceReset):
+ * inspector/front-end/UISourceCode.js:
+ (WebInspector.UISourceCode):
+ * inspector/front-end/inspector.js:
+
2012-08-16 Pierre Rossi <pierre.rossi@gmail.com>
[Qt] Remove FontQt4, HAVE_QRAWFONT flag and the related dead code
@@ -33,19 +33,22 @@
* @extends {WebInspector.Object}
* @param {WebInspector.Setting} breakpointStorage
* @param {WebInspector.DebuggerModel} debuggerModel
+ * @param {WebInspector.Workspace} workspace
*/
-WebInspector.BreakpointManager = function(breakpointStorage, debuggerModel)
+WebInspector.BreakpointManager = function(breakpointStorage, debuggerModel, workspace)
{
this._storage = new WebInspector.BreakpointManager.Storage(this, breakpointStorage);
this._debuggerModel = debuggerModel;
+ this._workspace = workspace;
this._breakpoints = [];
this._breakpointForDebuggerId = {};
this._breakpointsForUISourceCode = new Map();
this._sourceFilesWithRestoredBreakpoints = {};
this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
- this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
+ this._workspace.addEventListener(WebInspector.Workspace.Events.WorkspaceReset, this._workspaceReset, this);
+ this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
}
WebInspector.BreakpointManager.Events = {
@@ -75,6 +78,16 @@ WebInspector.BreakpointManager.prototype = {
this._storage._restoreBreakpoints(uiSourceCode);
},
+ /**
+ * @param {WebInspector.Event} event
+ */
+ _uiSourceCodeAdded: function(event)
+ {
+ var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data;
+ if (uiSourceCode instanceof WebInspector.JavaScriptSource)
+ this.restoreBreakpoints(uiSourceCode);
+ },
+
/**
* @param {WebInspector.UISourceCode} uiSourceCode
* @param {number} lineNumber
@@ -170,7 +183,7 @@ WebInspector.BreakpointManager.prototype = {
this._sourceFilesWithRestoredBreakpoints = {};
},
- _debuggerReset: function()
+ _workspaceReset: function()
{
var breakpoints = this._breakpoints.slice();
for (var i = 0; i < breakpoints.length; ++i) {
@@ -65,9 +65,6 @@ WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMappi
this.history = [];
this._restoreRevisionHistory();
this._formatterMapping = new WebInspector.IdentityFormatterSourceMapping();
-
- // FIXME: postpone formattedChanged call to after the mapping has been established.
- setTimeout(this.formattedChanged.bind(this), 0);
}
WebInspector.UISourceCode.Events = {
@@ -456,7 +456,6 @@ WebInspector._doLoadedDoneWithCapabilities = function()
this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._updateErrorAndWarningCounts, this);
this.debuggerModel = new WebInspector.DebuggerModel();
- this.breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this.debuggerModel);
WebInspector.CSSCompletions.requestCSSNameCompletions();
@@ -495,6 +494,7 @@ WebInspector._doLoadedDoneWithCapabilities = function()
this.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; });
this.workspace = new WebInspector.Workspace();
+ this.breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this.debuggerModel, this.workspace);
this._createPanels();
this._createGlobalStatusBarItems();

0 comments on commit 2fd791a

Please sign in to comment.