Web Inspector: Add a Setting Toggle for Source Maps
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2019 21:27:34 +0000 (21:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2019 21:27:34 +0000 (21:27 +0000)
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239635 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Setting.js
Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js

index 55d4eff..409dd67 100644 (file)
@@ -1,5 +1,23 @@
 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
         https://bugs.webkit.org/show_bug.cgi?id=193147
 
index aa78eeb..0721c09 100644 (file)
@@ -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";
@@ -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";
index d0508a3..0f6db17 100644 (file)
@@ -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),
index 0344e55..444cd90 100644 (file)
@@ -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)
index 60511de..d123dc0 100644 (file)
@@ -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();