Bug 1349360 - Mark experimental SourceMapService as deprecated. r=ochameau draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 21 Mar 2017 16:44:09 -0500
changeset 503809 0bb915acac7a3fe3f6ddb2f46cbb4436c10010e3
parent 503115 8acaf1190f937ad47c3fef1f9772c362c8962f57
child 503810 fba1b25d02f688492c23c11ba05ec425943d0c6c
push id50657
push userbmo:jryans@gmail.com
push dateThu, 23 Mar 2017 14:54:24 +0000
reviewersochameau
bugs1349360, 1349354
milestone55.0a1
Bug 1349360 - Mark experimental SourceMapService as deprecated. r=ochameau The existing `SourceMapService` uses server-side source maps, which we are replacing with client-side source maps. It will be removed later in bug 1349354, but for now mark it as deprecated so we don't use it with any other tools. MozReview-Commit-ID: ABmWGC5asZd
devtools/client/framework/toolbox.js
devtools/client/preferences/devtools.js
devtools/client/webconsole/new-console-output/new-console-output-wrapper.js
devtools/client/webconsole/webconsole.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -88,18 +88,23 @@ loader.lazyGetter(this, "registerHarOver
  */
 function Toolbox(target, selectedTool, hostType, contentWindow, frameId) {
   this._target = target;
   this._win = contentWindow;
   this.frameId = frameId;
 
   this._toolPanels = new Map();
   this._telemetry = new Telemetry();
+
+  // TODO: This approach to source maps uses server-side source maps, which we are
+  // replacing with client-side source maps.  Do not use this in new code paths.
+  // To be removed in bug 1349354.  Read more about ongoing work with source maps:
+  // https://docs.google.com/document/d/19TKnMJD3CMBzwByNE4aBBVWnl-AEan8Sf4hxi6J-eps/edit
   if (Services.prefs.getBoolPref("devtools.source-map.locations.enabled")) {
-    this._sourceMapService = new SourceMapService(this._target);
+    this._deprecatedServerSourceMapService = new SourceMapService(this._target);
   }
 
   this._initInspector = null;
   this._inspector = null;
 
   // Map of frames (id => frame-info) and currently selected frame id.
   this.frameMap = new Map();
   this.selectedFrameId = null;
@@ -2260,19 +2265,20 @@ Toolbox.prototype = {
     gDevTools.off("tool-registered", this._toolRegistered);
     gDevTools.off("tool-unregistered", this._toolUnregistered);
 
     Services.prefs.removeObserver("devtools.cache.disabled", this._applyCacheSettings);
     Services.prefs.removeObserver("devtools.serviceWorkers.testing.enabled",
                                   this._applyServiceWorkersTestingSettings);
 
     this._lastFocusedElement = null;
-    if (this._sourceMapService) {
-      this._sourceMapService.destroy();
-      this._sourceMapService = null;
+
+    if (this._deprecatedServerSourceMapService) {
+      this._deprecatedServerSourceMapService.destroy();
+      this._deprecatedServerSourceMapService = null;
     }
 
     if (this.webconsolePanel) {
       this._saveSplitConsoleHeight();
       this.webconsolePanel.removeEventListener("resize",
         this._saveSplitConsoleHeight);
       this.webconsolePanel = null;
     }
--- a/devtools/client/preferences/devtools.js
+++ b/devtools/client/preferences/devtools.js
@@ -296,17 +296,21 @@ pref("devtools.webconsole.autoMultiline"
 
 // Enable the experimental webconsole frontend
 #if defined(NIGHTLY_BUILD)
 pref("devtools.webconsole.new-frontend-enabled", true);
 #else
 pref("devtools.webconsole.new-frontend-enabled", false);
 #endif
 
-// Enable the experimental support for source maps in console (work in progress)
+// Enable the server-side mapping service for source maps in console (deprecated)
+// NOTE: This approach to source maps uses server-side source maps, which we are
+// replacing with client-side source maps.  Do not use this in new code paths.
+// To be removed in bug 1349354.  Read more about ongoing work with source maps:
+// https://docs.google.com/document/d/19TKnMJD3CMBzwByNE4aBBVWnl-AEan8Sf4hxi6J-eps/edit
 pref("devtools.source-map.locations.enabled", false);
 
 // The number of lines that are displayed in the web console.
 pref("devtools.hud.loglimit", 1000);
 
 // The number of lines that are displayed in the web console for the Net,
 // CSS, JS and Web Developer categories. These defaults should be kept in sync
 // with DEFAULT_LOG_LIMIT in the webconsole frontend.
--- a/devtools/client/webconsole/new-console-output/new-console-output-wrapper.js
+++ b/devtools/client/webconsole/new-console-output/new-console-output-wrapper.js
@@ -80,17 +80,18 @@ NewConsoleOutputWrapper.prototype = {
 
           return menu;
         },
         openNetworkPanel: (requestId) => {
           return this.toolbox.selectTool("netmonitor").then(panel => {
             return panel.panelWin.NetMonitorController.inspectRequest(requestId);
           });
         },
-        sourceMapService: this.toolbox ? this.toolbox._sourceMapService : null,
+        sourceMapService:
+          this.toolbox ? this.toolbox._deprecatedServerSourceMapService : null,
         openLink: url => this.jsterm.hud.owner.openLink(url),
         createElement: nodename => {
           return this.document.createElementNS("http://www.w3.org/1999/xhtml", nodename);
         },
         highlightDomElement: (grip, options = {}) => {
           return this.toolbox && this.toolbox.highlighterUtils
             ? this.toolbox.highlighterUtils.highlightDomValueGrip(grip, options)
             : null;
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -2619,17 +2619,17 @@ WebConsoleFrame.prototype = {
 
     let { url, line, column } = location;
     let source = url ? url.split(" -> ").pop() : "";
 
     this.ReactDOM.render(this.FrameView({
       frame: { source, line, column },
       showEmptyPathAsHost: true,
       onClick,
-      sourceMapService: toolbox ? toolbox._sourceMapService : null,
+      sourceMapService: toolbox ? toolbox._deprecatedServerSourceMapService : null,
     }), locationNode);
 
     return locationNode;
   },
 
   /**
    * Adjusts the category and severity of the given message.
    *