Title: [259741] trunk/Source/WebInspectorUI
Revision
259741
Author
[email protected]
Date
2020-04-08 12:02:28 -0700 (Wed, 08 Apr 2020)

Log Message

Web Inspector: Uncaught Exception: undefined is not an object (evaluating 'this._target.NetworkAgent.getResponseBody')
https://bugs.webkit.org/show_bug.cgi?id=210168

Reviewed by Timothy Hatcher.

If a script is loaded by the main page and a `Worker`, the `WI.Script` from the `Worker`
will be associated with the `WI.Resource` from the main page, the call stack in the Sources
Tab will use the `WI.Resource` over the `WI.Script`, but the `WI.Target` for a `Worker` does
not have a `NetworkAgent` or `PageAgent`. As such, inside `WI.Resource`, if the `_target` is
a `WI.TargetType.Worker`, use the `DebuggerAgent`.

* UserInterface/Models/Resource.js:
(WI.Resource.prototype.requestContentFromBackend):

* UserInterface/Main.html:
Drive-by: remove unnecessary `<script>`.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (259740 => 259741)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-04-08 19:00:02 UTC (rev 259740)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-04-08 19:02:28 UTC (rev 259741)
@@ -1,5 +1,24 @@
 2020-04-08  Devin Rousso  <[email protected]>
 
+        Web Inspector: Uncaught Exception: undefined is not an object (evaluating 'this._target.NetworkAgent.getResponseBody')
+        https://bugs.webkit.org/show_bug.cgi?id=210168
+
+        Reviewed by Timothy Hatcher.
+
+        If a script is loaded by the main page and a `Worker`, the `WI.Script` from the `Worker`
+        will be associated with the `WI.Resource` from the main page, the call stack in the Sources
+        Tab will use the `WI.Resource` over the `WI.Script`, but the `WI.Target` for a `Worker` does
+        not have a `NetworkAgent` or `PageAgent`. As such, inside `WI.Resource`, if the `_target` is
+        a `WI.TargetType.Worker`, use the `DebuggerAgent`.
+
+        * UserInterface/Models/Resource.js:
+        (WI.Resource.prototype.requestContentFromBackend):
+
+        * UserInterface/Main.html:
+        Drive-by: remove unnecessary `<script>`.
+
+2020-04-08  Devin Rousso  <[email protected]>
+
         Web Inspector: don't reveal the prototype methods when using the "Expand All" context menu item for property-only object trees
         https://bugs.webkit.org/show_bug.cgi?id=210123
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (259740 => 259741)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2020-04-08 19:00:02 UTC (rev 259740)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2020-04-08 19:02:28 UTC (rev 259741)
@@ -893,8 +893,6 @@
     <script src=""
     <script src=""
 
-    <script src=""
-
     <script src=""
     <script src=""
     <script src=""

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (259740 => 259741)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2020-04-08 19:00:02 UTC (rev 259740)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2020-04-08 19:02:28 UTC (rev 259741)
@@ -845,14 +845,22 @@
         if (specialContentPromise)
             return specialContentPromise;
 
-        // If we have the requestIdentifier we can get the actual response for this specific resource.
-        // Otherwise the content will be cached resource data, which might not exist anymore.
-        if (this._requestIdentifier)
-            return this._target.NetworkAgent.getResponseBody(this._requestIdentifier);
+        if (this._target.type === WI.TargetType.Worker) {
+            console.assert(this.isScript);
+            let scriptForTarget = this.scripts.find((script) => script.target === this._target);
+            console.assert(scriptForTarget);
+            if (scriptForTarget)
+                return scriptForTarget.requestContentFromBackend();
+        } else {
+            // If we have the requestIdentifier we can get the actual response for this specific resource.
+            // Otherwise the content will be cached resource data, which might not exist anymore.
+            if (this._requestIdentifier)
+                return this._target.NetworkAgent.getResponseBody(this._requestIdentifier);
 
-        // There is no request identifier or frame to request content from.
-        if (this._parentFrame)
-            return this._target.PageAgent.getResourceContent(this._parentFrame.id, this._url);
+            // There is no request identifier or frame to request content from.
+            if (this._parentFrame)
+                return this._target.PageAgent.getResourceContent(this._parentFrame.id, this._url);
+        }
 
         return Promise.reject(new Error("Content request failed."));
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to