Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Web Inspector: Add a Setting Toggle for Source Maps
https://bugs.webkit.org/show_bug.cgi?id=193148

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-01-04
Reviewed by Devin Rousso.

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype.downloadSourceMap):
Don't download source maps if the setting is disabled.

* UserInterface/Base/Setting.js:
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createGeneralSettingsView):
Settings toggle for source maps. Enabled by default.

* Localizations/en.lproj/localizedStrings.js:

Canonical link: https://commits.webkit.org/207663@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JosephPecoraro authored and webkit-commit-queue committed Jan 4, 2019
1 parent 3a8c925 commit e595df1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Source/WebInspectorUI/ChangeLog
@@ -1,3 +1,21 @@
2019-01-04 Joseph Pecoraro <pecoraro@apple.com>

Web Inspector: Add a Setting Toggle for Source Maps
https://bugs.webkit.org/show_bug.cgi?id=193148

Reviewed by Devin Rousso.

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype.downloadSourceMap):
Don't download source maps if the setting is disabled.

* UserInterface/Base/Setting.js:
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createGeneralSettingsView):
Settings toggle for source maps. Enabled by default.

* Localizations/en.lproj/localizedStrings.js:

2019-01-04 Joseph Pecoraro <pecoraro@apple.com>

Web Inspector: Include `globalThis` in default JavaScript completions
Expand Down
Expand Up @@ -362,6 +362,7 @@ localizedStrings["Enable Program"] = "Enable Program";
localizedStrings["Enable all breakpoints (%s)"] = "Enable all breakpoints (%s)";
localizedStrings["Enable breakpoints"] = "Enable breakpoints";
localizedStrings["Enable paint flashing"] = "Enable paint flashing";
localizedStrings["Enable source maps"] = "Enable source maps";
localizedStrings["Enabled"] = "Enabled";
localizedStrings["Encoded"] = "Encoded";
localizedStrings["Encoding"] = "Encoding";
Expand Down Expand Up @@ -873,6 +874,7 @@ localizedStrings["Sockets"] = "Sockets";
localizedStrings["Sort Ascending"] = "Sort Ascending";
localizedStrings["Sort Descending"] = "Sort Descending";
localizedStrings["Source"] = "Source";
localizedStrings["Source maps:"] = "Source maps:";
localizedStrings["Sources"] = "Sources";
localizedStrings["Space"] = "Space";
localizedStrings["Spaces"] = "Spaces";
Expand Down
1 change: 1 addition & 0 deletions Source/WebInspectorUI/UserInterface/Base/Setting.js
Expand Up @@ -114,6 +114,7 @@ WI.settings = {
indentWithTabs: new WI.Setting("indent-with-tabs", false),
resourceCachingDisabled: new WI.Setting("disable-resource-caching", false),
selectedNetworkDetailContentViewIdentifier: new WI.Setting("network-detail-content-view-identifier", "preview"),
sourceMapsEnabled: new WI.Setting("source-maps-enabled", true),
showAllRequestsBreakpoint: new WI.Setting("show-all-requests-breakpoint", true),
showAssertionFailuresBreakpoint: new WI.Setting("show-assertion-failures-breakpoint", true),
showCanvasPath: new WI.Setting("show-canvas-path", false),
Expand Down
Expand Up @@ -108,6 +108,9 @@ WI.NetworkManager = class NetworkManager extends WI.Object

downloadSourceMap(sourceMapURL, baseURL, originalSourceCode)
{
if (!WI.settings.sourceMapsEnabled.value)
return;

// The baseURL could have come from a "//# sourceURL". Attempt to get a
// reasonable absolute URL for the base by using the main resource's URL.
if (WI.networkManager.mainFrame)
Expand Down
Expand Up @@ -207,6 +207,7 @@ WI.SettingsTabContentView = class SettingsTabContentView extends WI.TabContentVi
generalSettingsView.addSeparator();

generalSettingsView.addSetting(WI.UIString("Debugger:"), WI.settings.showScopeChainOnPause, WI.UIString("Show Scope Chain on pause"));
generalSettingsView.addSetting(WI.UIString("Source maps:"), WI.settings.sourceMapsEnabled, WI.UIString("Enable source maps"));

generalSettingsView.addSeparator();

Expand Down

0 comments on commit e595df1

Please sign in to comment.