Title: [238750] trunk/Source/WebInspectorUI
Revision
238750
Author
joep...@webkit.org
Date
2018-11-30 13:13:27 -0800 (Fri, 30 Nov 2018)

Log Message

Web Inspector: Uncaught Exception opening Web Inspector to Debugger Tab
https://bugs.webkit.org/show_bug.cgi?id=192174

Reviewed by Devin Rousso.

* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackendClass.prototype.runAfterPendingDispatches):
Dispatch the callback with a timeout if there is no backend target yet
so it doesn't get lost.

* UserInterface/Protocol/Connection.js:
(InspectorBackend.Connection.prototype.runAfterPendingDispatches):
Change the ambiguous name "script" to the more familiar "callback".

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (238749 => 238750)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-11-30 20:13:16 UTC (rev 238749)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-11-30 21:13:27 UTC (rev 238750)
@@ -1,3 +1,19 @@
+2018-11-30  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Uncaught Exception opening Web Inspector to Debugger Tab
+        https://bugs.webkit.org/show_bug.cgi?id=192174
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Protocol/InspectorBackend.js:
+        (InspectorBackendClass.prototype.runAfterPendingDispatches):
+        Dispatch the callback with a timeout if there is no backend target yet
+        so it doesn't get lost.
+
+        * UserInterface/Protocol/Connection.js:
+        (InspectorBackend.Connection.prototype.runAfterPendingDispatches):
+        Change the ambiguous name "script" to the more familiar "callback".
+
 2018-11-30  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: replace all unicode characters with the escaped character code

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js (238749 => 238750)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js	2018-11-30 20:13:16 UTC (rev 238749)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js	2018-11-30 21:13:27 UTC (rev 238750)
@@ -38,7 +38,7 @@
     {
         this._pendingResponses = new Map;
         this._agents = {};
-        this._deferredScripts = [];
+        this._deferredCallbacks = [];
         this._target = null;
     }
 
@@ -72,14 +72,14 @@
             this._dispatchEvent(messageObject);
     }
 
-    runAfterPendingDispatches(script)
+    runAfterPendingDispatches(callback)
     {
-        console.assert(typeof script === "function");
+        console.assert(typeof callback === "function");
 
         if (!this._pendingResponses.size)
-            script.call(this);
+            callback.call(this);
         else
-            this._deferredScripts.push(script);
+            this._deferredCallbacks.push(callback);
     }
 
     // Protected
@@ -130,7 +130,7 @@
         for (let tracer of InspectorBackend.activeTracers)
             tracer.logDidHandleResponse(this, messageObject, {rtt: roundTripTime, dispatch: processingTime});
 
-        if (this._deferredScripts.length && !this._pendingResponses.size)
+        if (this._deferredCallbacks.length && !this._pendingResponses.size)
             this._flushPendingScripts();
     }
 
@@ -267,8 +267,8 @@
     {
         console.assert(this._pendingResponses.size === 0);
 
-        let scriptsToRun = this._deferredScripts;
-        this._deferredScripts = [];
+        let scriptsToRun = this._deferredCallbacks;
+        this._deferredCallbacks = [];
         for (let script of scriptsToRun)
             script.call(this);
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (238749 => 238750)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2018-11-30 20:13:16 UTC (rev 238749)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2018-11-30 21:13:27 UTC (rev 238750)
@@ -172,10 +172,15 @@
         InspectorBackend.backendConnection.dispatch(message);
     }
 
-    runAfterPendingDispatches(script)
+    runAfterPendingDispatches(callback)
     {
+        if (!WI.mainTarget) {
+            callback();
+            return;
+        }
+
         // FIXME: Should this respect pending dispatches in all connections?
-        WI.mainTarget.connection.runAfterPendingDispatches(script);
+        WI.mainTarget.connection.runAfterPendingDispatches(callback);
     }
 
     activateDomain(domainName, activationDebuggableTypes)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to