Title: [165093] trunk/Source
Revision
165093
Author
[email protected]
Date
2014-03-04 20:44:15 -0800 (Tue, 04 Mar 2014)

Log Message

Inspector does not restore breakpoints after a page reload
https://bugs.webkit.org/show_bug.cgi?id=129655

Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

Fix a regression introduced by r162096 that erroneously removed
the inspector backend's mapping of files to breakpoints whenever the
global object was cleared.

The inspector's breakpoint mappings should only be cleared when the
debugger agent is disabled or destroyed. We should only clear the
debugger's breakpoint state when the global object is cleared.

To make it clearer what state is being cleared, the two cases have
been split into separate methods.

* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::disable):
(Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState):
(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
(Inspector::InspectorDebuggerAgent::didClearGlobalObject):
* inspector/agents/InspectorDebuggerAgent.h:

Source/WebInspectorUI:

Fix some console asserts that fire when breakpoints resolve.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.breakpointResolved):
This had a typo, it should be `breakpoint.identifier`.
(WebInspector.DebuggerManager.prototype.scriptDidParse):
Sometimes the `url` parameter is empty instead of null.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (165092 => 165093)


--- trunk/Source/_javascript_Core/ChangeLog	2014-03-05 03:48:33 UTC (rev 165092)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-03-05 04:44:15 UTC (rev 165093)
@@ -1,3 +1,28 @@
+2014-03-04  Brian Burg  <[email protected]>
+
+        Inspector does not restore breakpoints after a page reload
+        https://bugs.webkit.org/show_bug.cgi?id=129655
+
+        Reviewed by Joseph Pecoraro.
+
+        Fix a regression introduced by r162096 that erroneously removed
+        the inspector backend's mapping of files to breakpoints whenever the
+        global object was cleared.
+
+        The inspector's breakpoint mappings should only be cleared when the
+        debugger agent is disabled or destroyed. We should only clear the
+        debugger's breakpoint state when the global object is cleared.
+
+        To make it clearer what state is being cleared, the two cases have
+        been split into separate methods.
+
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::disable):
+        (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState):
+        (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
+        (Inspector::InspectorDebuggerAgent::didClearGlobalObject):
+        * inspector/agents/InspectorDebuggerAgent.h:
+
 2014-03-04  Andreas Kling  <[email protected]>
 
         Streamline JSValue::get().

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp (165092 => 165093)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2014-03-05 03:48:33 UTC (rev 165092)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2014-03-05 04:44:15 UTC (rev 165093)
@@ -108,11 +108,11 @@
     if (!m_enabled)
         return;
 
-    m_javaScriptBreakpoints.clear();
-
     stopListeningScriptDebugServer(isBeingDestroyed);
-    clearResolvedBreakpointState();
+    clearInspectorBreakpointState();
 
+    ASSERT(m_javaScriptBreakpoints.isEmpty());
+
     if (m_listener)
         m_listener->debuggerWasDisabled();
 
@@ -686,7 +686,7 @@
     scriptDebugServer().breakProgram();
 }
 
-void InspectorDebuggerAgent::clearResolvedBreakpointState()
+void InspectorDebuggerAgent::clearInspectorBreakpointState()
 {
     ErrorString dummyError;
     Vector<String> breakpointIdentifiers;
@@ -694,8 +694,13 @@
     for (const String& identifier : breakpointIdentifiers)
         removeBreakpoint(&dummyError, identifier);
 
-    scriptDebugServer().continueProgram();
+    clearDebuggerBreakpointState();
+}
 
+void InspectorDebuggerAgent::clearDebuggerBreakpointState()
+{
+    scriptDebugServer().clearBreakpoints();
+
     m_pausedScriptState = nullptr;
     m_currentCallStack = Deprecated::ScriptValue();
     m_scripts.clear();
@@ -703,9 +708,20 @@
     m_continueToLocationBreakpointID = JSC::noBreakpointID;
     clearBreakDetails();
     m_javaScriptPauseScheduled = false;
-    setOverlayMessage(&dummyError, nullptr);
+
+    scriptDebugServer().continueProgram();
 }
 
+void InspectorDebuggerAgent::didClearGlobalObject()
+{
+    // Clear breakpoints from the debugger, but keep the inspector's model of which
+    // pages have what breakpoints, as the mapping is only sent to DebuggerAgent once.
+    clearDebuggerBreakpointState();
+
+    if (m_frontendDispatcher)
+        m_frontendDispatcher->globalObjectCleared();
+}
+
 bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString)
 {
     if (!m_pausedScriptState) {
@@ -722,14 +738,7 @@
     m_breakAuxData = nullptr;
 }
 
-void InspectorDebuggerAgent::didClearGlobalObject()
-{
-    if (m_frontendDispatcher)
-        m_frontendDispatcher->globalObjectCleared();
 
-    clearResolvedBreakpointState();
-}
-
 } // namespace Inspector
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h (165092 => 165093)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h	2014-03-05 03:48:33 UTC (rev 165092)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h	2014-03-05 04:44:15 UTC (rev 165093)
@@ -139,7 +139,8 @@
 
     PassRefPtr<Inspector::TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&);
     bool assertPaused(ErrorString*);
-    void clearResolvedBreakpointState();
+    void clearDebuggerBreakpointState();
+    void clearInspectorBreakpointState();
     void clearBreakDetails();
 
     bool breakpointActionsFromProtocol(ErrorString*, RefPtr<InspectorArray>& actions, Vector<ScriptBreakpointAction>* result);

Modified: trunk/Source/WebInspectorUI/ChangeLog (165092 => 165093)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-03-05 03:48:33 UTC (rev 165092)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-03-05 04:44:15 UTC (rev 165093)
@@ -1,3 +1,18 @@
+2014-03-04  Brian Burg  <[email protected]>
+
+        Inspector does not restore breakpoints after a page reload
+        https://bugs.webkit.org/show_bug.cgi?id=129655
+
+        Reviewed by Joseph Pecoraro.
+
+        Fix some console asserts that fire when breakpoints resolve.
+
+        * UserInterface/Controllers/DebuggerManager.js:
+        (WebInspector.DebuggerManager.prototype.breakpointResolved):
+        This had a typo, it should be `breakpoint.identifier`.
+        (WebInspector.DebuggerManager.prototype.scriptDidParse):
+        Sometimes the `url` parameter is empty instead of null.
+
 2014-03-04  Diego Pino Garcia  <[email protected]>
 
         Web Inspector: Remove WebInspector.EventHandler in favor of WebInspector.EventListenerSet

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (165092 => 165093)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js	2014-03-05 03:48:33 UTC (rev 165092)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js	2014-03-05 04:44:15 UTC (rev 165093)
@@ -305,7 +305,7 @@
         if (!breakpoint)
             return;
 
-        console.assert(breakpoint.id === breakpointIdentifier);
+        console.assert(breakpoint.identifier === breakpointIdentifier);
 
         breakpoint.resolved = true;
     },
@@ -411,7 +411,7 @@
     {
         // Don't add the script again if it is already known.
         if (this._scriptIdMap[scriptIdentifier]) {
-            console.assert(this._scriptIdMap[scriptIdentifier].url ="" url);
+            console.assert(this._scriptIdMap[scriptIdentifier].url ="" (url || null));
             console.assert(this._scriptIdMap[scriptIdentifier].range.startLine === startLine);
             console.assert(this._scriptIdMap[scriptIdentifier].range.startColumn === startColumn);
             console.assert(this._scriptIdMap[scriptIdentifier].range.endLine === endLine);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to