Title: [249037] trunk/Source/WebInspectorUI
Revision
249037
Author
[email protected]
Date
2019-08-22 18:07:43 -0700 (Thu, 22 Aug 2019)

Log 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 `Promise`s, 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):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (249036 => 249037)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-08-22 23:54:59 UTC (rev 249036)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-08-23 01:07:43 UTC (rev 249037)
@@ -1,3 +1,26 @@
+2019-08-22  Devin Rousso  <[email protected]>
+
+        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 `Promise`s, 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):
+
 2019-08-22  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: console.dir should expand objects

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js (249036 => 249037)


--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js	2019-08-22 23:54:59 UTC (rev 249036)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js	2019-08-23 01:07:43 UTC (rev 249037)
@@ -84,7 +84,7 @@
             // Force inline content to be asynchronous to match the expected load pattern.
             // FIXME: We don't know the MIME-type for inline content. Guess by analyzing the content?
             // Returns a promise.
-            return sourceMapResourceLoaded.call(this, {content: inlineContent, mimeType: this.mimeType, statusCode: 200});
+            return Promise.resolve().then(sourceMapResourceLoaded.bind(this, {content: inlineContent, mimeType: this.mimeType, statusCode: 200}));
         }
 
         function sourceMapResourceNotAvailable(error, content, mimeType, statusCode)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to