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

Changeset 249037 in webkit


Ignore:
Timestamp:
Aug 22, 2019, 6:07:43 PM (7 years ago)
Author:
Devin Rousso
Message:

Web Inspector: REGRESSION(r248485): stack overflow when viewing a source map generated from inline content
https://bugs.webkit.org/show_bug.cgi?id=201042
<rdar://problem/54509750>

Reviewed by Antoine Quint.

In r248485, WI.ResourceClusterContentView was changed to requestContent whenever the
given resource finished loading (by listening for WI.Resource.Event.LoadingDidFinish).

Even though retrieving a source map's contents uses Promises, in the case that the content
was inlined in the "original" source code, the code path would mark the source map as being
finished (which would fire a WI.Resource.Event.LoadingDidFinish) _before_ it could return
a Promise, which would've been cached (WI.SourceCode.prototype.requestContent) and
preventend any reentrancy.

Wrapping the inline code path in a Promise.resolve() gives the WI.SourceCode a chance to
cache the Promise before any events are fired.

  • UserInterface/Models/SourceMapResource.js:

(WI.SourceMapResource.prototype.requestContentFromBackend):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r249034 r249037  
     12019-08-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: REGRESSION(r248485): stack overflow when viewing a source map generated from inline content
     4        https://bugs.webkit.org/show_bug.cgi?id=201042
     5        <rdar://problem/54509750>
     6
     7        Reviewed by Antoine Quint.
     8
     9        In r248485, `WI.ResourceClusterContentView` was changed to `requestContent` whenever the
     10        given resource finished loading (by listening for `WI.Resource.Event.LoadingDidFinish`).
     11
     12        Even though retrieving a source map's contents uses `Promise`s, in the case that the content
     13        was inlined in the "original" source code, the code path would mark the source map as being
     14        finished (which would fire a `WI.Resource.Event.LoadingDidFinish`) _before_ it could return
     15        a `Promise`, which would've been cached (`WI.SourceCode.prototype.requestContent`) and
     16        preventend any reentrancy.
     17
     18        Wrapping the inline code path in a `Promise.resolve()` gives the `WI.SourceCode` a chance to
     19        cache the `Promise` before any events are fired.
     20
     21        * UserInterface/Models/SourceMapResource.js:
     22        (WI.SourceMapResource.prototype.requestContentFromBackend):
     23
    1242019-08-22  Nikita Vasilyev  <nvasilyev@apple.com>
    225
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js

    r243024 r249037  
    8585            // FIXME: We don't know the MIME-type for inline content. Guess by analyzing the content?
    8686            // Returns a promise.
    87             return sourceMapResourceLoaded.call(this, {content: inlineContent, mimeType: this.mimeType, statusCode: 200});
     87            return Promise.resolve().then(sourceMapResourceLoaded.bind(this, {content: inlineContent, mimeType: this.mimeType, statusCode: 200}));
    8888        }
    8989
Note: See TracChangeset for help on using the changeset viewer.