⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259741 in webkit


Ignore:
Timestamp:
Apr 8, 2020, 12:02:28 PM (6 years ago)
Author:
Devin Rousso
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>.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r259740 r259741  
     12020-04-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Uncaught Exception: undefined is not an object (evaluating 'this._target.NetworkAgent.getResponseBody')
     4        https://bugs.webkit.org/show_bug.cgi?id=210168
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        If a script is loaded by the main page and a `Worker`, the `WI.Script` from the `Worker`
     9        will be associated with the `WI.Resource` from the main page, the call stack in the Sources
     10        Tab will use the `WI.Resource` over the `WI.Script`, but the `WI.Target` for a `Worker` does
     11        not have a `NetworkAgent` or `PageAgent`. As such, inside `WI.Resource`, if the `_target` is
     12        a `WI.TargetType.Worker`, use the `DebuggerAgent`.
     13
     14        * UserInterface/Models/Resource.js:
     15        (WI.Resource.prototype.requestContentFromBackend):
     16
     17        * UserInterface/Main.html:
     18        Drive-by: remove unnecessary `<script>`.
     19
    1202020-04-08  Devin Rousso  <drousso@apple.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/Main.html

    r259173 r259741  
    894894    <script src="Controllers/WorkerManager.js"></script>
    895895
    896     <script src="Workers/Formatter/FormatterContentBuilder.js"></script>
    897 
    898896    <script src="Controllers/DiagnosticController.js"></script>
    899897    <script src="Controllers/DiagnosticEventRecorder.js"></script>
  • trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js

    r259141 r259741  
    846846            return specialContentPromise;
    847847
    848         // If we have the requestIdentifier we can get the actual response for this specific resource.
    849         // Otherwise the content will be cached resource data, which might not exist anymore.
    850         if (this._requestIdentifier)
    851             return this._target.NetworkAgent.getResponseBody(this._requestIdentifier);
    852 
    853         // There is no request identifier or frame to request content from.
    854         if (this._parentFrame)
    855             return this._target.PageAgent.getResourceContent(this._parentFrame.id, this._url);
     848        if (this._target.type === WI.TargetType.Worker) {
     849            console.assert(this.isScript);
     850            let scriptForTarget = this.scripts.find((script) => script.target === this._target);
     851            console.assert(scriptForTarget);
     852            if (scriptForTarget)
     853                return scriptForTarget.requestContentFromBackend();
     854        } else {
     855            // If we have the requestIdentifier we can get the actual response for this specific resource.
     856            // Otherwise the content will be cached resource data, which might not exist anymore.
     857            if (this._requestIdentifier)
     858                return this._target.NetworkAgent.getResponseBody(this._requestIdentifier);
     859
     860            // There is no request identifier or frame to request content from.
     861            if (this._parentFrame)
     862                return this._target.PageAgent.getResourceContent(this._parentFrame.id, this._url);
     863        }
    856864
    857865        return Promise.reject(new Error("Content request failed."));
Note: See TracChangeset for help on using the changeset viewer.