Title: [249846] trunk/Source/WebInspectorUI
Revision
249846
Author
joep...@webkit.org
Date
2019-09-13 11:58:30 -0700 (Fri, 13 Sep 2019)

Log Message

Uncaught Exception: null is not an object (evaluating 'Object.keys(propertyNames)​')​ (at _javascript_RuntimeCompletionProvider.js:​244:​57)​
https://bugs.webkit.org/show_bug.cgi?id=201729

Reviewed by Devin Rousso.

* UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js:
(WI._javascript_RuntimeCompletionProvider):
(WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded):
Don't clear the completion object group until all ongoing requests have completed.
Percision for the lifetime of the object group objects is not important, but we
surely don't want to delete an object too soon.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (249845 => 249846)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-09-13 18:46:56 UTC (rev 249845)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-09-13 18:58:30 UTC (rev 249846)
@@ -1,5 +1,19 @@
 2019-09-13  Joseph Pecoraro  <pecor...@apple.com>
 
+        Uncaught Exception: null is not an object (evaluating 'Object.keys(propertyNames)​')​ (at _javascript_RuntimeCompletionProvider.js:​244:​57)​
+        https://bugs.webkit.org/show_bug.cgi?id=201729
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js:
+        (WI._javascript_RuntimeCompletionProvider):
+        (WI._javascript_RuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded):
+        Don't clear the completion object group until all ongoing requests have completed.
+        Percision for the lifetime of the object group objects is not important, but we
+        surely don't want to delete an object too soon.
+
+2019-09-13  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: Formatter: Pretty Print HTML resources (including inline <script>/<style>)
         https://bugs.webkit.org/show_bug.cgi?id=201535
         <rdar://problem/29119232>

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js (249845 => 249846)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js	2019-09-13 18:46:56 UTC (rev 249845)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/_javascript_RuntimeCompletionProvider.js	2019-09-13 18:58:30 UTC (rev 249846)
@@ -41,6 +41,8 @@
 
         console.assert(!WI._javascript_RuntimeCompletionProvider._instance);
 
+        this._ongoingCompletionRequests = 0;
+
         WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ActiveCallFrameDidChange, this._clearLastProperties, this);
     }
 
@@ -130,6 +132,9 @@
                 bracketNotation = false;
         }
 
+        // Start an completion request. We must now decrement before calling completionController.updateCompletions.
+        this._incrementOngoingCompletionRequests();
+
         // If the base is the same as the last time, we can reuse the property names we have already gathered.
         // Doing this eliminates delay caused by the async nature of the code below and it only calls getters
         // and functions once instead of repetitively. Sure, there can be difference each time the base is evaluated,
@@ -163,7 +168,7 @@
         function evaluated(result, wasThrown)
         {
             if (wasThrown || !result || result.type === "undefined" || (result.type === "object" && result.subtype === "null")) {
-                WI.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");
+                this._decrementOngoingCompletionRequests();
 
                 updateLastPropertyNames.call(this, []);
                 completionController.updateCompletions(defaultCompletions);
@@ -265,7 +270,7 @@
 
             updateLastPropertyNames.call(this, propertyNames);
 
-            WI.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");
+            this._decrementOngoingCompletionRequests();
 
             if (!base) {
                 propertyNames.pushAll(_javascript_RuntimeCompletionProvider._commandLineAPIKeys);
@@ -370,6 +375,23 @@
 
     // Private
 
+    _incrementOngoingCompletionRequests()
+    {
+        this._ongoingCompletionRequests++;
+
+        console.assert(this._ongoingCompletionRequests <= 50, "Ongoing requests probably should not get this high. We may be missing a balancing decrement.");
+    }
+
+    _decrementOngoingCompletionRequests()
+    {
+        this._ongoingCompletionRequests--;
+
+        console.assert(this._ongoingCompletionRequests >= 0, "Unbalanced increments / decrements.");
+
+        if (this._ongoingCompletionRequests <= 0)
+            WI.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");
+    }
+
     _clearLastProperties()
     {
         if (this._clearLastPropertiesTimeout) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to