[webkit-changes] [WebKit/WebKit] b29b3c: Web Inspector: allow sourcemaps to be blackboxed

Devin Rousso noreply at github.com
Mon Aug 26 09:02:52 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b29b3cee5dbfd8fd6facbed5c9a87ed1bf2daffe
      https://github.com/WebKit/WebKit/commit/b29b3cee5dbfd8fd6facbed5c9a87ed1bf2daffe
  Author: Devin Rousso <hi at devinrousso.com>
  Date:   2024-08-26 (Mon, 26 Aug 2024)

  Changed paths:
    M LayoutTests/inspector/debugger/resources/log-pause-location.js
    A LayoutTests/inspector/debugger/resources/source-map.js
    A LayoutTests/inspector/debugger/resources/source-map.js.map
    A LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-inner-expected.txt
    A LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-inner.html
    A LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-middle-expected.txt
    A LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-middle.html
    A LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-outer-expected.txt
    A LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-outer.html
    M Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
    M Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
    M Source/WebInspectorUI/UserInterface/Models/CallFrame.js
    M Source/WebInspectorUI/UserInterface/Models/SourceCode.js
    M Source/WebInspectorUI/UserInterface/Models/SourceMap.js
    M Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js
    M Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js

  Log Message:
  -----------
  Web Inspector: allow sourcemaps to be blackboxed
https://bugs.webkit.org/show_bug.cgi?id=277668

Reviewed by Yusuke Suzuki.

As of 281634 at main it's now possible to blackbox a (sub)range of a `.js` file.

This change allows developers to leverage that by automatically blackboxing only the affected range(s) if they blackbox a resource within a sourcemap.

* Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js:
(WI.SourceMapResource.prototype.get supportsScriptBlackboxing):

* Source/WebInspectorUI/UserInterface/Models/SourceMap.js:
(WI.SourceMap):
(WI.SourceMap.get instances): Added.
(WI.SourceMap.prototype.get sourceMappingURL): Added.
(WI.SourceMap.prototype.calculateBlackboxSourceRangesForProtocol): Added.
Add helper methods to get all sourcemap instances and to determine all blackbox ranges for a given sourcemap.

* Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.async initializeTarget):
(WI.DebuggerManager.prototype.setShouldBlackboxScript):
(WI.DebuggerManager.prototype.setShouldBlackboxPattern):
(WI.DebuggerManager.prototype._updateBlackbox): Added.
(WI.DebuggerManager.prototype._handleSourceCodeSourceMapAdded): Added.
In addition to allowing `.js` files to be entirely blackboxed, also support looking at all relevant sourcemap to see if just parts are blackboxed.
Check each time a new sourcemap is added, as well as if the relevant `.js` file is unblackboxed as resources within the sourcemap may still be blackboxed.

* Source/WebInspectorUI/UserInterface/Models/CallFrame.js:
(WI.CallFrame.fromDebuggerPayload):
(WI.CallFrame.fromPayload):
* Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js:
(WI.appendContextMenuItemsForSourceCode):
Use the `displaySourceCode` so that if the developer right-clicks on a resource within a sourcemap they're able to blackbox just that instead of the entire underlying `.js` file.
Drive-by: also allow developers to set breakpoints in and save resources within a sourcemap instead of only for the entire underlying `.js` file.

* Source/WebInspectorUI/UserInterface/Models/SourceCode.js:
(WI.SourceCode.prototype.addSourceMap):
Include the sourcemap object when dispatching `WI.SourceCode.Event.SourceMapAdded` for tests.

* Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype._loadAndParseSourceMap.sourceMapLoaded):
Drive-by: Reorder constructor arguments for clarity.

* LayoutTests/inspector/debugger/resources/log-pause-location.js:
(isSourceAvailable): Added.
(getLineContent): Added.
(logLinesWithContext):
(logPauseLocation):
Allow for resources within a sourcemap to be printed since they are created with the content already available (instead of having to fetch it from the backend).
Additionally, prefer the display location wherever possible (instead of the actual location according to JSC).

* LayoutTests/inspector/debugger/resources/source-map.js: Added.
* LayoutTests/inspector/debugger/resources/source-map.js.map: Added.
* LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-inner.html: Added.
* LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-inner-expected.txt: Added.
* LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-middle.html: Added.
* LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-middle-expected.txt: Added.
* LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-outer.html: Added.
* LayoutTests/inspector/debugger/setShouldBlackboxURL-source-map-outer-expected.txt: Added.

Canonical link: https://commits.webkit.org/282740@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list