Bug 1077523 - Enable CSS source maps by default. r=bgrins
authorHeather Arthur <fayearthur@gmail.com>
Thu, 09 Oct 2014 14:27:00 +0200
changeset 209766 0218c2f545e860e3d23b780ab37bf6234037adce
parent 209765 9bac05cbed6a3f858043594a78fbc4f792040a8e
child 209767 9cc3b7b1671a643ab527bca6065ce3940d4032b3
push id27626
push userkwierso@gmail.com
push dateSat, 11 Oct 2014 01:34:27 +0000
treeherdermozilla-central@708b45d9b1b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1077523
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1077523 - Enable CSS source maps by default. r=bgrins
browser/app/profile/firefox.js
browser/devtools/styleeditor/test/browser_styleeditor_sourcemap_watching.js
browser/devtools/styleeditor/test/browser_styleeditor_sourcemaps.js
browser/devtools/styleinspector/computed-view.js
browser/devtools/styleinspector/rule-view.js
browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js
toolkit/locales/en-US/chrome/global/devtools/styleinspector.properties
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1413,17 +1413,17 @@ pref("devtools.scratchpad.recentFilesMax
 pref("devtools.scratchpad.showTrailingSpace", false);
 pref("devtools.scratchpad.enableAutocompletion", true);
 
 // Enable the Storage Inspector
 pref("devtools.storage.enabled", false);
 
 // Enable the Style Editor.
 pref("devtools.styleeditor.enabled", true);
-pref("devtools.styleeditor.source-maps-enabled", false);
+pref("devtools.styleeditor.source-maps-enabled", true);
 pref("devtools.styleeditor.autocompletion-enabled", true);
 pref("devtools.styleeditor.showMediaSidebar", true);
 pref("devtools.styleeditor.mediaSidebarWidth", 238);
 pref("devtools.styleeditor.navSidebarWidth", 245);
 pref("devtools.styleeditor.transitions", true);
 
 // Enable the Shader Editor.
 pref("devtools.shadereditor.enabled", false);
--- a/browser/devtools/styleeditor/test/browser_styleeditor_sourcemap_watching.js
+++ b/browser/devtools/styleeditor/test/browser_styleeditor_sourcemap_watching.js
@@ -8,17 +8,16 @@ let {Promise: promise} = Cu.import("reso
 
 const TESTCASE_URI_HTML = TEST_BASE + "sourcemaps-watching.html";
 const TESTCASE_URI_CSS = TEST_BASE + "sourcemap-css/sourcemaps.css";
 const TESTCASE_URI_REG_CSS = TEST_BASE + "simple.css";
 const TESTCASE_URI_SCSS = TEST_BASE + "sourcemap-sass/sourcemaps.scss";
 const TESTCASE_URI_MAP = TEST_BASE + "sourcemap-css/sourcemaps.css.map";
 const TESTCASE_SCSS_NAME = "sourcemaps.scss";
 
-const SOURCE_MAP_PREF = "devtools.styleeditor.source-maps-enabled";
 const TRANSITIONS_PREF = "devtools.styleeditor.transitions";
 
 const CSS_TEXT = "* { color: blue }";
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 let tempScope = {};
@@ -26,17 +25,16 @@ Components.utils.import("resource://gre/
 Components.utils.import("resource://gre/modules/NetUtil.jsm", tempScope);
 let FileUtils = tempScope.FileUtils;
 let NetUtil = tempScope.NetUtil;
 
 function test()
 {
   waitForExplicitFinish();
 
-  Services.prefs.setBoolPref(SOURCE_MAP_PREF, true);
   Services.prefs.setBoolPref(TRANSITIONS_PREF, false);
 
   Task.spawn(function() {
     // copy all our files over so we don't screw them up for other tests
     let HTMLFile = yield copy(TESTCASE_URI_HTML, ["sourcemaps.html"]);
     let CSSFile = yield copy(TESTCASE_URI_CSS, ["sourcemap-css", "sourcemaps.css"]);
     yield copy(TESTCASE_URI_SCSS, ["sourcemap-sass", "sourcemaps.scss"]);
     yield copy(TESTCASE_URI_MAP, ["sourcemap-css", "sourcemaps.css.map"]);
@@ -121,17 +119,16 @@ function pauseForTimeChange() {
   // our file's last change time will show a change. This reflects what
   // would happen in real life with a user manually saving the file.
   setTimeout(deferred.resolve, 2000);
 
   return deferred.promise;
 }
 
 function finishUp() {
-  Services.prefs.clearUserPref(SOURCE_MAP_PREF);
   Services.prefs.clearUserPref(TRANSITIONS_PREF);
   finish();
 }
 
 /* Helpers */
 
 function getLinkFor(editor) {
   return editor.summary.querySelector(".stylesheet-name");
--- a/browser/devtools/styleeditor/test/browser_styleeditor_sourcemaps.js
+++ b/browser/devtools/styleeditor/test/browser_styleeditor_sourcemaps.js
@@ -64,18 +64,16 @@ const contents = {
 }
 
 const cssNames = ["sourcemaps.css", "contained.css", "test-stylus.css"];
 const origNames = ["sourcemaps.scss", "contained.scss", "test-stylus.styl"];
 
 waitForExplicitFinish();
 
 let test = asyncTest(function*() {
-  Services.prefs.setBoolPref(PREF, true);
-
   let {UI} = yield addTabAndOpenStyleEditors(7, null, TESTCASE_URI);
 
   is(UI.editors.length, 4,
     "correct number of editors with source maps enabled");
 
   // Test first plain css editor
   testFirstEditor(UI.editors[0]);
 
--- a/browser/devtools/styleinspector/computed-view.js
+++ b/browser/devtools/styleinspector/computed-view.js
@@ -640,17 +640,18 @@ CssHtmlTree.prototype = {
       accesskey: "ruleView.contextmenu.copyColor.accessKey",
       command: this._onCopyColor
     });
 
     // Show Original Sources
     this.menuitemSources= createMenuItem(this._contextmenu, {
       label: "ruleView.contextmenu.showOrigSources",
       accesskey: "ruleView.contextmenu.showOrigSources.accessKey",
-      command: this._onToggleOrigSources
+      command: this._onToggleOrigSources,
+      type: "checkbox"
     });
 
     let popupset = doc.documentElement.querySelector("popupset");
     if (!popupset) {
       popupset = doc.createElementNS(XUL_NS, "popupset");
       doc.documentElement.appendChild(popupset);
     }
     popupset.appendChild(this._contextmenu);
@@ -661,26 +662,18 @@ CssHtmlTree.prototype = {
    * appropriate.
    */
   _contextMenuUpdate: function()
   {
     let win = this.styleDocument.defaultView;
     let disable = win.getSelection().isCollapsed;
     this.menuitemCopy.disabled = disable;
 
-    let label = "ruleView.contextmenu.showOrigSources";
-    if (Services.prefs.getBoolPref(PREF_ORIG_SOURCES)) {
-      label = "ruleView.contextmenu.showCSSSources";
-    }
-    this.menuitemSources.setAttribute("label",
-                                      CssHtmlTree.l10n(label));
-
-    let accessKey = label + ".accessKey";
-    this.menuitemSources.setAttribute("accesskey",
-                                      CssHtmlTree.l10n(accessKey));
+    let showOrig = Services.prefs.getBoolPref(PREF_ORIG_SOURCES);
+    this.menuitemSources.setAttribute("checked", showOrig);
 
     this.menuitemCopyColor.hidden = !this._isColorPopup();
   },
 
   /**
    * A helper that determines if the popup was opened with a click to a color
    * value and saves the color to this._colorToCopy.
    *
--- a/browser/devtools/styleinspector/rule-view.js
+++ b/browser/devtools/styleinspector/rule-view.js
@@ -1179,17 +1179,18 @@ CssRuleView.prototype = {
     this.menuitemCopyColor = createMenuItem(this._contextmenu, {
       label: "ruleView.contextmenu.copyColor",
       accesskey: "ruleView.contextmenu.copyColor.accessKey",
       command: this._onCopyColor
     });
     this.menuitemSources = createMenuItem(this._contextmenu, {
       label: "ruleView.contextmenu.showOrigSources",
       accesskey: "ruleView.contextmenu.showOrigSources.accessKey",
-      command: this._onToggleOrigSources
+      command: this._onToggleOrigSources,
+      type: "checkbox"
     });
 
     let popupset = doc.documentElement.querySelector("popupset");
     if (!popupset) {
       popupset = doc.createElementNS(XUL_NS, "popupset");
       doc.documentElement.appendChild(popupset);
     }
 
@@ -1221,26 +1222,18 @@ CssRuleView.prototype = {
     } else {
       // No text selected, disable copy.
       copy = false;
     }
 
     this.menuitemCopyColor.hidden = !this._isColorPopup();
     this.menuitemCopy.disabled = !copy;
 
-    let label = "ruleView.contextmenu.showOrigSources";
-    if (Services.prefs.getBoolPref(PREF_ORIG_SOURCES)) {
-      label = "ruleView.contextmenu.showCSSSources";
-    }
-    this.menuitemSources.setAttribute("label",
-                                      _strings.GetStringFromName(label));
-
-    let accessKey = label + ".accessKey";
-    this.menuitemSources.setAttribute("accesskey",
-                                      _strings.GetStringFromName(accessKey));
+    var showOrig = Services.prefs.getBoolPref(PREF_ORIG_SOURCES);
+    this.menuitemSources.setAttribute("checked", showOrig);
 
     this.menuitemAddRule.disabled = this.inspector.selection.isAnonymousNode();
   },
 
   /**
    * Get the type of a given node in the rule-view
    * @param {DOMNode} node The node which we want information about
    * @return {Object} The type information object contains the following props:
@@ -1956,17 +1949,19 @@ RuleEditor.prototype = {
     }
   },
 
   updateSourceLink: function RuleEditor_updateSourceLink()
   {
     let sourceLabel = this.element.querySelector(".source-link-label");
     let sourceHref = (this.rule.sheet && this.rule.sheet.href) ?
       this.rule.sheet.href : this.rule.title;
-    sourceLabel.setAttribute("tooltiptext", sourceHref);
+    let sourceLine = this.rule.ruleLine > 0 ? ":" + this.rule.ruleLine : "";
+
+    sourceLabel.setAttribute("tooltiptext", sourceHref + sourceLine);
 
     if (this.rule.isSystem) {
       let uaLabel = _strings.GetStringFromName("rule.userAgentStyles");
       sourceLabel.setAttribute("value", uaLabel + " " + this.rule.title);
 
       // Special case about:PreferenceStyleSheet, as it is generated on the
       // fly and the URI is not registered with the about: handler.
       // https://bugzilla.mozilla.org/show_bug.cgi?id=935803#c37
--- a/browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js
@@ -147,17 +147,17 @@ function validateStyleEditorSheet(editor
 function testRuleViewLinkLabel(view) {
   let link = getRuleViewLinkByIndex(view, 2);
   let labelElem = link.querySelector(".source-link-label");
   let value = labelElem.getAttribute("value");
   let tooltipText = labelElem.getAttribute("tooltiptext");
 
   is(value, EXTERNAL_STYLESHEET_FILE_NAME + ":1",
     "rule view stylesheet display value matches filename and line number");
-  is(tooltipText, EXTERNAL_STYLESHEET_URL,
+  is(tooltipText, EXTERNAL_STYLESHEET_URL + ":1",
     "rule view stylesheet tooltip text matches the full URI path");
 }
 
 function clickLinkByIndex(view, index) {
   let link = getRuleViewLinkByIndex(view, index);
   link.scrollIntoView();
   link.click();
 }
--- a/toolkit/locales/en-US/chrome/global/devtools/styleinspector.properties
+++ b/toolkit/locales/en-US/chrome/global/devtools/styleinspector.properties
@@ -95,24 +95,16 @@ ruleView.contextmenu.copyColor.accessKey
 # LOCALIZATION NOTE (ruleView.contextmenu.showOrigSources): Text displayed in the rule view
 # context menu.
 ruleView.contextmenu.showOrigSources=Show original sources
 
 # LOCALIZATION NOTE (ruleView.contextmenu.showOrigSources.accessKey): Access key for
 # the rule view context menu "Show original sources" entry.
 ruleView.contextmenu.showOrigSources.accessKey=O
 
-# LOCALIZATION NOTE (ruleView.contextmenu.showCSSSources): Text displayed in the rule view
-# context menu.
-ruleView.contextmenu.showCSSSources=Show CSS sources
-
-# LOCALIZATION NOTE (ruleView.contextmenu.showCSSSources.accessKey): Access key for
-# the rule view context menu "Show CSS sources" entry.
-ruleView.contextmenu.showCSSSources.accessKey=S
-
 # LOCALIZATION NOTE (ruleView.contextmenu.addRule): Text displayed in the
 # rule view context menu for adding a new rule to the element.
 ruleView.contextmenu.addRule=Add rule
 
 # LOCALIZATION NOTE (ruleView.contextmenu.addRule.accessKey): Access key for
 # the rule view context menu "Add rule" entry.
 ruleView.contextmenu.addRule.accessKey=R