+
diff --git a/browser/components/sessionstore/SessionStorage.jsm b/browser/components/sessionstore/SessionStorage.jsm
index 067a673e679c..df3f00ef8184 100644
--- a/browser/components/sessionstore/SessionStorage.jsm
+++ b/browser/components/sessionstore/SessionStorage.jsm
@@ -9,6 +9,7 @@ this.EXPORTED_SYMBOLS = ["SessionStorage"];
const Cu = Components.utils;
const Ci = Components.interfaces;
+Cu.import("resource://gre/modules/BrowserUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -72,9 +73,9 @@ let SessionStorageInternal = {
return;
}
- // Get the root domain of the current history entry
- // and use that as a key for the per-host storage data.
- let origin = principal.jarPrefix + principal.originNoSuffix;
+ // Get the origin of the current history entry
+ // and use that as a key for the per-principal storage data.
+ let origin = principal.origin;
if (visitedOrigins.has(origin)) {
// Don't read a host twice.
return;
@@ -102,10 +103,9 @@ let SessionStorageInternal = {
* {"example.com": {"key": "value", "my_number": 123}}
*/
restore: function (aDocShell, aStorageData) {
- for (let host of Object.keys(aStorageData)) {
- let data = aStorageData[host];
- let uri = Services.io.newURI(host, null, null);
- let principal = Services.scriptSecurityManager.getDocShellCodebasePrincipal(uri, aDocShell);
+ for (let origin of Object.keys(aStorageData)) {
+ let data = aStorageData[origin];
+ let principal = BrowserUtils.principalFromOrigin(origin);
let storageManager = aDocShell.QueryInterface(Ci.nsIDOMStorageManager);
let window = aDocShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
diff --git a/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js b/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js
index 0759496b3855..eb77b3c67a31 100644
--- a/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js
+++ b/browser/devtools/animationinspector/test/browser_animation_target_highlight_select.js
@@ -19,19 +19,14 @@ add_task(function*() {
function* testTargetNode({toolbox, inspector, panel}, isNewUI) {
info("Select the simple animated node");
- yield selectNode(".animated", inspector);
- // Make sure to wait for the target-retrieved event if the nodeFront hasn't
- // yet been retrieved by the TargetNodeComponent.
- let targetNodeComponent;
- if (isNewUI) {
- targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0];
- } else {
- targetNodeComponent = panel.playerWidgets[0].targetNodeComponent;
- }
- if (!targetNodeComponent.nodeFront) {
- yield targetNodeComponent.once("target-retrieved");
- }
+ let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
+ yield selectNode(".animated", inspector);
+ yield onPanelUpdated;
+
+ let targets = yield waitForAllAnimationTargets(panel);
+ // Arbitrary select the first one
+ let targetNodeComponent = targets[0];
info("Retrieve the part of the widget that highlights the node on hover");
let highlightingEl = targetNodeComponent.previewEl;
@@ -42,6 +37,12 @@ function* testTargetNode({toolbox, inspector, panel}, isNewUI) {
highlightingEl.ownerDocument.defaultView);
let nodeFront = yield onHighlight;
+ // Do not forget to mouseout, otherwise we get random mouseover event
+ // when selecting another node, which triggers some requests in animation
+ // inspector
+ EventUtils.synthesizeMouse(highlightingEl, 10, 5, {type: "mouseout"},
+ highlightingEl.ownerDocument.defaultView);
+
ok(true, "The node-highlight event was fired");
is(targetNodeComponent.nodeFront, nodeFront,
"The highlighted node is the one stored on the animation widget");
@@ -53,23 +54,17 @@ function* testTargetNode({toolbox, inspector, panel}, isNewUI) {
"The highlighted node has the correct class");
info("Select the body node in order to have the list of all animations");
+ onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
yield selectNode("body", inspector);
+ yield onPanelUpdated;
- // Make sure to wait for the target-retrieved event if the nodeFront hasn't
- // yet been retrieved by the TargetNodeComponent.
- if (isNewUI) {
- targetNodeComponent = panel.animationsTimelineComponent.targetNodes[0];
- } else {
- targetNodeComponent = panel.playerWidgets[0].targetNodeComponent;
- }
- if (!targetNodeComponent.nodeFront) {
- yield targetNodeComponent.once("target-retrieved");
- }
+ targets = yield waitForAllAnimationTargets(panel);
+ targetNodeComponent = targets[0];
info("Click on the first animation widget's selector icon and wait for the " +
"selection to change");
let onSelection = inspector.selection.once("new-node-front");
- let onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
+ onPanelUpdated = panel.once(panel.UI_UPDATED_EVENT);
let selectIconEl = targetNodeComponent.selectNodeEl;
EventUtils.sendMouseEvent({type: "click"}, selectIconEl,
selectIconEl.ownerDocument.defaultView);
@@ -79,4 +74,6 @@ function* testTargetNode({toolbox, inspector, panel}, isNewUI) {
"The selected node is the one stored on the animation widget");
yield onPanelUpdated;
+
+ yield waitForAllAnimationTargets(panel);
}
diff --git a/browser/devtools/animationinspector/test/head.js b/browser/devtools/animationinspector/test/head.js
index 9287f43d84d8..1a68920739ab 100644
--- a/browser/devtools/animationinspector/test/head.js
+++ b/browser/devtools/animationinspector/test/head.js
@@ -462,3 +462,26 @@ let getAnimationPlayerState = Task.async(function*(selector, animationIndex=0) {
function isNodeVisible(node) {
return !!node.getClientRects().length;
}
+
+/**
+ * Wait for all AnimationTargetNode instances to be fully loaded
+ * (fetched their related actor and rendered), and return them.
+ * @param {AnimationsPanel} panel
+ * @return {Array} all AnimationTargetNode instances
+ */
+let waitForAllAnimationTargets = Task.async(function*(panel) {
+ let targets = [];
+ if (panel.animationsTimelineComponent) {
+ targets = targets.concat(panel.animationsTimelineComponent.targetNodes);
+ }
+ if (panel.playerWidgets) {
+ targets = targets.concat(panel.playerWidgets.map(w => w.targetNodeComponent));
+ }
+ yield promise.all(targets.map(t => {
+ if (!t.nodeFront) {
+ return t.once("target-retrieved");
+ }
+ return false;
+ }));
+ return targets;
+});
diff --git a/browser/devtools/framework/toolbox.js b/browser/devtools/framework/toolbox.js
index 3509717434f9..e94b8a3b6ff1 100644
--- a/browser/devtools/framework/toolbox.js
+++ b/browser/devtools/framework/toolbox.js
@@ -1743,52 +1743,52 @@ Toolbox.prototype = {
* Returns a promise that resolves when the fronts are destroyed
*/
destroyInspector: function() {
- if (this._destroying) {
- return this._destroying;
+ if (this._destroyingInspector) {
+ return this._destroyingInspector;
}
- if (!this._inspector) {
- return promise.resolve();
- }
+ return this._destroyingInspector = Task.spawn(function*() {
+ if (!this._inspector) {
+ return;
+ }
- let outstanding = () => {
- return Task.spawn(function*() {
- yield this.highlighterUtils.stopPicker();
- yield this._inspector.destroy();
- if (this._highlighter) {
- // Note that if the toolbox is closed, this will work fine, but will fail
- // in case the browser is closed and will trigger a noSuchActor message.
- // We ignore the promise that |_hideBoxModel| returns, since we should still
- // proceed with the rest of destruction if it fails.
- // FF42+ now does the cleanup from the actor.
- if (!this.highlighter.traits.autoHideOnDestroy) {
- this.highlighterUtils.unhighlight();
- }
- yield this._highlighter.destroy();
- }
- if (this._selection) {
- this._selection.destroy();
+ // Releasing the walker (if it has been created)
+ // This can fail, but in any case, we want to continue destroying the
+ // inspector/highlighter/selection
+ // FF42+: Inspector actor starts managing Walker actor and auto destroy it.
+ if (this._walker && !this.walker.traits.autoReleased) {
+ try {
+ yield this._walker.release();
+ } catch(e) {}
+ }
+
+ yield this.highlighterUtils.stopPicker();
+ yield this._inspector.destroy();
+ if (this._highlighter) {
+ // Note that if the toolbox is closed, this will work fine, but will fail
+ // in case the browser is closed and will trigger a noSuchActor message.
+ // We ignore the promise that |_hideBoxModel| returns, since we should still
+ // proceed with the rest of destruction if it fails.
+ // FF42+ now does the cleanup from the actor.
+ if (!this.highlighter.traits.autoHideOnDestroy) {
+ this.highlighterUtils.unhighlight();
}
+ yield this._highlighter.destroy();
+ }
+ if (this._selection) {
+ this._selection.destroy();
+ }
- if (this.walker) {
- this.walker.off("highlighter-ready", this._highlighterReady);
- this.walker.off("highlighter-hide", this._highlighterHidden);
- }
+ if (this.walker) {
+ this.walker.off("highlighter-ready", this._highlighterReady);
+ this.walker.off("highlighter-hide", this._highlighterHidden);
+ }
- this._inspector = null;
- this._highlighter = null;
- this._selection = null;
- this._walker = null;
- }.bind(this));
- };
-
- // Releasing the walker (if it has been created)
- // This can fail, but in any case, we want to continue destroying the
- // inspector/highlighter/selection
- let walker = (this._destroying = this._walker) ?
- this._walker.release() :
- promise.resolve();
- return walker.then(outstanding, outstanding);
+ this._inspector = null;
+ this._highlighter = null;
+ this._selection = null;
+ this._walker = null;
+ }.bind(this));
},
/**
diff --git a/browser/devtools/styleinspector/computed-view.js b/browser/devtools/styleinspector/computed-view.js
index 15463830270d..5661494218c0 100644
--- a/browser/devtools/styleinspector/computed-view.js
+++ b/browser/devtools/styleinspector/computed-view.js
@@ -19,8 +19,10 @@ const {OutputParser} = require("devtools/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/styleeditor/utils");
const {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
-loader.lazyRequireGetter(this, "overlays", "devtools/styleinspector/style-inspector-overlays");
-loader.lazyRequireGetter(this, "StyleInspectorMenu", "devtools/styleinspector/style-inspector-menu");
+loader.lazyRequireGetter(this, "overlays",
+ "devtools/styleinspector/style-inspector-overlays");
+loader.lazyRequireGetter(this, "StyleInspectorMenu",
+ "devtools/styleinspector/style-inspector-menu");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -35,11 +37,11 @@ const HTML_NS = "http://www.w3.org/1999/xhtml";
* Helper for long-running processes that should yield occasionally to
* the mainloop.
*
- * @param {Window} aWin
+ * @param {Window} win
* Timeouts will be set on this window when appropriate.
- * @param {Generator} aGenerator
+ * @param {Generator} generator
* Will iterate this generator.
- * @param {object} aOptions
+ * @param {Object} options
* Options for the update process:
* onItem {function} Will be called with the value of each iteration.
* onBatch {function} Will be called after each batch of iterations,
@@ -47,17 +49,15 @@ const HTML_NS = "http://www.w3.org/1999/xhtml";
* onDone {function} Will be called when iteration is complete.
* onCancel {function} Will be called if the process is canceled.
* threshold {int} How long to process before yielding, in ms.
- *
- * @constructor
*/
-function UpdateProcess(aWin, aGenerator, aOptions) {
- this.win = aWin;
- this.iter = _Iterator(aGenerator);
- this.onItem = aOptions.onItem || function() {};
- this.onBatch = aOptions.onBatch || function() {};
- this.onDone = aOptions.onDone || function() {};
- this.onCancel = aOptions.onCancel || function() {};
- this.threshold = aOptions.threshold || 45;
+function UpdateProcess(win, generator, options) {
+ this.win = win;
+ this.iter = _Iterator(generator);
+ this.onItem = options.onItem || function() {};
+ this.onBatch = options.onBatch || function() {};
+ this.onDone = options.onDone || function() {};
+ this.onCancel = options.onCancel || function() {};
+ this.threshold = options.threshold || 45;
this.canceled = false;
}
@@ -121,13 +121,13 @@ UpdateProcess.prototype = {
* sorted by style. There should be one instance of CssComputedView
* per style display (of which there will generally only be one).
*
- * @param {Inspector} inspector toolbox panel
- * @param {Document} document The document that will contain the computed view.
+ * @param {Inspector} inspector
+ * Inspector toolbox panel
+ * @param {Document} document
+ * The document that will contain the computed view.
* @param {PageStyleFront} pageStyle
* Front for the page style actor that will be providing
* the style information.
- *
- * @constructor
*/
function CssComputedView(inspector, document, pageStyle) {
this.inspector = inspector;
@@ -153,14 +153,16 @@ function CssComputedView(inspector, document, pageStyle) {
this._onFilterKeyPress = this._onFilterKeyPress.bind(this);
this._onClearSearch = this._onClearSearch.bind(this);
this._onIncludeBrowserStyles = this._onIncludeBrowserStyles.bind(this);
- this._onFilterTextboxContextMenu = this._onFilterTextboxContextMenu.bind(this);
+ this._onFilterTextboxContextMenu =
+ this._onFilterTextboxContextMenu.bind(this);
let doc = this.styleDocument;
this.root = doc.getElementById("root");
this.element = doc.getElementById("propertyContainer");
this.searchField = doc.getElementById("computedview-searchbox");
this.searchClearButton = doc.getElementById("computedview-searchinput-clear");
- this.includeBrowserStylesCheckbox = doc.getElementById("browser-style-checkbox");
+ this.includeBrowserStylesCheckbox =
+ doc.getElementById("browser-style-checkbox");
this.styleDocument.addEventListener("keypress", this._onKeypress);
this.styleDocument.addEventListener("mousedown", this.focusWindow);
@@ -169,7 +171,8 @@ function CssComputedView(inspector, document, pageStyle) {
this.element.addEventListener("contextmenu", this._onContextMenu);
this.searchField.addEventListener("input", this._onFilterStyles);
this.searchField.addEventListener("keypress", this._onFilterKeyPress);
- this.searchField.addEventListener("contextmenu", this._onFilterTextboxContextMenu);
+ this.searchField.addEventListener("contextmenu",
+ this._onFilterTextboxContextMenu);
this.searchClearButton.addEventListener("click", this._onClearSearch);
this.includeBrowserStylesCheckbox.addEventListener("command",
this._onIncludeBrowserStyles);
@@ -205,15 +208,17 @@ function CssComputedView(inspector, document, pageStyle) {
/**
* Memoized lookup of a l10n string from a string bundle.
- * @param {string} aName The key to lookup.
- * @returns A localized version of the given key.
+ *
+ * @param {String} name
+ * The key to lookup.
+ * @returns {String} localized version of the given key.
*/
-CssComputedView.l10n = function(aName) {
+CssComputedView.l10n = function(name) {
try {
- return CssComputedView._strings.GetStringFromName(aName);
+ return CssComputedView._strings.GetStringFromName(name);
} catch (ex) {
- Services.console.logStringMessage("Error reading '" + aName + "'");
- throw new Error("l10n error with " + aName);
+ Services.console.logStringMessage("Error reading '" + name + "'");
+ throw new Error("l10n error with " + name);
}
};
@@ -252,8 +257,8 @@ CssComputedView.prototype = {
},
_handlePrefChange: function(event, data) {
- if (this._computed && (data.pref == "devtools.defaultColorUnit" ||
- data.pref == PREF_ORIG_SOURCES)) {
+ if (this._computed && (data.pref === "devtools.defaultColorUnit" ||
+ data.pref === PREF_ORIG_SOURCES)) {
this.refreshPanel();
}
},
@@ -262,11 +267,12 @@ CssComputedView.prototype = {
* Update the view with a new selected element. The CssComputedView panel
* will show the style information for the given element.
*
- * @param {NodeFront} aElement The highlighted node to get styles for.
+ * @param {NodeFront} element
+ * The highlighted node to get styles for.
* @returns a promise that will be resolved when highlighting is complete.
*/
- selectElement: function(aElement) {
- if (!aElement) {
+ selectElement: function(element) {
+ if (!element) {
this.viewedElement = null;
this.noResults.hidden = false;
@@ -280,11 +286,11 @@ CssComputedView.prototype = {
return promise.resolve(undefined);
}
- if (aElement === this.viewedElement) {
+ if (element === this.viewedElement) {
return promise.resolve(undefined);
}
- this.viewedElement = aElement;
+ this.viewedElement = element;
this.refreshSourceFilter();
return this.refreshPanel();
@@ -292,7 +298,9 @@ CssComputedView.prototype = {
/**
* Get the type of a given node in the computed-view
- * @param {DOMNode} node The node which we want information about
+ *
+ * @param {DOMNode} node
+ * The node which we want information about
* @return {Object} The type information object contains the following props:
* - type {String} One of the VIEW_NODE_XXX_TYPE const in
* style-inspector-overlays
@@ -393,9 +401,9 @@ CssComputedView.prototype = {
this._createViewsProcess = new UpdateProcess(
this.styleWindow, CssComputedView.propertyNames, {
- onItem: (aPropertyName) => {
+ onItem: (propertyName) => {
// Per-item callback.
- let propView = new PropertyView(this, aPropertyName);
+ let propView = new PropertyView(this, propertyName);
fragment.appendChild(propView.buildMain());
fragment.appendChild(propView.buildSelectorContainer());
@@ -466,8 +474,8 @@ CssComputedView.prototype = {
let deferred = promise.defer();
this._refreshProcess = new UpdateProcess(
this.styleWindow, this.propertyViews, {
- onItem: (aPropView) => {
- aPropView.refresh();
+ onItem: (propView) => {
+ propView.refresh();
},
onDone: () => {
this._refreshProcess = null;
@@ -476,7 +484,8 @@ CssComputedView.prototype = {
if (this.searchField.value.length > 0 && !this.numVisibleProperties) {
this.searchField.classList.add("devtools-style-searchbox-no-match");
} else {
- this.searchField.classList.remove("devtools-style-searchbox-no-match");
+ this.searchField.classList
+ .remove("devtools-style-searchbox-no-match");
}
this.inspector.emit("computed-view-refreshed");
@@ -492,7 +501,7 @@ CssComputedView.prototype = {
* Handle the keypress event in the computed view.
*/
_onKeypress: function(event) {
- let isOSX = Services.appinfo.OS == "Darwin";
+ let isOSX = Services.appinfo.OS === "Darwin";
if (((isOSX && event.metaKey && !event.ctrlKey && !event.altKey) ||
(!isOSX && event.ctrlKey && !event.metaKey && !event.altKey)) &&
@@ -504,10 +513,8 @@ CssComputedView.prototype = {
/**
* Called when the user enters a search term in the filter style search box.
- *
- * @param {Event} aEvent the DOM Event object.
*/
- _onFilterStyles: function(aEvent) {
+ _onFilterStyles: function() {
let win = this.styleWindow;
if (this._filterChangedTimeout) {
@@ -534,11 +541,11 @@ CssComputedView.prototype = {
* Handle the search box's keypress event. If the escape key is pressed,
* clear the search box field.
*/
- _onFilterKeyPress: function(aEvent) {
- if (aEvent.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE &&
+ _onFilterKeyPress: function(event) {
+ if (event.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE &&
this._onClearSearch()) {
- aEvent.preventDefault();
- aEvent.stopPropagation();
+ event.preventDefault();
+ event.stopPropagation();
}
},
@@ -572,10 +579,8 @@ CssComputedView.prototype = {
/**
* The change event handler for the includeBrowserStyles checkbox.
- *
- * @param {Event} aEvent the DOM Event object.
*/
- _onIncludeBrowserStyles: function(aEvent) {
+ _onIncludeBrowserStyles: function() {
this.refreshSourceFilter();
this.refreshPanel();
},
@@ -612,7 +617,8 @@ CssComputedView.prototype = {
// Here we build and cache a list of css properties supported by the browser
// We could use any element but let's use the main document's root element
- let styles = this.styleWindow.getComputedStyle(this.styleDocument.documentElement);
+ let styles = this.styleWindow
+ .getComputedStyle(this.styleDocument.documentElement);
let mozProps = [];
for (let i = 0, numStyles = styles.length; i < numStyles; i++) {
let prop = styles.item(i);
@@ -651,10 +657,8 @@ CssComputedView.prototype = {
/**
* Focus the window on mousedown.
- *
- * @param event The event object
*/
- focusWindow: function(event) {
+ focusWindow: function() {
let win = this.styleDocument.defaultView;
win.focus();
},
@@ -679,13 +683,13 @@ CssComputedView.prototype = {
/**
* Callback for copy event. Copy selected text.
- * @param {Event} event copy event object.
+ *
+ * @param {Event} event
+ * copy event object.
*/
_onCopy: function(event) {
this.copySelection();
- if (event) {
- event.preventDefault();
- }
+ event.preventDefault();
},
/**
@@ -759,7 +763,8 @@ CssComputedView.prototype = {
this.element.removeEventListener("contextmenu", this._onContextMenu);
this.searchField.removeEventListener("input", this._onFilterStyles);
this.searchField.removeEventListener("keypress", this._onFilterKeyPress);
- this.searchField.removeEventListener("contextmenu", this._onFilterTextboxContextMenu);
+ this.searchField.removeEventListener("contextmenu",
+ this._onFilterTextboxContextMenu);
this.searchClearButton.removeEventListener("click", this._onClearSearch);
this.includeBrowserStylesCheckbox.removeEventListener("command",
this.includeBrowserStylesChanged);
@@ -786,10 +791,11 @@ CssComputedView.prototype = {
}
};
-function PropertyInfo(aTree, aName) {
- this.tree = aTree;
- this.name = aName;
+function PropertyInfo(tree, name) {
+ this.tree = tree;
+ this.name = name;
}
+
PropertyInfo.prototype = {
get value() {
if (this.tree._computed) {
@@ -802,19 +808,20 @@ PropertyInfo.prototype = {
/**
* A container to give easy access to property data from the template engine.
*
- * @constructor
- * @param {CssComputedView} aTree the CssComputedView instance we are working with.
- * @param {string} aName the CSS property name for which this PropertyView
- * instance will render the rules.
+ * @param {CssComputedView} tree
+ * The CssComputedView instance we are working with.
+ * @param {String} name
+ * The CSS property name for which this PropertyView
+ * instance will render the rules.
*/
-function PropertyView(aTree, aName) {
- this.tree = aTree;
- this.name = aName;
- this.getRTLAttr = aTree.getRTLAttr;
+function PropertyView(tree, name) {
+ this.tree = tree;
+ this.name = name;
+ this.getRTLAttr = tree.getRTLAttr;
- this.link = "https://developer.mozilla.org/CSS/" + aName;
+ this.link = "https://developer.mozilla.org/CSS/" + name;
- this._propertyInfo = new PropertyInfo(aTree, aName);
+ this._propertyInfo = new PropertyInfo(tree, name);
}
PropertyView.prototype = {
@@ -848,7 +855,7 @@ PropertyView.prototype = {
/**
* Get the computed style for the current property.
*
- * @return {string} the computed style for the current property of the
+ * @return {String} the computed style for the current property of the
* currently highlighted element.
*/
get value() {
@@ -884,8 +891,8 @@ PropertyView.prototype = {
let searchTerm = this.tree.searchField.value.toLowerCase();
let isValidSearchTerm = searchTerm.trim().length > 0;
if (isValidSearchTerm &&
- this.name.toLowerCase().indexOf(searchTerm) == -1 &&
- this.value.toLowerCase().indexOf(searchTerm) == -1) {
+ this.name.toLowerCase().indexOf(searchTerm) === -1 &&
+ this.value.toLowerCase().indexOf(searchTerm) === -1) {
return false;
}
@@ -894,7 +901,8 @@ PropertyView.prototype = {
/**
* Returns the className that should be assigned to the propertyView.
- * @return string
+ *
+ * @return {String}
*/
get propertyHeaderClassName() {
if (this.visible) {
@@ -907,7 +915,8 @@ PropertyView.prototype = {
/**
* Returns the className that should be assigned to the propertyView content
* container.
- * @return string
+ *
+ * @return {String}
*/
get propertyContentClassName() {
if (this.visible) {
@@ -919,7 +928,8 @@ PropertyView.prototype = {
/**
* Build the markup for on computed style
- * @return Element
+ *
+ * @return {Element}
*/
buildMain: function() {
let doc = this.tree.styleDocument;
@@ -932,14 +942,14 @@ PropertyView.prototype = {
// Make it keyboard navigable
this.element.setAttribute("tabindex", "0");
- this.onKeyDown = (aEvent) => {
+ this.onKeyDown = (event) => {
let keyEvent = Ci.nsIDOMKeyEvent;
- if (aEvent.keyCode == keyEvent.DOM_VK_F1) {
+ if (event.keyCode === keyEvent.DOM_VK_F1) {
this.mdnLinkClick();
}
- if (aEvent.keyCode == keyEvent.DOM_VK_RETURN ||
- aEvent.keyCode == keyEvent.DOM_VK_SPACE) {
- this.onMatchedToggle(aEvent);
+ if (event.keyCode === keyEvent.DOM_VK_RETURN ||
+ event.keyCode === keyEvent.DOM_VK_SPACE) {
+ this.onMatchedToggle(event);
}
};
this.element.addEventListener("keydown", this.onKeyDown, false);
@@ -996,7 +1006,7 @@ PropertyView.prototype = {
this.element.className = this.propertyHeaderClassName;
this.element.nextElementSibling.className = this.propertyContentClassName;
- if (this.prevViewedElement != this.tree.viewedElement) {
+ if (this.prevViewedElement !== this.tree.viewedElement) {
this._matchedSelectorViews = null;
this.prevViewedElement = this.tree.viewedElement;
}
@@ -1112,8 +1122,8 @@ PropertyView.prototype = {
if (!this._matchedSelectorViews) {
this._matchedSelectorViews = [];
this._matchedSelectorResponse.forEach(
- function(aSelectorInfo) {
- let selectorView = new SelectorView(this.tree, aSelectorInfo);
+ function(selectorInfo) {
+ let selectorView = new SelectorView(this.tree, selectorInfo);
this._matchedSelectorViews.push(selectorView);
}, this);
}
@@ -1136,29 +1146,30 @@ PropertyView.prototype = {
/**
* The action when a user expands matched selectors.
*
- * @param {Event} aEvent Used to determine the class name of the targets click
- * event.
+ * @param {Event} event
+ * Used to determine the class name of the targets click
+ * event.
*/
- onMatchedToggle: function(aEvent) {
- if (aEvent.shiftKey) {
+ onMatchedToggle: function(event) {
+ if (event.shiftKey) {
return;
}
this.matchedExpanded = !this.matchedExpanded;
this.refreshMatchedSelectors();
- aEvent.preventDefault();
+ event.preventDefault();
},
/**
* The action when a user clicks on the MDN help link for a property.
*/
- mdnLinkClick: function(aEvent) {
+ mdnLinkClick: function(event) {
let inspector = this.tree.inspector;
if (inspector.target.tab) {
let browserWin = inspector.target.tab.ownerDocument.defaultView;
browserWin.openUILinkIn(this.link, "tab");
}
- aEvent.preventDefault();
+ event.preventDefault();
},
/**
@@ -1169,7 +1180,8 @@ PropertyView.prototype = {
this.element.removeEventListener("keydown", this.onKeyDown, false);
this.element = null;
- this.matchedExpander.removeEventListener("click", this.onMatchedToggle, false);
+ this.matchedExpander.removeEventListener("click", this.onMatchedToggle,
+ false);
this.matchedExpander = null;
this.nameNode.removeEventListener("click", this.onFocus, false);
@@ -1182,12 +1194,14 @@ PropertyView.prototype = {
/**
* A container to give us easy access to display data from a CssRule
- * @param CssComputedView aTree, the owning CssComputedView
- * @param aSelectorInfo
+ *
+ * @param CssComputedView tree
+ * the owning CssComputedView
+ * @param selectorInfo
*/
-function SelectorView(aTree, aSelectorInfo) {
- this.tree = aTree;
- this.selectorInfo = aSelectorInfo;
+function SelectorView(tree, selectorInfo) {
+ this.tree = tree;
+ this.selectorInfo = selectorInfo;
this._cacheStatusNames();
this.openStyleEditor = this.openStyleEditor.bind(this);
@@ -1216,8 +1230,6 @@ SelectorView.prototype = {
* These statuses are localized inside the styleinspector.properties string
* bundle.
* @see css-logic.js - the CssLogic.STATUS array.
- *
- * @return {void}
*/
_cacheStatusNames: function() {
if (SelectorView.STATUS_NAMES.length) {
@@ -1288,7 +1300,7 @@ SelectorView.prototype = {
*/
updateSourceLink: function() {
return this.updateSource().then((oldSource) => {
- if (oldSource != this.source && this.tree.element) {
+ if (oldSource !== this.source && this.tree.element) {
let selector = '[sourcelocation="' + oldSource + '"]';
let link = this.tree.element.querySelector(selector);
if (link) {
@@ -1314,13 +1326,13 @@ SelectorView.prototype = {
let showOrig = Services.prefs.getBoolPref(PREF_ORIG_SOURCES);
- if (showOrig && rule.type != ELEMENT_STYLE) {
+ if (showOrig && rule.type !== ELEMENT_STYLE) {
let deferred = promise.defer();
// set as this first so we show something while we're fetching
this.source = CssLogic.shortSource(this.sheet) + ":" + rule.line;
- rule.getOriginalLocation().then(({href, line, column}) => {
+ rule.getOriginalLocation().then(({href, line}) => {
let oldSource = this.source;
this.source = CssLogic.shortSource({href: href}) + ":" + line;
deferred.resolve(oldSource);
@@ -1337,9 +1349,9 @@ SelectorView.prototype = {
/**
* Open the style editor if the RETURN key was pressed.
*/
- maybeOpenStyleEditor: function(aEvent) {
+ maybeOpenStyleEditor: function(event) {
let keyEvent = Ci.nsIDOMKeyEvent;
- if (aEvent.keyCode == keyEvent.DOM_VK_RETURN) {
+ if (event.keyCode === keyEvent.DOM_VK_RETURN) {
this.openStyleEditor();
}
},
@@ -1351,10 +1363,8 @@ SelectorView.prototype = {
*
* We can only view stylesheets contained in document.styleSheets inside the
* style editor.
- *
- * @param aEvent The click event
*/
- openStyleEditor: function(aEvent) {
+ openStyleEditor: function() {
let inspector = this.tree.inspector;
let rule = this.selectorInfo.rule;
@@ -1374,6 +1384,7 @@ SelectorView.prototype = {
if (Services.prefs.getBoolPref(PREF_ORIG_SOURCES)) {
location = rule.getOriginalLocation();
}
+
location.then(({source, href, line, column}) => {
let target = inspector.target;
if (ToolDefinitions.styleEditor.isTargetSupported(target)) {
@@ -1389,27 +1400,27 @@ SelectorView.prototype = {
/**
* Create a child element with a set of attributes.
*
- * @param {Element} aParent
+ * @param {Element} parent
* The parent node.
- * @param {string} aTag
+ * @param {String} tag
* The tag name.
- * @param {object} aAttributes
+ * @param {Object} attributes
* A set of attributes to set on the node.
*/
-function createChild(aParent, aTag, aAttributes={}) {
- let elt = aParent.ownerDocument.createElementNS(HTML_NS, aTag);
- for (let attr in aAttributes) {
- if (aAttributes.hasOwnProperty(attr)) {
+function createChild(parent, tag, attributes={}) {
+ let elt = parent.ownerDocument.createElementNS(HTML_NS, tag);
+ for (let attr in attributes) {
+ if (attributes.hasOwnProperty(attr)) {
if (attr === "textContent") {
- elt.textContent = aAttributes[attr];
+ elt.textContent = attributes[attr];
} else if (attr === "child") {
- elt.appendChild(aAttributes[attr]);
+ elt.appendChild(attributes[attr]);
} else {
- elt.setAttribute(attr, aAttributes[attr]);
+ elt.setAttribute(attr, attributes[attr]);
}
}
}
- aParent.appendChild(elt);
+ parent.appendChild(elt);
return elt;
}
diff --git a/browser/devtools/styleinspector/computedview.xhtml b/browser/devtools/styleinspector/computedview.xhtml
index c9b412bded59..263f17871ef7 100644
--- a/browser/devtools/styleinspector/computedview.xhtml
+++ b/browser/devtools/styleinspector/computedview.xhtml
@@ -37,7 +37,7 @@
window.setPanel = function(panel, iframe) {
let {require} = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
let inspector = require("devtools/styleinspector/style-inspector");
- this.computedview = new inspector.ComputedViewTool(panel, window, iframe);
+ this.computedview = new inspector.ComputedViewTool(panel, window);
}
window.onunload = function() {
if (this.computedview) {
diff --git a/browser/devtools/styleinspector/css-parsing-utils.js b/browser/devtools/styleinspector/css-parsing-utils.js
index a1eeb1a53c50..dbd9ffc51a95 100644
--- a/browser/devtools/styleinspector/css-parsing-utils.js
+++ b/browser/devtools/styleinspector/css-parsing-utils.js
@@ -17,11 +17,11 @@ const SELECTOR_PSEUDO_CLASS = exports.SELECTOR_PSEUDO_CLASS = 3;
* For example, parseDeclarations("width: 1px; height: 1px") would return
* [{name:"width", value: "1px"}, {name: "height", "value": "1px"}]
*
- * The input string is assumed to only contain declarations so { and } characters
- * will be treated as part of either the property or value, depending where it's
- * found.
+ * The input string is assumed to only contain declarations so { and }
+ * characters will be treated as part of either the property or value,
+ * depending where it's found.
*
- * @param {string} inputString
+ * @param {String} inputString
* An input string of CSS
* @return {Array} an array of objects with the following signature:
* [{"name": string, "value": string, "priority": string}, ...]
@@ -106,7 +106,7 @@ function parseDeclarations(inputString) {
* (2) SELECTOR_ELEMENT
* (3) SELECTOR_PSEUDO_CLASS
*
- * @param {string} value
+ * @param {String} value
* The CSS selector text.
* @return {Array} an array of objects with the following signature:
* [{ "value": string, "type": integer }, ...]
@@ -201,8 +201,9 @@ function parsePseudoClassesAndAttributes(value) {
* Expects a single CSS value to be passed as the input and parses the value
* and priority.
*
- * @param {string} value The value from the text editor.
- * @return {object} an object with 'value' and 'priority' properties.
+ * @param {String} value
+ * The value from the text editor.
+ * @return {Object} an object with 'value' and 'priority' properties.
*/
function parseSingleValue(value) {
let declaration = parseDeclarations("a: " + value + ";")[0];
diff --git a/browser/devtools/styleinspector/cssruleview.xhtml b/browser/devtools/styleinspector/cssruleview.xhtml
index 27c322fc28f6..ebe45356aadb 100644
--- a/browser/devtools/styleinspector/cssruleview.xhtml
+++ b/browser/devtools/styleinspector/cssruleview.xhtml
@@ -8,25 +8,21 @@
%inspectorDTD;
]>
-
-
&ruleViewTitle;
-
-
-
@@ -57,6 +52,5 @@
-
diff --git a/browser/devtools/styleinspector/rule-view.js b/browser/devtools/styleinspector/rule-view.js
index 192641f31cf1..f420ff306ffc 100644
--- a/browser/devtools/styleinspector/rule-view.js
+++ b/browser/devtools/styleinspector/rule-view.js
@@ -28,9 +28,12 @@ const {
SELECTOR_PSEUDO_CLASS
} = require("devtools/styleinspector/css-parsing-utils");
-loader.lazyRequireGetter(this, "overlays", "devtools/styleinspector/style-inspector-overlays");
-loader.lazyRequireGetter(this, "EventEmitter", "devtools/toolkit/event-emitter");
-loader.lazyRequireGetter(this, "StyleInspectorMenu", "devtools/styleinspector/style-inspector-menu");
+loader.lazyRequireGetter(this, "overlays",
+ "devtools/styleinspector/style-inspector-overlays");
+loader.lazyRequireGetter(this, "EventEmitter",
+ "devtools/toolkit/event-emitter");
+loader.lazyRequireGetter(this, "StyleInspectorMenu",
+ "devtools/styleinspector/style-inspector-menu");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -114,25 +117,23 @@ function createDummyDocument() {
/**
* ElementStyle maintains a list of Rule objects for a given element.
*
- * @param {Element} aElement
+ * @param {Element} element
* The element whose style we are viewing.
- * @param {object} aStore
+ * @param {Object} store
* The ElementStyle can use this object to store metadata
* that might outlast the rule view, particularly the current
* set of disabled properties.
- * @param {PageStyleFront} aPageStyle
+ * @param {PageStyleFront} pageStyle
* Front for the page style actor that will be providing
* the style information.
- * @param {bool} aShowUserAgentStyles
+ * @param {Boolean} showUserAgentStyles
* Should user agent styles be inspected?
- *
- * @constructor
*/
-function ElementStyle(aElement, aStore, aPageStyle, aShowUserAgentStyles) {
- this.element = aElement;
- this.store = aStore || {};
- this.pageStyle = aPageStyle;
- this.showUserAgentStyles = aShowUserAgentStyles;
+function ElementStyle(element, store, pageStyle, showUserAgentStyles) {
+ this.element = element;
+ this.store = store || {};
+ this.pageStyle = pageStyle;
+ this.showUserAgentStyles = showUserAgentStyles;
this.rules = [];
// We don't want to overwrite this.store.userProperties so we only create it
@@ -215,7 +216,7 @@ ElementStyle.prototype = {
// Make sure the dummy element has been created before continuing...
return this.dummyElementPromise.then(() => {
- if (this.populated != populated) {
+ if (this.populated !== populated) {
// Don't care anymore.
return;
}
@@ -263,20 +264,19 @@ ElementStyle.prototype = {
* Add a rule if it's one we care about. Filters out duplicates and
* inherited styles with no inherited properties.
*
- * @param {object} aOptions
+ * @param {Object} options
* Options for creating the Rule, see the Rule constructor.
- *
- * @return {bool} true if we added the rule.
+ * @return {Boolean} true if we added the rule.
*/
- _maybeAddRule: function(aOptions) {
+ _maybeAddRule: function(options) {
// If we've already included this domRule (for example, when a
// common selector is inherited), ignore it.
- if (aOptions.rule &&
- this.rules.some(rule => rule.domRule === aOptions.rule)) {
+ if (options.rule &&
+ this.rules.some(rule => rule.domRule === options.rule)) {
return false;
}
- if (aOptions.system) {
+ if (options.system) {
return false;
}
@@ -286,9 +286,9 @@ ElementStyle.prototype = {
// Rule object.
if (this._refreshRules) {
for (let r of this._refreshRules) {
- if (r.matches(aOptions)) {
+ if (r.matches(options)) {
rule = r;
- rule.refresh(aOptions);
+ rule.refresh(options);
break;
}
}
@@ -296,11 +296,11 @@ ElementStyle.prototype = {
// If this is a new rule, create its Rule object.
if (!rule) {
- rule = new Rule(this, aOptions);
+ rule = new Rule(this, options);
}
// Ignore inherited rules with no properties.
- if (aOptions.inherited && rule.textProps.length == 0) {
+ if (options.inherited && rule.textProps.length === 0) {
return false;
}
@@ -321,7 +321,8 @@ ElementStyle.prototype = {
/**
* Mark the properties listed in this.rules for a given pseudo element
* with an overridden flag if an earlier property overrides it.
- * @param {string} pseudo
+ *
+ * @param {String} pseudo
* Which pseudo element to flag as overridden.
* Empty string or undefined will default to no pseudo element.
*/
@@ -333,7 +334,7 @@ ElementStyle.prototype = {
// determine if the property is overridden.
let textProps = [];
for (let rule of this.rules) {
- if (rule.pseudoElement == pseudo && !rule.keyframes) {
+ if (rule.pseudoElement === pseudo && !rule.keyframes) {
for (let textProp of rule.textProps.slice(0).reverse()) {
if (textProp.enabled) {
textProps.push(textProp);
@@ -381,7 +382,8 @@ ElementStyle.prototype = {
overridden = !!earlier;
}
- computedProp._overriddenDirty = (!!computedProp.overridden != overridden);
+ computedProp._overriddenDirty =
+ (!!computedProp.overridden !== overridden);
computedProp.overridden = overridden;
if (!computedProp.overridden && computedProp.textProp.enabled) {
taken[computedProp.name] = computedProp;
@@ -406,16 +408,15 @@ ElementStyle.prototype = {
* state of its computed properties. Clears the _overriddenDirty state
* on all computed properties.
*
- * @param {TextProperty} aProp
+ * @param {TextProperty} prop
* The text property to update.
- *
- * @return {bool} true if the TextProperty's overridden state (or any of its
- * computed properties overridden state) changed.
+ * @return {Boolean} true if the TextProperty's overridden state (or any of
+ * its computed properties overridden state) changed.
*/
- _updatePropertyOverridden: function(aProp) {
+ _updatePropertyOverridden: function(prop) {
let overridden = true;
let dirty = false;
- for (let computedProp of aProp.computed) {
+ for (let computedProp of prop.computed) {
if (!computedProp.overridden) {
overridden = false;
}
@@ -423,8 +424,8 @@ ElementStyle.prototype = {
delete computedProp._overriddenDirty;
}
- dirty = (!!aProp.overridden != overridden) || dirty;
- aProp.overridden = overridden;
+ dirty = (!!prop.overridden !== overridden) || dirty;
+ prop.overridden = overridden;
return dirty;
}
};
@@ -432,26 +433,25 @@ ElementStyle.prototype = {
/**
* A single style rule or declaration.
*
- * @param {ElementStyle} aElementStyle
+ * @param {ElementStyle} elementStyle
* The ElementStyle to which this rule belongs.
- * @param {object} aOptions
+ * @param {Object} options
* The information used to construct this rule. Properties include:
* rule: A StyleRuleActor
* inherited: An element this rule was inherited from. If omitted,
* the rule applies directly to the current element.
* isSystem: Is this a user agent style?
- * @constructor
*/
-function Rule(aElementStyle, aOptions) {
- this.elementStyle = aElementStyle;
- this.domRule = aOptions.rule || null;
- this.style = aOptions.rule;
- this.matchedSelectors = aOptions.matchedSelectors || [];
- this.pseudoElement = aOptions.pseudoElement || "";
+function Rule(elementStyle, options) {
+ this.elementStyle = elementStyle;
+ this.domRule = options.rule || null;
+ this.style = options.rule;
+ this.matchedSelectors = options.matchedSelectors || [];
+ this.pseudoElement = options.pseudoElement || "";
- this.isSystem = aOptions.isSystem;
- this.inherited = aOptions.inherited || null;
- this.keyframes = aOptions.keyframes || null;
+ this.isSystem = options.isSystem;
+ this.inherited = options.inherited || null;
+ this.keyframes = options.keyframes || null;
this._modificationDepth = 0;
if (this.domRule && this.domRule.mediaText) {
@@ -549,6 +549,7 @@ Rule.prototype = {
if (this._originalSourceStrings) {
return promise.resolve(this._originalSourceStrings);
}
+
return this.domRule.getOriginalLocation().then(({href, line, mediaText}) => {
let mediaString = mediaText ? " @" + mediaText : "";
@@ -567,30 +568,30 @@ Rule.prototype = {
* Returns true if the rule matches the creation options
* specified.
*
- * @param {object} aOptions
- * Creation options. See the Rule constructor for documentation.
+ * @param {Object} options
+ * Creation options. See the Rule constructor for documentation.
*/
- matches: function(aOptions) {
- return this.style === aOptions.rule;
+ matches: function(options) {
+ return this.style === options.rule;
},
/**
* Create a new TextProperty to include in the rule.
*
- * @param {string} aName
+ * @param {String} name
* The text property name (such as "background" or "border-top").
- * @param {string} aValue
+ * @param {String} value
* The property's value (not including priority).
- * @param {string} aPriority
+ * @param {String} priority
* The property's priority (either "important" or an empty string).
- * @param {TextProperty} aSiblingProp
+ * @param {TextProperty} siblingProp
* Optional, property next to which the new property will be added.
*/
- createProperty: function(aName, aValue, aPriority, aSiblingProp) {
- let prop = new TextProperty(this, aName, aValue, aPriority);
+ createProperty: function(name, value, priority, siblingProp) {
+ let prop = new TextProperty(this, name, value, priority);
- if (aSiblingProp) {
- let ind = this.textProps.indexOf(aSiblingProp);
+ if (siblingProp) {
+ let ind = this.textProps.indexOf(siblingProp);
this.textProps.splice(ind + 1, 0, prop);
} else {
this.textProps.push(prop);
@@ -605,11 +606,11 @@ Rule.prototype = {
* computed styles. Store disabled properties in the element
* style's store. Will re-mark overridden properties.
*/
- applyProperties: function(aModifications) {
+ applyProperties: function(modifications) {
this.elementStyle.markOverriddenAll();
- if (!aModifications) {
- aModifications = this.style.startModifyingProperties();
+ if (!modifications) {
+ modifications = this.style.startModifyingProperties();
}
let disabledProps = [];
@@ -626,7 +627,7 @@ Rule.prototype = {
continue;
}
- aModifications.setProperty(prop.name, prop.value, prop.priority);
+ modifications.setProperty(prop.name, prop.value, prop.priority);
prop.updateComputed();
}
@@ -639,7 +640,7 @@ Rule.prototype = {
disabled.delete(this.style);
}
- let modificationsPromise = aModifications.apply().then(() => {
+ let modificationsPromise = modifications.apply().then(() => {
let cssProps = {};
for (let cssProp of parseDeclarations(this.style.cssText)) {
cssProps[cssProp.name] = cssProp;
@@ -678,55 +679,55 @@ Rule.prototype = {
/**
* Renames a property.
*
- * @param {TextProperty} aProperty
+ * @param {TextProperty} property
* The property to rename.
- * @param {string} aName
+ * @param {String} name
* The new property name (such as "background" or "border-top").
*/
- setPropertyName: function(aProperty, aName) {
- if (aName === aProperty.name) {
+ setPropertyName: function(property, name) {
+ if (name === property.name) {
return;
}
let modifications = this.style.startModifyingProperties();
- modifications.removeProperty(aProperty.name);
- aProperty.name = aName;
- this.applyProperties(modifications, aName);
+ modifications.removeProperty(property.name);
+ property.name = name;
+ this.applyProperties(modifications, name);
},
/**
* Sets the value and priority of a property, then reapply all properties.
*
- * @param {TextProperty} aProperty
+ * @param {TextProperty} property
* The property to manipulate.
- * @param {string} aValue
+ * @param {String} value
* The property's value (not including priority).
- * @param {string} aPriority
+ * @param {String} priority
* The property's priority (either "important" or an empty string).
*/
- setPropertyValue: function(aProperty, aValue, aPriority) {
- if (aValue === aProperty.value && aPriority === aProperty.priority) {
+ setPropertyValue: function(property, value, priority) {
+ if (value === property.value && priority === property.priority) {
return;
}
- aProperty.value = aValue;
- aProperty.priority = aPriority;
- this.applyProperties(null, aProperty.name);
+ property.value = value;
+ property.priority = priority;
+ this.applyProperties(null, property.name);
},
/**
* Just sets the value and priority of a property, in order to preview its
* effect on the content document.
*
- * @param {TextProperty} aProperty
+ * @param {TextProperty} property
* The property which value will be previewed
- * @param {String} aValue
+ * @param {String} value
* The value to be used for the preview
- * @param {String} aPriority
+ * @param {String} priority
* The property's priority (either "important" or an empty string).
*/
- previewPropertyValue: function(aProperty, aValue, aPriority) {
+ previewPropertyValue: function(property, value, priority) {
let modifications = this.style.startModifyingProperties();
- modifications.setProperty(aProperty.name, aValue, aPriority);
+ modifications.setProperty(property.name, value, priority);
modifications.apply().then(() => {
// Ensure dispatching a ruleview-changed event
// also for previews
@@ -737,15 +738,15 @@ Rule.prototype = {
/**
* Disables or enables given TextProperty.
*
- * @param {TextProperty} aProperty
+ * @param {TextProperty} property
* The property to enable/disable
- * @param {Boolean} aValue
+ * @param {Boolean} value
*/
- setPropertyEnabled: function(aProperty, aValue) {
- aProperty.enabled = !!aValue;
+ setPropertyEnabled: function(property, value) {
+ property.enabled = !!value;
let modifications = this.style.startModifyingProperties();
- if (!aProperty.enabled) {
- modifications.removeProperty(aProperty.name);
+ if (!property.enabled) {
+ modifications.removeProperty(property.name);
}
this.applyProperties(modifications);
},
@@ -754,20 +755,20 @@ Rule.prototype = {
* Remove a given TextProperty from the rule and update the rule
* accordingly.
*
- * @param {TextProperty} aProperty
+ * @param {TextProperty} property
* The property to be removed
*/
- removeProperty: function(aProperty) {
- this.textProps = this.textProps.filter(prop => prop != aProperty);
+ removeProperty: function(property) {
+ this.textProps = this.textProps.filter(prop => prop !== property);
let modifications = this.style.startModifyingProperties();
- modifications.removeProperty(aProperty.name);
+ modifications.removeProperty(property.name);
// Need to re-apply properties in case removing this TextProperty
// exposes another one.
this.applyProperties(modifications);
},
/**
- * Get the list of TextProperties from the style. Needs
+ * Get the list of TextProperties from the style. Needs
* to parse the style's cssText.
*/
_getTextProperties: function() {
@@ -817,8 +818,8 @@ Rule.prototype = {
* Reread the current state of the rules and rebuild text
* properties as needed.
*/
- refresh: function(aOptions) {
- this.matchedSelectors = aOptions.matchedSelectors || [];
+ refresh: function(options) {
+ this.matchedSelectors = options.matchedSelectors || [];
let newTextProps = this._getTextProperties();
// Update current properties for each property present on the style.
@@ -872,18 +873,17 @@ Rule.prototype = {
*
* If no existing properties match the property, nothing happens.
*
- * @param {TextProperty} aNewProp
+ * @param {TextProperty} newProp
* The current version of the property, as parsed from the
* cssText in Rule._getTextProperties().
- *
- * @return {bool} true if a property was updated, false if no properties
+ * @return {Boolean} true if a property was updated, false if no properties
* were updated.
*/
- _updateTextProperty: function(aNewProp) {
+ _updateTextProperty: function(newProp) {
let match = { rank: 0, prop: null };
for (let prop of this.textProps) {
- if (prop.name != aNewProp.name) {
+ if (prop.name !== newProp.name) {
continue;
}
@@ -896,9 +896,9 @@ Rule.prototype = {
// Value and Priority matches add 2 to the rank.
// Being enabled adds 1. This ranks better matches higher,
// with priority breaking ties.
- if (prop.value === aNewProp.value) {
+ if (prop.value === newProp.value) {
rank += 2;
- if (prop.priority === aNewProp.priority) {
+ if (prop.priority === newProp.priority) {
rank += 2;
}
}
@@ -925,7 +925,7 @@ Rule.prototype = {
// If we found a match, update its value with the new text property
// value.
if (match.prop) {
- match.prop.set(aNewProp);
+ match.prop.set(newProp);
return true;
}
@@ -941,7 +941,7 @@ Rule.prototype = {
*
* @param {TextProperty} textProperty
* The text property that will be left to focus on a sibling.
- * @param {number} direction
+ * @param {Number} direction
* The move focus direction number.
*/
editClosestTextProperty: function(textProperty, direction) {
@@ -970,7 +970,7 @@ Rule.prototype = {
stringifyRule: function() {
let selectorText = this.selectorText;
let cssText = "";
- let terminator = osString == "WINNT" ? "\r\n" : "\n";
+ let terminator = osString === "WINNT" ? "\r\n" : "\n";
for (let textProp of this.textProps) {
cssText += "\t" + textProp.stringifyProperty() + terminator;
@@ -983,21 +983,20 @@ Rule.prototype = {
/**
* A single property in a rule's cssText.
*
- * @param {Rule} aRule
+ * @param {Rule} rule
* The rule this TextProperty came from.
- * @param {string} aName
+ * @param {String} name
* The text property name (such as "background" or "border-top").
- * @param {string} aValue
+ * @param {String} value
* The property's value (not including priority).
- * @param {string} aPriority
+ * @param {String} priority
* The property's priority (either "important" or an empty string).
- *
*/
-function TextProperty(aRule, aName, aValue, aPriority) {
- this.rule = aRule;
- this.name = aName;
- this.value = aValue;
- this.priority = aPriority;
+function TextProperty(rule, name, value, priority) {
+ this.rule = rule;
+ this.name = name;
+ this.value = value;
+ this.priority = priority;
this.enabled = true;
this.updateComputed();
}
@@ -1034,7 +1033,7 @@ TextProperty.prototype = {
try {
// Manually get all the properties that are set when setting a value on
// this.name and check the computed style on dummyElement for each one.
- // If we just read dummyStyle, it would skip properties when value == "".
+ // If we just read dummyStyle, it would skip properties when value === "".
let subProps = domUtils.getSubpropertiesForCSSProperty(this.name);
for (let prop of subProps) {
@@ -1055,14 +1054,14 @@ TextProperty.prototype = {
* Set all the values from another TextProperty instance into
* this TextProperty instance.
*
- * @param {TextProperty} aOther
+ * @param {TextProperty} prop
* The other TextProperty instance.
*/
- set: function(aOther) {
+ set: function(prop) {
let changed = false;
for (let item of ["name", "value", "priority", "enabled"]) {
- if (this[item] != aOther[item]) {
- this[item] = aOther[item];
+ if (this[item] !== prop[item]) {
+ this[item] = prop[item];
changed = true;
}
}
@@ -1072,31 +1071,31 @@ TextProperty.prototype = {
}
},
- setValue: function(aValue, aPriority, force=false) {
+ setValue: function(value, priority, force=false) {
let store = this.rule.elementStyle.store;
- if (this.editor && aValue !== this.editor.committed.value || force) {
- store.userProperties.setProperty(this.rule.style, this.name, aValue);
+ if (this.editor && value !== this.editor.committed.value || force) {
+ store.userProperties.setProperty(this.rule.style, this.name, value);
}
- this.rule.setPropertyValue(this, aValue, aPriority);
+ this.rule.setPropertyValue(this, value, priority);
this.updateEditor();
},
- setName: function(aName) {
+ setName: function(name) {
let store = this.rule.elementStyle.store;
- if (aName !== this.name) {
- store.userProperties.setProperty(this.rule.style, aName,
+ if (name !== this.name) {
+ store.userProperties.setProperty(this.rule.style, name,
this.editor.committed.value);
}
- this.rule.setPropertyName(this, aName);
+ this.rule.setPropertyName(this, name);
this.updateEditor();
},
- setEnabled: function(aValue) {
- this.rule.setPropertyEnabled(this, aValue);
+ setEnabled: function(value) {
+ this.rule.setPropertyEnabled(this, value);
this.updateEditor();
},
@@ -1143,22 +1142,23 @@ TextProperty.prototype = {
* apply to a given element. After construction, the 'element'
* property will be available with the user interface.
*
- * @param {Inspector} inspector toolbox panel
- * @param {Document} document The document that will contain the rule view.
- * @param {object} aStore
+ * @param {Inspector} inspector
+ * Inspector toolbox panel
+ * @param {Document} document
+ * The document that will contain the rule view.
+ * @param {Object} store
* The CSS rule view can use this object to store metadata
* that might outlast the rule view, particularly the current
* set of disabled properties.
- * @param {PageStyleFront} aPageStyle
+ * @param {PageStyleFront} pageStyle
* The PageStyleFront for communicating with the remote server.
- * @constructor
*/
-function CssRuleView(inspector, document, aStore, aPageStyle) {
+function CssRuleView(inspector, document, store, pageStyle) {
this.inspector = inspector;
this.styleDocument = document;
this.styleWindow = this.styleDocument.defaultView;
- this.store = aStore || {};
- this.pageStyle = aPageStyle;
+ this.store = store || {};
+ this.pageStyle = pageStyle;
this._outputParser = new OutputParser(document);
@@ -1169,7 +1169,8 @@ function CssRuleView(inspector, document, aStore, aPageStyle) {
this._onFilterStyles = this._onFilterStyles.bind(this);
this._onFilterKeyPress = this._onFilterKeyPress.bind(this);
this._onClearSearch = this._onClearSearch.bind(this);
- this._onFilterTextboxContextMenu = this._onFilterTextboxContextMenu.bind(this);
+ this._onFilterTextboxContextMenu =
+ this._onFilterTextboxContextMenu.bind(this);
this._onTogglePseudoClassPanel = this._onTogglePseudoClassPanel.bind(this);
this._onTogglePseudoClass = this._onTogglePseudoClass.bind(this);
@@ -1251,6 +1252,7 @@ CssRuleView.prototype = {
* Get an instance of SelectorHighlighter (used to highlight nodes that match
* selectors in the rule-view). A new instance is only created the first time
* this function is called. The same instance will then be returned.
+ *
* @return {Promise} Resolves to the instance of the highlighter.
*/
getSelectorHighlighter: Task.async(function*() {
@@ -1283,9 +1285,12 @@ CssRuleView.prototype = {
* Calling the method a second time with the same selector will just
* unhighlight the highlighted nodes.
*
- * @param {DOMNode} The icon that was clicked to toggle the selector. The
- * class 'highlighted' will be added when the selector is highlighted.
- * @param {String} The selector used to find nodes in the page.
+ * @param {DOMNode} selectorIcon
+ * The icon that was clicked to toggle the selector. The
+ * class 'highlighted' will be added when the selector is
+ * highlighted.
+ * @param {String} selector
+ * The selector used to find nodes in the page.
*/
toggleSelectorHighlighter: function(selectorIcon, selector) {
if (this.lastSelectorIcon) {
@@ -1334,7 +1339,9 @@ CssRuleView.prototype = {
/**
* Get the type of a given node in the rule-view
- * @param {DOMNode} node The node which we want information about
+ *
+ * @param {DOMNode} node
+ * The node which we want information about
* @return {Object} The type information object contains the following props:
* - type {String} One of the VIEW_NODE_XXX_TYPE const in
* style-inspector-overlays
@@ -1427,7 +1434,9 @@ CssRuleView.prototype = {
/**
* Callback for copy event. Copy the selected text.
- * @param {Event} event copy event object.
+ *
+ * @param {Event} event
+ * copy event object.
*/
_onCopy: function(event) {
if (event) {
@@ -1439,13 +1448,15 @@ CssRuleView.prototype = {
/**
* Copy the current selection. The current target is necessary
* if the selection is inside an input or a textarea
- * @param {DOMNode} target DOMNode target of the copy action
+ *
+ * @param {DOMNode} target
+ * DOMNode target of the copy action
*/
copySelection: function(target) {
try {
let text = "";
- if (target && target.nodeName == "input") {
+ if (target && target.nodeName === "input") {
let start = Math.min(target.selectionStart, target.selectionEnd);
let end = Math.max(target.selectionStart, target.selectionEnd);
let count = end - start;
@@ -1517,16 +1528,18 @@ CssRuleView.prototype = {
this.addRuleButton.disabled = shouldBeDisabled;
},
- setPageStyle: function(aPageStyle) {
- this.pageStyle = aPageStyle;
+ setPageStyle: function(pageStyle) {
+ this.pageStyle = pageStyle;
},
/**
- * Return {bool} true if the rule view currently has an input editor visible.
+ * Return {Boolean} true if the rule view currently has an input
+ * editor visible.
*/
get isEditing() {
- return this.element.querySelectorAll(".styleinspector-propertyeditor").length > 0
- || this.tooltips.isEditing;
+ return this.tooltips.isEditing ||
+ this.element.querySelectorAll(".styleinspector-propertyeditor")
+ .length > 0;
},
_handlePrefChange: function(pref) {
@@ -1698,11 +1711,11 @@ CssRuleView.prototype = {
/**
* Update the view with a new selected element.
*
- * @param {NodeActor} aElement
+ * @param {NodeActor} element
* The node whose style rules we'll inspect.
*/
- selectElement: function(aElement) {
- if (this._viewedElement === aElement) {
+ selectElement: function(element) {
+ if (this._viewedElement === element) {
return promise.resolve(undefined);
}
@@ -1713,7 +1726,7 @@ CssRuleView.prototype = {
this.clear();
this.clearPseudoClassPanel();
- this._viewedElement = aElement;
+ this._viewedElement = element;
this.refreshAddRuleButtonState();
if (!this._viewedElement) {
@@ -1722,15 +1735,15 @@ CssRuleView.prototype = {
return promise.resolve(undefined);
}
- this._elementStyle = new ElementStyle(aElement, this.store,
+ this._elementStyle = new ElementStyle(element, this.store,
this.pageStyle, this.showUserAgentStyles);
return this._elementStyle.init().then(() => {
- if (this._viewedElement === aElement) {
+ if (this._viewedElement === element) {
return this._populate();
}
}).then(() => {
- if (this._viewedElement === aElement) {
+ if (this._viewedElement === element) {
this._elementStyle.onChanged = () => {
this._changed();
};
@@ -1802,7 +1815,7 @@ CssRuleView.prototype = {
_populate: function(clearRules = false) {
let elementStyle = this._elementStyle;
return this._elementStyle.populate().then(() => {
- if (this._elementStyle != elementStyle || this.isDestroyed) {
+ if (this._elementStyle !== elementStyle || this.isDestroyed) {
return;
}
@@ -1896,17 +1909,18 @@ CssRuleView.prototype = {
/**
* Creates an expandable container in the rule view
- * @param {String} aLabel
+ *
+ * @param {String} label
* The label for the container header
* @param {Boolean} isPseudo
* Whether or not the container will hold pseudo element rules
* @return {DOMNode} The container element
*/
- createExpandableContainer: function(aLabel, isPseudo = false) {
+ createExpandableContainer: function(label, isPseudo = false) {
let header = this.styleDocument.createElementNS(HTML_NS, "div");
header.className = this._getRuleViewHeaderClassName(true);
header.classList.add("show-expandable-container");
- header.textContent = aLabel;
+ header.textContent = label;
let twisty = this.styleDocument.createElementNS(HTML_NS, "span");
twisty.className = "ruleview-expander theme-twisty";
@@ -1939,6 +1953,7 @@ CssRuleView.prototype = {
/**
* Toggle the visibility of an expandable container
+ *
* @param {DOMNode} twisty
* clickable toggle DOM Node
* @param {DOMNode} header
@@ -2024,7 +2039,7 @@ CssRuleView.prototype = {
}
let inheritedSource = rule.inheritedSource;
- if (inheritedSource && inheritedSource != lastInheritedSource) {
+ if (inheritedSource && inheritedSource !== lastInheritedSource) {
let div = this.styleDocument.createElementNS(HTML_NS, "div");
div.className = this._getRuleViewHeaderClassName();
div.textContent = inheritedSource;
@@ -2039,7 +2054,7 @@ CssRuleView.prototype = {
}
let keyframes = rule.keyframes;
- if (keyframes && keyframes != lastKeyframes) {
+ if (keyframes && keyframes !== lastKeyframes) {
lastKeyframes = keyframes;
container = this.createExpandableContainer(rule.keyframesName);
}
@@ -2065,7 +2080,7 @@ CssRuleView.prototype = {
* @param {Rule} rule
* The rule object we're highlighting if its rule selectors or
* property values match the search value.
- * @return {bool} true if the rule was highlighted, false otherwise.
+ * @return {Boolean} true if the rule was highlighted, false otherwise.
*/
highlightRule: function(rule) {
let isRuleSelectorHighlighted = this._highlightRuleSelector(rule);
@@ -2088,7 +2103,8 @@ CssRuleView.prototype = {
*
* @param {Rule} rule
* The Rule object.
- * @return {bool} true if the rule selector was highlighted, false otherwise.
+ * @return {Boolean} true if the rule selector was highlighted,
+ * false otherwise.
*/
_highlightRuleSelector: function(rule) {
let isSelectorHighlighted = false;
@@ -2116,7 +2132,7 @@ CssRuleView.prototype = {
* returns a boolean indicating whether or not the stylesheet source was
* highlighted.
*
- * @return {bool} true if the stylesheet source was highlighted, false
+ * @return {Boolean} true if the stylesheet source was highlighted, false
* otherwise.
*/
_highlightStyleSheet: function(rule) {
@@ -2137,8 +2153,8 @@ CssRuleView.prototype = {
*
* @param {TextPropertyEditor} editor
* The rule property TextPropertyEditor object.
- * @return {bool} true if the property or computed property was highlighted,
- * false otherwise.
+ * @return {Boolean} true if the property or computed property was
+ * highlighted, false otherwise.
*/
_highlightProperty: function(editor) {
let isPropertyHighlighted = this._highlightRuleProperty(editor);
@@ -2180,7 +2196,8 @@ CssRuleView.prototype = {
*
* @param {TextPropertyEditor} editor
* The rule property TextPropertyEditor object.
- * @return {bool} true if the rule property was highlighted, false otherwise.
+ * @return {Boolean} true if the rule property was highlighted,
+ * false otherwise.
*/
_highlightRuleProperty: function(editor) {
// Get the actual property value displayed in the rule view
@@ -2205,7 +2222,7 @@ CssRuleView.prototype = {
*
* @param {TextPropertyEditor} editor
* The rule property TextPropertyEditor object.
- * @return {bool} true if the computed property was highlighted, false
+ * @return {Boolean} true if the computed property was highlighted, false
* otherwise.
*/
_highlightComputedProperty: function(editor) {
@@ -2250,7 +2267,7 @@ CssRuleView.prototype = {
* @param {Boolean} propertyMatch
* Whether or not the search term matches a property line like
* `font-family: arial`
- * @return {bool} true if the given search terms match the property, false
+ * @return {Boolean} true if the given search terms match the property, false
* otherwise.
*/
_highlightMatches: function(element, { searchName, searchValue, propertyName,
@@ -2324,7 +2341,7 @@ CssRuleView.prototype = {
* Handle the keypress event in the rule view.
*/
_onKeypress: function(event) {
- let isOSX = Services.appinfo.OS == "Darwin";
+ let isOSX = Services.appinfo.OS === "Darwin";
if (((isOSX && event.metaKey && !event.ctrlKey && !event.altKey) ||
(!isOSX && event.ctrlKey && !event.metaKey && !event.altKey)) &&
@@ -2342,7 +2359,6 @@ CssRuleView.prototype = {
* The CssRuleView containg the document holding this rule editor.
* @param {Rule} aRule
* The Rule object we're editing.
- * @constructor
*/
function RuleEditor(aRuleView, aRule) {
this.ruleView = aRuleView;
@@ -2498,14 +2514,14 @@ RuleEditor.prototype = {
}
} else {
sourceLabel.setAttribute("value", this.rule.title);
- if (this.rule.ruleLine == -1 && this.rule.domRule.parentStyleSheet) {
+ if (this.rule.ruleLine === -1 && this.rule.domRule.parentStyleSheet) {
sourceLabel.parentNode.setAttribute("unselectable", "true");
}
}
let showOrig = Services.prefs.getBoolPref(PREF_ORIG_SOURCES);
if (showOrig && !this.rule.isSystem &&
- this.rule.domRule.type != ELEMENT_STYLE) {
+ this.rule.domRule.type !== ELEMENT_STYLE) {
this.rule.getOriginalSourceStrings().then((strings) => {
sourceLabel.setAttribute("value", strings.short);
sourceLabel.setAttribute("tooltiptext", strings.full);
@@ -2531,7 +2547,7 @@ RuleEditor.prototype = {
this.selectorText.textContent = this.rule.domRule.keyText;
} else {
this.rule.domRule.selectors.forEach((selector, i) => {
- if (i != 0) {
+ if (i !== 0) {
createChild(this.selectorText, "span", {
class: "ruleview-selector-separator",
textContent: ", "
@@ -2586,25 +2602,25 @@ RuleEditor.prototype = {
/**
* Programatically add a new property to the rule.
*
- * @param {string} aName
+ * @param {String} name
* Property name.
- * @param {string} aValue
+ * @param {String} value
* Property value.
- * @param {string} aPriority
+ * @param {String} priority
* Property priority.
- * @param {TextProperty} aSiblingProp
+ * @param {TextProperty} siblingProp
* Optional, property next to which the new property will be added.
* @return {TextProperty}
* The new property
*/
- addProperty: function(aName, aValue, aPriority, aSiblingProp) {
- let prop = this.rule.createProperty(aName, aValue, aPriority, aSiblingProp);
+ addProperty: function(name, value, priority, siblingProp) {
+ let prop = this.rule.createProperty(name, value, priority, siblingProp);
let index = this.rule.textProps.indexOf(prop);
let editor = new TextPropertyEditor(this, prop);
// Insert this node before the DOM node that is currently at its new index
// in the property list. There is currently one less node in the DOM than
- // in the property list, so this causes it to appear after aSiblingProp.
+ // in the property list, so this causes it to appear after siblingProp.
// If there is no node at its index, as is the case where this is the last
// node being inserted, then this behaves as appendChild.
this.propertyList.insertBefore(editor.element,
@@ -2690,9 +2706,9 @@ RuleEditor.prototype = {
/**
* Called when the new property input has been dismissed.
*
- * @param {string} aValue
+ * @param {String} aValue
* The value in the editor.
- * @param {bool} aCommit
+ * @param {Boolean} aCommit
* True if the value should be committed.
*/
_onNewProperty: function(aValue, aCommit) {
@@ -2738,11 +2754,11 @@ RuleEditor.prototype = {
* Ignores the change if the user pressed escape, otherwise
* commits it.
*
- * @param {string} value
+ * @param {String} value
* The value contained in the editor.
- * @param {boolean} commit
+ * @param {Boolean} commit
* True if the change should be applied.
- * @param {number} direction
+ * @param {Number} direction
* The move focus direction number.
*/
_onSelectorDone: function(value, commit, direction) {
@@ -2790,7 +2806,7 @@ RuleEditor.prototype = {
// Remove highlight for modified selector
if (ruleView.highlightedSelector &&
- ruleView.highlightedSelector == this.rule.selectorText) {
+ ruleView.highlightedSelector === this.rule.selectorText) {
ruleView.toggleSelectorHighlighter(ruleView.lastSelectorIcon,
ruleView.highlightedSelector);
}
@@ -2809,11 +2825,11 @@ RuleEditor.prototype = {
*
* @param {Rule} rule
* The Rule object.
- * @param {number} direction
+ * @param {Number} direction
* The move focus direction number.
*/
_moveSelectorFocus: function(rule, direction) {
- if (!direction || direction == Ci.nsIFocusManager.MOVEFOCUS_BACKWARD) {
+ if (!direction || direction === Ci.nsIFocusManager.MOVEFOCUS_BACKWARD) {
return;
}
@@ -2828,18 +2844,17 @@ RuleEditor.prototype = {
/**
* Create a TextPropertyEditor.
*
- * @param {RuleEditor} aRuleEditor
+ * @param {RuleEditor} ruleEditor
* The rule editor that owns this TextPropertyEditor.
- * @param {TextProperty} aProperty
+ * @param {TextProperty} property
* The text property to edit.
- * @constructor
*/
-function TextPropertyEditor(aRuleEditor, aProperty) {
- this.ruleEditor = aRuleEditor;
+function TextPropertyEditor(ruleEditor, property) {
+ this.ruleEditor = ruleEditor;
this.ruleView = this.ruleEditor.ruleView;
this.doc = this.ruleEditor.doc;
this.popup = this.ruleView.popup;
- this.prop = aProperty;
+ this.prop = property;
this.prop.editor = this;
this.browserWindow = this.doc.defaultView.top;
this._populatedComputed = false;
@@ -2964,10 +2979,10 @@ TextPropertyEditor.prototype = {
if (this.ruleEditor.isEditable) {
this.enable.addEventListener("click", this._onEnableClicked, true);
- this.nameContainer.addEventListener("click", (aEvent) => {
+ this.nameContainer.addEventListener("click", (event) => {
// Clicks within the name shouldn't propagate any further.
- aEvent.stopPropagation();
- if (aEvent.target === propertyContainer) {
+ event.stopPropagation();
+ if (event.target === propertyContainer) {
this.nameSpan.click();
}
}, false);
@@ -2986,11 +3001,11 @@ TextPropertyEditor.prototype = {
this.nameContainer.addEventListener("paste",
blurOnMultipleProperties, false);
- propertyContainer.addEventListener("click", (aEvent) => {
+ propertyContainer.addEventListener("click", (event) => {
// Clicks within the value shouldn't propagate any further.
- aEvent.stopPropagation();
+ event.stopPropagation();
- if (aEvent.target === propertyContainer) {
+ if (event.target === propertyContainer) {
this.valueSpan.click();
}
}, false);
@@ -3022,7 +3037,8 @@ TextPropertyEditor.prototype = {
/**
* Get the path from which to resolve requests for this
* rule's stylesheet.
- * @return {string} the stylesheet's href.
+ *
+ * @return {String} the stylesheet's href.
*/
get sheetHref() {
let domRule = this.rule.domRule;
@@ -3034,6 +3050,7 @@ TextPropertyEditor.prototype = {
/**
* Get the URI from which to resolve relative requests for
* this rule's stylesheet.
+ *
* @return {nsIURI} A URI based on the the stylesheet's href.
*/
get sheetURI() {
@@ -3050,8 +3067,10 @@ TextPropertyEditor.prototype = {
/**
* Resolve a URI based on the rule stylesheet
- * @param {string} relativePath the path to resolve
- * @return {string} the resolved path.
+ *
+ * @param {String} relativePath
+ * the path to resolve
+ * @return {String} the resolved path.
*/
resolveURI: function(relativePath) {
if (this.sheetURI) {
@@ -3258,7 +3277,7 @@ TextPropertyEditor.prototype = {
/**
* Handles clicks on the disabled property.
*/
- _onEnableClicked: function(aEvent) {
+ _onEnableClicked: function(event) {
let checked = this.enable.hasAttribute("checked");
if (checked) {
this.enable.removeAttribute("checked");
@@ -3266,7 +3285,7 @@ TextPropertyEditor.prototype = {
this.enable.setAttribute("checked", "");
}
this.prop.setEnabled(!checked);
- aEvent.stopPropagation();
+ event.stopPropagation();
},
/**
@@ -3276,7 +3295,7 @@ TextPropertyEditor.prototype = {
* expand the computed list and tracks whether or not the computed list is
* expanded by manually by the user.
*/
- _onExpandClicked: function(aEvent) {
+ _onExpandClicked: function(event) {
if (this.computed.hasAttribute("filter-open") ||
this.computed.hasAttribute("user-open")) {
this.expander.removeAttribute("open");
@@ -3288,7 +3307,7 @@ TextPropertyEditor.prototype = {
this._populateComputed();
}
- aEvent.stopPropagation();
+ event.stopPropagation();
},
/**
@@ -3320,16 +3339,16 @@ TextPropertyEditor.prototype = {
* Ignores the change if the user pressed escape, otherwise
* commits it.
*
- * @param {string} value
+ * @param {String} value
* The value contained in the editor.
- * @param {boolean} commit
+ * @param {Boolean} commit
* True if the change should be applied.
- * @param {number} direction
+ * @param {Number} direction
* The move focus direction number.
*/
_onNameDone: function(value, commit, direction) {
let isNameUnchanged = (!commit && !this.ruleEditor.isEditing) ||
- this.committed.name == value;
+ this.committed.name === value;
if (this.prop.value && isNameUnchanged) {
return;
}
@@ -3372,7 +3391,7 @@ TextPropertyEditor.prototype = {
* Begin editing next or previous available property given the focus
* direction.
*
- * @param {number} direction
+ * @param {Number} direction
* The move focus direction number.
*/
remove: function(direction) {
@@ -3393,11 +3412,11 @@ TextPropertyEditor.prototype = {
* Called when a value editor closes. If the user pressed escape,
* revert to the value this property had before editing.
*
- * @param {string} value
+ * @param {String} value
* The value contained in the editor.
- * @param {bool} commit
+ * @param {Boolean} commit
* True if the change should be applied.
- * @param {number} direction
+ * @param {Number} direction
* The move focus direction number.
*/
_onValueDone: function(value="", commit, direction) {
@@ -3472,23 +3491,23 @@ TextPropertyEditor.prototype = {
* Example: Calling with "red; width: 100px" would return
* { firstValue: "red", propertiesToAdd: [{ name: "width", value: "100px" }] }
*
- * @param {string} aValue
+ * @param {String} value
* The string to parse
- * @return {object} An object with the following properties:
+ * @return {Object} An object with the following properties:
* firstValue: A string containing a simple value, like
* "red" or "100px!important"
* propertiesToAdd: An array with additional properties, following the
* parseDeclarations format of {name,value,priority}
*/
- _getValueAndExtraProperties: function(aValue) {
+ _getValueAndExtraProperties: function(value) {
// The inplace editor will prevent manual typing of multiple properties,
// but we need to deal with the case during a paste event.
// Adding multiple properties inside of value editor sets value with the
// first, then adds any more onto the property list (below this property).
- let firstValue = aValue;
+ let firstValue = value;
let propertiesToAdd = [];
- let properties = parseDeclarations(aValue);
+ let properties = parseDeclarations(value);
// Check to see if the input string can be parsed as multiple properties
if (properties.length) {
@@ -3514,16 +3533,18 @@ TextPropertyEditor.prototype = {
/**
* Live preview this property, without committing changes.
- * @param {string} aValue The value to set the current property to.
+ *
+ * @param {String} value
+ * The value to set the current property to.
*/
- _previewValue: function(aValue) {
+ _previewValue: function(value) {
// Since function call is throttled, we need to make sure we are still
// editing, and any selector modifications have been completed
if (!this.editing || this.ruleEditor.isEditing) {
return;
}
- let val = parseSingleValue(aValue);
+ let val = parseSingleValue(value);
this.ruleEditor.rule.previewPropertyValue(this.prop, val.value,
val.priority);
},
@@ -3532,7 +3553,7 @@ TextPropertyEditor.prototype = {
* Validate this property. Does it make sense for this value to be assigned
* to this property name? This does not apply the property value
*
- * @return {bool} true if the property value is valid, false otherwise.
+ * @return {Boolean} true if the property value is valid, false otherwise.
*/
isValid: function() {
return domUtils.cssPropertyIsValid(this.prop.name, this.prop.value);
@@ -3551,45 +3572,45 @@ UserProperties.prototype = {
/**
* Get a named property for a given CSSStyleDeclaration.
*
- * @param {CSSStyleDeclaration} aStyle
+ * @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property is mapped.
- * @param {string} aName
+ * @param {String} name
* The name of the property to get.
- * @param {string} aDefault
+ * @param {String} value
* Default value.
- * @return {string}
- * The property value if it has previously been set by the user, null
- * otherwise.
+ * @return {String}
+ * The property value if it has previously been set by the user, null
+ * otherwise.
*/
- getProperty: function(aStyle, aName, aDefault) {
- let key = this.getKey(aStyle);
+ getProperty: function(style, name, value) {
+ let key = this.getKey(style);
let entry = this.map.get(key, null);
- if (entry && aName in entry) {
- return entry[aName];
+ if (entry && name in entry) {
+ return entry[name];
}
- return aDefault;
+ return value;
},
/**
* Set a named property for a given CSSStyleDeclaration.
*
- * @param {CSSStyleDeclaration} aStyle
+ * @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property is to be mapped.
- * @param {String} aName
+ * @param {String} bame
* The name of the property to set.
- * @param {String} aUserValue
+ * @param {String} userValue
* The value of the property to set.
*/
- setProperty: function(aStyle, aName, aUserValue) {
- let key = this.getKey(aStyle, aName);
+ setProperty: function(style, bame, userValue) {
+ let key = this.getKey(style, bame);
let entry = this.map.get(key, null);
if (entry) {
- entry[aName] = aUserValue;
+ entry[bame] = userValue;
} else {
let props = {};
- props[aName] = aUserValue;
+ props[bame] = userValue;
this.map.set(key, props);
}
},
@@ -3597,19 +3618,19 @@ UserProperties.prototype = {
/**
* Check whether a named property for a given CSSStyleDeclaration is stored.
*
- * @param {CSSStyleDeclaration} aStyle
+ * @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property would be mapped.
- * @param {String} aName
+ * @param {String} name
* The name of the property to check.
*/
- contains: function(aStyle, aName) {
- let key = this.getKey(aStyle, aName);
+ contains: function(style, name) {
+ let key = this.getKey(style, name);
let entry = this.map.get(key, null);
- return !!entry && aName in entry;
+ return !!entry && name in entry;
},
- getKey: function(aStyle, aName) {
- return aStyle.actorID + ":" + aName;
+ getKey: function(style, name) {
+ return style.actorID + ":" + name;
},
clear: function() {
@@ -3624,27 +3645,27 @@ UserProperties.prototype = {
/**
* Create a child element with a set of attributes.
*
- * @param {Element} aParent
+ * @param {Element} parent
* The parent node.
- * @param {string} aTag
+ * @param {String} tag
* The tag name.
- * @param {object} aAttributes
+ * @param {Object} attributes
* A set of attributes to set on the node.
*/
-function createChild(aParent, aTag, aAttributes) {
- let elt = aParent.ownerDocument.createElementNS(HTML_NS, aTag);
- for (let attr in aAttributes) {
- if (aAttributes.hasOwnProperty(attr)) {
+function createChild(parent, tag, attributes) {
+ let elt = parent.ownerDocument.createElementNS(HTML_NS, tag);
+ for (let attr in attributes) {
+ if (attributes.hasOwnProperty(attr)) {
if (attr === "textContent") {
- elt.textContent = aAttributes[attr];
+ elt.textContent = attributes[attr];
} else if (attr === "child") {
- elt.appendChild(aAttributes[attr]);
+ elt.appendChild(attributes[attr]);
} else {
- elt.setAttribute(attr, aAttributes[attr]);
+ elt.setAttribute(attr, attributes[attr]);
}
}
}
- aParent.appendChild(elt);
+ parent.appendChild(elt);
return elt;
}
@@ -3696,7 +3717,9 @@ function appendText(aParent, aText) {
* Walk up the DOM from a given node until a parent property holder is found.
* For elements inside the computed property list, the non-computed parent
* property holder will be returned
- * @param {DOMNode} node The node to start from
+ *
+ * @param {DOMNode} node
+ * The node to start from
* @return {DOMNode} The parent property holder node, or null if not found
*/
function getParentTextPropertyHolder(node) {
@@ -3713,7 +3736,8 @@ function getParentTextPropertyHolder(node) {
/**
* For any given node, find the TextProperty it is in if any
- * @param {DOMNode} node The node to start from
+ * @param {DOMNode} node
+ * The node to start from
* @return {TextProperty}
*/
function getParentTextProperty(node) {
@@ -3735,7 +3759,9 @@ function getParentTextProperty(node) {
* and return the textContent for the name and value nodes.
* Stops at the first property found, so if node is inside the computed property
* list, the computed property will be returned
- * @param {DOMNode} node The node to start from
+ *
+ * @param {DOMNode} node
+ * The node to start from
* @return {Object} {name, value}
*/
function getPropertyNameAndValue(node) {
@@ -3761,15 +3787,18 @@ function getPropertyNameAndValue(node) {
* typed, and then by lexing the input and seeing whether the ";"
* would be a terminator at this point.
*
- * @param {number} aKeyCode Key code to be checked.
- * @param {String} aValue Current text editor value.
- * @param {number} aInsertionPoint The index of the insertion point.
+ * @param {Number} keyCode
+ * Key code to be checked.
+ * @param {String} value
+ * Current text editor value.
+ * @param {Number} insertionPoint
+ * The index of the insertion point.
* @return {Boolean} True if the focus should advance; false if
* the character should be inserted.
*/
-function advanceValidate(aKeyCode, aValue, aInsertionPoint) {
+function advanceValidate(keyCode, value, insertionPoint) {
// Only ";" has special handling here.
- if (aKeyCode !== Ci.nsIDOMKeyEvent.DOM_VK_SEMICOLON) {
+ if (keyCode !== Ci.nsIDOMKeyEvent.DOM_VK_SEMICOLON) {
return false;
}
@@ -3777,12 +3806,12 @@ function advanceValidate(aKeyCode, aValue, aInsertionPoint) {
// end up with a ";" symbol token, then the semicolon terminates the
// value. Otherwise it's been inserted in some spot where it has a
// valid meaning, like a comment or string.
- aValue = aValue.slice(0, aInsertionPoint) + ";" +
- aValue.slice(aInsertionPoint);
- let lexer = domUtils.getCSSLexer(aValue);
+ value = value.slice(0, insertionPoint) + ";" +
+ value.slice(insertionPoint);
+ let lexer = domUtils.getCSSLexer(value);
while (true) {
let token = lexer.nextToken();
- if (token.endOffset > aInsertionPoint) {
+ if (token.endOffset > insertionPoint) {
if (token.tokenType === "symbol" && token.text === ";") {
// The ";" is a terminator.
return true;
diff --git a/browser/devtools/styleinspector/style-inspector-menu.js b/browser/devtools/styleinspector/style-inspector-menu.js
index e60bd19744ea..0e1be5b651e1 100644
--- a/browser/devtools/styleinspector/style-inspector-menu.js
+++ b/browser/devtools/styleinspector/style-inspector-menu.js
@@ -11,21 +11,27 @@
const {Cc, Ci, Cu} = require("chrome");
const {PREF_ORIG_SOURCES} = require("devtools/styleeditor/utils");
-loader.lazyRequireGetter(this, "overlays", "devtools/styleinspector/style-inspector-overlays");
+loader.lazyRequireGetter(this, "overlays",
+ "devtools/styleinspector/style-inspector-overlays");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
-loader.lazyServiceGetter(this, "clipboardHelper", "@mozilla.org/widget/clipboardhelper;1", "nsIClipboardHelper");
+loader.lazyServiceGetter(this, "clipboardHelper",
+ "@mozilla.org/widget/clipboardhelper;1", "nsIClipboardHelper");
loader.lazyGetter(this, "_strings", () => {
return Services.strings
.createBundle("chrome://global/locale/devtools/styleinspector.properties");
});
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-const PREF_ENABLE_MDN_DOCS_TOOLTIP = "devtools.inspector.mdnDocsTooltip.enabled";
+const PREF_ENABLE_MDN_DOCS_TOOLTIP =
+ "devtools.inspector.mdnDocsTooltip.enabled";
/**
* Style inspector context menu
- * @param {RuleView|ComputedView} view RuleView or ComputedView instance controlling this menu
- * @param {Object} options menu configuration
+ *
+ * @param {RuleView|ComputedView} view
+ * RuleView or ComputedView instance controlling this menu
+ * @param {Object} options
+ * Option menu configuration
*/
function StyleInspectorMenu(view, options) {
this.view = view;
@@ -189,7 +195,8 @@ StyleInspectorMenu.prototype = {
item.setAttribute("label", _strings.GetStringFromName(attributes.label));
if (attributes.accesskey) {
- item.setAttribute("accesskey", _strings.GetStringFromName(attributes.accesskey));
+ item.setAttribute("accesskey",
+ _strings.GetStringFromName(attributes.accesskey));
}
item.addEventListener("command", attributes.command);
@@ -217,11 +224,14 @@ StyleInspectorMenu.prototype = {
let showOrig = Services.prefs.getBoolPref(PREF_ORIG_SOURCES);
this.menuitemSources.setAttribute("checked", showOrig);
- let enableMdnDocsTooltip = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP);
- this.menuitemShowMdnDocs.hidden = !(enableMdnDocsTooltip && this._isPropertyName());
+ let enableMdnDocsTooltip =
+ Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP);
+ this.menuitemShowMdnDocs.hidden = !(enableMdnDocsTooltip &&
+ this._isPropertyName());
this.menuitemAddRule.hidden = !this.isRuleView;
- this.menuitemAddRule.disabled = !(this.isRuleView && !this.inspector.selection.isAnonymousNode());
+ this.menuitemAddRule.disabled = !this.isRuleView ||
+ this.inspector.selection.isAnonymousNode();
},
/**
@@ -326,6 +336,7 @@ StyleInspectorMenu.prototype = {
/**
* Check if the current node (clicked node) is an image URL
+ *
* @return {Boolean} true if the node is an image url
*/
_isImageUrl: function() {
@@ -338,7 +349,9 @@ StyleInspectorMenu.prototype = {
/**
* Get the DOM Node container for the current popupNode.
- * If popupNode is a textNode, return the parent node, otherwise return popupNode itself.
+ * If popupNode is a textNode, return the parent node, otherwise return
+ * popupNode itself.
+ *
* @return {DOMNode}
*/
_getClickedNode: function() {
@@ -364,7 +377,7 @@ StyleInspectorMenu.prototype = {
/**
* Copy the most recently selected color value to clipboard.
*/
- _onCopy: function(event) {
+ _onCopy: function() {
this.view.copySelection(this.styleDocument.popupNode);
},
@@ -387,7 +400,8 @@ StyleInspectorMenu.prototype = {
},
/**
- * Retrieve the image data for the selected image url and copy it to the clipboard
+ * Retrieve the image data for the selected image url and copy it to the
+ * clipboard
*/
_onCopyImageDataUrl: Task.async(function*() {
if (!this._clickedNodeInfo) {
@@ -401,7 +415,8 @@ StyleInspectorMenu.prototype = {
let data = yield inspectorFront.getImageDataFromURL(imageUrl);
message = yield data.data.string();
} catch (e) {
- message = _strings.GetStringFromName("styleinspector.copyImageDataUrlError");
+ message =
+ _strings.GetStringFromName("styleinspector.copyImageDataUrlError");
}
clipboardHelper.copyString(message);
@@ -473,7 +488,8 @@ StyleInspectorMenu.prototype = {
* Copy the rule of the current clicked node.
*/
_onCopyRule: function() {
- let ruleEditor = this.styleDocument.popupNode.parentNode.offsetParent._ruleEditor;
+ let ruleEditor =
+ this.styleDocument.popupNode.parentNode.offsetParent._ruleEditor;
let rule = ruleEditor.rule;
clipboardHelper.copyString(rule.stringifyRule());
},
@@ -517,11 +533,15 @@ StyleInspectorMenu.prototype = {
this._removeContextMenuItem("menuitemAddRule", this._onAddNewRule);
this._removeContextMenuItem("menuitemCopy", this._onCopy);
this._removeContextMenuItem("menuitemCopyColor", this._onCopyColor);
- this._removeContextMenuItem("menuitemCopyImageDataUrl", this._onCopyImageDataUrl);
+ this._removeContextMenuItem("menuitemCopyImageDataUrl",
+ this._onCopyImageDataUrl);
this._removeContextMenuItem("menuitemCopyLocation", this._onCopyLocation);
- this._removeContextMenuItem("menuitemCopyPropertyDeclaration", this._onCopyPropertyDeclaration);
- this._removeContextMenuItem("menuitemCopyPropertyName", this._onCopyPropertyName);
- this._removeContextMenuItem("menuitemCopyPropertyValue", this._onCopyPropertyValue);
+ this._removeContextMenuItem("menuitemCopyPropertyDeclaration",
+ this._onCopyPropertyDeclaration);
+ this._removeContextMenuItem("menuitemCopyPropertyName",
+ this._onCopyPropertyName);
+ this._removeContextMenuItem("menuitemCopyPropertyValue",
+ this._onCopyPropertyValue);
this._removeContextMenuItem("menuitemCopyRule", this._onCopyRule);
this._removeContextMenuItem("menuitemCopySelector", this._onCopySelector);
this._removeContextMenuItem("menuitemCopyUrl", this._onCopyUrl);
diff --git a/browser/devtools/styleinspector/style-inspector-overlays.js b/browser/devtools/styleinspector/style-inspector-overlays.js
index 29c2598e9749..9702c003ade2 100644
--- a/browser/devtools/styleinspector/style-inspector-overlays.js
+++ b/browser/devtools/styleinspector/style-inspector-overlays.js
@@ -20,9 +20,8 @@ const {
CssDocsTooltip,
SwatchFilterTooltip
} = require("devtools/shared/widgets/Tooltip");
-const {CssLogic} = require("devtools/styleinspector/css-logic");
const EventEmitter = require("devtools/toolkit/event-emitter");
-const {Promise:promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
+const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@@ -41,8 +40,9 @@ const VIEW_NODE_LOCATION_TYPE = exports.VIEW_NODE_LOCATION_TYPE = 5;
/**
* Manages all highlighters in the style-inspector.
- * @param {CssRuleView|CssComputedView} view Either the rule-view or computed-view
- * panel
+ *
+ * @param {CssRuleView|CssComputedView} view
+ * Either the rule-view or computed-view panel
*/
function HighlightersOverlay(view) {
this.view = view;
@@ -60,7 +60,8 @@ function HighlightersOverlay(view) {
// Only initialize the overlay if at least one of the highlighter types is
// supported
- this.supportsHighlighters = this.highlighterUtils.supportsCustomHighlighters();
+ this.supportsHighlighters =
+ this.highlighterUtils.supportsCustomHighlighters();
EventEmitter.decorate(this);
}
@@ -138,13 +139,14 @@ HighlightersOverlay.prototype = {
}
},
- _onMouseLeave: function(event) {
+ _onMouseLeave: function() {
this._lastHovered = null;
this._hideCurrent();
},
/**
* Is the current hovered node a css transform property value in the rule-view
+ *
* @param {Object} nodeInfo
* @return {Boolean}
*/
@@ -160,6 +162,7 @@ HighlightersOverlay.prototype = {
/**
* Is the current hovered node a css transform property value in the
* computed-view
+ *
* @param {Object} nodeInfo
* @return {Boolean}
*/
@@ -231,8 +234,9 @@ HighlightersOverlay.prototype = {
/**
* Manages all tooltips in the style-inspector.
- * @param {CssRuleView|CssComputedView} view Either the rule-view or computed-view
- * panel
+ *
+ * @param {CssRuleView|CssComputedView} view
+ * Either the rule-view or computed-view panel
*/
function TooltipsOverlay(view) {
this.view = view;
@@ -263,21 +267,23 @@ TooltipsOverlay.prototype = {
return;
}
+ let panelDoc = this.view.inspector.panelDoc;
+
// Image, fonts, ... preview tooltip
- this.previewTooltip = new Tooltip(this.view.inspector.panelDoc);
+ this.previewTooltip = new Tooltip(panelDoc);
this.previewTooltip.startTogglingOnHover(this.view.element,
this._onPreviewTooltipTargetHover.bind(this));
// MDN CSS help tooltip
- this.cssDocs = new CssDocsTooltip(this.view.inspector.panelDoc);
+ this.cssDocs = new CssDocsTooltip(panelDoc);
if (this.isRuleView) {
// Color picker tooltip
- this.colorPicker = new SwatchColorPickerTooltip(this.view.inspector.panelDoc);
+ this.colorPicker = new SwatchColorPickerTooltip(panelDoc);
// Cubic bezier tooltip
- this.cubicBezier = new SwatchCubicBezierTooltip(this.view.inspector.panelDoc);
+ this.cubicBezier = new SwatchCubicBezierTooltip(panelDoc);
// Filter editor tooltip
- this.filterEditor = new SwatchFilterTooltip(this.view.inspector.panelDoc);
+ this.filterEditor = new SwatchFilterTooltip(panelDoc);
}
this._isStarted = true;
@@ -317,15 +323,17 @@ TooltipsOverlay.prototype = {
/**
* Given a hovered node info, find out which type of tooltip should be shown,
* if any
+ *
* @param {Object} nodeInfo
* @return {String} The tooltip type to be shown, or null
*/
- _getTooltipType: function({type, value:prop}) {
+ _getTooltipType: function({type, value: prop}) {
let tooltipType = null;
let inspector = this.view.inspector;
// Image preview tooltip
- if (type === VIEW_NODE_IMAGE_URL_TYPE && inspector.hasUrlToImageDataResolver) {
+ if (type === VIEW_NODE_IMAGE_URL_TYPE &&
+ inspector.hasUrlToImageDataResolver) {
tooltipType = TOOLTIP_IMAGE_TYPE;
}
@@ -341,10 +349,11 @@ TooltipsOverlay.prototype = {
},
/**
- * Executed by the tooltip when the pointer hovers over an element of the view.
- * Used to decide whether the tooltip should be shown or not and to actually
- * put content in it.
+ * Executed by the tooltip when the pointer hovers over an element of the
+ * view. Used to decide whether the tooltip should be shown or not and to
+ * actually put content in it.
* Checks if the hovered target is a css value we support tooltips for.
+ *
* @param {DOMNode} target The currently hovered node
*/
_onPreviewTooltipTargetHover: function(target) {
diff --git a/browser/devtools/styleinspector/style-inspector.js b/browser/devtools/styleinspector/style-inspector.js
index aa70e329d53c..326b2b492dbb 100644
--- a/browser/devtools/styleinspector/style-inspector.js
+++ b/browser/devtools/styleinspector/style-inspector.js
@@ -4,22 +4,29 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+/* globals RuleView, ComputedView, gDevTools */
+
+"use strict";
+
const {Cc, Cu, Ci} = require("chrome");
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
const {Tools} = require("main");
Cu.import("resource://gre/modules/Services.jsm");
const {PREF_ORIG_SOURCES} = require("devtools/styleeditor/utils");
-loader.lazyGetter(this, "gDevTools", () => Cu.import("resource:///modules/devtools/gDevTools.jsm", {}).gDevTools);
-loader.lazyGetter(this, "RuleView", () => require("devtools/styleinspector/rule-view"));
-loader.lazyGetter(this, "ComputedView", () => require("devtools/styleinspector/computed-view"));
+loader.lazyGetter(this, "gDevTools", () =>
+ Cu.import("resource:///modules/devtools/gDevTools.jsm", {}).gDevTools);
+loader.lazyGetter(this, "RuleView",
+ () => require("devtools/styleinspector/rule-view"));
+loader.lazyGetter(this, "ComputedView",
+ () => require("devtools/styleinspector/computed-view"));
loader.lazyGetter(this, "_strings", () => Services.strings
.createBundle("chrome://global/locale/devtools/styleinspector.properties"));
// This module doesn't currently export any symbols directly, it only
// registers inspector tools.
-function RuleViewTool(inspector, window, iframe) {
+function RuleViewTool(inspector, window) {
this.inspector = inspector;
this.document = window.document;
@@ -47,7 +54,6 @@ function RuleViewTool(inspector, window, iframe) {
this.onSelected();
}
-
RuleViewTool.prototype = {
isSidebarActive: function() {
if (!this.view) {
@@ -59,12 +65,14 @@ RuleViewTool.prototype = {
onSelected: function(event) {
// Ignore the event if the view has been destroyed, or if it's inactive.
// But only if the current selection isn't null. If it's been set to null,
- // let the update go through as this is needed to empty the view on navigation.
+ // let the update go through as this is needed to empty the view on
+ // navigation.
if (!this.view) {
return;
}
- let isInactive = !this.isSidebarActive() && this.inspector.selection.nodeFront;
+ let isInactive = !this.isSidebarActive() &&
+ this.inspector.selection.nodeFront;
if (isInactive) {
return;
}
@@ -79,7 +87,8 @@ RuleViewTool.prototype = {
if (!event || event == "new-node-front") {
let done = this.inspector.updating("rule-view");
- this.view.selectElement(this.inspector.selection.nodeFront).then(done, done);
+ this.view.selectElement(this.inspector.selection.nodeFront)
+ .then(done, done);
}
},
@@ -109,7 +118,6 @@ RuleViewTool.prototype = {
// Chrome stylesheets are not listed in the style editor, so show
// these sheets in the view source window instead.
if (!sheet || sheet.isSystem) {
- let contentDoc = this.inspector.selection.document;
let href = rule.nodeHref || rule.href;
let toolbox = gDevTools.getToolbox(this.inspector.target);
toolbox.viewSource(href, rule.line);
@@ -129,7 +137,7 @@ RuleViewTool.prototype = {
});
}
return;
- })
+ });
},
onPropertyChanged: function() {
@@ -157,11 +165,12 @@ RuleViewTool.prototype = {
}
};
-function ComputedViewTool(inspector, window, iframe) {
+function ComputedViewTool(inspector, window) {
this.inspector = inspector;
this.document = window.document;
- this.view = new ComputedView.CssComputedView(this.inspector, this.document, this.inspector.pageStyle);
+ this.view = new ComputedView.CssComputedView(this.inspector, this.document,
+ this.inspector.pageStyle);
this.onSelected = this.onSelected.bind(this);
this.refresh = this.refresh.bind(this);
@@ -181,7 +190,7 @@ function ComputedViewTool(inspector, window, iframe) {
ComputedViewTool.prototype = {
isSidebarActive: function() {
if (!this.view) {
- return;
+ return false;
}
return this.inspector.sidebar.getCurrentTabID() == "computedview";
},
@@ -189,12 +198,14 @@ ComputedViewTool.prototype = {
onSelected: function(event) {
// Ignore the event if the view has been destroyed, or if it's inactive.
// But only if the current selection isn't null. If it's been set to null,
- // let the update go through as this is needed to empty the view on navigation.
+ // let the update go through as this is needed to empty the view on
+ // navigation.
if (!this.view) {
return;
}
- let isInactive = !this.isSidebarActive() && this.inspector.selection.nodeFront;
+ let isInactive = !this.isSidebarActive() &&
+ this.inspector.selection.nodeFront;
if (isInactive) {
return;
}
diff --git a/browser/devtools/styleinspector/test/browser.ini b/browser/devtools/styleinspector/test/browser.ini
index a4eb8aa305f8..6b8e7402c277 100644
--- a/browser/devtools/styleinspector/test/browser.ini
+++ b/browser/devtools/styleinspector/test/browser.ini
@@ -74,8 +74,8 @@ support-files =
[browser_ruleview_completion-existing-property_02.js]
[browser_ruleview_completion-new-property_01.js]
[browser_ruleview_completion-new-property_02.js]
-[browser_ruleview_computed_01.js]
-[browser_ruleview_computed_02.js]
+[browser_ruleview_computed-lists_01.js]
+[browser_ruleview_computed-lists_02.js]
[browser_ruleview_completion-popup-hidden-after-navigation.js]
[browser_ruleview_content_01.js]
[browser_ruleview_content_02.js]
@@ -117,7 +117,9 @@ skip-if = e10s # Bug 1039528: "inspect element" contextual-menu doesn't work wit
[browser_ruleview_filtereditor-commit-on-ENTER.js]
[browser_ruleview_filtereditor-revert-on-ESC.js]
skip-if = (os == "win" && debug) || e10s # bug 963492: win. bug 1040653: e10s.
-[browser_ruleview_inherit.js]
+[browser_ruleview_inherited-properties_01.js]
+[browser_ruleview_inherited-properties_02.js]
+[browser_ruleview_inherited-properties_03.js]
[browser_ruleview_keybindings.js]
[browser_ruleview_keyframes-rule_01.js]
[browser_ruleview_keyframes-rule_02.js]
diff --git a/browser/devtools/styleinspector/test/browser_computedview_browser-styles.js b/browser/devtools/styleinspector/test/browser_computedview_browser-styles.js
index b0ca3a74521a..ac6bd5cf5fb1 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_browser-styles.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_browser-styles.js
@@ -6,20 +6,18 @@
// Tests that the checkbox to include browser styles works properly.
+const TEST_URI = `
+
+ Some styled text
+`;
+
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,default styles test");
-
- info("Creating the test document");
- content.document.body.innerHTML = '' +
- 'Some styled text' +
- '
"
-].join("\n");
+const TEST_URI = `
+
+ Some styled text
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," +
- "Computed view color cycling test.");
- content.document.body.innerHTML = PAGE_CONTENT;
-
- info("Opening the computed view");
- let {toolbox, inspector, view} = yield openComputedView();
-
- info("Selecting the test node");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openComputedView();
yield selectNode("#matches", inspector);
info("Checking the property itself");
@@ -42,27 +38,32 @@ function checkColorCycling(container, inspector) {
is(valueNode.textContent, "#F00", "Color displayed as a hex value.");
// HSL
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "hsl(0, 100%, 50%)",
"Color displayed as an HSL value.");
// RGB
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "rgb(255, 0, 0)",
"Color displayed as an RGB value.");
// Color name
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "red",
"Color displayed as a color name.");
// "Authored" (currently the computed value)
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "rgb(255, 0, 0)",
"Color displayed as an RGB value.");
// Back to hex
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "#F00",
"Color displayed as hex again.");
}
diff --git a/browser/devtools/styleinspector/test/browser_computedview_getNodeInfo.js b/browser/devtools/styleinspector/test/browser_computedview_getNodeInfo.js
index b62e323c376e..0efa17b8542a 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_getNodeInfo.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_getNodeInfo.js
@@ -4,15 +4,15 @@
"use strict";
-// Test various output of the computed-view's getNodeInfo method.
+// Tests various output of the computed-view's getNodeInfo method.
// This method is used by the style-inspector-overlay on mouseover to decide
-// which tooltip or highlighter to show when hovering over a value/name/selector
-// if any.
+// which tooltip or highlighter to show when hovering over a
+// value/name/selector if any.
// For instance, browser_ruleview_selector-highlighter_01.js and
// browser_ruleview_selector-highlighter_02.js test that the selector
// highlighter appear when hovering over a selector in the rule-view.
-// Since the code to make this work for the computed-view is 90% the same, there
-// is no need for testing it again here.
+// Since the code to make this work for the computed-view is 90% the same,
+// there is no need for testing it again here.
// This test however serves as a unit test for getNodeInfo.
const {
@@ -22,23 +22,23 @@ const {
VIEW_NODE_IMAGE_URL_TYPE
} = require("devtools/styleinspector/style-inspector-overlays");
-const PAGE_CONTENT = [
- '',
- '
Test element
'
-].join("\n");
+const TEST_URI = `
+
+
Test element
+`;
// Each item in this array must have the following properties:
// - desc {String} will be logged for information
@@ -102,7 +102,8 @@ const TEST_DATA = [
ok("property" in nodeInfo.value);
ok("value" in nodeInfo.value);
is(nodeInfo.value.property, "background-image");
- is(nodeInfo.value.value, "url(\"chrome://global/skin/icons/warning-64.png\")");
+ is(nodeInfo.value.value,
+ "url(\"chrome://global/skin/icons/warning-64.png\")");
is(nodeInfo.value.url, "chrome://global/skin/icons/warning-64.png");
}
},
@@ -164,8 +165,7 @@ const TEST_DATA = [
];
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openComputedView();
yield selectNode("#testElement", inspector);
diff --git a/browser/devtools/styleinspector/test/browser_computedview_keybindings_01.js b/browser/devtools/styleinspector/test/browser_computedview_keybindings_01.js
index 0a805bd62898..a5b92394aa48 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_keybindings_01.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_keybindings_01.js
@@ -4,20 +4,20 @@
"use strict";
-// Test computed view key bindings
+// Tests computed view key bindings.
+
+const TEST_URI = `
+
+ Some styled text
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,default styles test");
-
- info("Adding content to the test page");
- content.document.body.innerHTML = '' +
- 'Some styled text' +
- '
';
-
- let {toolbox, inspector, view} = yield openComputedView();
-
- info("Selecting the test node");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openComputedView();
yield selectNode(".matches", inspector);
let propView = getFirstVisiblePropertyView(view);
@@ -29,8 +29,10 @@ add_task(function*() {
EventUtils.synthesizeMouseAtCenter(matchedExpander, {}, view.styleWindow);
yield onMatchedExpanderFocus;
- yield checkToggleKeyBinding(view.styleWindow, "VK_SPACE", rulesTable, inspector);
- yield checkToggleKeyBinding(view.styleWindow, "VK_RETURN", rulesTable, inspector);
+ yield checkToggleKeyBinding(view.styleWindow, "VK_SPACE", rulesTable,
+ inspector);
+ yield checkToggleKeyBinding(view.styleWindow, "VK_RETURN", rulesTable,
+ inspector);
yield checkHelpLinkKeybinding(view);
});
@@ -48,7 +50,8 @@ function getFirstVisiblePropertyView(view) {
}
function* checkToggleKeyBinding(win, key, rulesTable, inspector) {
- info("Pressing " + key + " key a couple of times to check that the property gets expanded/collapsed");
+ info("Pressing " + key + " key a couple of times to check that the " +
+ "property gets expanded/collapsed");
let onExpand = inspector.once("computed-view-property-expanded");
let onCollapse = inspector.once("computed-view-property-collapsed");
@@ -69,7 +72,7 @@ function checkHelpLinkKeybinding(view) {
let def = promise.defer();
let propView = getFirstVisiblePropertyView(view);
- propView.mdnLinkClick = function(aEvent) {
+ propView.mdnLinkClick = function() {
ok(true, "Pressing F1 opened the MDN link");
def.resolve();
};
diff --git a/browser/devtools/styleinspector/test/browser_computedview_keybindings_02.js b/browser/devtools/styleinspector/test/browser_computedview_keybindings_02.js
index e7c3e9a6f008..2efe0e725333 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_keybindings_02.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_keybindings_02.js
@@ -4,33 +4,37 @@
"use strict";
-// Tests the computed-view keyboard navigation
+// Tests the computed-view keyboard navigation.
+
+const TEST_URI = `
+
+
+
Some header text
+
hi.
+
I am a test-case. This text exists
+ solely to provide some things to
+ highlight and count
+ style list-items in the box at right. If you are reading this,
+ you should go do something else instead. Maybe read a book. Or better
+ yet, write some test-cases for another bit of code.
+ some text
I am a test-case. This text exists ' +
- 'solely to provide some things to ' +
- 'highlight and count ' +
- 'style list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- 'some text
\n' +
- '
more text
\n' +
- '
even more text
' +
- '
';
- content.document.title = "Computed view keyboard navigation test";
-
- info("Opening the computed-view");
- let {toolbox, inspector, view} = yield openComputedView();
-
- info("Selecting the test node");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openComputedView();
yield selectNode("span", inspector);
info("Selecting the first computed style in the list");
diff --git a/browser/devtools/styleinspector/test/browser_computedview_matched-selectors-toggle.js b/browser/devtools/styleinspector/test/browser_computedview_matched-selectors-toggle.js
index 7238b315bc91..5b3b2d92a695 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_matched-selectors-toggle.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_matched-selectors-toggle.js
@@ -4,29 +4,20 @@
"use strict";
-// Test that the computed view properties can be expanded and collapsed with
-// either the twisty or by dbl-clicking on the container
+// Tests that the computed view properties can be expanded and collapsed with
+// either the twisty or by dbl-clicking on the container.
-const TEST_URL = "data:text/html;charset=utf-8," + encodeURIComponent([
- '' +
- '' +
- ' Computed view toggling test',
- ' ',
- '',
- '',
- '
");
-
- info("Opening the computed-view");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {toolbox, inspector, view} = yield openComputedView();
-
- info("Selecting the test node");
yield selectNode("h1", inspector);
let win = view.styleWindow;
diff --git a/browser/devtools/styleinspector/test/browser_computedview_search-filter_escape-keypress.js b/browser/devtools/styleinspector/test/browser_computedview_search-filter_escape-keypress.js
index b85654a70dde..28887af90387 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_search-filter_escape-keypress.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_search-filter_escape-keypress.js
@@ -6,18 +6,18 @@
// Tests that search filter escape keypress will clear the search field.
-let TEST_URI = [
- '',
- 'Some styled text'
-].join("\n");
+const TEST_URI = `
+
+ Some styled text
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openComputedView();
+ let {inspector, view} = yield openComputedView();
yield selectNode("#matches", inspector);
yield testAddTextInFilter(inspector, view);
yield testEscapeKeypress(inspector, view);
diff --git a/browser/devtools/styleinspector/test/browser_computedview_select-and-copy-styles.js b/browser/devtools/styleinspector/test/browser_computedview_select-and-copy-styles.js
index dc111c179b61..82aa095f835b 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_select-and-copy-styles.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_select-and-copy-styles.js
@@ -4,40 +4,42 @@
"use strict";
-// Tests that properties can be selected and copied from the computed view
+// Tests that properties can be selected and copied from the computed view.
XPCOMUtils.defineLazyGetter(this, "osString", function() {
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
});
+const TEST_URI = `
+
+
+
Some header text
+
hi.
+
I am a test-case. This text exists
+ solely to provide some things to
+ highlight and count
+ style list-items in the box at right. If you are reading this,
+ you should go do something else instead. Maybe read a book. Or better
+ yet, write some test-cases for another bit of code.
+ some text
+
more text
+
even more text
+
+`;
+
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,computed view copy test");
-
- info("Creating the test document");
- content.document.body.innerHTML = '
\n' +
- '
Some header text
\n' +
- '
hi.
\n' +
- '
I am a test-case. This text exists ' +
- 'solely to provide some things to ' +
- 'highlight and count ' +
- 'style list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- 'some text
\n' +
- '
more text
\n' +
- '
even more text
' +
- '
';
- content.document.title = "Computed view context menu test";
-
- info("Opening the computed view");
- let {toolbox, inspector, view} = yield openComputedView();
-
- info("Selecting the test node");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openComputedView();
yield selectNode("span", inspector);
-
yield checkCopySelection(view);
yield checkSelectAll(view);
});
@@ -54,7 +56,8 @@ function checkCopySelection(view) {
range.setEnd(props[3], 3);
contentDocument.defaultView.getSelection().addRange(range);
- info("Checking that cssHtmlTree.siBoundCopy() returns the correct clipboard value");
+ info("Checking that cssHtmlTree.siBoundCopy() returns the correct " +
+ "clipboard value");
let expectedPattern = "font-family: helvetica,sans-serif;[\\r\\n]+" +
"font-size: 16px;[\\r\\n]+" +
@@ -75,7 +78,8 @@ function checkSelectAll(view) {
let contentDoc = view.styleDocument;
let prop = contentDoc.querySelector(".property-view");
- info("Checking that _onSelectAll() then copy returns the correct clipboard value");
+ info("Checking that _onSelectAll() then copy returns the correct " +
+ "clipboard value");
view._contextmenu._onSelectAll();
let expectedPattern = "color: #FF0;[\\r\\n]+" +
"font-family: helvetica,sans-serif;[\\r\\n]+" +
diff --git a/browser/devtools/styleinspector/test/browser_computedview_style-editor-link.js b/browser/devtools/styleinspector/test/browser_computedview_style-editor-link.js
index 4a2ad240f188..e74e1aa0677e 100644
--- a/browser/devtools/styleinspector/test/browser_computedview_style-editor-link.js
+++ b/browser/devtools/styleinspector/test/browser_computedview_style-editor-link.js
@@ -11,14 +11,14 @@
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Unknown sheet source");
-// Test the links from the computed view to the style editor
+// Tests the links from the computed view to the style editor.
-const STYLESHEET_URL = "data:text/css,"+encodeURIComponent(
+const STYLESHEET_URL = "data:text/css," + encodeURIComponent(
[".highlight {",
"color: blue",
"}"].join("\n"));
-const DOCUMENT_URL = "data:text/html;charset=utf-8,"+encodeURIComponent(
+const DOCUMENT_URL = "data:text/html;charset=utf-8," + encodeURIComponent(
['' +
'' +
'Computed view style editor link test',
@@ -31,7 +31,7 @@ const DOCUMENT_URL = "data:text/html;charset=utf-8,"+encodeURIComponent(
'',
- '',
+ '',
'',
'',
'
Some header text
',
@@ -52,20 +52,16 @@ const DOCUMENT_URL = "data:text/html;charset=utf-8,"+encodeURIComponent(
add_task(function*() {
yield addTab(DOCUMENT_URL);
-
- info("Opening the computed-view");
let {toolbox, inspector, view} = yield openComputedView();
-
- info("Selecting the test node");
yield selectNode("span", inspector);
- yield testInlineStyle(view, inspector);
+ yield testInlineStyle(view);
yield testFirstInlineStyleSheet(view, toolbox);
yield testSecondInlineStyleSheet(view, toolbox);
yield testExternalStyleSheet(view, toolbox);
});
-function* testInlineStyle(view, inspector) {
+function* testInlineStyle(view) {
info("Testing inline style");
yield expandComputedViewPropertyByIndex(view, 0);
@@ -111,7 +107,8 @@ function* testSecondInlineStyleSheet(view, toolbox) {
clickLinkByIndex(view, 4);
let editor = yield onSelected;
- is(toolbox.currentToolId, "styleeditor", "The style editor is selected again");
+ is(toolbox.currentToolId, "styleeditor",
+ "The style editor is selected again");
validateStyleEditorSheet(editor, 1);
}
@@ -129,14 +126,16 @@ function* testExternalStyleSheet(view, toolbox) {
clickLinkByIndex(view, 1);
let editor = yield onSelected;
- is(toolbox.currentToolId, "styleeditor", "The style editor is selected again");
+ is(toolbox.currentToolId, "styleeditor",
+ "The style editor is selected again");
validateStyleEditorSheet(editor, 2);
}
function validateStyleEditorSheet(editor, expectedSheetIndex) {
info("Validating style editor stylesheet");
let sheet = content.document.styleSheets[expectedSheetIndex];
- is(editor.styleSheet.href, sheet.href, "loaded stylesheet matches document stylesheet");
+ is(editor.styleSheet.href, sheet.href,
+ "loaded stylesheet matches document stylesheet");
}
function clickLinkByIndex(view, index) {
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-property-and-reselect.js b/browser/devtools/styleinspector/test/browser_ruleview_add-property-and-reselect.js
index 03a45e4c6537..08d5fc056a26 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-property-and-reselect.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-property-and-reselect.js
@@ -5,16 +5,13 @@
"use strict";
// Tests that adding properties to rules work and reselecting the element still
-// show them
+// show them.
const TEST_URI = TEST_URL_ROOT + "doc_content_stylesheet.html";
add_task(function*() {
yield addTab(TEST_URI);
-
- let target = getNode("#target");
-
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNode("#target", inspector);
info("Setting a font-weight property on all rules");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_01.js b/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_01.js
index 27e38b17cde4..97106c09f7f7 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_01.js
@@ -4,19 +4,19 @@
"use strict";
-// Tests adding a new property and escapes the new empty property name editor
+// Tests adding a new property and escapes the new empty property name editor.
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_02.js b/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_02.js
index 330493bbaf08..36f4574cc9b7 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_02.js
@@ -4,16 +4,16 @@
"use strict";
-// Tests adding a new property and escapes the new empty property value editor
+// Tests adding a new property and escapes the new empty property value editor.
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_03.js b/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_03.js
index d9863b27e786..f4d0e3de9729 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_03.js
@@ -4,19 +4,20 @@
"use strict";
-// Tests adding a new property and escapes the property name editor with a value
+// Tests adding a new property and escapes the property name editor with a
+// value.
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-property-svg.js b/browser/devtools/styleinspector/test/browser_ruleview_add-property-svg.js
index 27379244601c..fe384c51d0a2 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-property-svg.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-property-svg.js
@@ -4,20 +4,15 @@
"use strict";
-// Tests editing SVG styles using the rules view
+// Tests editing SVG styles using the rules view.
let TEST_URL = "chrome://global/skin/icons/warning.svg";
let TEST_SELECTOR = "path";
add_task(function*() {
yield addTab(TEST_URL);
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test element");
+ let {inspector, view} = yield openRuleView();
yield selectNode(TEST_SELECTOR, inspector);
-
yield testCreateNew(view);
});
@@ -45,10 +40,13 @@ function* testCreateNew(ruleView) {
editor = inplaceEditor(ruleView.styleDocument.activeElement);
- is(elementRuleEditor.rule.textProps.length, 1, "Should have created a new text property.");
- is(elementRuleEditor.propertyList.children.length, 1, "Should have created a property editor.");
+ is(elementRuleEditor.rule.textProps.length, 1,
+ "Should have created a new text property.");
+ is(elementRuleEditor.propertyList.children.length, 1,
+ "Should have created a property editor.");
let textProp = elementRuleEditor.rule.textProps[0];
- is(editor, inplaceEditor(textProp.editor.valueSpan), "Should be editing the value span now.");
+ is(editor, inplaceEditor(textProp.editor.valueSpan),
+ "Should be editing the value span now.");
editor.input.value = "red";
let onBlur = once(editor.input, "blur");
@@ -58,5 +56,6 @@ function* testCreateNew(ruleView) {
is(textProp.value, "red", "Text prop should have been changed.");
- is((yield getComputedStyleProperty(TEST_SELECTOR, null, "fill")), "rgb(255, 0, 0)", "The fill was changed to red");
+ is((yield getComputedStyleProperty(TEST_SELECTOR, null, "fill")),
+ "rgb(255, 0, 0)", "The fill was changed to red");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-property_01.js b/browser/devtools/styleinspector/test/browser_ruleview_add-property_01.js
index d720f8479757..f543a152244f 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-property_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-property_01.js
@@ -8,31 +8,22 @@
// FIXME: To be split in several test files, and some of the inplace-editor
// focus/blur/commit/revert stuff should be factored out in head.js
-let TEST_URL = 'url("' + TEST_URL_ROOT + 'doc_test_image.png")';
-let PAGE_CONTENT = [
- '',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,test rule view user changes");
-
- info("Creating the test document");
- content.document.body.innerHTML = PAGE_CONTENT;
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test element");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
-
yield testCreateNew(view);
});
@@ -44,7 +35,8 @@ function* testCreateNew(view) {
info("Focusing a new property name in the rule-view");
let editor = yield focusEditableField(view, elementRuleEditor.closeBrace);
- is(inplaceEditor(elementRuleEditor.newPropSpan), editor, "The new property editor got focused");
+ is(inplaceEditor(elementRuleEditor.newPropSpan), editor,
+ "The new property editor got focused");
let input = editor.input;
info("Entering background-color in the property name editor");
@@ -61,9 +53,12 @@ function* testCreateNew(view) {
editor = inplaceEditor(view.styleDocument.activeElement);
let textProp = elementRuleEditor.rule.textProps[0];
- is(elementRuleEditor.rule.textProps.length, 1, "Created a new text property.");
- is(elementRuleEditor.propertyList.children.length, 1, "Created a property editor.");
- is(editor, inplaceEditor(textProp.editor.valueSpan), "Editing the value span now.");
+ is(elementRuleEditor.rule.textProps.length, 1,
+ "Created a new text property.");
+ is(elementRuleEditor.propertyList.children.length, 1,
+ "Created a property editor.");
+ is(editor, inplaceEditor(textProp.editor.valueSpan),
+ "Editing the value span now.");
info("Entering a value and bluring the field to expect a rule change");
editor.input.value = "#XYZ";
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-property_02.js b/browser/devtools/styleinspector/test/browser_ruleview_add-property_02.js
index 45ff3ef857e5..9c971426348a 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-property_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-property_02.js
@@ -4,25 +4,25 @@
"use strict";
-// Test all sorts of additions and updates of properties in the rule-view
+// Tests all sorts of additions and updates of properties in the rule-view.
// FIXME: TO BE SPLIT IN *MANY* SMALLER TESTS
+const TEST_URI = `
+
+
";
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield testCreateNew(inspector, view);
});
@@ -39,7 +39,8 @@ function* testCreateNew(inspector, ruleView) {
ok(input.selectionStart === 0 && input.selectionEnd === input.value.length,
"Editor contents are selected.");
- // Try clicking on the editor's input again, shouldn't cause trouble (see bug 761665).
+ // Try clicking on the editor's input again, shouldn't cause trouble
+ // (see bug 761665).
EventUtils.synthesizeMouse(input, 1, 1, {}, ruleView.styleWindow);
input.select();
@@ -54,10 +55,13 @@ function* testCreateNew(inspector, ruleView) {
editor = inplaceEditor(ruleView.styleDocument.activeElement);
- is(elementRuleEditor.rule.textProps.length, 1, "Should have created a new text property.");
- is(elementRuleEditor.propertyList.children.length, 1, "Should have created a property editor.");
+ is(elementRuleEditor.rule.textProps.length, 1,
+ "Should have created a new text property.");
+ is(elementRuleEditor.propertyList.children.length, 1,
+ "Should have created a property editor.");
let textProp = elementRuleEditor.rule.textProps[0];
- is(editor, inplaceEditor(textProp.editor.valueSpan), "Should be editing the value span now.");
+ is(editor, inplaceEditor(textProp.editor.valueSpan),
+ "Should be editing the value span now.");
let onMutated = inspector.once("markupmutation");
editor.input.value = "purple";
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_01.js b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_01.js
index 1b5b20d1b8f2..66eaf8fd24c1 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_01.js
@@ -5,22 +5,22 @@
"use strict";
// Tests the behaviour of adding a new rule to the rule view and the
-// various inplace-editor behaviours in the new rule editor
+// various inplace-editor behaviours in the new rule editor.
-let PAGE_CONTENT = [
- '',
- '
Styled Node
',
- 'This is a span',
- 'Multiple classes',
- 'Multiple classes',
- '
Empty
',
- '
Invalid characters in class
',
- '
Invalid characters in id
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+ This is a span
+ Multiple classes
+ Multiple classes
+
Empty
+
Invalid characters in class
+
Invalid characters in id
+`;
const TEST_DATA = [
{ node: "#testid", expected: "#testid" },
@@ -33,12 +33,9 @@ const TEST_DATA = [
];
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(PAGE_CONTENT));
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Iterating over the test data");
for (let data of TEST_DATA) {
yield runTestData(inspector, view, data, "context-menu");
yield runTestData(inspector, view, data, "button");
@@ -47,15 +44,12 @@ add_task(function*() {
function* runTestData(inspector, view, data, method) {
let {node, expected} = data;
- info("Selecting the test element");
yield selectNode(node, inspector);
-
yield addNewRule(inspector, view, method);
-
yield testNewRule(view, expected, 1);
info("Resetting page content");
- content.document.body.innerHTML = PAGE_CONTENT;
+ content.document.body.innerHTML = TEST_URI;
}
function* addNewRule(inspector, view, method) {
@@ -73,11 +67,11 @@ function* addNewRule(inspector, view, method) {
info("Adding the new rule");
view._contextmenu.menuitemAddRule.click();
view._contextmenu._menupopup.hidePopup();
- }
- else {
+ } else {
info("Adding the new rule using the button");
view.addRuleButton.click();
}
+
info("Waiting for rule view to change");
yield view.once("ruleview-changed");
}
@@ -94,7 +88,7 @@ function* testNewRule(view, expected, index) {
is(idRuleEditor.selectorText.textContent, expected,
"Selector text value is as expected: " + expected);
- info("Adding new properties to new rule: " + expected)
+ info("Adding new properties to new rule: " + expected);
let onRuleViewChanged = view.once("ruleview-changed");
idRuleEditor.addProperty("font-weight", "bold", "");
yield onRuleViewChanged;
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_02.js b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_02.js
index 1c38c45e719e..5d32438aaa32 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_02.js
@@ -5,33 +5,25 @@
"use strict";
// Tests the behaviour of adding a new rule to the rule view and editing
-// its selector
+// its selector.
-let PAGE_CONTENT = [
- '',
- '
Styled Node
',
- 'This is a span'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+ This is a span
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(PAGE_CONTENT));
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test element");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- info("Waiting for rule view to update");
let onRuleViewChanged = once(view, "ruleview-changed");
-
- info("Adding the new rule");
view.addRuleButton.click();
-
yield onRuleViewChanged;
yield testEditSelector(view, "span");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_03.js b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_03.js
index 7c8055e98caf..12cef69a64c3 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_03.js
@@ -5,33 +5,25 @@
"use strict";
// Tests the behaviour of adding a new rule to the rule view, adding a new
-// property and editing the selector
+// property and editing the selector.
-let PAGE_CONTENT = [
- '',
- '
Styled Node
',
- 'This is a span'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+ This is a span
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(PAGE_CONTENT));
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test element");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- info("Waiting for rule view to change");
let onRuleViewChanged = once(view, "ruleview-changed");
-
- info("Adding the new rule");
view.addRuleButton.click();
-
yield onRuleViewChanged;
info("Adding new properties to the new rule");
@@ -59,7 +51,7 @@ function* testNewRule(view, expected, index) {
is(idRuleEditor.selectorText.textContent, expected,
"Selector text value is as expected: " + expected);
- info("Adding new properties to new rule: " + expected)
+ info("Adding new properties to new rule: " + expected);
idRuleEditor.addProperty("font-weight", "bold", "");
let textProps = idRuleEditor.rule.textProps;
let lastRule = textProps[textProps.length - 1];
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_04.js b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_04.js
index 479a572a9c52..09767562ff38 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_04.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_04.js
@@ -5,24 +5,21 @@
"use strict";
// Tests if the `Add rule` button disables itself properly for non-element nodes
-// and anonymous element
+// and anonymous element.
-let PAGE_CONTENT = `
+const TEST_URI = `
-
Test Node
`;
+
Test Node
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(PAGE_CONTENT));
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Running test");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield testDisabledButton(inspector, view);
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_pseudo_class.js b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_pseudo_class.js
index 67c3d7e01e74..2b64aabcc76e 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_add-rule_pseudo_class.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_add-rule_pseudo_class.js
@@ -4,9 +4,9 @@
"use strict";
-// Tests adding a rule with pseudo class locks on
+// Tests adding a rule with pseudo class locks on.
-let PAGE_CONTENT = "
Test element
";
+const TEST_URI = "
Test element
";
const EXPECTED_SELECTOR = "#element";
const TEST_DATA = [
@@ -20,15 +20,10 @@ const TEST_DATA = [
];
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(PAGE_CONTENT));
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test element");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#element", inspector);
- info("Iterating over the test data");
for (let data of TEST_DATA) {
yield runTestData(inspector, view, data);
}
@@ -68,7 +63,8 @@ function* setPseudoLocks(inspector, view, pseudoClasses) {
if (pseudoClasses.length == 0) {
return;
}
- for (var pseudoClass of pseudoClasses) {
+
+ for (let pseudoClass of pseudoClasses) {
switch (pseudoClass) {
case ":hover":
view.hoverCheckbox.click();
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_01.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_01.js
index 07df4d898304..86cf55079f44 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_01.js
@@ -4,24 +4,22 @@
"use strict";
-// Test that after a color change, the image preview tooltip in the same
+// Tests that after a color change, the image preview tooltip in the same
// property is displayed and positioned correctly.
// See bug 979292
-const PAGE_CONTENT = [
- '',
- 'Testing the color picker tooltip!'
-].join("\n");
+const TEST_URI = `
+
+ Testing the color picker tooltip!
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
let value = getRuleViewProperty(view, "body", "background").valueSpan;
let swatch = value.querySelectorAll(".ruleview-colorswatch")[1];
let url = value.querySelector(".theme-link");
@@ -30,7 +28,8 @@ add_task(function*() {
function* testImageTooltipAfterColorChange(swatch, url, ruleView) {
info("First, verify that the image preview tooltip works");
- let anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip, url);
+ let anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip,
+ url);
ok(anchor, "The image preview tooltip is shown on the url span");
is(anchor, url, "The anchor returned by the showOnHover callback is correct");
@@ -53,7 +52,8 @@ function* testImageTooltipAfterColorChange(swatch, url, ruleView) {
info("Verify again that the image preview tooltip works");
// After a color change, the property is re-populated, we need to get the new
// dom node
- url = getRuleViewProperty(ruleView, "body", "background").valueSpan.querySelector(".theme-link");
+ url = getRuleViewProperty(ruleView, "body", "background").valueSpan
+ .querySelector(".theme-link");
anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip, url);
ok(anchor, "The image preview tooltip is shown on the url span");
is(anchor, url, "The anchor returned by the showOnHover callback is correct");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_02.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_02.js
index 9a017edcef46..2fdcc379b9c9 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-and-image-tooltip_02.js
@@ -4,25 +4,29 @@
"use strict";
-// Test that after a color change, opening another tooltip, like the image
-// preview doesn't revert the color change in the ruleView.
+// Tests that after a color change, opening another tooltip, like the image
+// preview doesn't revert the color change in the rule view.
// This used to happen when the activeSwatch wasn't reset when the colorpicker
// would hide.
// See bug 979292
+const TEST_URI = `
+
+ Testing the color picker tooltip!
+`;
+
const PAGE_CONTENT = [
- '',
- 'Testing the color picker tooltip!'
+
].join("\n");
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
yield testColorChangeIsntRevertedWhenOtherTooltipIsShown(view);
});
@@ -50,12 +54,14 @@ function* testColorChangeIsntRevertedWhenOtherTooltipIsShown(ruleView) {
let value = getRuleViewProperty(ruleView, "body", "background").valueSpan;
let url = value.querySelector(".theme-link");
onShown = ruleView.tooltips.previewTooltip.once("shown");
- let anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip, url);
+ let anchor = yield isHoverTooltipTarget(ruleView.tooltips.previewTooltip,
+ url);
ruleView.tooltips.previewTooltip.show(anchor);
yield onShown;
info("Image tooltip is shown, verify that the swatch is still correct");
swatch = value.querySelector(".ruleview-colorswatch");
- is(swatch.style.backgroundColor, "rgb(0, 0, 0)", "The swatch's color is correct");
+ is(swatch.style.backgroundColor, "rgb(0, 0, 0)",
+ "The swatch's color is correct");
is(swatch.nextSibling.textContent, "#000", "The color name is correct");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-appears-on-swatch-click.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-appears-on-swatch-click.js
index 806b35f090da..fca90088470d 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-appears-on-swatch-click.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-appears-on-swatch-click.js
@@ -4,24 +4,23 @@
"use strict";
-// Test that color pickers appear when clicking on color swatches
+// Tests that color pickers appear when clicking on color swatches.
-const PAGE_CONTENT = [
- '',
- 'Testing the color picker tooltip!'
-].join("\n");
+const TEST_URI = `
+
+ Testing the color picker tooltip!
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
let cSwatch = getRuleViewProperty(view, "body", "color").valueSpan
.querySelector(".ruleview-colorswatch");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-commit-on-ENTER.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-commit-on-ENTER.js
index cfa5233e5605..21213a6f3201 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-commit-on-ENTER.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-commit-on-ENTER.js
@@ -4,23 +4,23 @@
"use strict";
-// Test that a color change in the color picker is committed when ENTER is pressed
+// Tests that a color change in the color picker is committed when ENTER is
+// pressed.
-const PAGE_CONTENT = [
- '',
- 'Testing the color picker tooltip!'
-].join("\n");
+const TEST_URI = `
+
+ Testing the color picker tooltip!
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
- let swatch = getRuleViewProperty(view, "body" , "border").valueSpan
+ let swatch = getRuleViewProperty(view, "body", "border").valueSpan
.querySelector(".ruleview-colorswatch");
yield testPressingEnterCommitsChanges(swatch, view);
});
@@ -42,7 +42,7 @@ function* testPressingEnterCommitsChanges(swatch, ruleView) {
"The color swatch's background was updated");
is(getRuleViewProperty(ruleView, "body", "border").valueSpan.textContent,
"2em solid rgba(0, 255, 0, 0.5)",
- "The text of the border css property was updated");;
+ "The text of the border css property was updated");
let spectrum = yield cPicker.spectrum;
let onHidden = cPicker.tooltip.once("hidden");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-edit-gradient.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-edit-gradient.js
index ee5bbba7f70e..6e24c9cf9b07 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-edit-gradient.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-edit-gradient.js
@@ -4,26 +4,21 @@
"use strict";
-// Test that changing a color in a gradient css declaration using the tooltip
-// color picker works
+// Tests that changing a color in a gradient css declaration using the tooltip
+// color picker works.
-const PAGE_CONTENT = [
- '',
- 'Updating a gradient declaration with the color picker tooltip'
-].join("\n");
+const TEST_URI = `
+
+ Updating a gradient declaration with the color picker tooltip
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
-
- info("Creating the test document");
- content.document.body.innerHTML = PAGE_CONTENT;
-
- info("Opening the rule-view")
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
info("Testing that the colors in gradient properties are parsed correctly");
testColorParsing(view);
@@ -45,7 +40,7 @@ function testColorParsing(view) {
is(colorEls.length, 3, "There are 3 color values");
let colors = ["#F06", "#333", "#000"];
- for (let i = 0; i < colors.length; i ++) {
+ for (let i = 0; i < colors.length; i++) {
is(colorEls[i].textContent, colors[i], "The right color value was found");
}
}
@@ -73,7 +68,8 @@ function* testPickingNewColor(view) {
"The color swatch's background was updated");
is(colorEl.textContent, "#010101", "The color text was updated");
is(content.getComputedStyle(content.document.body).backgroundImage,
- "linear-gradient(to left, rgb(1, 1, 1) 25%, rgb(51, 51, 51) 95%, rgb(0, 0, 0) 100%)",
+ "linear-gradient(to left, rgb(1, 1, 1) 25%, rgb(51, 51, 51) 95%, " +
+ "rgb(0, 0, 0) 100%)",
"The gradient has been updated correctly");
cPicker.hide();
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-hides-on-tooltip.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-hides-on-tooltip.js
index 369378082302..bf50837db0f3 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-hides-on-tooltip.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-hides-on-tooltip.js
@@ -4,24 +4,23 @@
"use strict";
-// Test that the color picker tooltip hides when an image tooltip appears
+// Tests that the color picker tooltip hides when an image tooltip appears.
-const PAGE_CONTENT = [
- '',
- 'Testing the color picker tooltip!'
-].join("\n");
+const TEST_URI = `
+
+ Testing the color picker tooltip!
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
let swatch = getRuleViewProperty(view, "body", "color").valueSpan
.querySelector(".ruleview-colorswatch");
@@ -30,7 +29,8 @@ add_task(function*() {
});
function* testColorPickerHidesWhenImageTooltipAppears(view, swatch) {
- let bgImageSpan = getRuleViewProperty(view, "body", "background-image").valueSpan;
+ let bgImageSpan = getRuleViewProperty(view, "body", "background-image")
+ .valueSpan;
let uriSpan = bgImageSpan.querySelector(".theme-link");
let tooltip = view.tooltips.colorPicker.tooltip;
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-multiple-changes.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-multiple-changes.js
index d52c03a73e71..58a374f7d56c 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-multiple-changes.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-multiple-changes.js
@@ -4,30 +4,30 @@
"use strict";
-// Test that the color in the colorpicker tooltip can be changed several times
+// Tests that the color in the colorpicker tooltip can be changed several times.
// without causing error in various cases:
// - simple single-color property (color)
// - color and image property (background-image)
// - overridden property
// See bug 979292 and bug 980225
-const PAGE_CONTENT = [
- '',
- '
Testing the color picker tooltip!
'
-].join("\n");
+const TEST_URI = `
+
+
Testing the color picker tooltip!
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield testSimpleMultipleColorChanges(inspector, view);
yield testComplexMultipleColorChanges(inspector, view);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-release-outside-frame.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-release-outside-frame.js
index b86428280f27..8e6c2e9f99ba 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-release-outside-frame.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-release-outside-frame.js
@@ -4,15 +4,14 @@
"use strict";
-// Test that color pickers stops following the pointer if the pointer is
+// Tests that color pickers stops following the pointer if the pointer is
// released outside the tooltip frame (bug 1160720).
-const PAGE_CONTENT = "data:text/html;charset=utf-8," +
- 'Test page for bug 1160720';
+const TEST_URI = "Test page for bug 1160720";
add_task(function*() {
- yield addTab(PAGE_CONTENT);
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
let cSwatch = getRuleViewProperty(view, "element", "color").valueSpan
.querySelector(".ruleview-colorswatch");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-revert-on-ESC.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-revert-on-ESC.js
index 7ac2b0156e3e..fbdd4e41300f 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-revert-on-ESC.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-revert-on-ESC.js
@@ -4,15 +4,16 @@
"use strict";
-// Test that a color change in the color picker is reverted when ESC is pressed
+// Tests that a color change in the color picker is reverted when ESC is
+// pressed.
-let TEST_URI = [
- "",
-].join("\n");
+const TEST_URI = `
+
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-swatch-displayed.js b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-swatch-displayed.js
index 56b94a4636e7..98296ad33565 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-swatch-displayed.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_colorpicker-swatch-displayed.js
@@ -4,25 +4,25 @@
"use strict";
-// Test that color swatches are displayed next to colors in the rule-view
+// Tests that color swatches are displayed next to colors in the rule-view.
-const PAGE_CONTENT = [
- '',
- 'Testing the color picker tooltip!'
-].join("\n");
+const TEST_URI = `
+
+ Testing the color picker tooltip!
+`;
-// Tests that properties in the rule-view contain color swatches
+// Tests that properties in the rule-view contain color swatches.
// Each entry in the test array should contain:
// {
// selector: the rule-view selector to look for the property in
@@ -38,9 +38,8 @@ const TESTS = [
];
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view color picker tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
for (let {selector, propertyName, nb} of TESTS) {
info("Looking for color swatches in property " + propertyName +
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js b/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js
index 683c6776fe74..d6f08f6504cc 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js
@@ -4,8 +4,8 @@
"use strict";
-// Test that CSS property names are autocompleted and cycled correctly when
-// editing an existing property in the rule view
+// Tests that CSS property names are autocompleted and cycled correctly when
+// editing an existing property in the rule view.
const MAX_ENTRIES = 10;
@@ -18,8 +18,8 @@ const MAX_ENTRIES = 10;
// ]
let testData = [
["VK_RIGHT", "font", -1, 0],
- ["-","font-family", 0, MAX_ENTRIES],
- ["f","font-family", 0, 2],
+ ["-", "font-family", 0, MAX_ENTRIES],
+ ["f", "font-family", 0, 2],
["VK_BACK_SPACE", "font-f", -1, 0],
["VK_BACK_SPACE", "font-", -1, 0],
["VK_BACK_SPACE", "font", -1, 0],
@@ -54,11 +54,10 @@ let testData = [
["VK_ESCAPE", null, -1, 0],
];
-let TEST_URL = "data:text/html;charset=utf-8,
- Test the pref to enable/disable the "Show MDN Docs" context menu option
-
-
-`;
+
+
+
+ Test the pref to enable/disable the "Show MDN Docs" context menu option
+
+
+
+`;
add_task(function* () {
info("Ensure the pref is true to begin with");
@@ -95,7 +97,7 @@ function* setBooleanPref(pref, state) {
* menu item to be visible or not.
*/
function* testMdnContextMenuItemVisibility(view, shouldBeVisible) {
- let message = shouldBeVisible? "shown": "hidden";
+ let message = shouldBeVisible ? "shown" : "hidden";
info("Test that MDN context menu item is " + message);
info("Set a CSS property name as popupNode");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_copy_styles.js b/browser/devtools/styleinspector/test/browser_ruleview_copy_styles.js
index 318302efbb9c..967d0e1fa098 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_copy_styles.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_copy_styles.js
@@ -6,14 +6,14 @@
/**
* Tests the behaviour of the copy styles context menu items in the rule
- * view
+ * view.
*/
XPCOMUtils.defineLazyGetter(this, "osString", function() {
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
});
-let TEST_URI = TEST_URL_ROOT + "doc_copystyles.html";
+const TEST_URI = TEST_URL_ROOT + "doc_copystyles.html";
add_task(function*() {
yield addTab(TEST_URI);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-appears-on-swatch-click.js b/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-appears-on-swatch-click.js
index 1e9132b4a48a..f9966dcf3900 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-appears-on-swatch-click.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-appears-on-swatch-click.js
@@ -4,26 +4,26 @@
"use strict";
-// Test that cubic-bezier pickers appear when clicking on cubic-bezier swatches
+// Tests that cubic-bezier pickers appear when clicking on cubic-bezier
+// swatches.
-const PAGE_CONTENT = [
- '',
- '
Testing the cubic-bezier tooltip!
'
-].join("\n");
+const TEST_URI = `
+
+
Testing the cubic-bezier tooltip!
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view cubic-bezier tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("div", inspector);
let swatches = [];
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-commit-on-ENTER.js b/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-commit-on-ENTER.js
index 3095cbfa210d..dea4acc7994d 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-commit-on-ENTER.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-commit-on-ENTER.js
@@ -4,24 +4,23 @@
"use strict";
-// Test that a curve change in the cubic-bezier tooltip is committed when ENTER
-// is pressed
+// Tests that a curve change in the cubic-bezier tooltip is committed when ENTER
+// is pressed.
-const PAGE_CONTENT = [
- ''
-].join("\n");
+const TEST_URI = `
+
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view cubic-bezier tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {view} = yield openRuleView();
info("Getting the bezier swatch element");
- let swatch = getRuleViewProperty(view, "body" , "transition").valueSpan
+ let swatch = getRuleViewProperty(view, "body", "transition").valueSpan
.querySelector(".ruleview-bezierswatch");
yield testPressingEnterCommitsChanges(swatch, view);
@@ -41,7 +40,8 @@ function* testPressingEnterCommitsChanges(swatch, ruleView) {
let expected = "cubic-bezier(0.1, 2, 0.9, -1)";
yield waitForSuccess(() => {
- return content.getComputedStyle(content.document.body).transitionTimingFunction === expected;
+ return content.getComputedStyle(content.document.body)
+ .transitionTimingFunction === expected;
}, "Waiting for the change to be previewed on the element");
ok(getRuleViewProperty(ruleView, "body", "transition").valueSpan.textContent
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-revert-on-ESC.js b/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-revert-on-ESC.js
index d0bbac9db514..6b703667bdf8 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-revert-on-ESC.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_cubicbezier-revert-on-ESC.js
@@ -4,16 +4,16 @@
"use strict";
-// Test that changes made to the cubic-bezier timing-function in the
-// cubic-bezier tooltip are reverted when ESC is pressed
+// Tests that changes made to the cubic-bezier timing-function in the
+// cubic-bezier tooltip are reverted when ESC is pressed.
-let TEST_URI = [
- "",
-].join("\n");
+const TEST_URI = `
+
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_custom.js b/browser/devtools/styleinspector/test/browser_ruleview_custom.js
index 90d15103968f..84a310e12197 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_custom.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_custom.js
@@ -6,7 +6,7 @@
const TEST_URI = TEST_URL_ROOT + "doc_custom.html";
-// Test the display of custom declarations in the rule-view
+// Tests the display of custom declarations in the rule-view.
add_task(function*() {
yield addTab(TEST_URI);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_cycle-color.js b/browser/devtools/styleinspector/test/browser_ruleview_cycle-color.js
index 1124cfe02b26..8c1eb8218f3e 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_cycle-color.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_cycle-color.js
@@ -6,21 +6,18 @@
// Test cycling color types in the rule view.
-const PAGE_CONTENT = [
- "",
- "Test cycling color types in the rule view!"
-].join("\n");
+const TEST_URI = `
+
+ Test cycling color types in the rule view!
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,Test cycling color types in the " +
- "rule view.");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
let container = getRuleViewProperty(view, "body", "color").valueSpan;
checkColorCycling(container, inspector);
});
@@ -34,27 +31,32 @@ function checkColorCycling(container, inspector) {
is(valueNode.textContent, "#F00", "Color displayed as a hex value.");
// HSL
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "hsl(0, 100%, 50%)",
"Color displayed as an HSL value.");
// RGB
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "rgb(255, 0, 0)",
"Color displayed as an RGB value.");
// Color name
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "red",
"Color displayed as a color name.");
// "Authored" (currently the computed value)
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "rgb(255, 0, 0)",
"Color displayed as an RGB value.");
// Back to hex
- EventUtils.synthesizeMouseAtCenter(swatch, {type: "mousedown", shiftKey: true}, win);
+ EventUtils.synthesizeMouseAtCenter(swatch,
+ {type: "mousedown", shiftKey: true}, win);
is(valueNode.textContent, "#F00",
"Color displayed as hex again.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-cancel.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-cancel.js
index 299660374657..91fa3885ef56 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-cancel.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-cancel.js
@@ -7,14 +7,14 @@
// Tests editing a property name or value and escaping will revert the
// changes and restore the original value.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-commit.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-commit.js
index 3124d1bb4e64..2940b29dd365 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-commit.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-commit.js
@@ -7,7 +7,14 @@
// Test original value is correctly displayed when ESCaping out of the
// inplace editor in the style inspector.
-const originalValue = "#00F";
+const TEST_URI = `
+
+
Styled Node
+`;
// Test data format
// {
@@ -17,44 +24,41 @@ const originalValue = "#00F";
// expected: what value is expected as a result
// }
const testData = [
- {value: "red", commitKey: "VK_ESCAPE", modifiers: {}, expected: originalValue},
- {value: "red", commitKey: "VK_RETURN", modifiers: {}, expected: "red"},
- {value: "invalid", commitKey: "VK_RETURN", modifiers: {}, expected: "invalid"},
- {value: "blue", commitKey: "VK_TAB", modifiers: {shiftKey: true}, expected: "blue"}
+ {
+ value: "red",
+ commitKey: "VK_ESCAPE",
+ modifiers: {},
+ expected: "#00F"
+ },
+ {
+ value: "red",
+ commitKey: "VK_RETURN",
+ modifiers: {},
+ expected: "red"
+ },
+ {
+ value: "invalid",
+ commitKey: "VK_RETURN",
+ modifiers: {},
+ expected: "invalid"
+ },
+ {
+ value: "blue",
+ commitKey: "VK_TAB", modifiers: {shiftKey: true},
+ expected: "blue"
+ }
];
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,test escaping property change reverts back to original value");
-
- info("Creating the test document");
- createDocument();
-
- info("Opening the rule view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test node");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- info("Iterating over the test data");
for (let data of testData) {
yield runTestData(view, data);
}
});
-function createDocument() {
- let style = '' +
- '#testid {' +
- ' color: ' + originalValue + ';' +
- '}';
-
- let node = content.document.createElement('style');
- node.setAttribute("type", "text/css");
- node.textContent = style;
- content.document.getElementsByTagName("head")[0].appendChild(node);
-
- content.document.body.innerHTML = '
Styled Node
';
-}
-
function* runTestData(view, {value, commitKey, modifiers, expected}) {
let idRuleEditor = getRuleViewRuleEditor(view, 1);
let propEditor = idRuleEditor.rule.textProps[0].editor;
@@ -62,7 +66,8 @@ function* runTestData(view, {value, commitKey, modifiers, expected}) {
info("Focusing the inplace editor field");
let editor = yield focusEditableField(view, propEditor.valueSpan);
- is(inplaceEditor(propEditor.valueSpan), editor, "Focused editor should be the value span.");
+ is(inplaceEditor(propEditor.valueSpan), editor,
+ "Focused editor should be the value span.");
info("Entering test data " + value);
let onRuleViewChanged = view.once("ruleview-changed");
@@ -79,8 +84,10 @@ function* runTestData(view, {value, commitKey, modifiers, expected}) {
yield onRuleViewChanged;
if (commitKey === "VK_ESCAPE") {
- is(propEditor.valueSpan.textContent, expected, "Value is as expected: " + expected);
+ is(propEditor.valueSpan.textContent, expected,
+ "Value is as expected: " + expected);
} else {
- is(propEditor.valueSpan.textContent, expected, "Value is as expected: " + expected);
+ is(propEditor.valueSpan.textContent, expected,
+ "Value is as expected: " + expected);
}
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-computed.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-computed.js
index f2221f196d07..f37d1f46ff41 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-computed.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-computed.js
@@ -6,16 +6,17 @@
// Test that the computed values of a style (the shorthand expansion) are
// properly updated after the style is changed.
-add_task(function*() {
- let TEST_URI = [
- '',
- '
Styled Node
'
- ].join('\n');
+const TEST_URI = `
+
+
Styled Node
+`;
+
+add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
@@ -30,14 +31,17 @@ function* editAndCheck(view) {
info("Focusing the inplace editor field");
let editor = yield focusEditableField(view, propEditor.valueSpan);
- is(inplaceEditor(propEditor.valueSpan), editor, "Focused editor should be the value span.");
+ is(inplaceEditor(propEditor.valueSpan), editor,
+ "Focused editor should be the value span.");
- let onPropertyChange = waitForComputedStyleProperty("#testid", null, "padding-top", newPaddingValue);
+ let onPropertyChange = waitForComputedStyleProperty("#testid", null,
+ "padding-top", newPaddingValue);
info("Entering a new value");
EventUtils.sendString(newPaddingValue, view.styleWindow);
- info("Waiting for the throttled previewValue to apply the changes to document");
+ info("Waiting for the throttled previewValue to apply the " +
+ "changes to document");
yield onPropertyChange;
let onBlur = once(editor.input, "blur");
@@ -61,15 +65,19 @@ function* editAndCheck(view) {
is(computed.length, propNames.length, "There should be 4 computed values");
propNames.forEach((propName, i) => {
- is(computed[i].name, propName, "Computed property #" + i + " has name " + propName);
- is(computed[i].value, newPaddingValue, "Computed value of " + propName + " is as expected");
+ is(computed[i].name, propName,
+ "Computed property #" + i + " has name " + propName);
+ is(computed[i].value, newPaddingValue,
+ "Computed value of " + propName + " is as expected");
});
propEditor.expander.click();
let computedDom = propEditor.computed;
- is(computedDom.children.length, propNames.length, "There should be 4 nodes in the DOM");
+ is(computedDom.children.length, propNames.length,
+ "There should be 4 nodes in the DOM");
propNames.forEach((propName, i) => {
- is(computedDom.getElementsByClassName("ruleview-propertyvalue")[i].textContent,
- newPaddingValue, "Computed value of " + propName + " in DOM is as expected");
+ is(computedDom.getElementsByClassName("ruleview-propertyvalue")[i]
+ .textContent, newPaddingValue,
+ "Computed value of " + propName + " in DOM is as expected");
});
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-order.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-order.js
index 7cfd6bcd7753..0c088c9d2135 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-order.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-order.js
@@ -4,18 +4,16 @@
"use strict";
-// Checking properties orders and overrides in the rule-view
+// Checking properties orders and overrides in the rule-view.
+
+const TEST_URI = "
Styled Node
";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,browser_ruleview_manipulation.js");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Creating the test document and getting the test node");
- content.document.body.innerHTML = '
Styled Node
';
- let element = getNode("#testid");
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
+ let element = getNode("#testid");
let elementStyle = view._elementStyle;
let elementRule = elementStyle.rules[0];
@@ -23,46 +21,62 @@ add_task(function*() {
let firstProp = elementRule.createProperty("background-color", "green", "");
let secondProp = elementRule.createProperty("background-color", "blue", "");
is(elementRule.textProps[0], firstProp, "Rules should be in addition order.");
- is(elementRule.textProps[1], secondProp, "Rules should be in addition order.");
+ is(elementRule.textProps[1], secondProp,
+ "Rules should be in addition order.");
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "blue", "Second property should have been used.");
+ is(element.style.getPropertyValue("background-color"), "blue",
+ "Second property should have been used.");
info("Removing the second property and checking the applied style again");
secondProp.remove();
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "green", "After deleting second property, first should be used.");
+ is(element.style.getPropertyValue("background-color"), "green",
+ "After deleting second property, first should be used.");
- info("Creating a new second property and checking that the insertion order is still the same");
+ info("Creating a new second property and checking that the insertion order " +
+ "is still the same");
secondProp = elementRule.createProperty("background-color", "blue", "");
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "blue", "New property should be used.");
- is(elementRule.textProps[0], firstProp, "Rules shouldn't have switched places.");
- is(elementRule.textProps[1], secondProp, "Rules shouldn't have switched places.");
+ is(element.style.getPropertyValue("background-color"), "blue",
+ "New property should be used.");
+ is(elementRule.textProps[0], firstProp,
+ "Rules shouldn't have switched places.");
+ is(elementRule.textProps[1], secondProp,
+ "Rules shouldn't have switched places.");
info("Disabling the second property and checking the applied style");
secondProp.setEnabled(false);
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "green", "After disabling second property, first value should be used");
+ is(element.style.getPropertyValue("background-color"), "green",
+ "After disabling second property, first value should be used");
info("Disabling the first property too and checking the applied style");
firstProp.setEnabled(false);
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "", "After disabling both properties, value should be empty.");
+ is(element.style.getPropertyValue("background-color"), "",
+ "After disabling both properties, value should be empty.");
info("Re-enabling the second propertyt and checking the applied style");
secondProp.setEnabled(true);
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "blue", "Value should be set correctly after re-enabling");
+ is(element.style.getPropertyValue("background-color"), "blue",
+ "Value should be set correctly after re-enabling");
- info("Re-enabling the first property and checking the insertion order is still respected");
+ info("Re-enabling the first property and checking the insertion order " +
+ "is still respected");
firstProp.setEnabled(true);
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "blue", "Re-enabling an earlier property shouldn't make it override a later property.");
- is(elementRule.textProps[0], firstProp, "Rules shouldn't have switched places.");
- is(elementRule.textProps[1], secondProp, "Rules shouldn't have switched places.");
+ is(element.style.getPropertyValue("background-color"), "blue",
+ "Re-enabling an earlier property shouldn't make it override " +
+ "a later property.");
+ is(elementRule.textProps[0], firstProp,
+ "Rules shouldn't have switched places.");
+ is(elementRule.textProps[1], secondProp,
+ "Rules shouldn't have switched places.");
info("Modifying the first property and checking the applied style");
firstProp.setValue("purple", "");
yield elementRule._applyingModifications;
- is(element.style.getPropertyValue("background-color"), "blue", "Modifying an earlier property shouldn't override a later property.");
+ is(element.style.getPropertyValue("background-color"), "blue",
+ "Modifying an earlier property shouldn't override a later property.");
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_01.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_01.js
index 96562556906e..2fdf8031312f 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_01.js
@@ -8,15 +8,15 @@
// return key, and checks if the focus is moved to the appropriate editable
// field.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_02.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_02.js
index 524cd908760c..e9a9d2bf7bbb 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_02.js
@@ -8,15 +8,15 @@
// return key, and checks if the focus is moved to the appropriate editable
// field.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_03.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_03.js
index 92d8faa626a8..53ad3c4ec405 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property-remove_03.js
@@ -7,15 +7,16 @@
// Tests removing a property by clearing the property name and pressing shift
// and tab keys, and checks if the focus is moved to the appropriate editable
// field.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_01.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_01.js
index 5517e212d4f7..b2d774c570b4 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_01.js
@@ -9,20 +9,21 @@
// FIXME: some of the inplace-editor focus/blur/commit/revert stuff
// should be factored out in head.js
+const TEST_URI = `
+
+
'
-].join("\n");
let TEST_DATA = [
{ name: "border-color", value: "red", isValid: true },
@@ -31,12 +32,8 @@ let TEST_DATA = [
];
add_task(function*() {
- let tab = yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test element");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
let ruleEditor = getRuleViewRuleEditor(view, 1);
@@ -52,12 +49,15 @@ function* testEditProperty(ruleEditor, name, value, isValid) {
let propEditor = ruleEditor.rule.textProps[0].editor;
info("Focusing an existing property name in the rule-view");
- let editor = yield focusEditableField(ruleEditor.ruleView, propEditor.nameSpan, 32, 1);
+ let editor = yield focusEditableField(ruleEditor.ruleView,
+ propEditor.nameSpan, 32, 1);
- is(inplaceEditor(propEditor.nameSpan), editor, "The property name editor got focused");
+ is(inplaceEditor(propEditor.nameSpan), editor,
+ "The property name editor got focused");
let input = editor.input;
- info("Entering a new property name, including : to commit and focus the value");
+ info("Entering a new property name, including : to commit and " +
+ "focus the value");
let onValueFocus = once(ruleEditor.element, "focus", true);
let onModifications = ruleEditor.rule._applyingModifications;
EventUtils.sendString(name + ":", doc.defaultView);
@@ -76,7 +76,8 @@ function* testEditProperty(ruleEditor, name, value, isValid) {
yield onBlur;
yield onModifications;
- is(propEditor.isValid(), isValid, value + " is " + isValid ? "valid" : "invalid");
+ is(propEditor.isValid(), isValid,
+ value + " is " + isValid ? "valid" : "invalid");
info("Checking that the style property was changed on the content page");
let propValue = yield executeInContent("Test:GetRulePropertyValue", {
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_02.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_02.js
index 5a33ab3ce7ec..6e7f1361ac07 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_02.js
@@ -6,25 +6,24 @@
// Test several types of rule-view property edition
-let TEST_URI = [
- '',
- '
Styled Node
',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+
Styled Node
+`;
add_task(function*() {
- let tab = yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
-
- let {toolbox, inspector, view} = yield openRuleView();
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
+
yield testEditProperty(inspector, view);
yield testDisableProperty(inspector, view);
yield testPropertyStillMarkedDirty(inspector, view);
@@ -36,15 +35,19 @@ function* testEditProperty(inspector, ruleView) {
let editor = yield focusEditableField(ruleView, propEditor.nameSpan);
let input = editor.input;
- is(inplaceEditor(propEditor.nameSpan), editor, "Next focused editor should be the name editor.");
+ is(inplaceEditor(propEditor.nameSpan), editor,
+ "Next focused editor should be the name editor.");
- ok(input.selectionStart === 0 && input.selectionEnd === input.value.length, "Editor contents are selected.");
+ ok(input.selectionStart === 0 && input.selectionEnd === input.value.length,
+ "Editor contents are selected.");
- // Try clicking on the editor's input again, shouldn't cause trouble (see bug 761665).
+ // Try clicking on the editor's input again, shouldn't cause trouble
+ // (see bug 761665).
EventUtils.synthesizeMouse(input, 1, 1, {}, ruleView.styleWindow);
input.select();
- info("Entering property name \"border-color\" followed by a colon to focus the value");
+ info("Entering property name \"border-color\" followed by a colon to " +
+ "focus the value");
let onFocus = once(idRuleEditor.element, "focus", true);
EventUtils.sendString("border-color:", ruleView.styleWindow);
yield onFocus;
@@ -53,12 +56,15 @@ function* testEditProperty(inspector, ruleView) {
info("Verifying that the focused field is the valueSpan");
editor = inplaceEditor(ruleView.styleDocument.activeElement);
input = editor.input;
- is(inplaceEditor(propEditor.valueSpan), editor, "Focus should have moved to the value.");
- ok(input.selectionStart === 0 && input.selectionEnd === input.value.length, "Editor contents are selected.");
+ is(inplaceEditor(propEditor.valueSpan), editor,
+ "Focus should have moved to the value.");
+ ok(input.selectionStart === 0 && input.selectionEnd === input.value.length,
+ "Editor contents are selected.");
info("Entering a value following by a semi-colon to commit it");
let onBlur = once(editor.input, "blur");
- // Use sendChar() to pass each character as a string so that we can test propEditor.warning.hidden after each character.
+ // Use sendChar() to pass each character as a string so that we can test
+ // propEditor.warning.hidden after each character.
for (let ch of "red;") {
EventUtils.sendChar(ch, ruleView.styleWindow);
is(propEditor.warning.hidden, true,
@@ -74,7 +80,8 @@ function* testEditProperty(inspector, ruleView) {
});
is(newValue, "red", "border-color should have been set.");
- info("Entering property name \"color\" followed by a colon to focus the value");
+ info("Entering property name \"color\" followed by a colon to " +
+ "focus the value");
onFocus = once(idRuleEditor.element, "focus", true);
EventUtils.sendString("color:", ruleView.styleWindow);
yield onFocus;
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_03.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_03.js
index 7b2e568b34e2..05fae84ad8e6 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_03.js
@@ -7,45 +7,42 @@
// Tests that emptying out an existing value removes the property and
// doesn't cause any other issues. See also Bug 1150780.
-let TEST_URI = [
- '',
- '
Styled Node
',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+
Styled Node
+`;
add_task(function*() {
- let tab = yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
-
- info("Opening the rule-view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test element");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
let ruleEditor = getRuleViewRuleEditor(view, 1);
- let doc = ruleEditor.doc;
-
let propEditor = ruleEditor.rule.textProps[1].editor;
- let editor = yield focusEditableField(view, propEditor.valueSpan);
+
+ yield focusEditableField(view, propEditor.valueSpan);
info("Deleting all the text out of a value field");
- yield sendCharsAndWaitForFocus(view, ruleEditor.element, ["VK_DELETE", "VK_RETURN"]);
+ yield sendCharsAndWaitForFocus(view, ruleEditor.element,
+ ["VK_DELETE", "VK_RETURN"]);
info("Pressing enter a couple times to cycle through editors");
yield sendCharsAndWaitForFocus(view, ruleEditor.element, ["VK_RETURN"]);
yield sendCharsAndWaitForFocus(view, ruleEditor.element, ["VK_RETURN"]);
- isnot (ruleEditor.rule.textProps[1].editor.nameSpan.style.display, "none", "The name span is visible");
- is (ruleEditor.rule.textProps.length, 2, "Correct number of props");
+ isnot(ruleEditor.rule.textProps[1].editor.nameSpan.style.display, "none",
+ "The name span is visible");
+ is(ruleEditor.rule.textProps.length, 2, "Correct number of props");
});
function* sendCharsAndWaitForFocus(view, element, chars) {
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_04.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_04.js
index 24eccbff8260..880a1c70d165 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_04.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_04.js
@@ -7,14 +7,14 @@
// Tests that a disabled property remains disabled when the escaping out of
// the property editor.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_05.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_05.js
index 583704906f40..a346b275593b 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_05.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_05.js
@@ -7,14 +7,14 @@
// Tests that a disabled property is re-enabled if the property name or value is
// modified
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_06.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_06.js
index f15cf518ff0f..1025292d2a4c 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_06.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_06.js
@@ -7,16 +7,16 @@
// Tests that editing a property's priority is behaving correctly, and disabling
// and editing the property will re-enable the property.
-let TEST_URI = [
- "",
-].join("\n");
+const TEST_URI = `
+
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_07.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_07.js
index 72364c5d4557..25591ce16548 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-property_07.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-property_07.js
@@ -7,14 +7,14 @@
// Tests that adding multiple values will enable the property even if the
// property does not change, and that the extra values are added correctly.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector-commit.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector-commit.js
index 0665c6fba38f..7055d7f2999e 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector-commit.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector-commit.js
@@ -7,21 +7,21 @@
// Test selector value is correctly displayed when committing the inplace editor
// with ENTER, ESC, SHIFT+TAB and TAB
-let TEST_URI = [
- "",
- "
Styled Node
",
- "
Styled Node
",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+
Styled Node
+
Styled Node
+`;
const TEST_DATA = [
{
@@ -59,7 +59,6 @@ add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let { inspector, view } = yield openRuleView();
- info("Iterating over the test data");
for (let data of TEST_DATA) {
yield runTestData(inspector, view, data);
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_01.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_01.js
index 89e49b5ffd73..d1aef87dc3bd 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_01.js
@@ -6,18 +6,18 @@
// Testing selector inplace-editor behaviors in the rule-view
-let PAGE_CONTENT = [
- '',
- '
Styled Node
',
- 'This is a span',
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+ This is a span
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(PAGE_CONTENT));
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
info("Selecting the test element");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_02.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_02.js
index ba9e1e3ff11d..600d475b5f10 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_02.js
@@ -7,20 +7,20 @@
// Testing selector inplace-editor behaviors in the rule-view with pseudo
// classes.
-let PAGE_CONTENT = [
- '',
- '
Styled Node
',
- 'This is a span',
- '
A
',
- '
B
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+ This is a span
+
A
+
B
+`;
const PSEUDO_PREF = "devtools.inspector.show_pseudo_elements";
@@ -28,7 +28,7 @@ add_task(function*() {
// Expand the pseudo-elements section by default.
Services.prefs.setBoolPref(PSEUDO_PREF, true);
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(PAGE_CONTENT));
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
info("Selecting the test element");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_03.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_03.js
index 03d047e41c89..57f85c30b7e2 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_03.js
@@ -7,14 +7,14 @@
// Testing selector inplace-editor behaviors in the rule-view with invalid
// selectors
-let TEST_URI = [
- '',
- '
Styled Node
',
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_04.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_04.js
index f3248b3da6c1..01f2933c03cf 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_04.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_04.js
@@ -7,22 +7,23 @@
// Tests that the selector highlighter is removed when modifying a selector and
// the selector highlighter works for the newly added unmatched rule.
-const TEST_URI = [
- '',
- '
Test the selector highlighter
'
-].join("\n");
+const TEST_URI = `
+
+
Test the selector highlighter
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
-
- ok(!view.selectorHighlighter, "No selectorhighlighter exist in the rule-view");
-
yield selectNode("p", inspector);
+
+ ok(!view.selectorHighlighter,
+ "No selectorhighlighter exist in the rule-view");
+
yield testSelectorHighlight(view, "p");
yield testEditSelector(view, "body");
yield testSelectorHighlight(view, "body");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_05.js b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_05.js
index 424ec44831f9..216fc19aae4d 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_05.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_edit-selector_05.js
@@ -6,17 +6,17 @@
// Tests that adding a new property of an unmatched rule works properly.
-let TEST_URI = [
- '',
- '
Styled Node
',
- 'This is a span'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+ This is a span
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
@@ -90,7 +90,7 @@ function* testAddProperty(view) {
editor = inplaceEditor(view.styleDocument.activeElement);
let textProp = ruleEditor.rule.textProps[0];
- is(ruleEditor.rule.textProps.length, 1, "Created a new text property.");
+ is(ruleEditor.rule.textProps.length, 1, "Created a new text property.");
is(ruleEditor.propertyList.children.length, 1, "Created a property editor.");
is(editor, inplaceEditor(textProp.editor.valueSpan),
"Editing the value span now.");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_01.js b/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_01.js
index a8534f121e92..9981b1233e3b 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_01.js
@@ -7,20 +7,20 @@
// Tests that the correct editable fields are focused when tabbing and entering
// through the rule view.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_02.js b/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_02.js
index dc08386799a5..af5e2b9bc630 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_editable-field-focus_02.js
@@ -7,20 +7,20 @@
// Tests that the correct editable fields are focused when shift tabbing
// through the rule view.
-let TEST_URI = [
- "",
- "
Styled Node
",
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_eyedropper.js b/browser/devtools/styleinspector/test/browser_ruleview_eyedropper.js
index 495c75d0de7a..9180514bd5ea 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_eyedropper.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_eyedropper.js
@@ -7,7 +7,7 @@
// So we can test collecting telemetry on the eyedropper
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
-registerCleanupFunction(function () {
+registerCleanupFunction(function() {
Services.telemetry.canRecordExtended = oldCanRecord;
});
const HISTOGRAM_ID = "DEVTOOLS_PICKER_EYEDROPPER_OPENED_BOOLEAN";
@@ -15,30 +15,30 @@ const FLAG_HISTOGRAM_ID = "DEVTOOLS_PICKER_EYEDROPPER_OPENED_PER_USER_FLAG";
const EXPECTED_TELEMETRY = {
"DEVTOOLS_PICKER_EYEDROPPER_OPENED_BOOLEAN": 2,
"DEVTOOLS_PICKER_EYEDROPPER_OPENED_PER_USER_FLAG": 1
-}
+};
-const PAGE_CONTENT = [
- '',
- ''
-].join("\n");
+const TEST_URI = `
+
+
+`;
const ORIGINAL_COLOR = "rgb(255, 0, 153)"; // #f09
const EXPECTED_COLOR = "rgb(255, 255, 85)"; // #ff5
@@ -50,10 +50,8 @@ add_task(function*() {
// clear telemetry so we can get accurate counts
clearTelemetry();
- yield addTab("data:text/html;charset=utf-8,rule view eyedropper test");
- content.document.body.innerHTML = PAGE_CONTENT;
-
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#div2", inspector);
let property = getRuleViewProperty(view, "#div2", "background-color");
@@ -124,8 +122,8 @@ function checkTelemetry() {
let histogram = Services.telemetry.getHistogramById(histogramId);
let snapshot = histogram.snapshot();
- is (snapshot.counts[1], expected,
- "eyedropper telemetry value correct for " + histogramId);
+ is(snapshot.counts[1], expected,
+ "eyedropper telemetry value correct for " + histogramId);
}
}
@@ -141,7 +139,7 @@ function openEyedropper(view, swatch) {
let dropperButton = tooltipDoc.querySelector("#eyedropper-button");
tooltip.once("eyedropper-opened", (event, dropper) => {
- deferred.resolve(dropper)
+ deferred.resolve(dropper);
});
dropperButton.click();
});
@@ -163,7 +161,8 @@ function inspectPage(dropper, click=true) {
EventUtils.synthesizeMouse(target, x, y, { type: "mousemove" }, win);
return dropperLoaded(dropper).then(() => {
- EventUtils.synthesizeMouse(target, x + 10, y + 10, { type: "mousemove" }, win);
+ EventUtils.synthesizeMouse(target, x + 10, y + 10,
+ { type: "mousemove" }, win);
if (click) {
EventUtils.synthesizeMouse(target, x + 10, y + 10, {}, win);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-appears-on-swatch-click.js b/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-appears-on-swatch-click.js
index 140848ffa7e0..e58065426829 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-appears-on-swatch-click.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-appears-on-swatch-click.js
@@ -10,7 +10,7 @@ const TEST_URL = TEST_URL_ROOT + "doc_filter.html";
add_task(function*() {
yield addTab(TEST_URL);
- let {toolbox, inspector, view} = yield openRuleView();
+ let {view} = yield openRuleView();
info("Getting the filter swatch element");
let swatch = getRuleViewProperty(view, "body", "filter").valueSpan
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-commit-on-ENTER.js b/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-commit-on-ENTER.js
index ff164ef3cd7f..e572c9b149ec 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-commit-on-ENTER.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_filtereditor-commit-on-ENTER.js
@@ -9,8 +9,7 @@ const TEST_URL = TEST_URL_ROOT + "doc_filter.html";
add_task(function*() {
yield addTab(TEST_URL);
-
- let {toolbox, inspector, view} = yield openRuleView();
+ let {view} = yield openRuleView();
info("Getting the filter swatch element");
let swatch = getRuleViewProperty(view, "body", "filter").valueSpan
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_inherit.js b/browser/devtools/styleinspector/test/browser_ruleview_inherit.js
deleted file mode 100644
index 50dd49f20160..000000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_inherit.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Check that inherited properties appear as such in the rule-view
-
-let {ELEMENT_STYLE} = require("devtools/server/actors/styles");
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,browser_inspector_changes.js");
- let {toolbox, inspector, view} = yield openRuleView();
-
- yield simpleInherit(inspector, view);
- yield emptyInherit(inspector, view);
- yield elementStyleInherit(inspector, view);
-});
-
-function* simpleInherit(inspector, view) {
- let style = '' +
- '#test2 {' +
- ' background-color: green;' +
- ' color: purple;' +
- '}';
-
- let styleNode = addStyle(content.document, style);
- content.document.body.innerHTML = '
Styled Node
';
-
- yield selectNode("#test1", inspector);
-
- let elementStyle = view._elementStyle;
- is(elementStyle.rules.length, 2, "Should have 2 rules.");
-
- let elementRule = elementStyle.rules[0];
- ok(!elementRule.inherited, "Element style attribute should not consider itself inherited.");
-
- let inheritRule = elementStyle.rules[1];
- is(inheritRule.selectorText, "#test2", "Inherited rule should be the one that includes inheritable properties.");
- ok(!!inheritRule.inherited, "Rule should consider itself inherited.");
- is(inheritRule.textProps.length, 1, "Should only display one inherited style");
- let inheritProp = inheritRule.textProps[0];
- is(inheritProp.name, "color", "color should have been inherited.");
-
- styleNode.remove();
-}
-
-function* emptyInherit(inspector, view) {
- // No inheritable styles, this rule shouldn't show up.
- let style = '' +
- '#test2 {' +
- ' background-color: green;' +
- '}';
-
- let styleNode = addStyle(content.document, style);
- content.document.body.innerHTML = '
Styled Node
';
-
- yield selectNode("#test1", inspector);
-
- let elementStyle = view._elementStyle;
- is(elementStyle.rules.length, 1, "Should have 1 rule.");
-
- let elementRule = elementStyle.rules[0];
- ok(!elementRule.inherited, "Element style attribute should not consider itself inherited.");
-
- styleNode.parentNode.removeChild(styleNode);
-}
-
-function* elementStyleInherit(inspector, view) {
- content.document.body.innerHTML = '
Styled Node
';
-
- yield selectNode("#test1", inspector);
-
- let elementStyle = view._elementStyle;
- is(elementStyle.rules.length, 2, "Should have 2 rules.");
-
- let elementRule = elementStyle.rules[0];
- ok(!elementRule.inherited, "Element style attribute should not consider itself inherited.");
-
- let inheritRule = elementStyle.rules[1];
- is(inheritRule.domRule.type, ELEMENT_STYLE, "Inherited rule should be an element style, not a rule.");
- ok(!!inheritRule.inherited, "Rule should consider itself inherited.");
- is(inheritRule.textProps.length, 1, "Should only display one inherited style");
- let inheritProp = inheritRule.textProps[0];
- is(inheritProp.name, "color", "color should have been inherited.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_01.js b/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_01.js
new file mode 100644
index 000000000000..9d49ac034922
--- /dev/null
+++ b/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_01.js
@@ -0,0 +1,45 @@
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Check that inherited properties appear for a nested element in the
+// rule view.
+
+let {ELEMENT_STYLE} = require("devtools/server/actors/styles");
+
+const TEST_URI = `
+
+
Styled Node
+`;
+
+add_task(function*() {
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
+ yield selectNode("#test1", inspector);
+ yield simpleInherit(inspector, view);
+});
+
+function* simpleInherit(inspector, view) {
+ let elementStyle = view._elementStyle;
+ is(elementStyle.rules.length, 2, "Should have 2 rules.");
+
+ let elementRule = elementStyle.rules[0];
+ ok(!elementRule.inherited,
+ "Element style attribute should not consider itself inherited.");
+
+ let inheritRule = elementStyle.rules[1];
+ is(inheritRule.selectorText, "#test2",
+ "Inherited rule should be the one that includes inheritable properties.");
+ ok(!!inheritRule.inherited, "Rule should consider itself inherited.");
+ is(inheritRule.textProps.length, 1,
+ "Should only display one inherited style");
+ let inheritProp = inheritRule.textProps[0];
+ is(inheritProp.name, "color", "color should have been inherited.");
+}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_02.js b/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_02.js
new file mode 100644
index 000000000000..15b910c8664d
--- /dev/null
+++ b/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_02.js
@@ -0,0 +1,36 @@
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Check that no inherited properties appear when the property does not apply
+// to the nested element.
+
+let {ELEMENT_STYLE} = require("devtools/server/actors/styles");
+
+const TEST_URI = `
+
+
Styled Node
+`;
+
+add_task(function*() {
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
+ yield selectNode("#test1", inspector);
+ yield emptyInherit(inspector, view);
+});
+
+function* emptyInherit(inspector, view) {
+ // No inheritable styles, this rule shouldn't show up.
+ let elementStyle = view._elementStyle;
+ is(elementStyle.rules.length, 1, "Should have 1 rule.");
+
+ let elementRule = elementStyle.rules[0];
+ ok(!elementRule.inherited,
+ "Element style attribute should not consider itself inherited.");
+}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_03.js b/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_03.js
new file mode 100644
index 000000000000..bb7af19be3f0
--- /dev/null
+++ b/browser/devtools/styleinspector/test/browser_ruleview_inherited-properties_03.js
@@ -0,0 +1,40 @@
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Check that inline inherited properties appear in the nested element.
+
+let {ELEMENT_STYLE} = require("devtools/server/actors/styles");
+
+const TEST_URI = `
+
+
Styled Node
+
+`;
+
+add_task(function*() {
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
+ yield selectNode("#test1", inspector);
+ yield elementStyleInherit(inspector, view);
+});
+
+function* elementStyleInherit(inspector, view) {
+ let elementStyle = view._elementStyle;
+ is(elementStyle.rules.length, 2, "Should have 2 rules.");
+
+ let elementRule = elementStyle.rules[0];
+ ok(!elementRule.inherited,
+ "Element style attribute should not consider itself inherited.");
+
+ let inheritRule = elementStyle.rules[1];
+ is(inheritRule.domRule.type, ELEMENT_STYLE,
+ "Inherited rule should be an element style, not a rule.");
+ ok(!!inheritRule.inherited, "Rule should consider itself inherited.");
+ is(inheritRule.textProps.length, 1,
+ "Should only display one inherited style");
+ let inheritProp = inheritRule.textProps[0];
+ is(inheritProp.name, "color", "color should have been inherited.");
+}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_keybindings.js b/browser/devtools/styleinspector/test/browser_ruleview_keybindings.js
index d832a95cdad0..2cda1bea73c6 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_keybindings.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_keybindings.js
@@ -9,9 +9,7 @@
add_task(function*() {
yield addTab("data:text/html;charset=utf-8,
Some header text
");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test node");
+ let {inspector, view} = yield openRuleView();
yield selectNode("h1", inspector);
info("Getting the ruleclose brace element");
@@ -30,7 +28,8 @@ add_task(function*() {
onFocus = once(brace.parentNode, "focus", true);
// The rule view changes twice, once for the first field to loose focus
// and a second time for the second field to gain focus
- let onRuleViewChanged = view.once("ruleview-changed").then(() => view.once("ruleview-changed"));
+ let onRuleViewChanged = view.once("ruleview-changed").then(
+ () => view.once("ruleview-changed"));
EventUtils.sendKey("return");
yield onFocus;
yield onRuleViewChanged;
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_01.js b/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_01.js
index 001897f23e68..63533b9be0c4 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_01.js
@@ -4,15 +4,14 @@
"use strict";
-// Test that keyframe rules and gutters are displayed correctly in the rule view
+// Test that keyframe rules and gutters are displayed correctly in the
+// rule view.
const TEST_URI = TEST_URL_ROOT + "doc_keyframeanimation.html";
add_task(function*() {
yield addTab(TEST_URI);
-
- let {toolbox, inspector, view} = yield openRuleView();
-
+ let {inspector, view} = yield openRuleView();
yield testPacman(inspector, view);
yield testBoxy(inspector, view);
yield testMoxy(inspector, view);
@@ -21,18 +20,14 @@ add_task(function*() {
function* testPacman(inspector, view) {
info("Test content and gutter in the keyframes rule of #pacman");
- let {
- rules,
- element,
- elementStyle
- } = yield assertKeyframeRules("#pacman", inspector, view, {
+ yield assertKeyframeRules("#pacman", inspector, view, {
elementRulesNb: 2,
keyframeRulesNb: 2,
keyframesRules: ["pacman", "pacman"],
keyframeRules: ["100%", "100%"]
});
- let gutters = assertGutters(view, {
+ assertGutters(view, {
guttersNbs: 2,
gutterHeading: ["Keyframes pacman", "Keyframes pacman"]
});
@@ -41,18 +36,14 @@ function* testPacman(inspector, view) {
function* testBoxy(inspector, view) {
info("Test content and gutter in the keyframes rule of #boxy");
- let {
- rules,
- element,
- elementStyle
- } = yield assertKeyframeRules("#boxy", inspector, view, {
+ yield assertKeyframeRules("#boxy", inspector, view, {
elementRulesNb: 3,
keyframeRulesNb: 3,
keyframesRules: ["boxy", "boxy", "boxy"],
keyframeRules: ["10%", "20%", "100%"]
});
- let gutters = assertGutters(view, {
+ assertGutters(view, {
guttersNbs: 1,
gutterHeading: ["Keyframes boxy"]
});
@@ -61,18 +52,14 @@ function* testBoxy(inspector, view) {
function* testMoxy(inspector, view) {
info("Test content and gutter in the keyframes rule of #moxy");
- let {
- rules,
- element,
- elementStyle
- } = yield assertKeyframeRules("#moxy", inspector, view, {
+ yield assertKeyframeRules("#moxy", inspector, view, {
elementRulesNb: 3,
keyframeRulesNb: 4,
keyframesRules: ["boxy", "boxy", "boxy", "moxy"],
keyframeRules: ["10%", "20%", "100%", "100%"]
});
- let gutters = assertGutters(view, {
+ assertGutters(view, {
guttersNbs: 2,
gutterHeading: ["Keyframes boxy", "Keyframes moxy"]
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_02.js b/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_02.js
index 93f70e815bc2..b9fa4b8c8b0a 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_keyframes-rule_02.js
@@ -5,15 +5,13 @@
"use strict";
// Test that verifies the content of the keyframes rule and property changes
-// to keyframe rules
+// to keyframe rules.
const TEST_URI = TEST_URL_ROOT + "doc_keyframeanimation.html";
add_task(function*() {
yield addTab(TEST_URI);
-
- let {toolbox, inspector, view} = yield openRuleView();
-
+ let {inspector, view} = yield openRuleView();
yield testPacman(inspector, view);
yield testBoxy(inspector, view);
});
@@ -21,17 +19,11 @@ add_task(function*() {
function* testPacman(inspector, view) {
info("Test content in the keyframes rule of #pacman");
- let {
- rules,
- element,
- elementStyle
- } = yield getKeyframeRules("#pacman", inspector, view);
+ let {rules} = yield getKeyframeRules("#pacman", inspector, view);
info("Test text properties for Keyframes #pacman");
- is
- (
- convertTextPropsToString(rules.keyframeRules[0].textProps),
+ is(convertTextPropsToString(rules.keyframeRules[0].textProps),
"left: 750px",
"Keyframe pacman (100%) property is correct"
);
@@ -61,31 +53,21 @@ function* testPacman(inspector, view) {
function* testBoxy(inspector, view) {
info("Test content in the keyframes rule of #boxy");
- let {
- rules,
- element,
- elementStyle
- } = yield getKeyframeRules("#boxy", inspector, view);
+ let {rules} = yield getKeyframeRules("#boxy", inspector, view);
info("Test text properties for Keyframes #boxy");
- is
- (
- convertTextPropsToString(rules.keyframeRules[0].textProps),
+ is(convertTextPropsToString(rules.keyframeRules[0].textProps),
"background-color: blue",
"Keyframe boxy (10%) property is correct"
);
- is
- (
- convertTextPropsToString(rules.keyframeRules[1].textProps),
+ is(convertTextPropsToString(rules.keyframeRules[1].textProps),
"background-color: green",
"Keyframe boxy (20%) property is correct"
);
- is
- (
- convertTextPropsToString(rules.keyframeRules[2].textProps),
+ is(convertTextPropsToString(rules.keyframeRules[2].textProps),
"opacity: 0",
"Keyframe boxy (100%) property is correct"
);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_livepreview.js b/browser/devtools/styleinspector/test/browser_ruleview_livepreview.js
index e240e2065341..b7ffa136c7e5 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_livepreview.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_livepreview.js
@@ -4,7 +4,16 @@
"use strict";
-// Test that changes are previewed when editing a property value
+// Test that changes are previewed when editing a property value.
+
+const TEST_URI = `
+
+
Styled Node
inline element
+`;
// Format
// {
@@ -23,13 +32,8 @@ const TEST_DATA = [
];
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,test rule view live preview on user changes");
-
- let style = '#testid {display:block;}';
- let styleNode = addStyle(content.document, style);
- content.document.body.innerHTML = '
Styled Node
inline element';
-
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
for (let data of TEST_DATA) {
@@ -38,15 +42,15 @@ add_task(function*() {
});
function* testLivePreviewData(data, ruleView, selector) {
- let testElement = getNode(selector);
- let idRuleEditor = getRuleViewRuleEditor(ruleView, 1);
- let propEditor = idRuleEditor.rule.textProps[0].editor;
+ let ruleEditor = getRuleViewRuleEditor(ruleView, 1);
+ let propEditor = ruleEditor.rule.textProps[0].editor;
info("Focusing the property value inplace-editor");
let editor = yield focusEditableField(ruleView, propEditor.valueSpan);
- is(inplaceEditor(propEditor.valueSpan), editor, "The focused editor is the value");
+ is(inplaceEditor(propEditor.valueSpan), editor,
+ "The focused editor is the value");
- info("Enter a value in the editor")
+ info("Enter a value in the editor");
EventUtils.sendString(data.value, ruleView.styleWindow);
if (data.escape) {
EventUtils.synthesizeKey("VK_ESCAPE", {});
@@ -62,7 +66,8 @@ function* testLivePreviewData(data, ruleView, selector) {
}
}
- // While the editor is still focused in, the display should have changed already
+ // While the editor is still focused in, the display should have
+ // changed already
is((yield getComputedStyleProperty(selector, null, "display")),
data.expected,
"Element should be previewed as " + data.expected);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_01.js b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_01.js
index cd33e5603e38..9d09e2c4c466 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_01.js
@@ -5,19 +5,19 @@
"use strict";
// Tests that the rule view marks overridden rules correctly based on the
-// specificity of the rule
+// specificity of the rule.
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_02.js b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_02.js
index 8e93cea2c777..108ea61daf4f 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_02.js
@@ -7,17 +7,17 @@
// Tests that the rule view marks overridden rules correctly for short hand
// properties and the computed list properties
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_03.js b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_03.js
index 7f5834f1a5f0..aeba17ec0c47 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_03.js
@@ -7,17 +7,17 @@
// Tests that the rule view marks overridden rules correctly based on the
// priority for the rule
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_04.js b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_04.js
index 0a5b0cc68120..a2b0f9e6fea5 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_04.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_04.js
@@ -7,17 +7,17 @@
// Tests that the rule view marks overridden rules correctly if a property gets
// disabled
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_05.js b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_05.js
index 783243a9d704..87db8e522629 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_05.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_mark_overridden_05.js
@@ -5,16 +5,16 @@
"use strict";
// Tests that the rule view marks overridden rules correctly based on the
-// order of the property
+// order of the property.
-let TEST_URI = [
- "",
- "
Styled Node
"
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_mathml-element.js b/browser/devtools/styleinspector/test/browser_ruleview_mathml-element.js
index 288226378299..081a10ba289b 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_mathml-element.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_mathml-element.js
@@ -4,30 +4,29 @@
"use strict";
-// Tests that the rule-view displays correctly on MathML elements
+// Tests that the rule-view displays correctly on MathML elements.
-const TEST_URL = [
- "data:text/html;charset=utf-8,",
- "
",
- " ",
- "
"
-].join("");
+const TEST_URI = `
+
+
+
+`;
add_task(function*() {
- yield addTab(TEST_URL);
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
info("Select the DIV node and verify the rule-view shows rules");
yield selectNode("div", inspector);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_media-queries.js b/browser/devtools/styleinspector/test/browser_ruleview_media-queries.js
index 0eaebcbdd087..9984999467b1 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_media-queries.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_media-queries.js
@@ -12,7 +12,6 @@ const TEST_URI = TEST_URL_ROOT + "doc_media_queries.html";
add_task(function*() {
yield addTab(TEST_URI);
let {inspector, view} = yield openRuleView();
-
yield selectNode("div", inspector);
let elementStyle = view._elementStyle;
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-duplicates.js b/browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-duplicates.js
index c8b1df130fe1..589d00293dca 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-duplicates.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-duplicates.js
@@ -7,48 +7,60 @@
// Test that the rule-view behaves correctly when entering mutliple and/or
// unfinished properties/values in inplace-editors
+const TEST_URI = "
';
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
let testElement = getNode("#testid");
- let elementStyle = 'margin-top: 1px; padding-top: 5px;'
- testElement.setAttribute("style", elementStyle);
-
- let {toolbox, inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- info("Checking that the rule-view has the element, #testid and .testclass selectors");
+ info("Checking that the rule-view has the element, #testid and " +
+ ".testclass selectors");
checkRuleViewContent(view, ["element", "#testid", ".testclass"]);
- info("Changing the node's ID attribute and waiting for the rule-view refresh");
+ info("Changing the node's ID attribute and waiting for the " +
+ "rule-view refresh");
let ruleViewRefreshed = inspector.once("rule-view-refreshed");
testElement.setAttribute("id", "differentid");
yield ruleViewRefreshed;
@@ -47,12 +49,13 @@ add_task(function*() {
});
function checkRuleViewContent(view, expectedSelectors) {
- let selectors = view.styleDocument.querySelectorAll(".ruleview-selectorcontainer");
+ let selectors = view.styleDocument
+ .querySelectorAll(".ruleview-selectorcontainer");
is(selectors.length, expectedSelectors.length,
expectedSelectors.length + " selectors are displayed");
- for (let i = 0; i < expectedSelectors.length; i ++) {
+ for (let i = 0; i < expectedSelectors.length; i++) {
is(selectors[i].textContent.indexOf(expectedSelectors[i]), 0,
"Selector " + (i + 1) + " is " + expectedSelectors[i]);
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-attribute-change_02.js b/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-attribute-change_02.js
index 26017aac438b..06370efc2863 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-attribute-change_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-attribute-change_02.js
@@ -4,19 +4,22 @@
"use strict";
-// Test that changing the current element's style attribute refreshes the rule-view
+// Test that changing the current element's style attribute refreshes the
+// rule-view
+
+const TEST_URI = `
+
';
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
let testElement = getNode("#testid");
- testElement.setAttribute("style", "margin-top: 1px; padding-top: 5px;");
-
- let {toolbox, inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- yield testPropertyChanges(inspector, view, testElement);
+ yield testPropertyChanges(inspector, view);
yield testPropertyChange0(inspector, view, testElement);
yield testPropertyChange1(inspector, view, testElement);
yield testPropertyChange2(inspector, view, testElement);
@@ -26,7 +29,7 @@ add_task(function*() {
yield testPropertyChange6(inspector, view, testElement);
});
-function* testPropertyChanges(inspector, ruleView, testElement) {
+function* testPropertyChanges(inspector, ruleView) {
info("Adding a second margin-top value in the element selector");
let ruleEditor = ruleView._elementStyle.rules[0].editor;
let onRefreshed = inspector.once("rule-view-refreshed");
@@ -34,72 +37,98 @@ function* testPropertyChanges(inspector, ruleView, testElement) {
yield onRefreshed;
let rule = ruleView._elementStyle.rules[0];
- validateTextProp(rule.textProps[0], false, "margin-top", "1px", "Original margin property active");
+ validateTextProp(rule.textProps[0], false, "margin-top", "1px",
+ "Original margin property active");
}
function* testPropertyChange0(inspector, ruleView, testElement) {
- yield changeElementStyle(testElement, "margin-top: 1px; padding-top: 5px", inspector);
+ yield changeElementStyle(testElement, "margin-top: 1px; padding-top: 5px",
+ inspector);
let rule = ruleView._elementStyle.rules[0];
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[0], true, "margin-top", "1px", "First margin property re-enabled");
- validateTextProp(rule.textProps[2], false, "margin-top", "5px", "Second margin property disabled");
+ is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3,
+ "Correct number of properties");
+ validateTextProp(rule.textProps[0], true, "margin-top", "1px",
+ "First margin property re-enabled");
+ validateTextProp(rule.textProps[2], false, "margin-top", "5px",
+ "Second margin property disabled");
}
function* testPropertyChange1(inspector, ruleView, testElement) {
info("Now set it back to 5px, the 5px value should be re-enabled.");
- yield changeElementStyle(testElement, "margin-top: 5px; padding-top: 5px;", inspector);
+ yield changeElementStyle(testElement, "margin-top: 5px; padding-top: 5px;",
+ inspector);
let rule = ruleView._elementStyle.rules[0];
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
- validateTextProp(rule.textProps[2], true, "margin-top", "5px", "Second margin property disabled");
+ is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3,
+ "Correct number of properties");
+ validateTextProp(rule.textProps[0], false, "margin-top", "1px",
+ "First margin property re-enabled");
+ validateTextProp(rule.textProps[2], true, "margin-top", "5px",
+ "Second margin property disabled");
}
function* testPropertyChange2(inspector, ruleView, testElement) {
info("Set the margin property to a value that doesn't exist in the editor.");
info("Should reuse the currently-enabled element (the second one.)");
- yield changeElementStyle(testElement, "margin-top: 15px; padding-top: 5px;", inspector);
+ yield changeElementStyle(testElement, "margin-top: 15px; padding-top: 5px;",
+ inspector);
let rule = ruleView._elementStyle.rules[0];
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
- validateTextProp(rule.textProps[2], true, "margin-top", "15px", "Second margin property disabled");
+ is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3,
+ "Correct number of properties");
+ validateTextProp(rule.textProps[0], false, "margin-top", "1px",
+ "First margin property re-enabled");
+ validateTextProp(rule.textProps[2], true, "margin-top", "15px",
+ "Second margin property disabled");
}
function* testPropertyChange3(inspector, ruleView, testElement) {
- info("Remove the padding-top attribute. Should disable the padding property but not remove it.");
+ info("Remove the padding-top attribute. Should disable the padding " +
+ "property but not remove it.");
yield changeElementStyle(testElement, "margin-top: 5px;", inspector);
let rule = ruleView._elementStyle.rules[0];
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[1], false, "padding-top", "5px", "Padding property disabled");
+ is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3,
+ "Correct number of properties");
+ validateTextProp(rule.textProps[1], false, "padding-top", "5px",
+ "Padding property disabled");
}
function* testPropertyChange4(inspector, ruleView, testElement) {
- info("Put the padding-top attribute back in, should re-enable the padding property.");
- yield changeElementStyle(testElement, "margin-top: 5px; padding-top: 25px", inspector);
+ info("Put the padding-top attribute back in, should re-enable the " +
+ "padding property.");
+ yield changeElementStyle(testElement, "margin-top: 5px; padding-top: 25px",
+ inspector);
let rule = ruleView._elementStyle.rules[0];
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[1], true, "padding-top", "25px", "Padding property enabled");
+ is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3,
+ "Correct number of properties");
+ validateTextProp(rule.textProps[1], true, "padding-top", "25px",
+ "Padding property enabled");
}
function* testPropertyChange5(inspector, ruleView, testElement) {
info("Add an entirely new property");
- yield changeElementStyle(testElement, "margin-top: 5px; padding-top: 25px; padding-left: 20px;", inspector);
+ yield changeElementStyle(testElement,
+ "margin-top: 5px; padding-top: 25px; padding-left: 20px;", inspector);
let rule = ruleView._elementStyle.rules[0];
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 4, "Added a property");
- validateTextProp(rule.textProps[3], true, "padding-left", "20px", "Padding property enabled");
+ is(rule.editor.element.querySelectorAll(".ruleview-property").length, 4,
+ "Added a property");
+ validateTextProp(rule.textProps[3], true, "padding-left", "20px",
+ "Padding property enabled");
}
function* testPropertyChange6(inspector, ruleView, testElement) {
info("Add an entirely new property again");
- yield changeElementStyle(testElement, "background: red url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0%", inspector);
+ yield changeElementStyle(testElement, "background: red " +
+ "url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0%",
+ inspector);
let rule = ruleView._elementStyle.rules[0];
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 5, "Added a property");
+ is(rule.editor.element.querySelectorAll(".ruleview-property").length, 5,
+ "Added a property");
validateTextProp(rule.textProps[4], true, "background",
"red url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0%",
"shortcut property correctly set",
@@ -112,12 +141,15 @@ function* changeElementStyle(testElement, style, inspector) {
yield onRefreshed;
}
-function validateTextProp(aProp, aEnabled, aName, aValue, aDesc, valueSpanText) {
+function validateTextProp(aProp, aEnabled, aName, aValue, aDesc,
+ valueSpanText) {
is(aProp.enabled, aEnabled, aDesc + ": enabled.");
is(aProp.name, aName, aDesc + ": name.");
is(aProp.value, aValue, aDesc + ": value.");
- is(aProp.editor.enable.hasAttribute("checked"), aEnabled, aDesc + ": enabled checkbox.");
+ is(aProp.editor.enable.hasAttribute("checked"), aEnabled,
+ aDesc + ": enabled checkbox.");
is(aProp.editor.nameSpan.textContent, aName, aDesc + ": name span.");
- is(aProp.editor.valueSpan.textContent, valueSpanText || aValue, aDesc + ": value span.");
+ is(aProp.editor.valueSpan.textContent,
+ valueSpanText || aValue, aDesc + ": value span.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-style-change.js b/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-style-change.js
index 7813ac927ebd..b4ad2664be9b 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-style-change.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_refresh-on-style-change.js
@@ -7,19 +7,13 @@
// Test that the rule view refreshes when the current node has its style
// changed
-const TESTCASE_URI = 'data:text/html;charset=utf-8,' +
- '
Test div!
';
+const TEST_URI = "
Test div!
";
add_task(function*() {
- yield addTab(TESTCASE_URI);
-
Services.prefs.setCharPref("devtools.defaultColorUnit", "name");
- info("Getting the test node");
- let div = getNode("#testdiv");
-
- info("Opening the rule view and selecting the test node");
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testdiv", inspector);
let fontSize = getRuleViewPropertyValue(view, "element", "font-size");
@@ -27,15 +21,18 @@ add_task(function*() {
info("Changing the node's style and waiting for the update");
let onUpdated = inspector.once("rule-view-refreshed");
- div.style.cssText = "font-size: 3em; color: lightgoldenrodyellow; text-align: right; text-transform: uppercase";
+ let div = getNode("#testdiv");
+ div.style.cssText = "font-size: 3em; color: lightgoldenrodyellow; " +
+ "text-align: right; text-transform: uppercase";
yield onUpdated;
let textAlign = getRuleViewPropertyValue(view, "element", "text-align");
is(textAlign, "right", "The rule view shows the new text align.");
let color = getRuleViewPropertyValue(view, "element", "color");
- is(color, "lightgoldenrodyellow", "The rule view shows the new color.")
+ is(color, "lightgoldenrodyellow", "The rule view shows the new color.");
fontSize = getRuleViewPropertyValue(view, "element", "font-size");
is(fontSize, "3em", "The rule view shows the new font size.");
- let textTransform = getRuleViewPropertyValue(view, "element", "text-transform");
+ let textTransform = getRuleViewPropertyValue(view, "element",
+ "text-transform");
is(textTransform, "uppercase", "The rule view shows the new text transform.");
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_01.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_01.js
index dee38bf40556..efcc9a5bd81e 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_01.js
@@ -7,23 +7,23 @@
// Tests that the rule view search filter works properly in the computed list
// for property values.
-const SEARCH = "0px"
+const SEARCH = "0px";
-let TEST_URI = [
- '',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_02.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_02.js
index ac11eb887071..80ab205a8105 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_02.js
@@ -7,23 +7,23 @@
// Tests that the rule view search filter works properly in the computed list
// for property names.
-const SEARCH = "margin"
+const SEARCH = "margin";
-let TEST_URI = [
- '',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_03.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_03.js
index 204966da0833..1bb8118c4b78 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_03.js
@@ -7,23 +7,23 @@
// Tests that the rule view search filter works properly in the computed list
// for property line input.
-const SEARCH = "margin-top:4px"
+const SEARCH = "margin-top:4px";
-let TEST_URI = [
- '',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js
index dc20906459bb..58873f155990 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js
@@ -7,23 +7,23 @@
// Tests that the rule view search filter works properly in the computed list
// for parsed property value.
-const SEARCH = ":4px"
+const SEARCH = ":4px";
-let TEST_URI = [
- '',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_05.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_05.js
index f8eaea289c67..a8b87d3bb9de 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_05.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_05.js
@@ -7,23 +7,23 @@
// Tests that the rule view search filter works properly in the computed list
// for parsed property name.
-const SEARCH = "margin-top:"
+const SEARCH = "margin-top:";
-let TEST_URI = [
- '',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
});
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_06.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_06.js
index 40ece407e3df..dc2fa98b84f7 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_06.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_06.js
@@ -7,23 +7,23 @@
// Tests that the rule view search filter works properly in the computed list
// when modifying the existing search filter value
-const SEARCH = "margin-"
+const SEARCH = "margin-";
-let TEST_URI = [
- '',
- '
Styled Node
'
-].join("\n");
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
yield testRemoveTextInFilter(inspector, view);
@@ -70,7 +70,6 @@ function* testRemoveTextInFilter(inspector, ruleView) {
let win = ruleView.styleWindow;
let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
searchField.focus();
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_07.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_07.js
index 6eb9de1ba7f6..fb555578415d 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_07.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_07.js
@@ -7,20 +7,20 @@
// Tests that the rule view search filter works properly in the computed list
// for color values.
-const SEARCH = "background-color: #F3F3F3"
+const SEARCH = "background-color: #F3F3F3";
-let TEST_URI = [
- '',
- '
I am a test-case. This text exists
+ solely to provide some things to
+ highlight and count
+ style list-items in the box at right. If you are reading this,
+ you should go do something else instead. Maybe read a book. Or better
+ yet, write some test-cases for another bit of code.
+ some text
");
-
- info("Creating the test document");
- content.document.body.innerHTML = '
\n' +
- '
Some header text
\n' +
- '
hi.
\n' +
- '
I am a test-case. This text exists ' +
- 'solely to provide some things to ' +
- 'highlight and count ' +
- 'style list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- 'some text
\n' +
- '
more text
\n' +
- '
even more text
' +
- '
';
- content.document.title = "Rule view context menu test";
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
-
- info("Selecting the test node");
yield selectNode("div", inspector);
-
yield checkCopySelection(view);
yield checkSelectAll(view);
});
@@ -70,7 +74,8 @@ function* checkCopySelection(view) {
{button: 2, type: "contextmenu"}, win);
yield onPopup;
- ok(!view._contextmenu.menuitemCopy.hidden, "Copy menu item is not hidden as expected");
+ ok(!view._contextmenu.menuitemCopy.hidden,
+ "Copy menu item is not hidden as expected");
try {
yield waitForClipboard(() => view._contextmenu.menuitemCopy.click(),
@@ -89,7 +94,8 @@ function* checkSelectAll(view) {
let win = view.styleWindow;
let prop = contentDoc.querySelector(".ruleview-property");
- info("Checking that _SelectAll() then copy returns the correct clipboard value");
+ info("Checking that _SelectAll() then copy returns the correct " +
+ "clipboard value");
view._contextmenu._onSelectAll();
let expectedPattern = "[\\r\\n]+" +
"element {[\\r\\n]+" +
@@ -107,7 +113,8 @@ function* checkSelectAll(view) {
{button: 2, type: "contextmenu"}, win);
yield onPopup;
- ok(!view._contextmenu.menuitemCopy.hidden, "Copy menu item is not hidden as expected");
+ ok(!view._contextmenu.menuitemCopy.hidden,
+ "Copy menu item is not hidden as expected");
try {
yield waitForClipboard(() => view._contextmenu.menuitemCopy.click(),
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_01.js b/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_01.js
index 883558cae0b0..872d7755a500 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_01.js
@@ -7,20 +7,21 @@
// Test that the selector highlighter is created when clicking on a selector
// icon in the rule view.
-const PAGE_CONTENT = [
- '',
- 'Test the selector highlighter'
-].join("\n");
+const TEST_URI = `
+
+ Test the selector highlighter
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {view} = yield openRuleView();
- ok(!view.selectorHighlighter, "No selectorhighlighter exist in the rule-view");
+
+ ok(!view.selectorHighlighter,
+ "No selectorhighlighter exist in the rule-view");
info("Clicking on a selector icon");
let icon = getRuleViewSelectorHighlighterIcon(view, "body, p, td");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_02.js b/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_02.js
index 805fdbecdb5b..fba9e48f50af 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_02.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_02.js
@@ -10,21 +10,20 @@
// Note that in this test, we mock the highlighter front, merely testing the
// behavior of the style-inspector UI for now
-const PAGE_CONTENT = [
- '',
- '
Testing the selector highlighter
'
-].join("\n");
+const TEST_URI = `
+
+
Testing the selector highlighter
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
// Mock the highlighter front to get the reference of the NodeFront
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_03.js b/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_03.js
index 6de0ff286806..d8454a5e7734 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_selector-highlighter_03.js
@@ -9,19 +9,18 @@
// Note that in this test, we mock the highlighter front, merely testing the
// behavior of the style-inspector UI for now
-const PAGE_CONTENT = [
- '',
- '
Node 1
',
- '
Node 2
'
-].join("\n");
+const TEST_URI = `
+
+
Node 1
+
Node 2
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
// Mock the highlighter front.
@@ -61,7 +60,8 @@ add_task(function*() {
info("Selecting .node-2");
yield selectNode(".node-2", inspector);
- ok(HighlighterFront.isShown, "The highlighter is still shown after selection");
+ ok(HighlighterFront.isShown,
+ "The highlighter is still shown after selection");
info("With .node-2 selected, click on the div selector icon");
icon = getRuleViewSelectorHighlighterIcon(view, "div");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js b/browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js
index 5cbc5d73bc08..9760415841df 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js
@@ -57,17 +57,15 @@ const DOCUMENT_URL = "data:text/html;charset=utf-8,"+encodeURIComponent(
add_task(function*() {
yield addTab(DOCUMENT_URL);
let {toolbox, inspector, view} = yield openRuleView();
-
- info("Select the test node");
yield selectNode("div", inspector);
- yield testInlineStyle(view, inspector);
+ yield testInlineStyle(view);
yield testFirstInlineStyleSheet(view, toolbox);
yield testSecondInlineStyleSheet(view, toolbox);
yield testExternalStyleSheet(view, toolbox);
});
-function* testInlineStyle(view, inspector) {
+function* testInlineStyle(view) {
info("Testing inline style");
let onTab = waitForTab();
@@ -112,7 +110,8 @@ function* testSecondInlineStyleSheet(view, toolbox) {
clickLinkByIndex(view, 3);
let editor = yield onSelected;
- is(toolbox.currentToolId, "styleeditor", "The style editor is selected again");
+ is(toolbox.currentToolId, "styleeditor",
+ "The style editor is selected again");
validateStyleEditorSheet(editor, 1);
}
@@ -131,7 +130,8 @@ function* testExternalStyleSheet(view, toolbox) {
clickLinkByIndex(view, 1);
let editor = yield onSelected;
- is(toolbox.currentToolId, "styleeditor", "The style editor is selected again");
+ is(toolbox.currentToolId, "styleeditor",
+ "The style editor is selected again");
validateStyleEditorSheet(editor, 2);
}
@@ -141,7 +141,8 @@ function validateStyleEditorSheet(editor, expectedSheetIndex) {
"loaded stylesheet index matches document stylesheet");
let sheet = content.document.styleSheets[expectedSheetIndex];
- is(editor.styleSheet.href, sheet.href, "loaded stylesheet href matches document stylesheet");
+ is(editor.styleSheet.href, sheet.href,
+ "loaded stylesheet href matches document stylesheet");
}
function testRuleViewLinkLabel(view) {
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_urls-clickable.js b/browser/devtools/styleinspector/test/browser_ruleview_urls-clickable.js
index 4d753e2edb1d..6a60e59ba0f0 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_urls-clickable.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_urls-clickable.js
@@ -8,11 +8,13 @@
const TEST_URI = TEST_URL_ROOT + "doc_urls_clickable.html";
const TEST_IMAGE = TEST_URL_ROOT + "doc_test_image.png";
-const BASE_64_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
+const BASE_64_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAA" +
+ "FCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAA" +
+ "BJRU5ErkJggg==";
add_task(function*() {
yield addTab(TEST_URI);
- let {toolbox, inspector, view} = yield openRuleView();
+ let {inspector, view} = yield openRuleView();
yield selectNodes(inspector, view);
});
@@ -26,36 +28,43 @@ function* selectNodes(inspector, ruleView) {
let inlineresolved = ".inline-resolved";
yield selectNode(relative1, inspector);
- let relativeLink = ruleView.styleDocument.querySelector(".ruleview-propertyvaluecontainer a");
+ let relativeLink = ruleView.styleDocument
+ .querySelector(".ruleview-propertyvaluecontainer a");
ok(relativeLink, "Link exists for relative1 node");
is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches");
yield selectNode(relative2, inspector);
- relativeLink = ruleView.styleDocument.querySelector(".ruleview-propertyvaluecontainer a");
+ relativeLink = ruleView.styleDocument
+ .querySelector(".ruleview-propertyvaluecontainer a");
ok(relativeLink, "Link exists for relative2 node");
is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches");
yield selectNode(absolute, inspector);
- let absoluteLink = ruleView.styleDocument.querySelector(".ruleview-propertyvaluecontainer a");
+ let absoluteLink = ruleView.styleDocument
+ .querySelector(".ruleview-propertyvaluecontainer a");
ok(absoluteLink, "Link exists for absolute node");
is(absoluteLink.getAttribute("href"), TEST_IMAGE, "href matches");
yield selectNode(inline, inspector);
- let inlineLink = ruleView.styleDocument.querySelector(".ruleview-propertyvaluecontainer a");
+ let inlineLink = ruleView.styleDocument
+ .querySelector(".ruleview-propertyvaluecontainer a");
ok(inlineLink, "Link exists for inline node");
is(inlineLink.getAttribute("href"), TEST_IMAGE, "href matches");
yield selectNode(base64, inspector);
- let base64Link = ruleView.styleDocument.querySelector(".ruleview-propertyvaluecontainer a");
+ let base64Link = ruleView.styleDocument
+ .querySelector(".ruleview-propertyvaluecontainer a");
ok(base64Link, "Link exists for base64 node");
is(base64Link.getAttribute("href"), BASE_64_URL, "href matches");
yield selectNode(inlineresolved, inspector);
- let inlineResolvedLink = ruleView.styleDocument.querySelector(".ruleview-propertyvaluecontainer a");
+ let inlineResolvedLink = ruleView.styleDocument
+ .querySelector(".ruleview-propertyvaluecontainer a");
ok(inlineResolvedLink, "Link exists for style tag node");
is(inlineResolvedLink.getAttribute("href"), TEST_IMAGE, "href matches");
yield selectNode(noimage, inspector);
- let noimageLink = ruleView.styleDocument.querySelector(".ruleview-propertyvaluecontainer a");
+ let noimageLink = ruleView.styleDocument
+ .querySelector(".ruleview-propertyvaluecontainer a");
ok(!noimageLink, "There is no link for the node with no background image");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles-uneditable.js b/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles-uneditable.js
index f898bf6079cd..a6edd13bd9be 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles-uneditable.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles-uneditable.js
@@ -7,21 +7,22 @@
// Check that user agent styles are never editable via
// the UI
+const TEST_URI = `
+
";
add_task(function*() {
- info ("Starting the test with the pref set to true before toolbox is opened");
+ info("Starting the test with the pref set to true before toolbox is opened");
Services.prefs.setBoolPref(PREF_UA_STYLES, true);
- info ("Opening the testcase and toolbox")
- yield addTab(TEST_URI);
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield userAgentStylesUneditable(inspector, view);
@@ -30,21 +31,26 @@ add_task(function*() {
});
function* userAgentStylesUneditable(inspector, view) {
- info ("Making sure that UI is not editable for user agent styles");
+ info("Making sure that UI is not editable for user agent styles");
yield selectNode("a", inspector);
let uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable);
for (let rule of uaRules) {
- ok (rule.editor.element.hasAttribute("uneditable"), "UA rules have uneditable attribute");
+ ok(rule.editor.element.hasAttribute("uneditable"),
+ "UA rules have uneditable attribute");
- ok (!rule.textProps[0].editor.nameSpan._editable, "nameSpan is not editable");
- ok (!rule.textProps[0].editor.valueSpan._editable, "valueSpan is not editable");
- ok (!rule.editor.closeBrace._editable, "closeBrace is not editable");
+ ok(!rule.textProps[0].editor.nameSpan._editable,
+ "nameSpan is not editable");
+ ok(!rule.textProps[0].editor.valueSpan._editable,
+ "valueSpan is not editable");
+ ok(!rule.editor.closeBrace._editable, "closeBrace is not editable");
- let colorswatch = rule.editor.element.querySelector(".ruleview-colorswatch");
+ let colorswatch = rule.editor.element
+ .querySelector(".ruleview-colorswatch");
if (colorswatch) {
- ok (!view.tooltips.colorPicker.swatches.has(colorswatch), "The swatch is not editable");
+ ok(!view.tooltips.colorPicker.swatches.has(colorswatch),
+ "The swatch is not editable");
}
}
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles.js b/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles.js
index 7541b4fd29f4..cda1f369e180 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_user-agent-styles.js
@@ -10,29 +10,23 @@
let PREF_UA_STYLES = "devtools.inspector.showUserAgentStyles";
const { PrefObserver } = require("devtools/styleeditor/utils");
-const TEST_DOC = ' \
- \
- \
- \
- \
- \
- \
- \
- \
- \
-
+`;
const TEST_DATA = [
{
@@ -78,21 +72,20 @@ const TEST_DATA = [
];
add_task(function*() {
- info ("Starting the test with the pref set to true before toolbox is opened");
+ info("Starting the test with the pref set to true before toolbox is opened");
yield setUserAgentStylesPref(true);
- info ("Opening the testcase and toolbox")
- yield addTab(TEST_URI);
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
- info ("Making sure that UA styles are visible on initial load")
+ info("Making sure that UA styles are visible on initial load");
yield userAgentStylesVisible(inspector, view);
- info ("Making sure that setting the pref to false hides UA styles");
+ info("Making sure that setting the pref to false hides UA styles");
yield setUserAgentStylesPref(false);
yield userAgentStylesNotVisible(inspector, view);
- info ("Making sure that resetting the pref to true shows UA styles again");
+ info("Making sure that resetting the pref to true shows UA styles again");
yield setUserAgentStylesPref(true);
yield userAgentStylesVisible(inspector, view);
@@ -114,7 +107,7 @@ function* setUserAgentStylesPref(val) {
}
function* userAgentStylesVisible(inspector, view) {
- info ("Making sure that user agent styles are currently visible");
+ info("Making sure that user agent styles are currently visible");
let userRules;
let uaRules;
@@ -125,23 +118,23 @@ function* userAgentStylesVisible(inspector, view) {
userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable);
uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable);
- is (userRules.length, data.numUserRules, "Correct number of user rules");
- ok (uaRules.length > data.numUARules, "Has UA rules");
+ is(userRules.length, data.numUserRules, "Correct number of user rules");
+ ok(uaRules.length > data.numUARules, "Has UA rules");
}
- ok (userRules.some(rule=> rule.matchedSelectors.length === 1),
+ ok(userRules.some(rule=> rule.matchedSelectors.length === 1),
"There is an inline style for element in user styles");
- ok (uaRules.some(rule=> rule.matchedSelectors.indexOf(":-moz-any-link")),
+ ok(uaRules.some(rule=> rule.matchedSelectors.indexOf(":-moz-any-link")),
"There is a rule for :-moz-any-link");
- ok (uaRules.some(rule=> rule.matchedSelectors.indexOf("*|*:link")),
+ ok(uaRules.some(rule=> rule.matchedSelectors.indexOf("*|*:link")),
"There is a rule for *|*:link");
- ok (uaRules.some(rule=> rule.matchedSelectors.length === 1),
+ ok(uaRules.some(rule=> rule.matchedSelectors.length === 1),
"Inline styles for ua styles");
}
function* userAgentStylesNotVisible(inspector, view) {
- info ("Making sure that user agent styles are not currently visible");
+ info("Making sure that user agent styles are not currently visible");
let userRules;
let uaRules;
@@ -152,22 +145,24 @@ function* userAgentStylesNotVisible(inspector, view) {
userRules = view._elementStyle.rules.filter(rule=>rule.editor.isEditable);
uaRules = view._elementStyle.rules.filter(rule=>!rule.editor.isEditable);
- is (userRules.length, data.numUserRules, "Correct number of user rules");
- is (uaRules.length, data.numUARules, "No UA rules");
+ is(userRules.length, data.numUserRules, "Correct number of user rules");
+ is(uaRules.length, data.numUARules, "No UA rules");
}
}
function* compareAppliedStylesWithUI(inspector, view, filter) {
- info ("Making sure that UI is consistent with pageStyle.getApplied");
+ info("Making sure that UI is consistent with pageStyle.getApplied");
- let entries = yield inspector.pageStyle.getApplied(inspector.selection.nodeFront, {
+ let entries = yield inspector.pageStyle.getApplied(
+ inspector.selection.nodeFront, {
inherited: true,
matchedSelectors: true,
filter: filter
});
let elementStyle = view._elementStyle;
- is(elementStyle.rules.length, entries.length, "Should have correct number of rules (" + entries.length + ")");
+ is(elementStyle.rules.length, entries.length,
+ "Should have correct number of rules (" + entries.length + ")");
entries = entries.sort((a, b) => {
return (a.pseudoElement || "z") > (b.pseudoElement || "z");
@@ -175,8 +170,11 @@ function* compareAppliedStylesWithUI(inspector, view, filter) {
entries.forEach((entry, i) => {
let elementStyleRule = elementStyle.rules[i];
- is (elementStyleRule.inherited, entry.inherited, "Same inherited (" +entry.inherited+ ")" );
- is (elementStyleRule.isSystem, entry.isSystem, "Same isSystem (" +entry.isSystem+ ")");
- is (elementStyleRule.editor.isEditable, !entry.isSystem, "Editor isEditable opposite of UA (" +entry.isSystem+ ")");
+ is(elementStyleRule.inherited, entry.inherited,
+ "Same inherited (" + entry.inherited + ")");
+ is(elementStyleRule.isSystem, entry.isSystem,
+ "Same isSystem (" + entry.isSystem + ")");
+ is(elementStyleRule.editor.isEditable, !entry.isSystem,
+ "Editor isEditable opposite of UA (" + entry.isSystem + ")");
});
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_user-property-reset.js b/browser/devtools/styleinspector/test/browser_ruleview_user-property-reset.js
index 0bb5bc670186..23dc2fa57b73 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_user-property-reset.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_user-property-reset.js
@@ -7,15 +7,14 @@
// Test that user set style properties can be changed from the markup-view and
// don't survive page reload
-let TEST_PAGE = [
- "data:text/html;charset=utf-8,",
- "
element 1
",
- "
element 2
"
-].join("");
+const TEST_URI = `
+
element 1
+
element 2
+`;
add_task(function*() {
- yield addTab(TEST_PAGE);
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#id1", inspector);
yield modifyRuleViewWidth("300px", view, inspector);
@@ -40,7 +39,8 @@ function getStyleRule(ruleView) {
function* modifyRuleViewWidth(value, ruleView, inspector) {
info("Getting the property value element");
- let valueSpan = getStyleRule(ruleView).querySelector(".ruleview-propertyvalue");
+ let valueSpan = getStyleRule(ruleView)
+ .querySelector(".ruleview-propertyvalue");
info("Focusing the property value to set it to edit mode");
let editor = yield focusEditableField(ruleView, valueSpan.parentNode);
@@ -49,14 +49,16 @@ function* modifyRuleViewWidth(value, ruleView, inspector) {
info("Setting the new value");
editor.input.value = value;
- info("Pressing return and waiting for the field to blur and for the markup-view to show the mutation");
+ info("Pressing return and waiting for the field to blur and for the " +
+ "markup-view to show the mutation");
let onBlur = once(editor.input, "blur", true);
let onMutation = inspector.once("markupmutation");
EventUtils.sendKey("return");
yield onBlur;
yield onMutation;
- info("Escaping out of the new property field that has been created after the value was edited");
+ info("Escaping out of the new property field that has been created after " +
+ "the value was edited");
let onNewFieldBlur = once(ruleView.styleDocument.activeElement, "blur", true);
EventUtils.sendKey("escape");
yield onNewFieldBlur;
@@ -71,14 +73,17 @@ function* getContainerStyleAttrValue(id, {walker, markup}) {
if (attrName.textContent === "style") {
return container.elt.querySelectorAll(".attr-value")[attrIndex];
}
- attrIndex ++;
+ attrIndex++;
}
}
function* assertRuleAndMarkupViewWidth(id, value, ruleView, inspector) {
- let valueSpan = getStyleRule(ruleView).querySelector(".ruleview-propertyvalue");
- is(valueSpan.textContent, value, "Rule-view style width is " + value + " as expected");
+ let valueSpan = getStyleRule(ruleView)
+ .querySelector(".ruleview-propertyvalue");
+ is(valueSpan.textContent, value,
+ "Rule-view style width is " + value + " as expected");
let attr = yield getContainerStyleAttrValue(id, inspector);
- is(attr.textContent.replace(/\s/g, ""), "width:" + value + ";", "Markup-view style attribute width is " + value);
+ is(attr.textContent.replace(/\s/g, ""),
+ "width:" + value + ";", "Markup-view style attribute width is " + value);
}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_context-menu-copy-color_01.js b/browser/devtools/styleinspector/test/browser_styleinspector_context-menu-copy-color_01.js
index f707fa0ad37c..5db4a420deda 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_context-menu-copy-color_01.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_context-menu-copy-color_01.js
@@ -5,35 +5,27 @@
// Test "Copy color" item of the context menu #1: Test _isColorPopup.
-const TEST_COLOR = "#123ABC";
-const COLOR_SELECTOR = "span[data-color]";
+const TEST_URI = `
+
+`;
add_task(function*() {
- yield addTab(TEST_URL);
-
- info("Opening the rule-view and selecting test node one");
- let {inspector, view: rView} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#one", inspector);
- is(getRuleViewPropertyValue(rView, "element", "color"), "#F00",
+ is(getRuleViewPropertyValue(view, "element", "color"), "#F00",
"The rule-view shows the properties for test node one");
- let cView = inspector.sidebar.getWindowForTab("computedview")["computedview"].view;
+ let cView = inspector.sidebar.getWindowForTab("computedview")
+ .computedview.view;
let prop = getComputedViewProperty(cView, "color");
ok(!prop, "The computed-view doesn't show the properties for test node one");
@@ -38,6 +38,6 @@ add_task(function*() {
ok(getComputedViewPropertyValue(cView, "color"), "#00F",
"The computed-view shows the properties for test node two");
- is(getRuleViewPropertyValue(rView, "element", "color"), "#F00",
+ is(getRuleViewPropertyValue(view, "element", "color"), "#F00",
"The rule-view doesn't the properties for test node two");
-});
\ No newline at end of file
+});
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-background-image.js b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-background-image.js
index dd4fad3378de..e1ed28778344 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-background-image.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-background-image.js
@@ -7,28 +7,27 @@
// Test that background-image URLs have image preview tooltips in the rule-view
// and computed-view
-const PAGE_CONTENT = [
- '',
- '
test element
'
-].join("\n");
+const TEST_URI = `
+
+
test element
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,rule view tooltip test");
- content.document.body.innerHTML = PAGE_CONTENT;
- let {toolbox, inspector, view} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
info("Testing the background-image property on the body rule");
yield testBodyRuleView(view);
@@ -38,7 +37,8 @@ add_task(function*() {
info("Testing the the background property on the .test-element rule");
yield testDivRuleView(view);
- info("Testing that image preview tooltips show even when there are fields being edited");
+ info("Testing that image preview tooltips show even when there are " +
+ "fields being edited");
yield testTooltipAppearsEvenInEditMode(view);
info("Switching over to the computed-view");
@@ -54,7 +54,8 @@ function* testBodyRuleView(view) {
info("Testing tooltips in the rule view");
let panel = view.tooltips.previewTooltip.panel;
- // Check that the rule view has a tooltip and that a XUL panel has been created
+ // Check that the rule view has a tooltip and that a XUL panel has
+ // been created
ok(view.tooltips.previewTooltip, "Tooltip instance exists");
ok(panel, "XUL panel exists");
@@ -66,7 +67,8 @@ function* testBodyRuleView(view) {
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
- ok(images[0].getAttribute("src").indexOf("iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHe") !== -1,
+ ok(images[0].getAttribute("src")
+ .indexOf("iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHe") !== -1,
"The image URL seems fine");
}
@@ -81,12 +83,11 @@ function* testDivRuleView(view) {
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
- ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri image as expected");
+ ok(images[0].getAttribute("src").startsWith("data:"),
+ "Tooltip contains a data-uri image as expected");
}
function* testTooltipAppearsEvenInEditMode(view) {
- let panel = view.tooltips.previewTooltip.panel;
-
info("Switching to edit mode in the rule view");
let editor = yield turnToEditMode(view);
@@ -119,5 +120,6 @@ function* testComputedView(view) {
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
- ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri in the computed-view too");
+ ok(images[0].getAttribute("src").startsWith("data:"),
+ "Tooltip contains a data-uri in the computed-view too");
}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-closes-on-new-selection.js b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-closes-on-new-selection.js
index 11ae65f87889..0c0572095105 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-closes-on-new-selection.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-closes-on-new-selection.js
@@ -6,10 +6,11 @@
// Test that if a tooltip is visible when a new selection is made, it closes
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,
el 1
el 2
");
+const TEST_URI = "
el 1
el 2
";
- let {toolbox, inspector, view} = yield openRuleView();
+add_task(function*() {
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode(".one", inspector);
info("Testing rule view tooltip closes on new selection");
@@ -30,6 +31,7 @@ function* testRuleView(ruleView, inspector) {
info("Selecting a new node");
let onHidden = tooltip.once("hidden");
yield selectNode(".two", inspector);
+ yield onHidden;
ok(true, "Rule view tooltip closed after a new node got selected");
}
@@ -44,6 +46,7 @@ function* testComputedView(computedView, inspector) {
info("Selecting a new node");
let onHidden = tooltip.once("hidden");
yield selectNode(".one", inspector);
+ yield onHidden;
ok(true, "Computed view tooltip closed after a new node got selected");
}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-longhand-fontfamily.js b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-longhand-fontfamily.js
index d188f13cd598..196eeda948cb 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-longhand-fontfamily.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-longhand-fontfamily.js
@@ -6,34 +6,26 @@
// Test the fontfamily tooltip on longhand properties
-const PAGE_CONTENT = [
- '',
- '
test element
'
-].join("\n");
+const TEST_URI = `
+
+
test element
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,font family longhand tooltip test");
-
- info("Creating the test document");
- content.document.body.innerHTML = PAGE_CONTENT;
-
- info("Opening the rule view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test node");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testElement", inspector);
-
yield testRuleView(view, inspector.selection.nodeFront);
info("Opening the computed view");
let onComputedViewReady = inspector.once("computed-view-refreshed");
- ({toolbox, inspector, view} = yield openComputedView());
+ ({inspector, view} = yield openComputedView());
yield onComputedViewReady;
yield testComputedView(view, inspector.selection.nodeFront);
@@ -47,22 +39,26 @@ function* testRuleView(ruleView, nodeFront) {
let tooltip = ruleView.tooltips.previewTooltip;
let panel = tooltip.panel;
- // Check that the rule view has a tooltip and that a XUL panel has been created
+ // Check that the rule view has a tooltip and that a XUL panel has
+ // been created
ok(tooltip, "Tooltip instance exists");
ok(panel, "XUL panel exists");
// Get the font family property inside the rule view
- let {valueSpan} = getRuleViewProperty(ruleView, "#testElement", "font-family");
+ let {valueSpan} = getRuleViewProperty(ruleView, "#testElement",
+ "font-family");
// And verify that the tooltip gets shown on this property
yield assertHoverTooltipOn(tooltip, valueSpan);
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
- ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri image as expected");
+ ok(images[0].getAttribute("src").startsWith("data:"),
+ "Tooltip contains a data-uri image as expected");
let dataURL = yield getFontFamilyDataURL(valueSpan.textContent, nodeFront);
- is(images[0].getAttribute("src"), dataURL, "Tooltip contains the correct data-uri image");
+ is(images[0].getAttribute("src"), dataURL,
+ "Tooltip contains the correct data-uri image");
}
function* testComputedView(computedView, nodeFront) {
@@ -76,14 +72,17 @@ function* testComputedView(computedView, nodeFront) {
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
- ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri image as expected");
+ ok(images[0].getAttribute("src").startsWith("data:"),
+ "Tooltip contains a data-uri image as expected");
let dataURL = yield getFontFamilyDataURL(valueSpan.textContent, nodeFront);
- is(images[0].getAttribute("src"), dataURL, "Tooltip contains the correct data-uri image");
+ is(images[0].getAttribute("src"), dataURL,
+ "Tooltip contains the correct data-uri image");
}
function* testExpandedComputedViewProperty(computedView, nodeFront) {
- info("Testing font-family tooltips in expanded properties of the computed view");
+ info("Testing font-family tooltips in expanded properties of the " +
+ "computed view");
info("Expanding the font-family property to reveal matched selectors");
let propertyView = getPropertyView(computedView, "font-family");
@@ -100,10 +99,12 @@ function* testExpandedComputedViewProperty(computedView, nodeFront) {
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
- ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri image as expected");
+ ok(images[0].getAttribute("src").startsWith("data:"),
+ "Tooltip contains a data-uri image as expected");
let dataURL = yield getFontFamilyDataURL(valueSpan.textContent, nodeFront);
- is(images[0].getAttribute("src"), dataURL, "Tooltip contains the correct data-uri image");
+ is(images[0].getAttribute("src"), dataURL,
+ "Tooltip contains the correct data-uri image");
}
function getPropertyView(computedView, name) {
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-shorthand-fontfamily.js b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-shorthand-fontfamily.js
index 6be03806bb53..0da1d9479313 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-shorthand-fontfamily.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-shorthand-fontfamily.js
@@ -6,27 +6,19 @@
// Test the fontfamily tooltip on shorthand properties
-const PAGE_CONTENT = [
- '',
- '
test element
'
-].join("\n");
+const TEST_URI = `
+
+
test element
+`;
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8,font family shorthand tooltip test");
-
- info("Creating the test document");
- content.document.body.innerHTML = PAGE_CONTENT;
-
- info("Opening the rule view");
- let {toolbox, inspector, view} = yield openRuleView();
-
- info("Selecting the test node");
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("#testElement", inspector);
-
yield testRuleView(view, inspector.selection.nodeFront);
});
@@ -36,25 +28,30 @@ function* testRuleView(ruleView, nodeFront) {
let tooltip = ruleView.tooltips.previewTooltip;
let panel = tooltip.panel;
- // Check that the rule view has a tooltip and that a XUL panel has been created
+ // Check that the rule view has a tooltip and that a XUL panel has
+ // been created
ok(tooltip, "Tooltip instance exists");
ok(panel, "XUL panel exists");
// Get the computed font family property inside the font rule view
- let propertyList = ruleView.element.querySelectorAll(".ruleview-propertylist");
+ let propertyList = ruleView.element
+ .querySelectorAll(".ruleview-propertylist");
let fontExpander = propertyList[1].querySelectorAll(".ruleview-expander")[0];
fontExpander.click();
let rule = getRuleViewRule(ruleView, "#testElement");
- let valueSpan = rule.querySelector(".ruleview-computed .ruleview-propertyvalue");
+ let valueSpan = rule
+ .querySelector(".ruleview-computed .ruleview-propertyvalue");
// And verify that the tooltip gets shown on this property
yield assertHoverTooltipOn(tooltip, valueSpan);
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
- ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri image as expected");
+ ok(images[0].getAttribute("src")
+ .startsWith("data:"), "Tooltip contains a data-uri image as expected");
let dataURL = yield getFontFamilyDataURL(valueSpan.textContent, nodeFront);
- is(images[0].getAttribute("src"), dataURL, "Tooltip contains the correct data-uri image");
+ is(images[0].getAttribute("src"), dataURL,
+ "Tooltip contains the correct data-uri image");
}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-size.js b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-size.js
index ecdc1b969aa5..4d481647d29a 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-size.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-size.js
@@ -7,23 +7,20 @@
// Checking tooltips dimensions, to make sure their big enough to display their
// content
-const TEST_PAGE = [
- 'data:text/html;charset=utf-8,',
- '',
- ''
-].join("\n");
+const TEST_URI = `
+
+
+`;
add_task(function*() {
- yield addTab(TEST_PAGE);
- let {toolbox, inspector, view} = yield openRuleView();
-
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode("div", inspector);
-
yield testImageDimension(view);
yield testPickerDimension(view);
});
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-01.js b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-01.js
index d9e018bc16de..295c6dec691c 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-01.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-01.js
@@ -6,29 +6,30 @@
// Test that the css transform highlighter is created only when asked
-const PAGE_CONTENT = [
- '',
- 'Test the css transform highlighter'
-].join("\n");
+const TEST_URI = `
+
+ Test the css transform highlighter
+`;
const TYPE = "CssTransformHighlighter";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
- let {inspector, view: rView} = yield openRuleView();
- let overlay = rView.highlighters;
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
+ let overlay = view.highlighters;
ok(!overlay.highlighters[TYPE], "No highlighter exists in the rule-view");
let h = yield overlay._getHighlighter(TYPE);
- ok(overlay.highlighters[TYPE], "The highlighter has been created in the rule-view");
+ ok(overlay.highlighters[TYPE],
+ "The highlighter has been created in the rule-view");
is(h, overlay.highlighters[TYPE], "The right highlighter has been created");
let h2 = yield overlay._getHighlighter(TYPE);
- is(h, h2, "The same instance of highlighter is returned everytime in the rule-view");
+ is(h, h2,
+ "The same instance of highlighter is returned everytime in the rule-view");
let onComputedViewReady = inspector.once("computed-view-refreshed");
let {view: cView} = yield openComputedView();
@@ -37,8 +38,10 @@ add_task(function*() {
ok(!overlay.highlighters[TYPE], "No highlighter exists in the computed-view");
h = yield overlay._getHighlighter(TYPE);
- ok(overlay.highlighters[TYPE], "The highlighter has been created in the computed-view");
+ ok(overlay.highlighters[TYPE],
+ "The highlighter has been created in the computed-view");
is(h, overlay.highlighters[TYPE], "The right highlighter has been created");
h2 = yield overlay._getHighlighter(TYPE);
- is(h, h2, "The same instance of highlighter is returned everytime in the computed-view");
+ is(h, h2, "The same instance of highlighter is returned everytime " +
+ "in the computed-view");
});
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-02.js b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-02.js
index 64d8f0bb6666..a319b1dfe1e8 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-02.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-02.js
@@ -7,35 +7,36 @@
// Test that the css transform highlighter is created when hovering over a
// transform property
-const PAGE_CONTENT = [
- '',
- 'Test the css transform highlighter'
-].join("\n");
+const TEST_URI = `
+
+ Test the css transform highlighter
+`;
let TYPE = "CssTransformHighlighter";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
- let {inspector, view: rView} = yield openRuleView();
- let hs = rView.highlighters;
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
+ let hs = view.highlighters;
ok(!hs.highlighters[TYPE], "No highlighter exists in the rule-view (1)");
- ok(!hs.promises[TYPE], "No highlighter is being created in the rule-view (1)");
+ ok(!hs.promises[TYPE],
+ "No highlighter is being created in the rule-view (1)");
info("Faking a mousemove on a non-transform property");
- let {valueSpan} = getRuleViewProperty(rView, "body", "color");
+ let {valueSpan} = getRuleViewProperty(view, "body", "color");
hs._onMouseMove({target: valueSpan});
ok(!hs.highlighters[TYPE], "No highlighter exists in the rule-view (2)");
- ok(!hs.promises[TYPE], "No highlighter is being created in the rule-view (2)");
+ ok(!hs.promises[TYPE],
+ "No highlighter is being created in the rule-view (2)");
info("Faking a mousemove on a transform property");
- ({valueSpan} = getRuleViewProperty(rView, "body", "transform"));
+ ({valueSpan} = getRuleViewProperty(view, "body", "transform"));
let onHighlighterShown = hs.once("highlighter-shown");
hs._onMouseMove({target: valueSpan});
yield onHighlighterShown;
@@ -49,13 +50,15 @@ add_task(function*() {
hs = cView.highlighters;
ok(!hs.highlighters[TYPE], "No highlighter exists in the computed-view (1)");
- ok(!hs.promises[TYPE], "No highlighter is being created in the computed-view (1)");
+ ok(!hs.promises[TYPE],
+ "No highlighter is being created in the computed-view (1)");
info("Faking a mousemove on a non-transform property");
({valueSpan} = getComputedViewProperty(cView, "color"));
hs._onMouseMove({target: valueSpan});
ok(!hs.highlighters[TYPE], "No highlighter exists in the computed-view (2)");
- ok(!hs.promises[TYPE], "No highlighter is being created in the computed-view (2)");
+ ok(!hs.promises[TYPE],
+ "No highlighter is being created in the computed-view (2)");
info("Faking a mousemove on a transform property");
({valueSpan} = getComputedViewProperty(cView, "transform"));
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-03.js b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-03.js
index 06041c412ea3..72b687ec0bbb 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-03.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-03.js
@@ -10,25 +10,24 @@
// Note that in this test, we mock the highlighter front, merely testing the
// behavior of the style-inspector UI for now
-const PAGE_CONTENT = [
- '',
- 'Test the css transform highlighter'
-].join("\n");
+const TEST_URI = `
+
+ Test the css transform highlighter
+`;
const TYPE = "CssTransformHighlighter";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
- let {inspector, view: rView} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
// Mock the highlighter front to get the reference of the NodeFront
let HighlighterFront = {
@@ -49,10 +48,10 @@ add_task(function*() {
};
// Inject the mock highlighter in the rule-view
- let hs = rView.highlighters;
+ let hs = view.highlighters;
hs.promises[TYPE] = promise.resolve(HighlighterFront);
- let {valueSpan} = getRuleViewProperty(rView, "body", "transform");
+ let {valueSpan} = getRuleViewProperty(view, "body", "transform");
info("Checking that the HighlighterFront's show/hide methods are called");
let onHighlighterShown = hs.once("highlighter-shown");
@@ -78,7 +77,7 @@ add_task(function*() {
info("Checking that the right NodeFront reference is passed");
yield selectNode("html", inspector);
- ({valueSpan} = getRuleViewProperty(rView, "html", "transform"));
+ ({valueSpan} = getRuleViewProperty(view, "html", "transform"));
onHighlighterShown = hs.once("highlighter-shown");
hs._onMouseMove({target: valueSpan});
yield onHighlighterShown;
@@ -86,15 +85,16 @@ add_task(function*() {
"The right NodeFront is passed to the highlighter (1)");
yield selectNode("body", inspector);
- ({valueSpan} = getRuleViewProperty(rView, "body", "transform"));
+ ({valueSpan} = getRuleViewProperty(view, "body", "transform"));
onHighlighterShown = hs.once("highlighter-shown");
hs._onMouseMove({target: valueSpan});
yield onHighlighterShown;
is(HighlighterFront.nodeFront.tagName, "BODY",
"The right NodeFront is passed to the highlighter (2)");
- info("Checking that the highlighter gets hidden when hovering a non-transform property");
- ({valueSpan} = getRuleViewProperty(rView, "body", "color"));
+ info("Checking that the highlighter gets hidden when hovering a " +
+ "non-transform property");
+ ({valueSpan} = getRuleViewProperty(view, "body", "color"));
onHighlighterHidden = hs.once("highlighter-hidden");
hs._onMouseMove({target: valueSpan});
yield onHighlighterHidden;
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-04.js b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-04.js
index ae253f37ae57..0e3d7ef8a5ef 100644
--- a/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-04.js
+++ b/browser/devtools/styleinspector/test/browser_styleinspector_transform-highlighter-04.js
@@ -11,50 +11,51 @@
// tests, this one only tests the rule-view as only this view features disabled
// and overriden properties
-const PAGE_CONTENT = [
- '',
- ''
-].join("\n");
+const TEST_URI = `
+
+
+`;
const TYPE = "CssTransformHighlighter";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + PAGE_CONTENT);
-
- let {view: rView, inspector} = yield openRuleView();
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ let {inspector, view} = yield openRuleView();
yield selectNode(".test", inspector);
- let hs = rView.highlighters;
+ let hs = view.highlighters;
info("Faking a mousemove on the overriden property");
- let {valueSpan} = getRuleViewProperty(rView, "div", "transform");
+ let {valueSpan} = getRuleViewProperty(view, "div", "transform");
hs._onMouseMove({target: valueSpan});
- ok(!hs.highlighters[TYPE], "No highlighter was created for the overriden property");
+ ok(!hs.highlighters[TYPE],
+ "No highlighter was created for the overriden property");
ok(!hs.promises[TYPE], "And no highlighter is being initialized either");
info("Disabling the applied property");
- let classRuleEditor = getRuleViewRuleEditor(rView, 1);
+ let classRuleEditor = getRuleViewRuleEditor(view, 1);
let propEditor = classRuleEditor.rule.textProps[0].editor;
propEditor.enable.click();
yield classRuleEditor.rule._applyingModifications;
info("Faking a mousemove on the disabled property");
- ({valueSpan} = getRuleViewProperty(rView, ".test", "transform"));
+ ({valueSpan} = getRuleViewProperty(view, ".test", "transform"));
hs._onMouseMove({target: valueSpan});
- ok(!hs.highlighters[TYPE], "No highlighter was created for the disabled property");
+ ok(!hs.highlighters[TYPE],
+ "No highlighter was created for the disabled property");
ok(!hs.promises[TYPE], "And no highlighter is being initialized either");
info("Faking a mousemove on the now unoverriden property");
- ({valueSpan} = getRuleViewProperty(rView, "div", "transform"));
+ ({valueSpan} = getRuleViewProperty(view, "div", "transform"));
let onHighlighterShown = hs.once("highlighter-shown");
hs._onMouseMove({target: valueSpan});
yield onHighlighterShown;
diff --git a/browser/devtools/styleinspector/test/head.js b/browser/devtools/styleinspector/test/head.js
index c70aba22e705..679f16f55ec2 100644
--- a/browser/devtools/styleinspector/test/head.js
+++ b/browser/devtools/styleinspector/test/head.js
@@ -13,14 +13,18 @@ let {CssRuleView, _ElementStyle} = require("devtools/styleinspector/rule-view");
let {CssLogic, CssSelector} = require("devtools/styleinspector/css-logic");
let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
let {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
-let {editableField, getInplaceEditorForSpan: inplaceEditor} = require("devtools/shared/inplace-editor");
-let {console} = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {});
+let {editableField, getInplaceEditorForSpan: inplaceEditor} =
+ require("devtools/shared/inplace-editor");
+let {console} =
+ Components.utils.import("resource://gre/modules/devtools/Console.jsm", {});
// All tests are asynchronous
waitForExplicitFinish();
-const TEST_URL_ROOT = "http://example.com/browser/browser/devtools/styleinspector/test/";
-const TEST_URL_ROOT_SSL = "https://example.com/browser/browser/devtools/styleinspector/test/";
+const TEST_URL_ROOT =
+ "http://example.com/browser/browser/devtools/styleinspector/test/";
+const TEST_URL_ROOT_SSL =
+ "https://example.com/browser/browser/devtools/styleinspector/test/";
const ROOT_TEST_DIR = getRootDirectory(gTestPath);
const FRAME_SCRIPT_URL = ROOT_TEST_DIR + "doc_frame_script.js";
@@ -73,12 +77,12 @@ registerCleanupFunction(() => {
* There is no need to clean tabs up at the end of a test as this is done
* automatically.
*
- * It is advised not to store any references on the global scope. There shouldn't
- * be a need to anyway. Thanks to add_task, test steps, even though asynchronous,
- * can be described in a nice flat way, and if/for/while/... control flow can be
- * used as in sync code, making it possible to write the outline of the test case
- * all in add_task, and delegate actual processing and assertions to other
- * functions.
+ * It is advised not to store any references on the global scope. There
+ * shouldn't be a need to anyway. Thanks to add_task, test steps, even
+ * though asynchronous, can be described in a nice flat way, and
+ * if/for/while/... control flow can be used as in sync code, making it
+ * possible to write the outline of the test case all in add_task, and delegate
+ * actual processing and assertions to other functions.
*/
/* *********************************************
@@ -91,7 +95,9 @@ registerCleanupFunction(() => {
/**
* Add a new test tab in the browser and load the given url.
- * @param {String} url The url to be loaded in the new tab
+ *
+ * @param {String} url
+ * The url to be loaded in the new tab
* @return a promise that resolves to the tab object when the url is loaded
*/
function addTab(url) {
@@ -119,6 +125,7 @@ function addTab(url) {
/**
* Simple DOM node accesor function that takes either a node or a string css
* selector as argument and returns the corresponding node
+ *
* @param {String|DOMNode} nodeOrSelector
* @return {DOMNode|CPOW} Note that in e10s mode a CPOW object is returned which
* doesn't implement *all* of the DOMNode's properties
@@ -132,9 +139,10 @@ function getNode(nodeOrSelector) {
/**
* Get the NodeFront for a given css selector, via the protocol
+ *
* @param {String} selector
- * @param {InspectorPanel} inspector The instance of InspectorPanel currently
- * loaded in the toolbox
+ * @param {InspectorPanel} inspector
+ * The instance of InspectorPanel currently loaded in the toolbox
* @return {Promise} Resolves to the NodeFront instance
*/
function getNodeFront(selector, {walker}) {
@@ -144,9 +152,10 @@ function getNodeFront(selector, {walker}) {
/**
* Highlight a node that matches the given css selector and set the inspector's
* current selection to this node.
+ *
* @param {String} selector
- * @param {InspectorPanel} inspector The instance of InspectorPanel currently
- * loaded in the toolbox
+ * @param {InspectorPanel} inspector
+ * The instance of InspectorPanel currently loaded in the toolbox
* @return {Promise} Resolves when the inspector is updated with the new node
*/
let selectAndHighlightNode = Task.async(function*(selector, inspector) {
@@ -161,11 +170,11 @@ let selectAndHighlightNode = Task.async(function*(selector, inspector) {
/*
* Set the inspector's current selection to a node or to the first match of the
* given css selector.
- * @param {String|NodeFront}
- * data The node to select
+ *
+ * @param {String|NodeFront} data
+ * The node to select
* @param {InspectorPanel} inspector
- * The instance of InspectorPanel currently
- * loaded in the toolbox
+ * The instance of InspectorPanel currently loaded in the toolbox
* @param {String} reason
* Defaults to "test" which instructs the inspector not
* to highlight the node upon selection
@@ -184,8 +193,9 @@ let selectNode = Task.async(function*(data, inspector, reason="test") {
/**
* Set the inspector's current selection to null so that no node is selected
- * @param {InspectorPanel} inspector The instance of InspectorPanel currently
- * loaded in the toolbox
+ *
+ * @param {InspectorPanel} inspector
+ * The instance of InspectorPanel currently loaded in the toolbox
* @return a promise that resolves when the inspector is updated
*/
function clearCurrentNodeSelection(inspector) {
@@ -197,6 +207,7 @@ function clearCurrentNodeSelection(inspector) {
/**
* Open the toolbox, with the inspector tool visible.
+ *
* @return a promise that resolves when the inspector is ready
*/
let openInspector = Task.async(function*() {
@@ -236,6 +247,7 @@ let openInspector = Task.async(function*() {
/**
* Wait for the toolbox frame to receive focus after it loads
+ *
* @param {Toolbox} toolbox
* @return a promise that resolves when focus has been received
*/
@@ -250,6 +262,7 @@ function waitForToolboxFrameFocus(toolbox) {
/**
* Open the toolbox, with the inspector tool visible, and the sidebar that
* corresponds to the given id selected
+ *
* @return a promise that resolves when the inspector is ready and the sidebar
* view is visible and ready
*/
@@ -274,6 +287,7 @@ let openInspectorSideBar = Task.async(function*(id) {
/**
* Open the toolbox, with the inspector tool visible, and the computed-view
* sidebar tab selected.
+ *
* @return a promise that resolves when the inspector is ready and the computed
* view is visible and ready
*/
@@ -284,6 +298,7 @@ function openComputedView() {
/**
* Open the toolbox, with the inspector tool visible, and the rule-view
* sidebar tab selected.
+ *
* @return a promise that resolves when the inspector is ready and the rule
* view is visible and ready
*/
@@ -293,10 +308,13 @@ function openRuleView() {
/**
* Wait for eventName on target.
- * @param {Object} target An observable object that either supports on/off or
- * addEventListener/removeEventListener
+ *
+ * @param {Object} target
+ * An observable object that either supports on/off or
+ * addEventListener/removeEventListener
* @param {String} eventName
- * @param {Boolean} useCapture Optional, for addEventListener/removeEventListener
+ * @param {Boolean} useCapture
+ * Optional, for addEventListener/removeEventListener
* @return A promise that resolves when the event has been handled
*/
function once(target, eventName, useCapture=false) {
@@ -324,7 +342,9 @@ function once(target, eventName, useCapture=false) {
/**
* This shouldn't be used in the tests, but is useful when writing new tests or
* debugging existing tests in order to introduce delays in the test steps
- * @param {Number} ms The time to wait
+ *
+ * @param {Number} ms
+ * The time to wait
* @return A promise that resolves when the time is passed
*/
function wait(ms) {
@@ -336,7 +356,9 @@ function wait(ms) {
/**
* Wait for a content -> chrome message on the message manager (the window
* messagemanager is used).
- * @param {String} name The message name
+ *
+ * @param {String} name
+ * The message name
* @return {Promise} A promise that resolves to the response data when the
* message has been received
*/
@@ -356,12 +378,17 @@ function waitForContentMessage(name) {
/**
* Send an async message to the frame script (chrome -> content) and wait for a
* response message with the same name (content -> chrome).
- * @param {String} name The message name. Should be one of the messages defined
- * in doc_frame_script.js
- * @param {Object} data Optional data to send along
- * @param {Object} objects Optional CPOW objects to send along
- * @param {Boolean} expectResponse If set to false, don't wait for a response
- * with the same name from the content script. Defaults to true.
+ *
+ * @param {String} name
+ * The message name. Should be one of the messages defined
+ * in doc_frame_script.js
+ * @param {Object} data
+ * Optional data to send along
+ * @param {Object} objects
+ * Optional CPOW objects to send along
+ * @param {Boolean} expectResponse
+ * If set to false, don't wait for a response with the same name
+ * from the content script. Defaults to true.
* @return {Promise} Resolves to the response data if a response is expected,
* immediately resolves otherwise
*/
@@ -372,21 +399,25 @@ function executeInContent(name, data={}, objects={}, expectResponse=true) {
mm.sendAsyncMessage(name, data, objects);
if (expectResponse) {
return waitForContentMessage(name);
- } else {
- return promise.resolve();
}
+
+ return promise.resolve();
}
/**
* Send an async message to the frame script and get back the requested
* computed style property.
- * @param {String} selector: The selector used to obtain the element.
- * @param {String} pseudo: pseudo id to query, or null.
- * @param {String} name: name of the property.
+ *
+ * @param {String} selector
+ * The selector used to obtain the element.
+ * @param {String} pseudo
+ * pseudo id to query, or null.
+ * @param {String} name
+ * name of the property.
*/
function* getComputedStyleProperty(selector, pseudo, propName) {
- return yield executeInContent("Test:GetComputedStylePropertyValue",
- {selector,
+ return yield executeInContent("Test:GetComputedStylePropertyValue",
+ {selector,
pseudo,
name: propName});
}
@@ -394,15 +425,21 @@ function* getComputedStyleProperty(selector, pseudo, propName) {
/**
* Send an async message to the frame script and wait until the requested
* computed style property has the expected value.
- * @param {String} selector: The selector used to obtain the element.
- * @param {String} pseudo: pseudo id to query, or null.
- * @param {String} prop: name of the property.
- * @param {String} expected: expected value of property
- * @param {String} name: the name used in test message
+ *
+ * @param {String} selector
+ * The selector used to obtain the element.
+ * @param {String} pseudo
+ * pseudo id to query, or null.
+ * @param {String} prop
+ * name of the property.
+ * @param {String} expected
+ * expected value of property
+ * @param {String} name
+ * the name used in test message
*/
function* waitForComputedStyleProperty(selector, pseudo, name, expected) {
- return yield executeInContent("Test:WaitForComputedStylePropertyValue",
- {selector,
+ return yield executeInContent("Test:WaitForComputedStylePropertyValue",
+ {selector,
pseudo,
expected,
name});
@@ -411,9 +448,11 @@ function* waitForComputedStyleProperty(selector, pseudo, name, expected) {
/**
* Given an inplace editable element, click to switch it to edit mode, wait for
* focus
+ *
* @return a promise that resolves to the inplace-editor element when ready
*/
-let focusEditableField = Task.async(function*(ruleView, editable, xOffset=1, yOffset=1, options={}) {
+let focusEditableField = Task.async(function*(ruleView, editable, xOffset=1,
+ yOffset=1, options={}) {
let onFocus = once(editable.parentNode, "focus", true);
info("Clicking on editable field to turn to edit mode");
EventUtils.synthesizeMouse(editable, xOffset, yOffset, options,
@@ -428,9 +467,10 @@ let focusEditableField = Task.async(function*(ruleView, editable, xOffset=1, yOf
/**
* Given a tooltip object instance (see Tooltip.js), checks if it is set to
- * toggle and hover and if so, checks if the given target is a valid hover target.
- * This won't actually show the tooltip (the less we interact with XUL panels
- * during test runs, the better).
+ * toggle and hover and if so, checks if the given target is a valid hover
+ * target. This won't actually show the tooltip (the less we interact with XUL
+ * panels during test runs, the better).
+ *
* @return a promise that resolves when the answer is known
*/
function isHoverTooltipTarget(tooltip, target) {
@@ -444,6 +484,7 @@ function isHoverTooltipTarget(tooltip, target) {
/**
* Same as isHoverTooltipTarget except that it will fail the test if there is no
* tooltip defined on hover of the given element
+ *
* @return a promise
*/
function assertHoverTooltipOn(tooltip, element) {
@@ -457,6 +498,7 @@ function assertHoverTooltipOn(tooltip, element) {
/**
* Same as assertHoverTooltipOn but fails the test if there is a tooltip defined
* on hover of the given element
+ *
* @return a promise
*/
function assertNoHoverTooltipOn(tooltip, element) {
@@ -471,6 +513,7 @@ function assertNoHoverTooltipOn(tooltip, element) {
* Listen for a new window to open and return a promise that resolves when one
* does and completes its load.
* Only resolves when the new window topic isn't domwindowopened.
+ *
* @return a promise that resolves to the window object
*/
function waitForWindow() {
@@ -496,6 +539,7 @@ function waitForWindow() {
/**
* Listen for a new tab to open and return a promise that resolves when one
* does and completes the load event.
+ *
* @return a promise that resolves to the tab object
*/
let waitForTab = Task.async(function*() {
@@ -510,9 +554,12 @@ let waitForTab = Task.async(function*() {
/**
* @see SimpleTest.waitForClipboard
- * @param {Function} setup Function to execute before checking for the
- * clipboard content
- * @param {String|Boolean} expected An expected string or validator function
+ *
+ * @param {Function} setup
+ * Function to execute before checking for the
+ * clipboard content
+ * @param {String|Boolean} expected
+ * An expected string or validator function
* @return a promise that resolves when the expected string has been found or
* the validator function has returned true, rejects otherwise.
*/
@@ -534,23 +581,25 @@ function fireCopyEvent(element) {
/**
* Polls a given function waiting for it to return true.
*
- * @param {Function} validatorFn A validator function that returns a boolean.
- * This is called every few milliseconds to check if the result is true. When
- * it is true, the promise resolves.
- * @param {String} name Optional name of the test. This is used to generate
- * the success and failure messages.
+ * @param {Function} validatorFn
+ * A validator function that returns a boolean.
+ * This is called every few milliseconds to check if the result is true.
+ * When it is true, the promise resolves.
+ * @param {String} name
+ * Optional name of the test. This is used to generate
+ * the success and failure messages.
* @return a promise that resolves when the function returned true or rejects
* if the timeout is reached
*/
function waitForSuccess(validatorFn, name="untitled") {
let def = promise.defer();
- function wait(validatorFn) {
- if (validatorFn()) {
+ function wait(validator) {
+ if (validator()) {
ok(true, "Validator function " + name + " returned true");
def.resolve();
} else {
- setTimeout(() => wait(validatorFn), 200);
+ setTimeout(() => wait(validator), 200);
}
}
wait(validatorFn);
@@ -561,6 +610,7 @@ function waitForSuccess(validatorFn, name="untitled") {
/**
* Create a new style tag containing the given style text and append it to the
* document's head node
+ *
* @param {Document} doc
* @param {String} style
* @return {DOMNode} The newly created style node
@@ -568,7 +618,7 @@ function waitForSuccess(validatorFn, name="untitled") {
function addStyle(doc, style) {
info("Adding a new style tag to the document with style content: " +
style.substring(0, 50));
- let node = doc.createElement('style');
+ let node = doc.createElement("style");
node.setAttribute("type", "text/css");
node.textContent = style;
doc.getElementsByTagName("head")[0].appendChild(node);
@@ -578,6 +628,7 @@ function addStyle(doc, style) {
/**
* Checks whether the inspector's sidebar corresponding to the given id already
* exists
+ *
* @param {InspectorPanel}
* @param {String}
* @return {Boolean}
@@ -588,7 +639,9 @@ function hasSideBarTab(inspector, id) {
/**
* Get the dataURL for the font family tooltip.
- * @param {String} font The font family value.
+ *
+ * @param {String} font
+ * The font family value.
* @param {object} nodeFront
* The NodeActor that will used to retrieve the dataURL for the
* font family tooltip contents.
@@ -604,12 +657,15 @@ let getFontFamilyDataURL = Task.async(function*(font, nodeFront) {
/**
* Simulate the key input for the given input in the window.
- * @param {String} input The string value to input
- * @param {Window} win The window containing the panel
+ *
+ * @param {String} input
+ * The string value to input
+ * @param {Window} win
+ * The window containing the panel
*/
function synthesizeKeys(input, win) {
for (let key of input.split("")) {
- EventUtils.synthesizeKey(key, {}, win);
+ EventUtils.synthesizeKey(key, {}, win);
}
}
@@ -623,9 +679,12 @@ function synthesizeKeys(input, win) {
/**
* Get the DOMNode for a css rule in the rule-view that corresponds to the given
* selector
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {String} selectorText The selector in the rule-view for which the rule
- * object is wanted
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {String} selectorText
+ * The selector in the rule-view for which the rule
+ * object is wanted
* @return {DOMNode}
*/
function getRuleViewRule(view, selectorText) {
@@ -645,10 +704,13 @@ function getRuleViewRule(view, selectorText) {
/**
* Get references to the name and value span nodes corresponding to a given
* selector and property name in the rule-view
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {String} selectorText The selector in the rule-view to look for the
- * property in
- * @param {String} propertyName The name of the property
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {String} selectorText
+ * The selector in the rule-view to look for the property in
+ * @param {String} propertyName
+ * The name of the property
* @return {Object} An object like {nameSpan: DOMNode, valueSpan: DOMNode}
*/
function getRuleViewProperty(view, selectorText, propertyName) {
@@ -673,10 +735,13 @@ function getRuleViewProperty(view, selectorText, propertyName) {
/**
* Get the text value of the property corresponding to a given selector and name
* in the rule-view
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {String} selectorText The selector in the rule-view to look for the
- * property in
- * @param {String} propertyName The name of the property
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {String} selectorText
+ * The selector in the rule-view to look for the property in
+ * @param {String} propertyName
+ * The name of the property
* @return {String} The property value
*/
function getRuleViewPropertyValue(view, selectorText, propertyName) {
@@ -687,8 +752,11 @@ function getRuleViewPropertyValue(view, selectorText, propertyName) {
/**
* Get a reference to the selector DOM element corresponding to a given selector
* in the rule-view
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {String} selectorText The selector in the rule-view to look for
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {String} selectorText
+ * The selector in the rule-view to look for
* @return {DOMNode} The selector DOM element
*/
function getRuleViewSelector(view, selectorText) {
@@ -699,8 +767,11 @@ function getRuleViewSelector(view, selectorText) {
/**
* Get a reference to the selectorhighlighter icon DOM element corresponding to
* a given selector in the rule-view
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {String} selectorText The selector in the rule-view to look for
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {String} selectorText
+ * The selector in the rule-view to look for
* @return {DOMNode} The selectorhighlighter icon DOM element
*/
function getRuleViewSelectorHighlighterIcon(view, selectorText) {
@@ -711,17 +782,22 @@ function getRuleViewSelectorHighlighterIcon(view, selectorText) {
/**
* Simulate a color change in a given color picker tooltip, and optionally wait
* for a given element in the page to have its style changed as a result
- * @param {RuleView} ruleView The related rule view instance
+ *
+ * @param {RuleView} ruleView
+ * The related rule view instance
* @param {SwatchColorPickerTooltip} colorPicker
- * @param {Array} newRgba The new color to be set [r, g, b, a]
- * @param {Object} expectedChange Optional object that needs the following props:
- * - {DOMNode} element The element in the page that will have its
- * style changed.
- * - {String} name The style name that will be changed
- * - {String} value The expected style value
+ * @param {Array} newRgba
+ * The new color to be set [r, g, b, a]
+ * @param {Object} expectedChange
+ * Optional object that needs the following props:
+ * - {DOMNode} element The element in the page that will have its
+ * style changed.
+ * - {String} name The style name that will be changed
+ * - {String} value The expected style value
* The style will be checked like so: getComputedStyle(element)[name] === value
*/
-let simulateColorPickerChange = Task.async(function*(ruleView, colorPicker, newRgba, expectedChange) {
+let simulateColorPickerChange = Task.async(function*(ruleView, colorPicker,
+ newRgba, expectedChange) {
let onRuleViewChanged = ruleView.once("ruleview-changed");
info("Getting the spectrum colorpicker object");
let spectrum = yield colorPicker.spectrum;
@@ -744,8 +820,11 @@ let simulateColorPickerChange = Task.async(function*(ruleView, colorPicker, newR
/**
* Get a rule-link from the rule-view given its index
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {Number} index The index of the link to get
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {Number} index
+ * The index of the link to get
* @return {DOMNode} The link if any at this index
*/
function getRuleViewLinkByIndex(view, index) {
@@ -755,8 +834,11 @@ function getRuleViewLinkByIndex(view, index) {
/**
* Get rule-link text from the rule-view given its index
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {Number} index The index of the link to get
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {Number} index
+ * The index of the link to get
* @return {String} The string at this index
*/
function getRuleViewLinkTextByIndex(view, index) {
@@ -766,9 +848,13 @@ function getRuleViewLinkTextByIndex(view, index) {
/**
* Get the rule editor from the rule-view given its index
- * @param {CssRuleView} view The instance of the rule-view panel
- * @param {Number} childrenIndex The children index of the element to get
- * @param {Number} nodeIndex The child node index of the element to get
+ *
+ * @param {CssRuleView} view
+ * The instance of the rule-view panel
+ * @param {Number} childrenIndex
+ * The children index of the element to get
+ * @param {Number} nodeIndex
+ * The child node index of the element to get
* @return {DOMNode} The rule editor if any at this index
*/
function getRuleViewRuleEditor(view, childrenIndex, nodeIndex) {
@@ -779,8 +865,9 @@ function getRuleViewRuleEditor(view, childrenIndex, nodeIndex) {
/**
* Click on a rule-view's close brace to focus a new property name editor
- * @param {RuleEditor} ruleEditor An instance of RuleEditor that will receive
- * the new property
+ *
+ * @param {RuleEditor} ruleEditor
+ * An instance of RuleEditor that will receive the new property
* @return a promise that resolves to the newly created editor when ready and
* focused
*/
@@ -801,10 +888,11 @@ let focusNewRuleViewProperty = Task.async(function*(ruleEditor) {
* by clicking on the close brace, and then entering the given text.
* Keep in mind that the rule-view knows how to handle strings with multiple
* properties, so the input text may be like: "p1:v1;p2:v2;p3:v3".
- * @param {RuleEditor} ruleEditor The instance of RuleEditor that will receive
- * the new property(ies)
- * @param {String} inputValue The text to be entered in the new property name
- * field
+ *
+ * @param {RuleEditor} ruleEditor
+ * The instance of RuleEditor that will receive the new property(ies)
+ * @param {String} inputValue
+ * The text to be entered in the new property name field
* @return a promise that resolves when the new property name has been entered
* and once the value field is focused
*/
@@ -832,8 +920,11 @@ let createNewRuleViewProperty = Task.async(function*(ruleEditor, inputValue) {
/**
* Get references to the name and value span nodes corresponding to a given
* property name in the computed-view
- * @param {CssComputedView} view The instance of the computed view panel
- * @param {String} name The name of the property to retrieve
+ *
+ * @param {CssComputedView} view
+ * The instance of the computed view panel
+ * @param {String} name
+ * The name of the property to retrieve
* @return an object {nameSpan, valueSpan}
*/
function getComputedViewProperty(view, name) {
@@ -852,8 +943,11 @@ function getComputedViewProperty(view, name) {
/**
* Get an instance of PropertyView from the computed-view.
- * @param {CssComputedView} view The instance of the computed view panel
- * @param {String} name The name of the property to retrieve
+ *
+ * @param {CssComputedView} view
+ * The instance of the computed view panel
+ * @param {String} name
+ * The name of the property to retrieve
* @return {PropertyView}
*/
function getComputedViewPropertyView(view, name) {
@@ -872,10 +966,13 @@ function getComputedViewPropertyView(view, name) {
* the computed-view.
* A property-content element always follows (nextSibling) the property itself
* and is only shown when the twisty icon is expanded on the property.
- * A property-content element contains matched rules, with selectors, properties,
- * values and stylesheet links
- * @param {CssComputedView} view The instance of the computed view panel
- * @param {String} name The name of the property to retrieve
+ * A property-content element contains matched rules, with selectors,
+ * properties, values and stylesheet links
+ *
+ * @param {CssComputedView} view
+ * The instance of the computed view panel
+ * @param {String} name
+ * The name of the property to retrieve
* @return {Promise} A promise that resolves to the property matched rules
* container
*/
@@ -904,8 +1001,11 @@ let getComputedViewMatchedRules = Task.async(function*(view, name) {
/**
* Get the text value of the property corresponding to a given name in the
* computed-view
- * @param {CssComputedView} view The instance of the computed view panel
- * @param {String} name The name of the property to retrieve
+ *
+ * @param {CssComputedView} view
+ * The instance of the computed view panel
+ * @param {String} name
+ * The name of the property to retrieve
* @return {String} The property value
*/
function getComputedViewPropertyValue(view, name, propertyName) {
@@ -916,8 +1016,11 @@ function getComputedViewPropertyValue(view, name, propertyName) {
/**
* Expand a given property, given its index in the current property list of
* the computed view
- * @param {CssComputedView} view The instance of the computed view panel
- * @param {Number} index The index of the property to be expanded
+ *
+ * @param {CssComputedView} view
+ * The instance of the computed view panel
+ * @param {Number} index
+ * The index of the property to be expanded
* @return a promise that resolves when the property has been expanded, or
* rejects if the property was not found
*/
@@ -935,8 +1038,11 @@ function expandComputedViewPropertyByIndex(view, index) {
/**
* Get a rule-link from the computed-view given its index
- * @param {CssComputedView} view The instance of the computed view panel
- * @param {Number} index The index of the link to be retrieved
+ *
+ * @param {CssComputedView} view
+ * The instance of the computed view panel
+ * @param {Number} index
+ * The index of the link to be retrieved
* @return {DOMNode} The link at the given index, if one exists, null otherwise
*/
function getComputedViewLinkByIndex(view, index) {
@@ -954,9 +1060,10 @@ function getComputedViewLinkByIndex(view, index) {
* Wait for the toolbox to emit the styleeditor-selected event and when done
* wait for the stylesheet identified by href to be loaded in the stylesheet
* editor
+ *
* @param {Toolbox} toolbox
- * @param {String} href Optional, if not provided, wait for the first editor
- * to be ready
+ * @param {String} href
+ * Optional, if not provided, wait for the first editor to be ready
* @return a promise that resolves to the editor when the stylesheet editor is
* ready
*/
@@ -976,9 +1083,9 @@ function waitForStyleEditor(toolbox, href) {
info("Stylesheet editor selected");
panel.UI.off("editor-selected", gotEditor);
- editor.getSourceEditor().then(editor => {
+ editor.getSourceEditor().then(sourceEditor => {
info("Stylesheet editor fully loaded");
- def.resolve(editor);
+ def.resolve(sourceEditor);
});
return true;
@@ -1003,9 +1110,11 @@ function waitForStyleEditor(toolbox, href) {
/**
* Reload the current page and wait for the inspector to be initialized after
* the navigation
+ *
* @param {InspectorPanel} inspector
* The instance of InspectorPanel currently loaded in the toolbox
- * @return a promise that resolves after page reload and inspector initialization
+ * @return a promise that resolves after page reload and inspector
+ * initialization
*/
function reloadPage(inspector) {
let onNewRoot = inspector.once("new-root");
diff --git a/browser/devtools/styleinspector/test/unit/test_parseDeclarations.js b/browser/devtools/styleinspector/test/unit/test_parseDeclarations.js
index c9916e4e5e26..a7779f46f660 100644
--- a/browser/devtools/styleinspector/test/unit/test_parseDeclarations.js
+++ b/browser/devtools/styleinspector/test/unit/test_parseDeclarations.js
@@ -3,9 +3,12 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
const Cu = Components.utils;
const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-const {parseDeclarations} = require("devtools/styleinspector/css-parsing-utils");
+const {parseDeclarations} =
+ require("devtools/styleinspector/css-parsing-utils");
const TEST_DATA = [
// Simple test
@@ -31,7 +34,8 @@ const TEST_DATA = [
input: "name:value",
expected: [{name: "name", value: "value", priority: ""}]
},
- // Test multiple declarations separated by whitespaces and carriage returns and tabs
+ // Test multiple declarations separated by whitespaces and carriage
+ // returns and tabs
{
input: "p1 : v1 ; \t\t \n p2:v2; \n\n\n\n\t p3 : v3;",
expected: [
@@ -74,22 +78,38 @@ const TEST_DATA = [
// Test various types of background-image urls
{
input: "background-image: url(../../relative/image.png)",
- expected: [{name: "background-image", value: "url(../../relative/image.png)", priority: ""}]
+ expected: [{
+ name: "background-image",
+ value: "url(../../relative/image.png)",
+ priority: ""
+ }]
},
{
input: "background-image: url(http://site.com/test.png)",
- expected: [{name: "background-image", value: "url(http://site.com/test.png)", priority: ""}]
+ expected: [{
+ name: "background-image",
+ value: "url(http://site.com/test.png)",
+ priority: ""
+ }]
},
{
input: "background-image: url(wow.gif)",
- expected: [{name: "background-image", value: "url(wow.gif)", priority: ""}]
+ expected: [{
+ name: "background-image",
+ value: "url(wow.gif)",
+ priority: ""
+ }]
},
// Test that urls with :;{} characters in them are parsed correctly
{
- input: "background: red url(\"http://site.com/image{}:;.png?id=4#wat\") repeat top right",
- expected: [
- {name: "background", value: "red url(\"http://site.com/image{}:;.png?id=4#wat\") repeat top right", priority: ""}
- ]
+ input: "background: red url(\"http://site.com/image{}:;.png?id=4#wat\") "
+ + "repeat top right",
+ expected: [{
+ name: "background",
+ value: "red url(\"http://site.com/image{}:;.png?id=4#wat\") " +
+ "repeat top right",
+ priority: ""
+ }]
},
// Test that an empty string results in an empty array
{input: "", expected: []},
@@ -99,12 +119,15 @@ const TEST_DATA = [
{input: null, throws: true},
// Test that a undefined input throws an exception
{input: undefined, throws: true},
- // Test that :;{} characters in quoted content are not parsed as multiple declarations
+ // Test that :;{} characters in quoted content are not parsed as multiple
+ // declarations
{
input: "content: \";color:red;}selector{color:yellow;\"",
- expected: [
- {name: "content", value: "\";color:red;}selector{color:yellow;\"", priority: ""}
- ]
+ expected: [{
+ name: "content",
+ value: "\";color:red;}selector{color:yellow;\"",
+ priority: ""
+ }]
},
// Test that rules aren't parsed, just declarations. So { and } found after a
// property name should be part of the property name, same for values.
@@ -119,12 +142,18 @@ const TEST_DATA = [
// Test unbalanced : and ;
{
input: "color :red : font : arial;",
- expected : [
+ expected: [
{name: "color", value: "red : font : arial", priority: ""}
]
},
- {input: "background: red;;;;;", expected: [{name: "background", value: "red", priority: ""}]},
- {input: "background:;", expected: [{name: "background", value: "", priority: ""}]},
+ {
+ input: "background: red;;;;;",
+ expected: [{name: "background", value: "red", priority: ""}]
+ },
+ {
+ input: "background:;",
+ expected: [{name: "background", value: "", priority: ""}]
+ },
{input: ";;;;;", expected: []},
{input: ":;:;", expected: []},
// Test name only
@@ -147,15 +176,54 @@ const TEST_DATA = [
{name: "color", value: "blue", priority: ""}
]},
// Test hex colors
- {input: "color: #333", expected: [{name: "color", value: "#333", priority: ""}]},
- {input: "color: #456789", expected: [{name: "color", value: "#456789", priority: ""}]},
- {input: "wat: #XYZ", expected: [{name: "wat", value: "#XYZ", priority: ""}]},
+ {
+ input: "color: #333",
+ expected: [{name: "color", value: "#333", priority: ""}]
+ },
+ {
+ input: "color: #456789",
+ expected: [{name: "color", value: "#456789", priority: ""}]
+ },
+ {
+ input: "wat: #XYZ",
+ expected: [{name: "wat", value: "#XYZ", priority: ""}]
+ },
// Test string/url quotes escaping
- {input: "content: \"this is a 'string'\"", expected: [{name: "content", value: "\"this is a 'string'\"", priority: ""}]},
- {input: 'content: "this is a \\"string\\""', expected: [{name: "content", value: '"this is a \\"string\\""', priority: ""}]},
- {input: "content: 'this is a \"string\"'", expected: [{name: "content", value: '\'this is a "string"\'', priority: ""}]},
- {input: "content: 'this is a \\'string\\''", expected: [{name: "content", value: "'this is a \\'string\\''", priority: ""}]},
- {input: "content: 'this \\' is a \" really strange string'", expected: [{name: "content", value: "'this \\' is a \" really strange string'", priority: ""}]},
+ {
+ input: "content: \"this is a 'string'\"",
+ expected: [{name: "content", value: "\"this is a 'string'\"", priority: ""}]
+ },
+ {
+ input: 'content: "this is a \\"string\\""',
+ expected: [{
+ name: "content",
+ value: '"this is a \\"string\\""',
+ priority: ""}]
+ },
+ {
+ input: "content: 'this is a \"string\"'",
+ expected: [{
+ name: "content",
+ value: '\'this is a "string"\'',
+ priority: ""
+ }]
+ },
+ {
+ input: "content: 'this is a \\'string\\''",
+ expected: [{
+ name: "content",
+ value: "'this is a \\'string\\''",
+ priority: ""
+ }]
+ },
+ {
+ input: "content: 'this \\' is a \" really strange string'",
+ expected: [{
+ name: "content",
+ value: "'this \\' is a \" really strange string'",
+ priority: ""
+ }]
+ },
{
input: "content: \"a not s\\\
o very long title\"",
@@ -165,7 +233,10 @@ const TEST_DATA = [
]
},
// Test calc with nested parentheses
- {input: "width: calc((100% - 3em) / 2)", expected: [{name: "width", value: "calc((100% - 3em) / 2)", priority: ""}]},
+ {
+ input: "width: calc((100% - 3em) / 2)",
+ expected: [{name: "width", value: "calc((100% - 3em) / 2)", priority: ""}]
+ },
];
function run_test() {
@@ -175,7 +246,8 @@ function run_test() {
try {
output = parseDeclarations(test.input);
} catch (e) {
- do_print("parseDeclarations threw an exception with the given input string");
+ do_print("parseDeclarations threw an exception with the given input " +
+ "string");
if (test.throws) {
do_print("Exception expected");
do_check_true(true);
@@ -192,16 +264,18 @@ function run_test() {
function assertOutput(actual, expected) {
if (actual.length === expected.length) {
- for (let i = 0; i < expected.length; i ++) {
+ for (let i = 0; i < expected.length; i++) {
do_check_true(!!actual[i]);
- do_print("Check that the output item has the expected name, value and priority");
+ do_print("Check that the output item has the expected name, " +
+ "value and priority");
do_check_eq(expected[i].name, actual[i].name);
do_check_eq(expected[i].value, actual[i].value);
do_check_eq(expected[i].priority, actual[i].priority);
}
} else {
for (let prop of actual) {
- do_print("Actual output contained: {name: "+prop.name+", value: "+prop.value+", priority: "+prop.priority+"}");
+ do_print("Actual output contained: {name: " + prop.name + ", value: " +
+ prop.value + ", priority: " + prop.priority + "}");
}
do_check_eq(actual.length, expected.length);
}
diff --git a/browser/devtools/styleinspector/test/unit/test_parseSingleValue.js b/browser/devtools/styleinspector/test/unit/test_parseSingleValue.js
index 433be0a8e950..39d3409c4167 100644
--- a/browser/devtools/styleinspector/test/unit/test_parseSingleValue.js
+++ b/browser/devtools/styleinspector/test/unit/test_parseSingleValue.js
@@ -3,6 +3,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
const Cu = Components.utils;
const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {parseSingleValue} = require("devtools/styleinspector/css-parsing-utils");
@@ -16,10 +18,16 @@ const TEST_DATA = [
{input: "blue !important", expected: {value: "blue", priority: "important"}},
{input: "blue!important", expected: {value: "blue", priority: "important"}},
{input: "blue ! important", expected: {value: "blue", priority: "important"}},
- {input: "blue ! important", expected: {value: "blue", priority: "important"}},
+ {
+ input: "blue ! important",
+ expected: {value: "blue", priority: "important"}
+ },
{input: "blue !", expected: {value: "blue", priority: ""}},
{input: "blue !mportant", expected: {value: "blue !mportant", priority: ""}},
- {input: " blue !important ", expected: {value: "blue", priority: "important"}},
+ {
+ input: " blue !important ",
+ expected: {value: "blue", priority: "important"}
+ },
{
input: "url(\"http://url.com/whyWouldYouDoThat!important.png\") !important",
expected: {
@@ -64,7 +72,8 @@ function run_test() {
let output = parseSingleValue(test.input);
assertOutput(output, test.expected);
} catch (e) {
- do_print("parseSingleValue threw an exception with the given input value");
+ do_print("parseSingleValue threw an exception with the given input " +
+ "value");
if (test.throws) {
do_print("Exception expected");
do_check_true(true);
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_inspector.js b/browser/devtools/tilt/test/browser_tilt_picking_inspector.js
index 5b625e8f4d14..709f9866af97 100644
--- a/browser/devtools/tilt/test/browser_tilt_picking_inspector.js
+++ b/browser/devtools/tilt/test/browser_tilt_picking_inspector.js
@@ -2,7 +2,8 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
-let presenter;
+Components.utils.import("resource://gre/modules/Task.jsm");
+let promise = require("promise");
function test() {
if (!isTiltEnabled()) {
@@ -22,27 +23,39 @@ function test() {
let {TargetFactory} = require("devtools/framework/target");
let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- let contentDocument = toolbox.target.tab.linkedBrowser.contentDocument;
- let div = contentDocument.getElementById("first-law");
- toolbox.getCurrentPanel().selection.setNode(div);
-
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- whenOpen();
- }
- }, false, function suddenDeath()
- {
- ok(false, "Tilt could not be initialized properly.");
- cleanup();
- });
- });
+ gDevTools.showToolbox(target, "inspector")
+ .then(Task.async(onToolbox));
});
}
-function whenOpen() {
+function* onToolbox(toolbox) {
+ let contentDocument = toolbox.target.tab.linkedBrowser.contentDocument;
+ let div = contentDocument.getElementById("first-law");
+ let inspector = toolbox.getPanel("inspector");
+
+ let onInspectorUpdated = inspector.once("inspector-updated");
+ inspector.selection.setNode(div);
+ yield onInspectorUpdated;
+
+ let deferred = promise.defer();
+ onInspectorUpdated = inspector.once("inspector-updated");
+ createTilt({
+ onTiltOpen: function(instance)
+ {
+ deferred.resolve(instance.presenter);
+ }
+ }, false, function suddenDeath()
+ {
+ ok(false, "Tilt could not be initialized properly.");
+ cleanup();
+ });
+ let presenter = yield deferred.promise;
+ yield onInspectorUpdated;
+
+ whenOpen(presenter);
+}
+
+function whenOpen(presenter) {
ok(presenter._currentSelection > 0,
"Highlighting a node didn't work properly.");
ok(!presenter._highlight.disabled,
diff --git a/browser/devtools/webconsole/test/browser_webconsole_output_05.js b/browser/devtools/webconsole/test/browser_webconsole_output_05.js
index 8e754bb883c0..bcf3e82335ac 100644
--- a/browser/devtools/webconsole/test/browser_webconsole_output_05.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_output_05.js
@@ -11,7 +11,14 @@ const TEST_URI = "data:text/html;charset=utf8,test for console output - 05";
const ELLIPSIS = Services.prefs.getComplexValue("intl.ellipsis",
Ci.nsIPrefLocalizedString).data;
-let dateNow = Date.now();
+// March, 1960: The first implementation of Lisp. From Wikipedia:
+//
+// > Lisp was first implemented by Steve Russell on an IBM 704 computer. Russell
+// > had read McCarthy's paper, and realized (to McCarthy's surprise) that the
+// > Lisp eval function could be implemented in machine code. The result was a
+// > working Lisp interpreter which could be used to run Lisp programs, or more
+// > properly, 'evaluate Lisp expressions.'
+let testDate = -310435200000;
let inputTests = [
// 0
@@ -49,9 +56,9 @@ let inputTests = [
// 5
{
- input: "new Date(" + dateNow + ")",
- output: "Date " + (new Date(dateNow)).toISOString(),
- printOutput: (new Date(dateNow)).toString(),
+ input: "new Date(" + testDate + ")",
+ output: "Date " + (new Date(testDate)).toISOString(),
+ printOutput: (new Date(testDate)).toString(),
inspectable: true,
},
@@ -132,6 +139,6 @@ function test() {
}
function finishUp() {
- inputTests = dateNow = null;
+ inputTests = testDate = null;
finishTest();
}
diff --git a/browser/locales/en-US/chrome/browser/loop/loop.properties b/browser/locales/en-US/chrome/browser/loop/loop.properties
index 3dd4f1a176da..4b1f9c23f4c6 100644
--- a/browser/locales/en-US/chrome/browser/loop/loop.properties
+++ b/browser/locales/en-US/chrome/browser/loop/loop.properties
@@ -91,13 +91,13 @@ contacts_search_placesholder=Search…
## LOCALIZATION NOTE (new_contact_button): This is the button to open the
## new contact sub-panel.
new_contact_button=New Contact
-## LOCALIZATION NOTE (new_contact_name_placeholder, new_contact_email_placeholder):
-## These are the placeholders for the fields for entering a new contact. Click
-## the 'New Contact' button to see the fields.
-new_contact_name_placeholder=Name
-new_contact_email_placeholder=Email
-new_contact_fxos_phone_placeholder=Firefox OS Phone
-new_contact_phone_placeholder2=Phone
+## LOCALIZATION NOTE (contact_form_*_placeholder):
+## These are the placeholders for the inputs for entering or editing a contact
+## Click the 'New Contact' button to see the fields.
+contact_form_name_placeholder=Name
+contact_form_email_placeholder=Email
+contact_form_fxos_phone_placeholder=Firefox OS Phone
+contact_form_phone_placeholder2=Phone
contacts_blocked_contacts=Blocked Contacts
@@ -105,6 +105,9 @@ contacts_blocked_contacts=Blocked Contacts
## This is the button to actually add the new contact. Click the 'New Contact'
## button to see the fields.
add_contact_button=Add Contact
+## LOCALIZATION NOTE(add_contact_title): This is the subtitle of the add contact
+## panel. It is displayed when Add Contact is selected.
+add_contact_title=Add Contact
### LOCALIZATION NOTE (valid_email_text_description): This is displayed when
### the user enters an invalid email address, preventing the addition of the
### contact.
diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/AudioManagerAndroid.java b/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/AudioManagerAndroid.java
index 5067b7c87b95..c80207e28afd 100644
--- a/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/AudioManagerAndroid.java
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/AudioManagerAndroid.java
@@ -21,7 +21,7 @@ import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
@WebRTCJNITarget
class AudioManagerAndroid {
diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java b/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java
index ef8b976f119d..7a9267e21e02 100644
--- a/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java
@@ -20,7 +20,7 @@ import android.media.AudioRecord;
import android.media.MediaRecorder.AudioSource;
import android.util.Log;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
@WebRTCJNITarget
class WebRtcAudioRecord {
diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java b/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java
index f525d97672e8..f131edc7f563 100644
--- a/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java
@@ -20,7 +20,7 @@ import android.media.AudioRecord;
import android.media.AudioTrack;
import android.util.Log;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
@WebRTCJNITarget
class WebRtcAudioTrack {
diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/CaptureCapabilityAndroid.java b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/CaptureCapabilityAndroid.java
index 6cefced35a6c..811be9d11a7a 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/CaptureCapabilityAndroid.java
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/CaptureCapabilityAndroid.java
@@ -10,7 +10,7 @@
package org.webrtc.videoengine;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
@WebRTCJNITarget
public class CaptureCapabilityAndroid {
diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
index c7729c4794a7..49290f5d7f2b 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
@@ -32,9 +32,9 @@ import android.view.SurfaceHolder.Callback;
import android.view.SurfaceHolder;
import android.view.WindowManager;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoAppShell.AppStateListener;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
// Wrapper for android Camera, with support for direct local preview rendering.
// Threading notes: this class is called from ViE C++ code, and from Camera &
diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
index 082f0fdde81a..fed4e072c293 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
@@ -19,7 +19,7 @@ import android.hardware.Camera.Size;
import android.hardware.Camera;
import android.util.Log;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
public class VideoCaptureDeviceInfoAndroid {
private final static String TAG = "WEBRTC-JC";
diff --git a/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViEAndroidGLES20.java b/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViEAndroidGLES20.java
index 788c71016db9..b1097504a285 100644
--- a/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViEAndroidGLES20.java
+++ b/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViEAndroidGLES20.java
@@ -25,7 +25,7 @@ import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.util.Log;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
public class ViEAndroidGLES20 extends GLSurfaceView
implements GLSurfaceView.Renderer {
diff --git a/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViESurfaceRenderer.java b/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViESurfaceRenderer.java
index 11fcd3da5c43..9f46255bfb16 100644
--- a/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViESurfaceRenderer.java
+++ b/media/webrtc/trunk/webrtc/modules/video_render/android/java/src/org/webrtc/videoengine/ViESurfaceRenderer.java
@@ -26,7 +26,7 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.SurfaceHolder.Callback;
-import org.mozilla.gecko.mozglue.WebRTCJNITarget;
+import org.mozilla.gecko.annotation.WebRTCJNITarget;
public class ViESurfaceRenderer implements Callback {
diff --git a/mobile/android/base/AboutPages.java b/mobile/android/base/AboutPages.java
index ada8e644abea..7f5574d66bce 100644
--- a/mobile/android/base/AboutPages.java
+++ b/mobile/android/base/AboutPages.java
@@ -5,9 +5,9 @@
package org.mozilla.gecko;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.home.HomeConfig;
import org.mozilla.gecko.home.HomeConfig.PanelType;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.StringUtils;
public class AboutPages {
diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java
index a4ffe14ed57d..18746e186a63 100644
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -5,6 +5,7 @@
package org.mozilla.gecko;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.DynamicToolbar.PinReason;
import org.mozilla.gecko.DynamicToolbar.VisibilityTransition;
@@ -49,7 +50,6 @@ import org.mozilla.gecko.menu.GeckoMenu;
import org.mozilla.gecko.menu.GeckoMenuItem;
import org.mozilla.gecko.mozglue.ContextUtils;
import org.mozilla.gecko.mozglue.ContextUtils.SafeIntent;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.overlays.ui.ShareDialog;
import org.mozilla.gecko.preferences.ClearOnShutdownPref;
import org.mozilla.gecko.preferences.GeckoPreferences;
diff --git a/mobile/android/base/CustomEditText.java b/mobile/android/base/CustomEditText.java
index 2ea7d6d02ff9..23f8af545853 100644
--- a/mobile/android/base/CustomEditText.java
+++ b/mobile/android/base/CustomEditText.java
@@ -5,6 +5,7 @@
package org.mozilla.gecko;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.widget.ThemedEditText;
import android.content.Context;
@@ -80,7 +81,7 @@ public class CustomEditText extends ThemedEditText {
public void setPrivateMode(boolean isPrivate) {
super.setPrivateMode(isPrivate);
- mHighlightColor = getContext().getResources().getColor(isPrivate
+ mHighlightColor = ColorUtils.getColor(getContext(), isPrivate
? R.color.url_bar_text_highlight_pb : R.color.fennec_ui_orange);
// android:textColorHighlight cannot support a ColorStateList.
setHighlightColor(mHighlightColor);
diff --git a/mobile/android/base/EventDispatcher.java b/mobile/android/base/EventDispatcher.java
index 6ec8cbb5f80c..30008230fbbc 100644
--- a/mobile/android/base/EventDispatcher.java
+++ b/mobile/android/base/EventDispatcher.java
@@ -4,9 +4,9 @@
package org.mozilla.gecko;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.NativeEventListener;
diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java
index 70ef3ef16fad..d1a615bb47f3 100644
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -30,6 +30,8 @@ import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
+import org.mozilla.gecko.annotation.JNITarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.db.BrowserDB;
@@ -40,8 +42,6 @@ import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.gfx.PanZoomController;
import org.mozilla.gecko.mozglue.ContextUtils;
import org.mozilla.gecko.mozglue.GeckoLoader;
-import org.mozilla.gecko.mozglue.JNITarget;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.overlays.ui.ShareDialog;
import org.mozilla.gecko.prompts.PromptService;
import org.mozilla.gecko.util.EventCallback;
diff --git a/mobile/android/base/GeckoEvent.java b/mobile/android/base/GeckoEvent.java
index c970aa7a39ed..0b3e1596439e 100644
--- a/mobile/android/base/GeckoEvent.java
+++ b/mobile/android/base/GeckoEvent.java
@@ -25,8 +25,8 @@ import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.MotionEvent;
-import org.mozilla.gecko.mozglue.JNITarget;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.JNITarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
/**
* We're not allowed to hold on to most events given to us
diff --git a/mobile/android/base/GeckoNetworkManager.java b/mobile/android/base/GeckoNetworkManager.java
index 0d349376fd2b..aaa2392fcc97 100644
--- a/mobile/android/base/GeckoNetworkManager.java
+++ b/mobile/android/base/GeckoNetworkManager.java
@@ -5,7 +5,7 @@
package org.mozilla.gecko;
-import org.mozilla.gecko.mozglue.JNITarget;
+import org.mozilla.gecko.annotation.JNITarget;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
import org.mozilla.gecko.util.EventCallback;
diff --git a/mobile/android/base/GeckoProfile.java b/mobile/android/base/GeckoProfile.java
index ae7d493cf4e1..134b5cbaa639 100644
--- a/mobile/android/base/GeckoProfile.java
+++ b/mobile/android/base/GeckoProfile.java
@@ -21,6 +21,7 @@ import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONArray;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.GeckoProfileDirectories.NoMozillaDirectoryException;
import org.mozilla.gecko.GeckoProfileDirectories.NoSuchProfileException;
import org.mozilla.gecko.db.BrowserDB;
@@ -28,7 +29,6 @@ import org.mozilla.gecko.db.LocalBrowserDB;
import org.mozilla.gecko.db.StubBrowserDB;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.mozglue.ContextUtils;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.firstrun.FirstrunPane;
import org.mozilla.gecko.RestrictedProfiles;
import org.mozilla.gecko.util.INIParser;
diff --git a/mobile/android/base/GeckoProfileDirectories.java b/mobile/android/base/GeckoProfileDirectories.java
index d655928dacd2..f584c4ccfa0e 100644
--- a/mobile/android/base/GeckoProfileDirectories.java
+++ b/mobile/android/base/GeckoProfileDirectories.java
@@ -9,7 +9,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.util.INIParser;
import org.mozilla.gecko.util.INISection;
diff --git a/mobile/android/base/GeckoSharedPrefs.java b/mobile/android/base/GeckoSharedPrefs.java
index 7a64dd31e936..b4468bcacd20 100644
--- a/mobile/android/base/GeckoSharedPrefs.java
+++ b/mobile/android/base/GeckoSharedPrefs.java
@@ -9,7 +9,7 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Map;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import android.content.Context;
import android.content.SharedPreferences;
diff --git a/mobile/android/base/GeckoThread.java b/mobile/android/base/GeckoThread.java
index 0b5b2f508b07..213cc6db21b2 100644
--- a/mobile/android/base/GeckoThread.java
+++ b/mobile/android/base/GeckoThread.java
@@ -5,8 +5,8 @@
package org.mozilla.gecko;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.mozglue.GeckoLoader;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.ThreadUtils;
diff --git a/mobile/android/base/MediaPlayerManager.java b/mobile/android/base/MediaPlayerManager.java
index 80ed0870566f..da0b88875304 100644
--- a/mobile/android/base/MediaPlayerManager.java
+++ b/mobile/android/base/MediaPlayerManager.java
@@ -16,8 +16,8 @@ import android.util.Log;
import com.google.android.gms.cast.CastMediaControlIntent;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.JNITarget;
import org.mozilla.gecko.AppConstants.Versions;
-import org.mozilla.gecko.mozglue.JNITarget;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
diff --git a/mobile/android/base/NSSBridge.java b/mobile/android/base/NSSBridge.java
index 83dc32d9f2f7..8d525b0ba663 100644
--- a/mobile/android/base/NSSBridge.java
+++ b/mobile/android/base/NSSBridge.java
@@ -7,7 +7,7 @@ package org.mozilla.gecko;
import org.mozilla.gecko.mozglue.GeckoLoader;
import android.content.Context;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
public class NSSBridge {
private static final String LOGTAG = "NSSBridge";
diff --git a/mobile/android/base/PrivateTab.java b/mobile/android/base/PrivateTab.java
index 3392588e08c7..114cc4343563 100644
--- a/mobile/android/base/PrivateTab.java
+++ b/mobile/android/base/PrivateTab.java
@@ -8,6 +8,7 @@ package org.mozilla.gecko;
import android.content.Context;
import org.mozilla.gecko.db.BrowserDB;
+import org.mozilla.gecko.util.ColorUtils;
public class PrivateTab extends Tab {
public PrivateTab(Context context, int id, String url, boolean external, int parentId, String title) {
@@ -15,7 +16,7 @@ public class PrivateTab extends Tab {
// Init background to private_toolbar_grey to ensure flicker-free
// private tab creation. Page loads will reset it to white as expected.
- final int bgColor = context.getResources().getColor(R.color.tabs_tray_grey_pressed);
+ final int bgColor = ColorUtils.getColor(context, R.color.tabs_tray_grey_pressed);
setBackgroundColor(bgColor);
}
diff --git a/mobile/android/base/ReadingListHelper.java b/mobile/android/base/ReadingListHelper.java
index 44501a55e292..a768b252f922 100644
--- a/mobile/android/base/ReadingListHelper.java
+++ b/mobile/android/base/ReadingListHelper.java
@@ -6,11 +6,11 @@ package org.mozilla.gecko;
import org.json.JSONException;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.db.BrowserContract.ReadingListItems;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.ReadingListAccessor;
import org.mozilla.gecko.favicons.Favicons;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
diff --git a/mobile/android/base/RemoteTabsExpandableListAdapter.java b/mobile/android/base/RemoteTabsExpandableListAdapter.java
index e87e34bebf69..b7e4de9d51f6 100644
--- a/mobile/android/base/RemoteTabsExpandableListAdapter.java
+++ b/mobile/android/base/RemoteTabsExpandableListAdapter.java
@@ -10,6 +10,7 @@ import android.text.format.DateUtils;
import org.mozilla.gecko.db.RemoteClient;
import org.mozilla.gecko.db.RemoteTab;
import org.mozilla.gecko.home.TwoLinePageRow;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.text.TextUtils;
@@ -161,7 +162,7 @@ public class RemoteTabsExpandableListAdapter extends BaseExpandableListAdapter {
// Now update the UI.
holder.nameView.setText(client.name);
- holder.nameView.setTextColor(context.getResources().getColor(textColorResId));
+ holder.nameView.setTextColor(ColorUtils.getColor(context, textColorResId));
final long now = System.currentTimeMillis();
diff --git a/mobile/android/base/RestrictedProfiles.java b/mobile/android/base/RestrictedProfiles.java
index d52e6f05963c..27ec658972fe 100644
--- a/mobile/android/base/RestrictedProfiles.java
+++ b/mobile/android/base/RestrictedProfiles.java
@@ -5,9 +5,9 @@
package org.mozilla.gecko;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.restrictions.DefaultConfiguration;
import org.mozilla.gecko.restrictions.GuestProfileConfiguration;
import org.mozilla.gecko.restrictions.RestrictedProfileConfiguration;
diff --git a/mobile/android/base/SuggestClient.java b/mobile/android/base/SuggestClient.java
index 439f63271a72..ebea3d43c983 100644
--- a/mobile/android/base/SuggestClient.java
+++ b/mobile/android/base/SuggestClient.java
@@ -13,7 +13,7 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import org.json.JSONArray;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
diff --git a/mobile/android/base/Tab.java b/mobile/android/base/Tab.java
index ce16e7690d83..051eeb921249 100644
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -15,6 +15,7 @@ import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.URLMetadata;
import org.mozilla.gecko.favicons.Favicons;
@@ -23,7 +24,6 @@ import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
import org.mozilla.gecko.favicons.RemoteFavicon;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.gfx.Layer;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.toolbar.BrowserToolbar.TabEditingState;
import org.mozilla.gecko.util.ThreadUtils;
diff --git a/mobile/android/base/Tabs.java b/mobile/android/base/Tabs.java
index f2c801cf4884..22c4774d7fed 100644
--- a/mobile/android/base/Tabs.java
+++ b/mobile/android/base/Tabs.java
@@ -14,13 +14,13 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONException;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.JNITarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.fxa.FirefoxAccounts;
import org.mozilla.gecko.mozglue.ContextUtils.SafeIntent;
-import org.mozilla.gecko.mozglue.JNITarget;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.sync.setup.SyncAccounts;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.util.GeckoEventListener;
diff --git a/mobile/android/base/Telemetry.java b/mobile/android/base/Telemetry.java
index bac613bcf965..1ec3c5a5cdcf 100644
--- a/mobile/android/base/Telemetry.java
+++ b/mobile/android/base/Telemetry.java
@@ -5,7 +5,7 @@
package org.mozilla.gecko;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.TelemetryContract.Event;
import org.mozilla.gecko.TelemetryContract.Method;
import org.mozilla.gecko.TelemetryContract.Reason;
diff --git a/mobile/android/base/TelemetryContract.java b/mobile/android/base/TelemetryContract.java
index 68d8b3d63578..97799a5bafd7 100644
--- a/mobile/android/base/TelemetryContract.java
+++ b/mobile/android/base/TelemetryContract.java
@@ -5,7 +5,7 @@
package org.mozilla.gecko;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
/**
* Holds data definitions for our UI Telemetry implementation.
diff --git a/mobile/android/base/mozglue/JNITarget.java b/mobile/android/base/annotation/JNITarget.java
similarity index 93%
rename from mobile/android/base/mozglue/JNITarget.java
rename to mobile/android/base/annotation/JNITarget.java
index 2cfd8496909f..d6140a1ffb66 100644
--- a/mobile/android/base/mozglue/JNITarget.java
+++ b/mobile/android/base/annotation/JNITarget.java
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package org.mozilla.gecko.mozglue;
+package org.mozilla.gecko.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/mobile/android/base/mozglue/RobocopTarget.java b/mobile/android/base/annotation/RobocopTarget.java
similarity index 93%
rename from mobile/android/base/mozglue/RobocopTarget.java
rename to mobile/android/base/annotation/RobocopTarget.java
index 94fa1b85fb09..e15130674801 100644
--- a/mobile/android/base/mozglue/RobocopTarget.java
+++ b/mobile/android/base/annotation/RobocopTarget.java
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package org.mozilla.gecko.mozglue;
+package org.mozilla.gecko.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/mobile/android/base/mozglue/WebRTCJNITarget.java b/mobile/android/base/annotation/WebRTCJNITarget.java
similarity index 93%
rename from mobile/android/base/mozglue/WebRTCJNITarget.java
rename to mobile/android/base/annotation/WebRTCJNITarget.java
index aad1cbfda29d..f58dea148764 100644
--- a/mobile/android/base/mozglue/WebRTCJNITarget.java
+++ b/mobile/android/base/annotation/WebRTCJNITarget.java
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package org.mozilla.gecko.mozglue;
+package org.mozilla.gecko.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/mobile/android/base/background/nativecode/NativeCrypto.java b/mobile/android/base/background/nativecode/NativeCrypto.java
index a48c4862716c..d72db75cc6d9 100644
--- a/mobile/android/base/background/nativecode/NativeCrypto.java
+++ b/mobile/android/base/background/nativecode/NativeCrypto.java
@@ -6,8 +6,8 @@ package org.mozilla.gecko.background.nativecode;
import java.security.GeneralSecurityException;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import android.util.Log;
diff --git a/mobile/android/base/db/AbstractPerProfileDatabaseProvider.java b/mobile/android/base/db/AbstractPerProfileDatabaseProvider.java
index 832192765fb5..2e056cc1ea7c 100644
--- a/mobile/android/base/db/AbstractPerProfileDatabaseProvider.java
+++ b/mobile/android/base/db/AbstractPerProfileDatabaseProvider.java
@@ -4,7 +4,7 @@
package org.mozilla.gecko.db;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
diff --git a/mobile/android/base/db/BrowserContract.java b/mobile/android/base/db/BrowserContract.java
index c662da594bf1..7cc275984123 100644
--- a/mobile/android/base/db/BrowserContract.java
+++ b/mobile/android/base/db/BrowserContract.java
@@ -8,7 +8,7 @@ package org.mozilla.gecko.db;
import org.mozilla.gecko.AppConstants;
import android.net.Uri;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
@RobocopTarget
public class BrowserContract {
diff --git a/mobile/android/base/db/DBUtils.java b/mobile/android/base/db/DBUtils.java
index 3851eb9c9a38..608ada5a2452 100644
--- a/mobile/android/base/db/DBUtils.java
+++ b/mobile/android/base/db/DBUtils.java
@@ -19,8 +19,8 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.Telemetry;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import java.util.Map;
diff --git a/mobile/android/base/db/LocalBrowserDB.java b/mobile/android/base/db/LocalBrowserDB.java
index a92ee5554e4b..3ee673694616 100644
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -24,6 +24,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.AboutPages;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.R;
import org.mozilla.gecko.db.BrowserContract.Bookmarks;
@@ -39,7 +40,6 @@ import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.favicons.decoders.FaviconDecoder;
import org.mozilla.gecko.favicons.decoders.LoadFaviconResult;
import org.mozilla.gecko.gfx.BitmapUtils;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.util.GeckoJarReader;
import org.mozilla.gecko.util.StringUtils;
diff --git a/mobile/android/base/db/LocalReadingListAccessor.java b/mobile/android/base/db/LocalReadingListAccessor.java
index 3bac122e1da9..850e313943b8 100644
--- a/mobile/android/base/db/LocalReadingListAccessor.java
+++ b/mobile/android/base/db/LocalReadingListAccessor.java
@@ -13,11 +13,11 @@ import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import org.mozilla.gecko.AboutPages;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.ReaderModeUtils;
import org.mozilla.gecko.db.BrowserContract.ReadingListItems;
-import org.mozilla.gecko.mozglue.RobocopTarget;
@RobocopTarget
diff --git a/mobile/android/base/db/ReadingListAccessor.java b/mobile/android/base/db/ReadingListAccessor.java
index b63687dd235c..b1ff8fdc2cd3 100644
--- a/mobile/android/base/db/ReadingListAccessor.java
+++ b/mobile/android/base/db/ReadingListAccessor.java
@@ -9,7 +9,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
@RobocopTarget
public interface ReadingListAccessor {
diff --git a/mobile/android/base/db/StubBrowserDB.java b/mobile/android/base/db/StubBrowserDB.java
index f5b5f24ad379..877074cf7269 100644
--- a/mobile/android/base/db/StubBrowserDB.java
+++ b/mobile/android/base/db/StubBrowserDB.java
@@ -13,10 +13,10 @@ import java.util.List;
import java.util.Map;
import org.json.JSONObject;
-import org.mozilla.gecko.Tab;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.favicons.decoders.LoadFaviconResult;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.Tab;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
diff --git a/mobile/android/base/db/SuggestedSites.java b/mobile/android/base/db/SuggestedSites.java
index 58434e747bfd..3708435c121e 100644
--- a/mobile/android/base/db/SuggestedSites.java
+++ b/mobile/android/base/db/SuggestedSites.java
@@ -34,6 +34,7 @@ import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.GeckoSharedPrefs;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.Locales;
@@ -41,7 +42,6 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.RestrictedProfiles;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.util.RawResource;
import org.mozilla.gecko.util.ThreadUtils;
diff --git a/mobile/android/base/db/TopSitesCursorWrapper.java b/mobile/android/base/db/TopSitesCursorWrapper.java
index d83dc129008e..a546f1563eb0 100644
--- a/mobile/android/base/db/TopSitesCursorWrapper.java
+++ b/mobile/android/base/db/TopSitesCursorWrapper.java
@@ -486,6 +486,11 @@ public class TopSitesCursorWrapper implements Cursor {
throw new UnsupportedOperationException();
}
+ // @Override - Method has been introduced in Android M. Add @Override annotation as soon as we are building with the M SDK - Bug 1193205
+ public void setExtras(Bundle extras) {
+ throw new UnsupportedOperationException();
+ }
+
@Override
public boolean getWantsAllOnMoveCalls() {
return false;
diff --git a/mobile/android/base/distribution/Distribution.java b/mobile/android/base/distribution/Distribution.java
index 1cb9d508711d..12e11b44abb7 100644
--- a/mobile/android/base/distribution/Distribution.java
+++ b/mobile/android/base/distribution/Distribution.java
@@ -36,12 +36,12 @@ import ch.boye.httpclientandroidlib.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoSharedPrefs;
import org.mozilla.gecko.Telemetry;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.FileUtils;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.ThreadUtils;
diff --git a/mobile/android/base/distribution/ReferrerDescriptor.java b/mobile/android/base/distribution/ReferrerDescriptor.java
index f422810ed14f..981756c8c7e2 100644
--- a/mobile/android/base/distribution/ReferrerDescriptor.java
+++ b/mobile/android/base/distribution/ReferrerDescriptor.java
@@ -4,7 +4,7 @@
package org.mozilla.gecko.distribution;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import android.net.Uri;
diff --git a/mobile/android/base/distribution/ReferrerReceiver.java b/mobile/android/base/distribution/ReferrerReceiver.java
index 1c41b7bd40a9..2d75fbbf6b90 100644
--- a/mobile/android/base/distribution/ReferrerReceiver.java
+++ b/mobile/android/base/distribution/ReferrerReceiver.java
@@ -6,10 +6,10 @@
package org.mozilla.gecko.distribution;
import org.mozilla.gecko.AdjustConstants;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.json.JSONException;
import org.json.JSONObject;
diff --git a/mobile/android/base/fxa/activities/FxAccountAbstractSetupActivity.java b/mobile/android/base/fxa/activities/FxAccountAbstractSetupActivity.java
index 9be939c99639..4bf4e53c90d3 100644
--- a/mobile/android/base/fxa/activities/FxAccountAbstractSetupActivity.java
+++ b/mobile/android/base/fxa/activities/FxAccountAbstractSetupActivity.java
@@ -32,6 +32,7 @@ import org.mozilla.gecko.sync.SyncConfiguration;
import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.sync.setup.Constants;
import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
+import org.mozilla.gecko.util.ColorUtils;
import android.accounts.Account;
import android.accounts.AccountManager;
@@ -135,12 +136,12 @@ abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractAc
passwordEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
showPasswordButton.setText(R.string.fxaccount_password_show);
showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_show_background));
- showPasswordButton.setTextColor(getResources().getColor(R.color.fxaccount_password_show_textcolor));
+ showPasswordButton.setTextColor(ColorUtils.getColor(this, R.color.fxaccount_password_show_textcolor));
} else {
passwordEdit.setTransformationMethod(SingleLineTransformationMethod.getInstance());
showPasswordButton.setText(R.string.fxaccount_password_hide);
showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_hide_background));
- showPasswordButton.setTextColor(getResources().getColor(R.color.fxaccount_password_hide_textcolor));
+ showPasswordButton.setTextColor(ColorUtils.getColor(this, R.color.fxaccount_password_hide_textcolor));
}
passwordEdit.setSelection(start, stop);
}
diff --git a/mobile/android/base/gfx/GeckoLayerClient.java b/mobile/android/base/gfx/GeckoLayerClient.java
index 612f27859473..cfa1ff5aef45 100644
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -5,6 +5,7 @@
package org.mozilla.gecko.gfx;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
@@ -12,7 +13,6 @@ import org.mozilla.gecko.gfx.LayerView.DrawListener;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.ZoomConstraints;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.FloatUtils;
import org.mozilla.gecko.AppConstants;
diff --git a/mobile/android/base/gfx/LayerRenderer.java b/mobile/android/base/gfx/LayerRenderer.java
index 437a2ae63892..bce023303b98 100644
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -28,7 +28,7 @@ import android.opengl.GLES20;
import android.os.SystemClock;
import android.util.Log;
-import org.mozilla.gecko.mozglue.JNITarget;
+import org.mozilla.gecko.annotation.JNITarget;
import org.mozilla.gecko.util.ThreadUtils;
import java.nio.ByteBuffer;
diff --git a/mobile/android/base/gfx/LayerView.java b/mobile/android/base/gfx/LayerView.java
index 8fa2820d56a7..56faaf49e8f0 100644
--- a/mobile/android/base/gfx/LayerView.java
+++ b/mobile/android/base/gfx/LayerView.java
@@ -10,6 +10,7 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import org.mozilla.gecko.AndroidGamepadManager;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.EventDispatcher;
@@ -20,7 +21,6 @@ import org.mozilla.gecko.PrefsHelper;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.ZoomConstraints;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import android.content.Context;
import android.graphics.Bitmap;
diff --git a/mobile/android/base/gfx/PanningPerfAPI.java b/mobile/android/base/gfx/PanningPerfAPI.java
index c4b9e4e55056..4507e30dbf22 100644
--- a/mobile/android/base/gfx/PanningPerfAPI.java
+++ b/mobile/android/base/gfx/PanningPerfAPI.java
@@ -5,7 +5,7 @@
package org.mozilla.gecko.gfx;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import android.os.SystemClock;
import android.util.Log;
diff --git a/mobile/android/base/home/BrowserSearch.java b/mobile/android/base/home/BrowserSearch.java
index 8c46a7521967..7b898053b869 100644
--- a/mobile/android/base/home/BrowserSearch.java
+++ b/mobile/android/base/home/BrowserSearch.java
@@ -14,6 +14,7 @@ import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
@@ -28,7 +29,6 @@ import org.mozilla.gecko.db.BrowserContract.History;
import org.mozilla.gecko.db.BrowserContract.URLColumns;
import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
import org.mozilla.gecko.home.SearchLoader.SearchCursorLoader;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.toolbar.AutocompleteHandler;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.StringUtils;
diff --git a/mobile/android/base/home/HomeConfig.java b/mobile/android/base/home/HomeConfig.java
index 6bab4c2eab4d..4676548e17c5 100644
--- a/mobile/android/base/home/HomeConfig.java
+++ b/mobile/android/base/home/HomeConfig.java
@@ -17,10 +17,10 @@ import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.R;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.ThreadUtils;
import android.content.Context;
diff --git a/mobile/android/base/home/HomePagerTabStrip.java b/mobile/android/base/home/HomePagerTabStrip.java
index 7edff5a0c072..3177ddf1f798 100644
--- a/mobile/android/base/home/HomePagerTabStrip.java
+++ b/mobile/android/base/home/HomePagerTabStrip.java
@@ -9,6 +9,7 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.animation.BounceAnimatorBuilder;
import org.mozilla.gecko.animation.BounceAnimatorBuilder.Attributes;
import org.mozilla.gecko.animation.TransitionsTracker;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.Resources;
@@ -60,7 +61,7 @@ class HomePagerTabStrip extends PagerTabStrip {
shadowSize = res.getDimensionPixelSize(R.dimen.tabs_strip_shadow_size);
shadowPaint = new Paint();
- shadowPaint.setColor(res.getColor(R.color.url_bar_shadow));
+ shadowPaint.setColor(ColorUtils.getColor(context, R.color.url_bar_shadow));
shadowPaint.setStrokeWidth(0.0f);
getViewTreeObserver().addOnPreDrawListener(new PreDrawListener());
diff --git a/mobile/android/base/home/PanelRecyclerView.java b/mobile/android/base/home/PanelRecyclerView.java
index b07f8de7e4fc..9145ab1e1ca4 100644
--- a/mobile/android/base/home/PanelRecyclerView.java
+++ b/mobile/android/base/home/PanelRecyclerView.java
@@ -143,11 +143,26 @@ public class PanelRecyclerView extends RecyclerView
@Override
public boolean onItemLongClicked(RecyclerView recyclerView, int position, View v) {
+ if (viewConfig.hasHeaderConfig()) {
+ if (position == 0) {
+ final HomeConfig.HeaderConfig headerConfig = viewConfig.getHeaderConfig();
+
+ final HomeContextMenuInfo info = new HomeContextMenuInfo(v, position, -1);
+ info.url = headerConfig.getUrl();
+ info.title = headerConfig.getUrl();
+
+ contextMenuInfo = info;
+ return showContextMenuForChild(this);
+ }
+
+ position--;
+ }
+
Cursor cursor = adapter.getCursor();
cursor.moveToPosition(position);
contextMenuInfo = contextMenuInfoFactory.makeInfoForCursor(recyclerView, position, -1, cursor);
- return showContextMenuForChild(PanelRecyclerView.this);
+ return showContextMenuForChild(this);
}
private class PanelSpanSizeLookup extends GridLayoutManager.SpanSizeLookup {
diff --git a/mobile/android/base/home/SearchEngineAdapter.java b/mobile/android/base/home/SearchEngineAdapter.java
index 2226aa070e88..a833c8e68bac 100644
--- a/mobile/android/base/home/SearchEngineAdapter.java
+++ b/mobile/android/base/home/SearchEngineAdapter.java
@@ -11,6 +11,7 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import java.util.Collections;
import java.util.List;
@@ -102,7 +103,7 @@ public class SearchEngineAdapter
.inflate(R.layout.search_engine_bar_label, parent, false);
final Drawable icon = DrawableCompat.wrap(
ContextCompat.getDrawable(mContext, R.drawable.search_icon_active).mutate());
- DrawableCompat.setTint(icon, mContext.getResources().getColor(R.color.disabled_grey));
+ DrawableCompat.setTint(icon, ColorUtils.getColor(mContext, R.color.disabled_grey));
final ImageView iconView = (ImageView) view.findViewById(R.id.search_engine_label);
iconView.setImageDrawable(icon);
diff --git a/mobile/android/base/home/SearchEngineBar.java b/mobile/android/base/home/SearchEngineBar.java
index 223c7166d911..019bb0bfc423 100644
--- a/mobile/android/base/home/SearchEngineBar.java
+++ b/mobile/android/base/home/SearchEngineBar.java
@@ -15,8 +15,9 @@ import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.R;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.widget.RecyclerViewClickSupport;
import java.util.List;
@@ -47,7 +48,7 @@ public class SearchEngineBar extends RecyclerView
super(context, attrs);
mDividerPaint = new Paint();
- mDividerPaint.setColor(getResources().getColor(R.color.divider_light));
+ mDividerPaint.setColor(ColorUtils.getColor(context, R.color.divider_light));
mDividerPaint.setStyle(Paint.Style.FILL_AND_STROKE);
final DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
diff --git a/mobile/android/base/home/TabMenuStrip.java b/mobile/android/base/home/TabMenuStrip.java
index fc6311f2ae82..ceba4ca67dc9 100644
--- a/mobile/android/base/home/TabMenuStrip.java
+++ b/mobile/android/base/home/TabMenuStrip.java
@@ -6,6 +6,7 @@
package org.mozilla.gecko.home;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.Resources;
@@ -56,7 +57,7 @@ public class TabMenuStrip extends HorizontalScrollView
shadowSize = res.getDimensionPixelSize(R.dimen.tabs_strip_shadow_size);
shadowPaint = new Paint();
- shadowPaint.setColor(res.getColor(R.color.url_bar_shadow));
+ shadowPaint.setColor(ColorUtils.getColor(context, R.color.url_bar_shadow));
shadowPaint.setStrokeWidth(0.0f);
}
diff --git a/mobile/android/base/home/TabMenuStripLayout.java b/mobile/android/base/home/TabMenuStripLayout.java
index eb231f72616c..78caee023d94 100644
--- a/mobile/android/base/home/TabMenuStripLayout.java
+++ b/mobile/android/base/home/TabMenuStripLayout.java
@@ -6,6 +6,7 @@
package org.mozilla.gecko.home;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -79,7 +80,7 @@ class TabMenuStripLayout extends LinearLayout
}
selectedView = (TextView) getChildAt(position);
- selectedView.setTextColor(getResources().getColor(R.color.placeholder_grey));
+ selectedView.setTextColor(ColorUtils.getColor(getContext(), R.color.placeholder_grey));
// Callback to measure and draw the strip after the view is visible.
ViewTreeObserver vto = selectedView.getViewTreeObserver();
diff --git a/mobile/android/base/home/TopSitesThumbnailView.java b/mobile/android/base/home/TopSitesThumbnailView.java
index fed2698445c6..8e26884018f4 100644
--- a/mobile/android/base/home/TopSitesThumbnailView.java
+++ b/mobile/android/base/home/TopSitesThumbnailView.java
@@ -7,6 +7,7 @@ package org.mozilla.gecko.home;
import org.mozilla.gecko.R;
import org.mozilla.gecko.ThumbnailHelper;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
@@ -38,7 +39,7 @@ public class TopSitesThumbnailView extends ImageView {
private Matrix mLayoutNextMatrix = new Matrix();
// Default filter color for "Add a bookmark" views.
- private final int mDefaultColor = getResources().getColor(R.color.top_site_default);
+ private final int mDefaultColor = ColorUtils.getColor(getContext(), R.color.top_site_default);
// Stroke width for the border.
private final float mStrokeWidth = getResources().getDisplayMetrics().density * 2;
@@ -68,7 +69,7 @@ public class TopSitesThumbnailView extends ImageView {
// Initialize the border paint.
final Resources res = getResources();
mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mBorderPaint.setColor(res.getColor(R.color.top_site_border));
+ mBorderPaint.setColor(ColorUtils.getColor(context, R.color.top_site_border));
mBorderPaint.setStyle(Paint.Style.STROKE);
}
diff --git a/mobile/android/base/menu/MenuItemActionBar.java b/mobile/android/base/menu/MenuItemActionBar.java
index 8e3266714769..c36886419265 100644
--- a/mobile/android/base/menu/MenuItemActionBar.java
+++ b/mobile/android/base/menu/MenuItemActionBar.java
@@ -5,9 +5,12 @@
package org.mozilla.gecko.menu;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.DrawableUtil;
import org.mozilla.gecko.widget.ThemedImageButton;
import android.content.Context;
+import android.content.res.ColorStateList;
+import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
@@ -15,6 +18,8 @@ public class MenuItemActionBar extends ThemedImageButton
implements GeckoMenuItem.Layout {
private static final String LOGTAG = "GeckoMenuItemActionBar";
+ private final ColorStateList drawableColors;
+
public MenuItemActionBar(Context context) {
this(context, null);
}
@@ -25,6 +30,10 @@ public class MenuItemActionBar extends ThemedImageButton
public MenuItemActionBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+
+ final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MenuItemActionBar, defStyle, 0);
+ drawableColors = ta.getColorStateList(R.styleable.MenuItemActionBar_drawableTintList);
+ ta.recycle();
}
@Override
@@ -43,6 +52,7 @@ public class MenuItemActionBar extends ThemedImageButton
setVisibility(GONE);
} else {
setVisibility(VISIBLE);
+ DrawableUtil.tintDrawableWithStateList(icon, drawableColors);
setImageDrawable(icon);
}
}
@@ -56,12 +66,6 @@ public class MenuItemActionBar extends ThemedImageButton
setContentDescription(title);
}
- @Override
- public void setEnabled(boolean enabled) {
- super.setEnabled(enabled);
- setColorFilter(enabled ? 0 : 0xFF999999);
- }
-
@Override
public void setShowIcon(boolean show) {
// Do nothing.
diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build
index ceaccb87044f..82e16da0dbf1 100644
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -14,6 +14,9 @@ thirdparty_source_dir = TOPSRCDIR + '/mobile/android/thirdparty/'
constants_jar = add_java_jar('constants')
constants_jar.sources = [
'adjust/AdjustHelperInterface.java',
+ 'annotation/JNITarget.java',
+ 'annotation/RobocopTarget.java',
+ 'annotation/WebRTCJNITarget.java',
'annotation/WrapForJNI.java',
'SysInfo.java',
]
@@ -56,11 +59,8 @@ mgjar.sources += [
'mozglue/DirectBufferAllocator.java',
'mozglue/GeckoLoader.java',
'mozglue/JNIObject.java',
- 'mozglue/JNITarget.java',
'mozglue/NativeReference.java',
'mozglue/NativeZip.java',
- 'mozglue/RobocopTarget.java',
- 'mozglue/WebRTCJNITarget.java',
]
mgjar.generated_sources = [] # Keep it this way.
mgjar.extra_jars += [
@@ -74,6 +74,7 @@ gujar.sources += [
'util/ActivityResultHandlerMap.java',
'util/ActivityUtils.java',
'util/Clipboard.java',
+ 'util/ColorUtils.java',
'util/DrawableUtil.java',
'util/EventCallback.java',
'util/FileUtils.java',
diff --git a/mobile/android/base/mozglue/GeckoLoader.java b/mobile/android/base/mozglue/GeckoLoader.java
index 646b33a49561..5a28b0e451b9 100644
--- a/mobile/android/base/mozglue/GeckoLoader.java
+++ b/mobile/android/base/mozglue/GeckoLoader.java
@@ -21,6 +21,8 @@ import android.os.Build;
import android.os.Environment;
import android.util.Log;
+import org.mozilla.gecko.annotation.JNITarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.mozglue.ContextUtils.SafeIntent;
diff --git a/mobile/android/base/mozglue/NativeZip.java b/mobile/android/base/mozglue/NativeZip.java
index 8a35d155fb91..be2f76390faa 100644
--- a/mobile/android/base/mozglue/NativeZip.java
+++ b/mobile/android/base/mozglue/NativeZip.java
@@ -5,7 +5,7 @@
package org.mozilla.gecko.mozglue;
-import org.mozilla.gecko.mozglue.JNITarget;
+import org.mozilla.gecko.annotation.JNITarget;
import java.io.InputStream;
import java.nio.ByteBuffer;
diff --git a/mobile/android/base/resources/color-large-v11/action_bar_menu_item_colors.xml b/mobile/android/base/resources/color-large-v11/action_bar_menu_item_colors.xml
new file mode 100644
index 000000000000..756463d68c9a
--- /dev/null
+++ b/mobile/android/base/resources/color-large-v11/action_bar_menu_item_colors.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mobile/android/base/resources/color-large-v11/action_bar_secondary_menu_item_colors.xml b/mobile/android/base/resources/color-large-v11/action_bar_secondary_menu_item_colors.xml
new file mode 100644
index 000000000000..c72ce0923f83
--- /dev/null
+++ b/mobile/android/base/resources/color-large-v11/action_bar_secondary_menu_item_colors.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/mobile/android/base/resources/color-large-v11/tabs_counter_text_color.xml b/mobile/android/base/resources/color-large-v11/tabs_counter_text_color.xml
new file mode 100644
index 000000000000..945634b7a670
--- /dev/null
+++ b/mobile/android/base/resources/color-large-v11/tabs_counter_text_color.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mobile/android/base/resources/color/url_bar_title.xml b/mobile/android/base/resources/color/url_bar_title.xml
index e438979af1ef..473bee41d289 100644
--- a/mobile/android/base/resources/color/url_bar_title.xml
+++ b/mobile/android/base/resources/color/url_bar_title.xml
@@ -7,10 +7,10 @@
xmlns:gecko="http://schemas.android.com/apk/res-auto">
-
+
-
+
diff --git a/mobile/android/base/resources/drawable-large-v11/new_tablet_action_bar_button.xml b/mobile/android/base/resources/drawable-large-v11/new_tablet_action_bar_button.xml
index 54dedbe256c3..b7f7f014ce2d 100644
--- a/mobile/android/base/resources/drawable-large-v11/new_tablet_action_bar_button.xml
+++ b/mobile/android/base/resources/drawable-large-v11/new_tablet_action_bar_button.xml
@@ -15,7 +15,7 @@
android:insetLeft="@dimen/new_tablet_browser_toolbar_menu_item_inset_horizontal"
android:insetRight="@dimen/new_tablet_browser_toolbar_menu_item_inset_horizontal">
-
+
@@ -31,7 +31,7 @@
android:insetLeft="@dimen/new_tablet_browser_toolbar_menu_item_inset_horizontal"
android:insetRight="@dimen/new_tablet_browser_toolbar_menu_item_inset_horizontal">
-
+
diff --git a/mobile/android/base/resources/drawable-large-v11/new_tablet_url_bar_nav_button.xml b/mobile/android/base/resources/drawable-large-v11/new_tablet_url_bar_nav_button.xml
index c71774713e1e..3027357ec78d 100644
--- a/mobile/android/base/resources/drawable-large-v11/new_tablet_url_bar_nav_button.xml
+++ b/mobile/android/base/resources/drawable-large-v11/new_tablet_url_bar_nav_button.xml
@@ -9,13 +9,13 @@
+ android:drawable="@color/text_and_tabs_tray_grey"/>
+ android:drawable="@color/placeholder_active_grey"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -33,6 +57,19 @@
+
+
+
+
+
+
+
+
+
-
+
+
+
+ android:drawable="@drawable/tabs_panel_indicator_selected"/>
+
+
+
diff --git a/mobile/android/base/resources/drawable/tabs_panel_indicator_selected_private.xml b/mobile/android/base/resources/drawable/tabs_panel_indicator_selected_private.xml
new file mode 100644
index 000000000000..93dc0498650c
--- /dev/null
+++ b/mobile/android/base/resources/drawable/tabs_panel_indicator_selected_private.xml
@@ -0,0 +1,9 @@
+
+
+
+
diff --git a/mobile/android/base/resources/drawable/tabs_strip_indicator.xml b/mobile/android/base/resources/drawable/tabs_strip_indicator.xml
new file mode 100644
index 000000000000..32ca3115a28b
--- /dev/null
+++ b/mobile/android/base/resources/drawable/tabs_strip_indicator.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_counter.xml b/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_counter.xml
index 0f73b6591eb7..bb3217fe79ef 100644
--- a/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_counter.xml
+++ b/mobile/android/base/resources/layout-large-v11/new_tablet_tabs_counter.xml
@@ -10,7 +10,7 @@
android:paddingLeft="4dip"
android:background="@drawable/new_tablet_tabs_count_foreground"
android:textAppearance="@style/TextAppearance.Micro"
- android:textColor="@color/toolbar_grey"
+ android:textColor="@color/tabs_counter_text_color"
android:textStyle="bold"
android:duplicateParentState="true"
android:gravity="center"/>
diff --git a/mobile/android/base/resources/layout-v11/new_tablet_tabs_item_cell.xml b/mobile/android/base/resources/layout-v11/new_tablet_tabs_item_cell.xml
index 204eba2df91f..32b5a680f211 100644
--- a/mobile/android/base/resources/layout-v11/new_tablet_tabs_item_cell.xml
+++ b/mobile/android/base/resources/layout-v11/new_tablet_tabs_item_cell.xml
@@ -57,6 +57,7 @@
+
-
-
+ android:clickable="true"
+ android:foreground="@color/recyclerview_selector">
diff --git a/mobile/android/base/resources/layout/tab_menu_strip.xml b/mobile/android/base/resources/layout/tab_menu_strip.xml
index 1b768bb5b2ed..17f918a0aba3 100644
--- a/mobile/android/base/resources/layout/tab_menu_strip.xml
+++ b/mobile/android/base/resources/layout/tab_menu_strip.xml
@@ -7,7 +7,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/tabs_strip_button_width"
- android:background="@drawable/tabs_panel_indicator"
+ android:background="@drawable/tabs_strip_indicator"
android:paddingLeft="@dimen/tabs_strip_button_padding"
android:paddingRight="@dimen/tabs_strip_button_padding"
android:gravity="center"
diff --git a/mobile/android/base/resources/layout/tabs_item_cell.xml b/mobile/android/base/resources/layout/tabs_item_cell.xml
index 2c6483ec07ee..712bbdadb037 100644
--- a/mobile/android/base/resources/layout/tabs_item_cell.xml
+++ b/mobile/android/base/resources/layout/tabs_item_cell.xml
@@ -15,6 +15,7 @@
android:paddingRight="1dip"
android:gravity="center">
+
-
+
-
+
diff --git a/mobile/android/base/resources/values-large-v11/dimens.xml b/mobile/android/base/resources/values-large-v11/dimens.xml
index 1d9063d60eba..deeb2f2def34 100644
--- a/mobile/android/base/resources/values-large-v11/dimens.xml
+++ b/mobile/android/base/resources/values-large-v11/dimens.xml
@@ -8,6 +8,11 @@
100dp56dp
+
+ 50dp
+
60dp16dp16dp
diff --git a/mobile/android/base/resources/values-large-v11/styles.xml b/mobile/android/base/resources/values-large-v11/styles.xml
index 5ed98e069dc7..788cdc05f5a8 100644
--- a/mobile/android/base/resources/values-large-v11/styles.xml
+++ b/mobile/android/base/resources/values-large-v11/styles.xml
@@ -78,6 +78,7 @@
wrap_contentwrap_content@drawable/new_tablet_action_bar_button
+ @color/action_bar_menu_item_colorscenter
-
+
+
+
+
diff --git a/mobile/android/base/resources/values-xlarge-v11/dimens.xml b/mobile/android/base/resources/values-xlarge-v11/dimens.xml
index 8e38c4587ea0..f27050f6ca9d 100644
--- a/mobile/android/base/resources/values-xlarge-v11/dimens.xml
+++ b/mobile/android/base/resources/values-xlarge-v11/dimens.xml
@@ -5,7 +5,6 @@
- 56dp250dp48dp
diff --git a/mobile/android/base/resources/values/attrs.xml b/mobile/android/base/resources/values/attrs.xml
index b33cf4380338..eb62f3c15a25 100644
--- a/mobile/android/base/resources/values/attrs.xml
+++ b/mobile/android/base/resources/values/attrs.xml
@@ -196,5 +196,11 @@
+
+
+
+
+
diff --git a/mobile/android/base/resources/values/colors.xml b/mobile/android/base/resources/values/colors.xml
index 71ff06163f87..9cc767dce18d 100644
--- a/mobile/android/base/resources/values/colors.xml
+++ b/mobile/android/base/resources/values/colors.xml
@@ -152,4 +152,6 @@
#FFECF0F3#FFCFD9E1
+ #FFFFFF
+
diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml
index 16fe548ad258..675ce2deb6a4 100644
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -11,6 +11,11 @@
32dp48dp
+
+ 42dp
+
48dp
diff --git a/mobile/android/base/resources/values/styles.xml b/mobile/android/base/resources/values/styles.xml
index b409ae0a63f5..79694da514d9 100644
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -90,12 +90,16 @@
fitCenter
-
+
+
@@ -757,7 +761,7 @@
diff --git a/mobile/android/base/sqlite/SQLiteBridge.java b/mobile/android/base/sqlite/SQLiteBridge.java
index 072e63bf815c..9ad88dca02c6 100644
--- a/mobile/android/base/sqlite/SQLiteBridge.java
+++ b/mobile/android/base/sqlite/SQLiteBridge.java
@@ -11,7 +11,7 @@ import android.database.sqlite.SQLiteException;
import android.text.TextUtils;
import android.util.Log;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/mobile/android/base/tabs/TabStrip.java b/mobile/android/base/tabs/TabStrip.java
index b20c83da2daf..d28ead7b2ef5 100644
--- a/mobile/android/base/tabs/TabStrip.java
+++ b/mobile/android/base/tabs/TabStrip.java
@@ -19,6 +19,7 @@ import org.mozilla.gecko.BrowserApp.Refreshable;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.widget.ThemedImageButton;
import org.mozilla.gecko.widget.ThemedLinearLayout;
@@ -152,7 +153,7 @@ public class TabStrip extends ThemedLinearLayout
@Override
public void onLightweightThemeReset() {
- final int defaultBackgroundColor = getResources().getColor(R.color.text_and_tabs_tray_grey);
+ final int defaultBackgroundColor = ColorUtils.getColor(getContext(), R.color.text_and_tabs_tray_grey);
setBackgroundColor(defaultBackgroundColor);
}
}
diff --git a/mobile/android/base/tabs/TabsGridLayout.java b/mobile/android/base/tabs/TabsGridLayout.java
index 5d8027da0b19..5c364f44e3c2 100644
--- a/mobile/android/base/tabs/TabsGridLayout.java
+++ b/mobile/android/base/tabs/TabsGridLayout.java
@@ -13,6 +13,7 @@ import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
import org.mozilla.gecko.tabs.TabsPanel.TabsLayout;
+import org.mozilla.gecko.widget.ThemedRelativeLayout;
import android.content.Context;
import android.content.res.Resources;
@@ -435,6 +436,7 @@ class TabsGridLayout extends GridView
final TabsLayoutItemView item = super.newView(position, parent);
item.setCloseOnClickListener(mCloseClickListener);
+ ((ThemedRelativeLayout) item.findViewById(R.id.wrapper)).setPrivateMode(mIsPrivate);
return item;
}
diff --git a/mobile/android/base/tabs/TabsListLayout.java b/mobile/android/base/tabs/TabsListLayout.java
index 934ab5e6d3be..2e5a3ff36d00 100644
--- a/mobile/android/base/tabs/TabsListLayout.java
+++ b/mobile/android/base/tabs/TabsListLayout.java
@@ -18,6 +18,7 @@ import org.mozilla.gecko.Tab;
import org.mozilla.gecko.tabs.TabsPanel.TabsLayout;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.util.ThreadUtils;
+import org.mozilla.gecko.widget.ThemedRelativeLayout;
import org.mozilla.gecko.widget.TwoWayView;
import android.content.Context;
@@ -108,6 +109,7 @@ class TabsListLayout extends TwoWayView
TabsLayoutItemView item = super.newView(position, parent);
item.setCloseOnClickListener(mCloseOnClickListener);
+ ((ThemedRelativeLayout) item.findViewById(R.id.wrapper)).setPrivateMode(mIsPrivate);
return item;
}
diff --git a/mobile/android/base/tabs/TabsPanel.java b/mobile/android/base/tabs/TabsPanel.java
index cc8a0d3a0944..895cdd070563 100644
--- a/mobile/android/base/tabs/TabsPanel.java
+++ b/mobile/android/base/tabs/TabsPanel.java
@@ -19,6 +19,7 @@ import org.mozilla.gecko.animation.ViewHelper;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.lwt.LightweightThemeDrawable;
import org.mozilla.gecko.restrictions.Restriction;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.widget.GeckoPopupMenu;
import org.mozilla.gecko.widget.IconTabWidget;
@@ -38,6 +39,7 @@ import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
+import org.mozilla.gecko.widget.ThemedImageButton;
public class TabsPanel extends LinearLayout
implements GeckoPopupMenu.OnMenuItemClickListener,
@@ -139,7 +141,9 @@ public class TabsPanel extends LinearLayout
mTabWidget = (IconTabWidget) findViewById(R.id.tab_widget);
mTabWidget.addTab(R.drawable.tabs_normal, R.string.tabs_normal);
- mTabWidget.addTab(R.drawable.tabs_private, R.string.tabs_private);
+ final ThemedImageButton privateTabsPanel =
+ (ThemedImageButton) mTabWidget.addTab(R.drawable.tabs_private, R.string.tabs_private);
+ privateTabsPanel.setPrivateMode(true);
if (!RestrictedProfiles.isAllowed(mContext, Restriction.DISALLOW_PRIVATE_BROWSING)) {
mTabWidget.setVisibility(View.GONE);
@@ -281,7 +285,7 @@ public class TabsPanel extends LinearLayout
@Override
@SuppressWarnings("deprecation") // setBackgroundDrawable deprecated by API level 16
public void onLightweightThemeChanged() {
- final int background = getResources().getColor(R.color.text_and_tabs_tray_grey);
+ final int background = ColorUtils.getColor(getContext(), R.color.text_and_tabs_tray_grey);
final LightweightThemeDrawable drawable = mTheme.getColorDrawable(this, background, true);
if (drawable == null)
return;
@@ -292,7 +296,7 @@ public class TabsPanel extends LinearLayout
@Override
public void onLightweightThemeReset() {
- setBackgroundColor(getContext().getResources().getColor(R.color.text_and_tabs_tray_grey));
+ setBackgroundColor(ColorUtils.getColor(getContext(), R.color.text_and_tabs_tray_grey));
}
@Override
@@ -352,7 +356,7 @@ public class TabsPanel extends LinearLayout
@Override
@SuppressWarnings("deprecation") // setBackgroundDrawable deprecated by API level 16
public void onLightweightThemeChanged() {
- final int background = getResources().getColor(R.color.text_and_tabs_tray_grey);
+ final int background = ColorUtils.getColor(getContext(), R.color.text_and_tabs_tray_grey);
final LightweightThemeDrawable drawable = mTheme.getColorDrawable(this, background);
if (drawable == null)
return;
@@ -363,7 +367,7 @@ public class TabsPanel extends LinearLayout
@Override
public void onLightweightThemeReset() {
- setBackgroundColor(getContext().getResources().getColor(R.color.text_and_tabs_tray_grey));
+ setBackgroundColor(ColorUtils.getColor(getContext(), R.color.text_and_tabs_tray_grey));
}
@Override
diff --git a/mobile/android/base/toolbar/BrowserToolbar.java b/mobile/android/base/toolbar/BrowserToolbar.java
index eebd5ddfa488..d2ed162dd165 100644
--- a/mobile/android/base/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/toolbar/BrowserToolbar.java
@@ -29,6 +29,7 @@ import org.mozilla.gecko.toolbar.ToolbarDisplayLayout.OnStopListener;
import org.mozilla.gecko.toolbar.ToolbarDisplayLayout.OnTitleChangeListener;
import org.mozilla.gecko.toolbar.ToolbarDisplayLayout.UpdateFlags;
import org.mozilla.gecko.util.Clipboard;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.MenuUtils;
import org.mozilla.gecko.widget.ThemedImageButton;
@@ -202,8 +203,8 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
shadowSize = res.getDimensionPixelSize(R.dimen.browser_toolbar_shadow_size);
shadowPaint = new Paint();
- shadowColor = res.getColor(R.color.url_bar_shadow);
- shadowPrivateColor = res.getColor(R.color.url_bar_shadow_private);
+ shadowColor = ColorUtils.getColor(context, R.color.url_bar_shadow);
+ shadowPrivateColor = ColorUtils.getColor(context, R.color.url_bar_shadow_private);
shadowPaint.setColor(shadowColor);
shadowPaint.setStrokeWidth(0.0f);
@@ -926,8 +927,8 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
}
public static LightweightThemeDrawable getLightweightThemeDrawable(final View view,
- final Resources res, final LightweightTheme theme, final int colorResID) {
- final int color = res.getColor(colorResID);
+ final LightweightTheme theme, final int colorResID) {
+ final int color = ColorUtils.getColor(view.getContext(), colorResID);
final LightweightThemeDrawable drawable = theme.getColorDrawable(view, color);
if (drawable != null) {
diff --git a/mobile/android/base/toolbar/BrowserToolbarPhoneBase.java b/mobile/android/base/toolbar/BrowserToolbarPhoneBase.java
index ae2be68b2763..1e39cac6debc 100644
--- a/mobile/android/base/toolbar/BrowserToolbarPhoneBase.java
+++ b/mobile/android/base/toolbar/BrowserToolbarPhoneBase.java
@@ -13,6 +13,7 @@ import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.widget.ThemedImageView;
import android.content.Context;
@@ -63,7 +64,7 @@ abstract class BrowserToolbarPhoneBase extends BrowserToolbar {
roundCornerPaint = new Paint();
roundCornerPaint.setAntiAlias(true);
- roundCornerPaint.setColor(res.getColor(R.color.text_and_tabs_tray_grey));
+ roundCornerPaint.setColor(ColorUtils.getColor(context, R.color.text_and_tabs_tray_grey));
roundCornerPaint.setStrokeWidth(0.0f);
}
diff --git a/mobile/android/base/toolbar/BrowserToolbarTablet.java b/mobile/android/base/toolbar/BrowserToolbarTablet.java
index ccaffc99d51c..beba4240561a 100644
--- a/mobile/android/base/toolbar/BrowserToolbarTablet.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTablet.java
@@ -206,7 +206,6 @@ class BrowserToolbarTablet extends BrowserToolbarTabletBase {
@Override
protected Drawable getLWTDefaultStateSetDrawable() {
- return BrowserToolbar.getLightweightThemeDrawable(this, getResources(), getTheme(),
- R.color.toolbar_grey);
+ return BrowserToolbar.getLightweightThemeDrawable(this, getTheme(), R.color.toolbar_grey);
}
}
diff --git a/mobile/android/base/toolbar/BrowserToolbarTabletBase.java b/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
index 3371818d3b3d..555bfef7611d 100644
--- a/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
+++ b/mobile/android/base/toolbar/BrowserToolbarTabletBase.java
@@ -12,8 +12,12 @@ import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.tabs.TabHistoryController;
import org.mozilla.gecko.menu.MenuItemActionBar;
+import org.mozilla.gecko.util.ColorUtils;
+import org.mozilla.gecko.widget.ThemedTextView;
import android.content.Context;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
@@ -37,6 +41,8 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
protected final BackButton backButton;
protected final ForwardButton forwardButton;
+ private final PorterDuffColorFilter privateBrowsingTabletMenuItemColorFilter;
+
protected abstract void animateForwardButton(ForwardButtonAnimation animation);
public BrowserToolbarTabletBase(final Context context, final AttributeSet attrs) {
@@ -55,6 +61,9 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
focusOrder.addAll(Arrays.asList(actionItemBar, menuButton));
urlDisplayLayout.updateSiteIdentityAnchor(backButton);
+
+ privateBrowsingTabletMenuItemColorFilter = new PorterDuffColorFilter(
+ ColorUtils.getColor(context, R.color.tabs_tray_icon_grey), PorterDuff.Mode.SRC_IN);
}
private void initButtonListeners() {
@@ -121,6 +130,17 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
public void setPrivateMode(final boolean isPrivate) {
super.setPrivateMode(isPrivate);
+ // Better done with android:tint but it doesn't take a ColorStateList:
+ // https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=18220
+ // Nor can we use DrawableCompat because the drawables (as opposed
+ // to the Views) don't receive gecko:state_private.
+ final PorterDuffColorFilter colorFilter =
+ isPrivate ? privateBrowsingTabletMenuItemColorFilter : null;
+ backButton.setColorFilter(colorFilter);
+ forwardButton.setColorFilter(colorFilter);
+ setTabsCounterPrivateMode(isPrivate, colorFilter);
+ menuIcon.setColorFilter(colorFilter);
+
backButton.setPrivateMode(isPrivate);
forwardButton.setPrivateMode(isPrivate);
for (int i = 0; i < actionItemBar.getChildCount(); ++i) {
@@ -129,6 +149,20 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
}
}
+ private void setTabsCounterPrivateMode(final boolean isPrivate, final PorterDuffColorFilter colorFilter) {
+ // The TabsCounter is a TextSwitcher which cycles two views
+ // to provide animations, hence looping over these two children.
+ for (int i = 0; i < 2; ++i) {
+ final ThemedTextView view = (ThemedTextView) tabsCounter.getChildAt(i);
+ view.setPrivateMode(isPrivate);
+ view.getBackground().mutate().setColorFilter(colorFilter);
+ }
+
+ // To prevent animation of the background,
+ // it is set to a different Drawable.
+ tabsCounter.getBackground().mutate().setColorFilter(colorFilter);
+ }
+
@Override
public View getDoorHangerAnchor() {
return backButton;
diff --git a/mobile/android/base/toolbar/NavButton.java b/mobile/android/base/toolbar/NavButton.java
index 5e300023dd74..8bd22653d4e3 100644
--- a/mobile/android/base/toolbar/NavButton.java
+++ b/mobile/android/base/toolbar/NavButton.java
@@ -5,6 +5,7 @@
package org.mozilla.gecko.toolbar;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.Resources;
@@ -27,8 +28,8 @@ abstract class NavButton extends ShapedButton {
super(context, attrs);
final Resources res = getResources();
- mBorderColor = res.getColor(R.color.disabled_grey);
- mBorderColorPrivate = res.getColor(R.color.toolbar_icon_grey);
+ mBorderColor = ColorUtils.getColor(context, R.color.disabled_grey);
+ mBorderColorPrivate = ColorUtils.getColor(context, R.color.toolbar_icon_grey);
mBorderWidth = res.getDimension(R.dimen.nav_button_border_width);
// Paint to draw the border.
@@ -60,8 +61,7 @@ abstract class NavButton extends ShapedButton {
// The drawable is constructed as per @drawable/new_tablet_url_bar_nav_button.
@Override
public void onLightweightThemeChanged() {
- final Drawable drawable = BrowserToolbar.getLightweightThemeDrawable(this, getResources(),
- getTheme(), R.color.toolbar_grey);
+ final Drawable drawable = BrowserToolbar.getLightweightThemeDrawable(this, getTheme(), R.color.toolbar_grey);
if (drawable == null) {
return;
diff --git a/mobile/android/base/toolbar/ShapedButton.java b/mobile/android/base/toolbar/ShapedButton.java
index 089fb0aed347..fb98a8b13fa6 100644
--- a/mobile/android/base/toolbar/ShapedButton.java
+++ b/mobile/android/base/toolbar/ShapedButton.java
@@ -9,6 +9,7 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.lwt.LightweightThemeDrawable;
import org.mozilla.gecko.tabs.TabCurve;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.widget.ThemedImageButton;
import android.content.Context;
@@ -35,7 +36,7 @@ public class ShapedButton extends ThemedImageButton
final Paint paint = new Paint();
paint.setAntiAlias(true);
- paint.setColor(getResources().getColor(R.color.canvas_delegate_paint));
+ paint.setColor(ColorUtils.getColor(context, R.color.canvas_delegate_paint));
paint.setStrokeWidth(0.0f);
mCanvasDelegate = new CanvasDelegate(this, Mode.DST_IN, paint);
@@ -58,7 +59,7 @@ public class ShapedButton extends ThemedImageButton
// The drawable is constructed as per @drawable/shaped_button.
@Override
public void onLightweightThemeChanged() {
- final int background = getResources().getColor(R.color.text_and_tabs_tray_grey);
+ final int background = ColorUtils.getColor(getContext(), R.color.text_and_tabs_tray_grey);
final LightweightThemeDrawable lightWeight = getTheme().getColorDrawable(this, background);
if (lightWeight == null)
diff --git a/mobile/android/base/toolbar/SiteIdentityPopup.java b/mobile/android/base/toolbar/SiteIdentityPopup.java
index 885e95e12050..ec85f9a1b705 100644
--- a/mobile/android/base/toolbar/SiteIdentityPopup.java
+++ b/mobile/android/base/toolbar/SiteIdentityPopup.java
@@ -27,6 +27,7 @@ import org.mozilla.gecko.SiteIdentity.MixedMode;
import org.mozilla.gecko.SiteIdentity.TrackingMode;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.gecko.widget.AnchoredPopup;
@@ -338,13 +339,13 @@ public class SiteIdentityPopup extends AnchoredPopup implements GeckoEventListen
}
mSecurityState.setText(R.string.identity_connection_insecure);
- mSecurityState.setTextColor(mResources.getColor(R.color.placeholder_active_grey));
+ mSecurityState.setTextColor(ColorUtils.getColor(mContext, R.color.placeholder_active_grey));
} else {
// Connection is secure.
mIcon.setImageResource(R.drawable.lock_secure);
setSecurityStateIcon(R.drawable.img_check, 2);
- mSecurityState.setTextColor(mResources.getColor(R.color.affirmative_green));
+ mSecurityState.setTextColor(ColorUtils.getColor(mContext, R.color.affirmative_green));
mSecurityState.setText(R.string.identity_connection_secure);
// Mixed content has been blocked, if present.
diff --git a/mobile/android/base/toolbar/ToolbarDisplayLayout.java b/mobile/android/base/toolbar/ToolbarDisplayLayout.java
index eb6b1c9ae55e..bdafdf2a0af3 100644
--- a/mobile/android/base/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/toolbar/ToolbarDisplayLayout.java
@@ -23,6 +23,7 @@ import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.toolbar.BrowserToolbarTabletBase.ForwardButtonAnimation;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.widget.ThemedLinearLayout;
@@ -153,10 +154,10 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout
final Resources res = getResources();
- mUrlColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_urltext));
- mBlockedColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_blockedtext));
- mDomainColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_domaintext));
- mPrivateDomainColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_domaintext_private));
+ mUrlColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_urltext));
+ mBlockedColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_blockedtext));
+ mDomainColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_domaintext));
+ mPrivateDomainColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_domaintext_private));
mFavicon = (ImageButton) findViewById(R.id.favicon);
mSiteSecurity = (ImageButton) findViewById(R.id.site_security);
diff --git a/mobile/android/base/toolbar/ToolbarEditText.java b/mobile/android/base/toolbar/ToolbarEditText.java
index ff0d297bb20b..1ce7ff25b9b5 100644
--- a/mobile/android/base/toolbar/ToolbarEditText.java
+++ b/mobile/android/base/toolbar/ToolbarEditText.java
@@ -5,6 +5,7 @@
package org.mozilla.gecko.toolbar;
+import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.CustomEditText;
import org.mozilla.gecko.InputMethods;
@@ -12,11 +13,13 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.toolbar.BrowserToolbar.OnCommitListener;
import org.mozilla.gecko.toolbar.BrowserToolbar.OnDismissListener;
import org.mozilla.gecko.toolbar.BrowserToolbar.OnFilterListener;
+import org.mozilla.gecko.util.DrawableUtil;
import org.mozilla.gecko.util.GamepadUtils;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.graphics.Rect;
import android.text.Editable;
import android.text.NoCopySpan;
@@ -122,7 +125,17 @@ public class ToolbarEditText extends CustomEditText
@Override
public void setText(final CharSequence text, final TextView.BufferType type) {
- super.setText(text, type);
+ final String textString = (text == null) ? "" : text.toString();
+
+ // If we're on the home or private browsing page, we don't set the "about" url.
+ final CharSequence finalText;
+ if (AboutPages.isAboutHome(textString) || AboutPages.isAboutPrivateBrowsing(textString)) {
+ finalText = "";
+ } else {
+ finalText = text;
+ }
+
+ super.setText(finalText, type);
// Any autocomplete text would have been overwritten, so reset our autocomplete states.
resetAutocompleteState();
@@ -160,11 +173,18 @@ public class ToolbarEditText extends CustomEditText
}
// When on tablet show a magnifying glass in editing mode
- if (isActive) {
- setCompoundDrawablesWithIntrinsicBounds(R.drawable.search_icon_active, 0, 0, 0);
+ final int searchDrawableId = R.drawable.search_icon_active;
+ final Drawable searchDrawable;
+ if (!isActive) {
+ searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.placeholder_grey);
} else {
- setCompoundDrawablesWithIntrinsicBounds(R.drawable.search_icon_inactive, 0, 0, 0);
+ if (isPrivateMode()) {
+ searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.tabs_tray_icon_grey);
+ } else {
+ searchDrawable = getResources().getDrawable(searchDrawableId);
+ }
}
+ setCompoundDrawablesWithIntrinsicBounds(searchDrawable, null, null, null);
}
/**
diff --git a/mobile/android/base/toolbar/ToolbarProgressView.java b/mobile/android/base/toolbar/ToolbarProgressView.java
index bf45cc788c69..dce9dba91da9 100644
--- a/mobile/android/base/toolbar/ToolbarProgressView.java
+++ b/mobile/android/base/toolbar/ToolbarProgressView.java
@@ -18,6 +18,7 @@ package org.mozilla.gecko.toolbar;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.widget.ThemedImageView;
import org.mozilla.gecko.util.WeakReferenceHandler;
@@ -70,7 +71,7 @@ public class ToolbarProgressView extends ThemedImageView {
mTargetProgress = 0;
mPrivateBrowsingColorFilter = new PorterDuffColorFilter(
- getResources().getColor(R.color.private_browsing_purple), PorterDuff.Mode.SRC_IN);
+ ColorUtils.getColor(ctx, R.color.private_browsing_purple), PorterDuff.Mode.SRC_IN);
mHandler = new ToolbarProgressHandler(this);
}
diff --git a/mobile/android/base/updater/UpdateServiceHelper.java b/mobile/android/base/updater/UpdateServiceHelper.java
index 9a8f428a2d15..f464146d3f77 100644
--- a/mobile/android/base/updater/UpdateServiceHelper.java
+++ b/mobile/android/base/updater/UpdateServiceHelper.java
@@ -5,9 +5,9 @@
package org.mozilla.gecko.updater;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.PrefsHelper;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.GeckoJarReader;
import android.content.Context;
diff --git a/mobile/android/base/util/ColorUtils.java b/mobile/android/base/util/ColorUtils.java
new file mode 100644
index 000000000000..d13e803aa758
--- /dev/null
+++ b/mobile/android/base/util/ColorUtils.java
@@ -0,0 +1,26 @@
+/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.util;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.support.annotation.ColorRes;
+import android.support.annotation.NonNull;
+
+public class ColorUtils {
+ // TODO: Eventually this functionality should be available in ContextCompat (support library)
+ @SuppressWarnings("deprecation")
+ public static int getColor(@NonNull Context context, @ColorRes int color) {
+ final Resources resources = context.getResources();
+
+ // TODO: After switching to Android M SDK: Use getColor(color, theme) on Android M+
+ // if (AppConstants.Versions.feature23Plus) {
+ // return resources.getColor(color, context.getTheme());
+ // }
+
+ return resources.getColor(color);
+ }
+}
diff --git a/mobile/android/base/util/DrawableUtil.java b/mobile/android/base/util/DrawableUtil.java
index 386fbe0cdf51..5d0de13b746d 100644
--- a/mobile/android/base/util/DrawableUtil.java
+++ b/mobile/android/base/util/DrawableUtil.java
@@ -6,6 +6,7 @@
package org.mozilla.gecko.util;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
@@ -19,7 +20,14 @@ public class DrawableUtil {
@ColorRes final int colorID) {
final Drawable icon = DrawableCompat.wrap(
ContextCompat.getDrawable(context, drawableID).mutate());
- DrawableCompat.setTint(icon, context.getResources().getColor(colorID));
+ DrawableCompat.setTint(icon, ColorUtils.getColor(context, colorID));
return icon;
}
+
+ public static Drawable tintDrawableWithStateList(@NonNull final Drawable drawable,
+ @NonNull final ColorStateList colorList) {
+ final Drawable wrappedDrawable = DrawableCompat.wrap(drawable.mutate());
+ DrawableCompat.setTintList(wrappedDrawable, colorList);
+ return wrappedDrawable;
+ }
}
diff --git a/mobile/android/base/util/EventCallback.java b/mobile/android/base/util/EventCallback.java
index 7bd4ad51cbfe..09954266617f 100644
--- a/mobile/android/base/util/EventCallback.java
+++ b/mobile/android/base/util/EventCallback.java
@@ -1,6 +1,6 @@
package org.mozilla.gecko.util;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
/**
* Callback interface for Gecko requests.
diff --git a/mobile/android/base/util/FileUtils.java b/mobile/android/base/util/FileUtils.java
index 202696338d30..77d6b6651ce8 100644
--- a/mobile/android/base/util/FileUtils.java
+++ b/mobile/android/base/util/FileUtils.java
@@ -11,7 +11,7 @@ import java.io.IOException;
import java.io.FilenameFilter;
import java.util.Scanner;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
public class FileUtils {
private static final String LOGTAG= "GeckoFileUtils";
diff --git a/mobile/android/base/util/GeckoEventListener.java b/mobile/android/base/util/GeckoEventListener.java
index bc78cb5aade3..10336490b704 100644
--- a/mobile/android/base/util/GeckoEventListener.java
+++ b/mobile/android/base/util/GeckoEventListener.java
@@ -6,7 +6,7 @@
package org.mozilla.gecko.util;
import org.json.JSONObject;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
@RobocopTarget
public interface GeckoEventListener {
diff --git a/mobile/android/base/util/GeckoJarReader.java b/mobile/android/base/util/GeckoJarReader.java
index 722f587ea8a6..501d8819af61 100644
--- a/mobile/android/base/util/GeckoJarReader.java
+++ b/mobile/android/base/util/GeckoJarReader.java
@@ -9,10 +9,10 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
+import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.mozglue.GeckoLoader;
import org.mozilla.gecko.mozglue.NativeZip;
-import org.mozilla.gecko.mozglue.RobocopTarget;
import java.io.BufferedReader;
import java.io.File;
diff --git a/mobile/android/base/util/GeckoRequest.java b/mobile/android/base/util/GeckoRequest.java
index ac32513db2e2..a57ed7f0826d 100644
--- a/mobile/android/base/util/GeckoRequest.java
+++ b/mobile/android/base/util/GeckoRequest.java
@@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONException;
import org.json.JSONObject;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import android.util.Log;
diff --git a/mobile/android/base/util/NativeEventListener.java b/mobile/android/base/util/NativeEventListener.java
index f5e7bb2d674c..2a1b6e89a8fe 100644
--- a/mobile/android/base/util/NativeEventListener.java
+++ b/mobile/android/base/util/NativeEventListener.java
@@ -5,7 +5,7 @@
package org.mozilla.gecko.util;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
@RobocopTarget
public interface NativeEventListener {
diff --git a/mobile/android/base/util/NativeJSContainer.java b/mobile/android/base/util/NativeJSContainer.java
index 0c939cadea30..ac092ecc83d4 100644
--- a/mobile/android/base/util/NativeJSContainer.java
+++ b/mobile/android/base/util/NativeJSContainer.java
@@ -6,7 +6,6 @@
package org.mozilla.gecko.util;
import org.mozilla.gecko.annotation.WrapForJNI;
-import org.mozilla.gecko.mozglue.JNITarget;
/**
* NativeJSContainer is a wrapper around the SpiderMonkey JSAPI to make it possible to
diff --git a/mobile/android/base/util/NativeJSObject.java b/mobile/android/base/util/NativeJSObject.java
index ad5b645d6480..0adce638ce16 100644
--- a/mobile/android/base/util/NativeJSObject.java
+++ b/mobile/android/base/util/NativeJSObject.java
@@ -5,9 +5,9 @@
package org.mozilla.gecko.util;
+import org.mozilla.gecko.annotation.JNITarget;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.mozglue.JNIObject;
-import org.mozilla.gecko.mozglue.JNITarget;
import android.os.Bundle;
diff --git a/mobile/android/base/util/ThreadUtils.java b/mobile/android/base/util/ThreadUtils.java
index 64681f23d755..884a56dc4dcd 100644
--- a/mobile/android/base/util/ThreadUtils.java
+++ b/mobile/android/base/util/ThreadUtils.java
@@ -5,7 +5,7 @@
package org.mozilla.gecko.util;
-import org.mozilla.gecko.mozglue.RobocopTarget;
+import org.mozilla.gecko.annotation.RobocopTarget;
import java.util.Map;
diff --git a/mobile/android/base/widget/ContentSecurityDoorHanger.java b/mobile/android/base/widget/ContentSecurityDoorHanger.java
index 2c0c2e12e531..d888b1828f3f 100644
--- a/mobile/android/base/widget/ContentSecurityDoorHanger.java
+++ b/mobile/android/base/widget/ContentSecurityDoorHanger.java
@@ -16,6 +16,7 @@ import org.json.JSONObject;
import android.content.Context;
import android.view.View;
import org.mozilla.gecko.toolbar.SiteIdentityPopup;
+import org.mozilla.gecko.util.ColorUtils;
public class ContentSecurityDoorHanger extends DoorHanger {
private static final String LOGTAG = "GeckoSecurityDoorHanger";
@@ -80,11 +81,11 @@ public class ContentSecurityDoorHanger extends DoorHanger {
if (enabled) {
mMessage.setText(R.string.doorhanger_tracking_message_enabled);
mSecurityState.setText(R.string.doorhanger_tracking_state_enabled);
- mSecurityState.setTextColor(getResources().getColor(R.color.affirmative_green));
+ mSecurityState.setTextColor(ColorUtils.getColor(getContext(), R.color.affirmative_green));
} else {
mMessage.setText(R.string.doorhanger_tracking_message_disabled);
mSecurityState.setText(R.string.doorhanger_tracking_state_disabled);
- mSecurityState.setTextColor(getResources().getColor(R.color.rejection_red));
+ mSecurityState.setTextColor(ColorUtils.getColor(getContext(), R.color.rejection_red));
}
mMessage.setVisibility(VISIBLE);
mSecurityState.setVisibility(VISIBLE);
diff --git a/mobile/android/base/widget/DefaultDoorHanger.java b/mobile/android/base/widget/DefaultDoorHanger.java
index 88ea3ac64256..23bbbbe574e2 100644
--- a/mobile/android/base/widget/DefaultDoorHanger.java
+++ b/mobile/android/base/widget/DefaultDoorHanger.java
@@ -12,6 +12,7 @@ import android.widget.Button;
import android.widget.TextView;
import org.mozilla.gecko.R;
import org.mozilla.gecko.prompts.PromptInput;
+import org.mozilla.gecko.util.ColorUtils;
import org.json.JSONArray;
import org.json.JSONException;
@@ -41,7 +42,7 @@ public class DefaultDoorHanger extends DoorHanger {
mMessage = (TextView) findViewById(R.id.doorhanger_message);
if (sSpinnerTextColor == -1) {
- sSpinnerTextColor = mResources.getColor(R.color.text_color_primary_disable_only);
+ sSpinnerTextColor = ColorUtils.getColor(context, R.color.text_color_primary_disable_only);
}
switch (mType) {
diff --git a/mobile/android/base/widget/DoorHanger.java b/mobile/android/base/widget/DoorHanger.java
index 91f8c906ae29..0d11a1116825 100644
--- a/mobile/android/base/widget/DoorHanger.java
+++ b/mobile/android/base/widget/DoorHanger.java
@@ -19,6 +19,7 @@ import android.widget.TextView;
import org.json.JSONObject;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tabs;
+import org.mozilla.gecko.util.ColorUtils;
public abstract class DoorHanger extends LinearLayout {
@@ -90,7 +91,7 @@ public abstract class DoorHanger extends LinearLayout {
mPositiveButton = (Button) findViewById(R.id.doorhanger_button_positive);
mOnButtonClickListener = config.getButtonClickListener();
- mDividerColor = mResources.getColor(R.color.divider_light);
+ mDividerColor = ColorUtils.getColor(context, R.color.divider_light);
final ViewStub contentStub = (ViewStub) findViewById(R.id.content);
contentStub.setLayoutResource(getContentResource());
diff --git a/mobile/android/base/widget/GeckoSwipeRefreshLayout.java b/mobile/android/base/widget/GeckoSwipeRefreshLayout.java
index 048cc091e56c..1536c4c2eb2f 100644
--- a/mobile/android/base/widget/GeckoSwipeRefreshLayout.java
+++ b/mobile/android/base/widget/GeckoSwipeRefreshLayout.java
@@ -17,6 +17,7 @@
package org.mozilla.gecko.widget;
import org.mozilla.gecko.AppConstants.Versions;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.Resources;
@@ -273,11 +274,11 @@ public class GeckoSwipeRefreshLayout extends ViewGroup {
*/
public void setColorScheme(int colorRes1, int colorRes2, int colorRes3, int colorRes4) {
ensureTarget();
- final Resources res = getResources();
- final int color1 = res.getColor(colorRes1);
- final int color2 = res.getColor(colorRes2);
- final int color3 = res.getColor(colorRes3);
- final int color4 = res.getColor(colorRes4);
+ final Context context = getContext();
+ final int color1 = ColorUtils.getColor(context, colorRes1);
+ final int color2 = ColorUtils.getColor(context, colorRes2);
+ final int color3 = ColorUtils.getColor(context, colorRes3);
+ final int color4 = ColorUtils.getColor(context, colorRes4);
mProgressBar.setColorScheme(color1, color2, color3,color4);
}
diff --git a/mobile/android/base/widget/IconTabWidget.java b/mobile/android/base/widget/IconTabWidget.java
index 579f819f4de6..71987bf8c9f9 100644
--- a/mobile/android/base/widget/IconTabWidget.java
+++ b/mobile/android/base/widget/IconTabWidget.java
@@ -38,7 +38,7 @@ public class IconTabWidget extends TabWidget {
}
}
- public void addTab(int imageResId, int stringResId) {
+ public View addTab(final int imageResId, final int stringResId) {
View button = LayoutInflater.from(getContext()).inflate(mButtonLayoutId, this, false);
if (mIsIcon) {
((ImageButton) button).setImageResource(imageResId);
@@ -50,6 +50,7 @@ public class IconTabWidget extends TabWidget {
addView(button);
button.setOnClickListener(new TabClickListener(getTabCount() - 1));
button.setOnFocusChangeListener(this);
+ return button;
}
public void setTabSelectionListener(OnTabChangedListener listener) {
diff --git a/mobile/android/base/widget/TabThumbnailWrapper.java b/mobile/android/base/widget/TabThumbnailWrapper.java
index 088dae92c735..928a61606fd1 100644
--- a/mobile/android/base/widget/TabThumbnailWrapper.java
+++ b/mobile/android/base/widget/TabThumbnailWrapper.java
@@ -2,11 +2,10 @@ package org.mozilla.gecko.widget;
import android.content.Context;
import android.util.AttributeSet;
-import android.widget.RelativeLayout;
import org.mozilla.gecko.R;
-public class TabThumbnailWrapper extends RelativeLayout {
+public class TabThumbnailWrapper extends ThemedRelativeLayout {
private boolean mRecording;
private static final int[] STATE_RECORDING = { R.attr.state_recording };
@@ -18,10 +17,6 @@ public class TabThumbnailWrapper extends RelativeLayout {
super(context, attrs);
}
- public TabThumbnailWrapper(Context context) {
- super(context);
- }
-
@Override
public int[] onCreateDrawableState(int extraSpace) {
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
diff --git a/mobile/android/base/widget/ThemedEditText.java b/mobile/android/base/widget/ThemedEditText.java
index 586a59c383b1..3d9f059dbd75 100644
--- a/mobile/android/base/widget/ThemedEditText.java
+++ b/mobile/android/base/widget/ThemedEditText.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -111,6 +112,7 @@ public class ThemedEditText extends android.widget.EditText
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -127,6 +129,7 @@ public class ThemedEditText extends android.widget.EditText
}
refreshDrawableState();
+ invalidate();
}
}
@@ -135,6 +138,7 @@ public class ThemedEditText extends android.widget.EditText
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -154,7 +158,7 @@ public class ThemedEditText extends android.widget.EditText
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedImageButton.java b/mobile/android/base/widget/ThemedImageButton.java
index 0b0b9bcd7860..4397befe7bd8 100644
--- a/mobile/android/base/widget/ThemedImageButton.java
+++ b/mobile/android/base/widget/ThemedImageButton.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -111,6 +112,7 @@ public class ThemedImageButton extends android.widget.ImageButton
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -127,6 +129,7 @@ public class ThemedImageButton extends android.widget.ImageButton
}
refreshDrawableState();
+ invalidate();
}
}
@@ -135,6 +138,7 @@ public class ThemedImageButton extends android.widget.ImageButton
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -154,7 +158,7 @@ public class ThemedImageButton extends android.widget.ImageButton
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedImageView.java b/mobile/android/base/widget/ThemedImageView.java
index 7227247b8b1b..26788af76386 100644
--- a/mobile/android/base/widget/ThemedImageView.java
+++ b/mobile/android/base/widget/ThemedImageView.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -111,6 +112,7 @@ public class ThemedImageView extends android.widget.ImageView
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -127,6 +129,7 @@ public class ThemedImageView extends android.widget.ImageView
}
refreshDrawableState();
+ invalidate();
}
}
@@ -135,6 +138,7 @@ public class ThemedImageView extends android.widget.ImageView
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -154,7 +158,7 @@ public class ThemedImageView extends android.widget.ImageView
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedLinearLayout.java b/mobile/android/base/widget/ThemedLinearLayout.java
index c04de75788ea..471c9bd70bf4 100644
--- a/mobile/android/base/widget/ThemedLinearLayout.java
+++ b/mobile/android/base/widget/ThemedLinearLayout.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -106,6 +107,7 @@ public class ThemedLinearLayout extends android.widget.LinearLayout
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -122,6 +124,7 @@ public class ThemedLinearLayout extends android.widget.LinearLayout
}
refreshDrawableState();
+ invalidate();
}
}
@@ -130,6 +133,7 @@ public class ThemedLinearLayout extends android.widget.LinearLayout
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -149,7 +153,7 @@ public class ThemedLinearLayout extends android.widget.LinearLayout
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedRelativeLayout.java b/mobile/android/base/widget/ThemedRelativeLayout.java
index db2991bbfb6c..394e754c735c 100644
--- a/mobile/android/base/widget/ThemedRelativeLayout.java
+++ b/mobile/android/base/widget/ThemedRelativeLayout.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -111,6 +112,7 @@ public class ThemedRelativeLayout extends android.widget.RelativeLayout
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -127,6 +129,7 @@ public class ThemedRelativeLayout extends android.widget.RelativeLayout
}
refreshDrawableState();
+ invalidate();
}
}
@@ -135,6 +138,7 @@ public class ThemedRelativeLayout extends android.widget.RelativeLayout
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -154,7 +158,7 @@ public class ThemedRelativeLayout extends android.widget.RelativeLayout
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedTextSwitcher.java b/mobile/android/base/widget/ThemedTextSwitcher.java
index 0bba303889df..82cc16bb2d92 100644
--- a/mobile/android/base/widget/ThemedTextSwitcher.java
+++ b/mobile/android/base/widget/ThemedTextSwitcher.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -106,6 +107,7 @@ public class ThemedTextSwitcher extends android.widget.TextSwitcher
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -122,6 +124,7 @@ public class ThemedTextSwitcher extends android.widget.TextSwitcher
}
refreshDrawableState();
+ invalidate();
}
}
@@ -130,6 +133,7 @@ public class ThemedTextSwitcher extends android.widget.TextSwitcher
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -149,7 +153,7 @@ public class ThemedTextSwitcher extends android.widget.TextSwitcher
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedTextView.java b/mobile/android/base/widget/ThemedTextView.java
index 024c75b25a03..2adc9b348c2d 100644
--- a/mobile/android/base/widget/ThemedTextView.java
+++ b/mobile/android/base/widget/ThemedTextView.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -111,6 +112,7 @@ public class ThemedTextView extends android.widget.TextView
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -127,6 +129,7 @@ public class ThemedTextView extends android.widget.TextView
}
refreshDrawableState();
+ invalidate();
}
}
@@ -135,6 +138,7 @@ public class ThemedTextView extends android.widget.TextView
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -154,7 +158,7 @@ public class ThemedTextView extends android.widget.TextView
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedView.java b/mobile/android/base/widget/ThemedView.java
index 9cc88c3114ab..090036cb6f85 100644
--- a/mobile/android/base/widget/ThemedView.java
+++ b/mobile/android/base/widget/ThemedView.java
@@ -9,6 +9,7 @@ package org.mozilla.gecko.widget;
import org.mozilla.gecko.GeckoApplication;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.util.ColorUtils;
import android.content.Context;
import android.content.res.TypedArray;
@@ -111,6 +112,7 @@ public class ThemedView extends android.view.View
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -127,6 +129,7 @@ public class ThemedView extends android.view.View
}
refreshDrawableState();
+ invalidate();
}
}
@@ -135,6 +138,7 @@ public class ThemedView extends android.view.View
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
@@ -154,7 +158,7 @@ public class ThemedView extends android.view.View
}
public ColorDrawable getColorDrawable(int id) {
- return new ColorDrawable(getResources().getColor(id));
+ return new ColorDrawable(ColorUtils.getColor(getContext(), id));
}
protected LightweightTheme getTheme() {
diff --git a/mobile/android/base/widget/ThemedView.java.frag b/mobile/android/base/widget/ThemedView.java.frag
index 7ffb1dcee0e8..077f9871a38d 100644
--- a/mobile/android/base/widget/ThemedView.java.frag
+++ b/mobile/android/base/widget/ThemedView.java.frag
@@ -114,6 +114,7 @@ public class Themed@VIEW_NAME_SUFFIX@ extends @BASE_TYPE@
if (mIsPrivate != isPrivate) {
mIsPrivate = isPrivate;
refreshDrawableState();
+ invalidate();
}
}
@@ -130,6 +131,7 @@ public class Themed@VIEW_NAME_SUFFIX@ extends @BASE_TYPE@
}
refreshDrawableState();
+ invalidate();
}
}
@@ -138,6 +140,7 @@ public class Themed@VIEW_NAME_SUFFIX@ extends @BASE_TYPE@
mIsLight = false;
mIsDark = false;
refreshDrawableState();
+ invalidate();
}
}
diff --git a/mobile/android/config/proguard/proguard.cfg b/mobile/android/config/proguard/proguard.cfg
index 466ea1a6a16f..c6b15f447120 100644
--- a/mobile/android/config/proguard/proguard.cfg
+++ b/mobile/android/config/proguard/proguard.cfg
@@ -118,19 +118,19 @@
# Keep miscellaneous targets.
# Keep the annotation.
--keep @interface org.mozilla.gecko.mozglue.JNITarget
+-keep @interface org.mozilla.gecko.annotation.JNITarget
# Keep classes tagged with the annotation.
--keep @org.mozilla.gecko.mozglue.JNITarget class *
+-keep @org.mozilla.gecko.annotation.JNITarget class *
# Keep all members of an annotated class.
--keepclassmembers @org.mozilla.gecko.mozglue.JNITarget class * {
+-keepclassmembers @org.mozilla.gecko.annotation.JNITarget class * {
*;
}
# Keep annotated members of any class.
-keepclassmembers class * {
- @org.mozilla.gecko.mozglue.JNITarget *;
+ @org.mozilla.gecko.annotation.JNITarget *;
}
# Keep classes which contain at least one annotated element. Split over two directives
@@ -138,44 +138,44 @@
# doesn't combine well with the '*' wildcard" (And, indeed, using it causes things to
# be deleted that we want to keep.)
-keepclasseswithmembers class * {
- @org.mozilla.gecko.mozglue.JNITarget ;
+ @org.mozilla.gecko.annotation.JNITarget ;
}
-keepclasseswithmembers class * {
- @org.mozilla.gecko.mozglue.JNITarget ;
+ @org.mozilla.gecko.annotation.JNITarget ;
}
# Keep Robocop targets. TODO: Can omit these from release builds. Also, Bug 916507.
# Same formula as above...
--keep @interface org.mozilla.gecko.mozglue.RobocopTarget
--keep @org.mozilla.gecko.mozglue.RobocopTarget class *
+-keep @interface org.mozilla.gecko.annotation.RobocopTarget
+-keep @org.mozilla.gecko.annotation.RobocopTarget class *
-keepclassmembers class * {
- @org.mozilla.gecko.mozglue.RobocopTarget *;
+ @org.mozilla.gecko.annotation.RobocopTarget *;
}
--keepclassmembers @org.mozilla.gecko.mozglue.RobocopTarget class * {
+-keepclassmembers @org.mozilla.gecko.annotation.RobocopTarget class * {
*;
}
-keepclasseswithmembers class * {
- @org.mozilla.gecko.mozglue.RobocopTarget ;
+ @org.mozilla.gecko.annotation.RobocopTarget ;
}
-keepclasseswithmembers class * {
- @org.mozilla.gecko.mozglue.RobocopTarget ;
+ @org.mozilla.gecko.annotation.RobocopTarget ;
}
# Keep WebRTC targets.
--keep @interface org.mozilla.gecko.mozglue.WebRTCJNITarget
--keep @org.mozilla.gecko.mozglue.WebRTCJNITarget class *
+-keep @interface org.mozilla.gecko.annotation.WebRTCJNITarget
+-keep @org.mozilla.gecko.annotation.WebRTCJNITarget class *
-keepclassmembers class * {
- @org.mozilla.gecko.mozglue.WebRTCJNITarget *;
+ @org.mozilla.gecko.annotation.WebRTCJNITarget *;
}
--keepclassmembers @org.mozilla.gecko.mozglue.WebRTCJNITarget class * {
+-keepclassmembers @org.mozilla.gecko.annotation.WebRTCJNITarget class * {
*;
}
-keepclasseswithmembers class * {
- @org.mozilla.gecko.mozglue.WebRTCJNITarget ;
+ @org.mozilla.gecko.annotation.WebRTCJNITarget ;
}
-keepclasseswithmembers class * {
- @org.mozilla.gecko.mozglue.WebRTCJNITarget ;
+ @org.mozilla.gecko.annotation.WebRTCJNITarget ;
}
# Keep generator-targeted entry points.
@@ -198,7 +198,7 @@
-keep class **.R$*
-# Keep classes, and all their contents, compiled before mozglue.RobocopTarget.
+# Keep classes, and all their contents, compiled before annotation.RobocopTarget.
-keep class org.mozilla.gecko.AppConstants {
*;
}
diff --git a/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java b/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
index de9cff67e0bf..f287eeb01e04 100644
--- a/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
+++ b/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
@@ -12,6 +12,7 @@ import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.search.providers.SearchEngine;
import android.annotation.SuppressLint;
@@ -164,7 +165,7 @@ public class PostSearchFragment extends Fragment {
final TextView message = (TextView) errorView.findViewById(R.id.empty_message);
message.setText(R.string.network_error_message);
- message.setTextColor(getResources().getColor(R.color.network_error_link));
+ message.setTextColor(ColorUtils.getColor(view.getContext(), R.color.network_error_link));
message.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/mobile/android/search/java/org/mozilla/search/autocomplete/SuggestionsFragment.java b/mobile/android/search/java/org/mozilla/search/autocomplete/SuggestionsFragment.java
index 436ae5d4a2a5..63fb37e53905 100644
--- a/mobile/android/search/java/org/mozilla/search/autocomplete/SuggestionsFragment.java
+++ b/mobile/android/search/java/org/mozilla/search/autocomplete/SuggestionsFragment.java
@@ -11,6 +11,7 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.SuggestClient;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
+import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.search.AcceptsSearchQuery;
import org.mozilla.search.AcceptsSearchQuery.SuggestionAnimation;
import org.mozilla.search.providers.SearchEngine;
@@ -212,7 +213,7 @@ public class SuggestionsFragment extends Fragment {
this.suggestions = null;
// Color of search term match in search suggestion
- suggestionHighlightColor = context.getResources().getColor(R.color.suggestion_highlight);
+ suggestionHighlightColor = ColorUtils.getColor(context, R.color.suggestion_highlight);
}
@Override
diff --git a/mobile/android/tests/browser/robocop/BaseTest.java b/mobile/android/tests/browser/robocop/BaseTest.java
index 9521694c2288..f52138a12bba 100644
--- a/mobile/android/tests/browser/robocop/BaseTest.java
+++ b/mobile/android/tests/browser/robocop/BaseTest.java
@@ -184,7 +184,7 @@ abstract class BaseTest extends BaseRobocopTest {
// Send the keys for the URL we want to enter
mSolo.clearEditText(urlEditView);
- mSolo.enterText(urlEditView, url);
+ mSolo.typeText(urlEditView, url);
// Get the URL text from the URL bar EditText view
final String urlBarText = urlEditView.getText().toString();
diff --git a/mobile/android/tests/browser/robocop/testInputUrlBar.java b/mobile/android/tests/browser/robocop/testInputUrlBar.java
index c4cd8a412e7a..c12ccef98276 100644
--- a/mobile/android/tests/browser/robocop/testInputUrlBar.java
+++ b/mobile/android/tests/browser/robocop/testInputUrlBar.java
@@ -23,7 +23,7 @@ public final class testInputUrlBar extends BaseTest {
blockForGeckoReady();
startEditingMode();
- assertUrlBarText(mStringHelper.ABOUT_HOME_URL);
+ assertUrlBarText("");
// Avoid any auto domain completion by using a prefix that matches
// nothing, including about: pages
@@ -97,7 +97,7 @@ public final class testInputUrlBar extends BaseTest {
// URL bar should have forgotten about "uv" text.
startEditingMode();
- assertUrlBarText(mStringHelper.ABOUT_HOME_URL);
+ assertUrlBarText("");
int width = mDriver.getGeckoWidth() / 2;
int y = mDriver.getGeckoHeight() / 2;
diff --git a/services/sync/tests/unit/head_http_server.js b/services/sync/tests/unit/head_http_server.js
index c917c4988c2f..82fb89e90347 100644
--- a/services/sync/tests/unit/head_http_server.js
+++ b/services/sync/tests/unit/head_http_server.js
@@ -545,13 +545,13 @@ SyncServer.prototype = {
* Start the SyncServer's underlying HTTP server.
*
* @param port
- * The numeric port on which to start. A falsy value implies the
- * default, a randomly chosen port.
+ * The numeric port on which to start. -1 implies the default, a
+ * randomly chosen port.
* @param cb
* A callback function (of no arguments) which is invoked after
* startup.
*/
- start: function start(port, cb) {
+ start: function start(port = -1, cb) {
if (this.started) {
this._log.warn("Warning: server already started on " + this.port);
return;
diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js
index f6436832d0f4..abbecfc1db25 100644
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -725,6 +725,30 @@ let AudioPlaybackListener = {
};
AudioPlaybackListener.init();
+addMessageListener("Browser:PurgeSessionHistory", function BrowserPurgeHistory() {
+ let sessionHistory = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
+ if (!sessionHistory) {
+ return;
+ }
+
+ // place the entry at current index at the end of the history list, so it won't get removed
+ if (sessionHistory.index < sessionHistory.count - 1) {
+ let indexEntry = sessionHistory.getEntryAtIndex(sessionHistory.index, false);
+ sessionHistory.QueryInterface(Components.interfaces.nsISHistoryInternal);
+ indexEntry.QueryInterface(Components.interfaces.nsISHEntry);
+ sessionHistory.addEntry(indexEntry, true);
+ }
+
+ let purge = sessionHistory.count;
+ if (global.content.location.href != "about:blank") {
+ --purge; // Don't remove the page the user's staring at from shistory
+ }
+
+ if (purge > 0) {
+ sessionHistory.PurgeHistory(purge);
+ }
+});
+
let ViewSelectionSource = {
init: function () {
addMessageListener("ViewSource:GetSelection", this);
diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml
index 61d947477348..960645f76f82 100644
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -871,7 +871,10 @@
+ we are removed from a tabbrowser. This will be explicitly called by tabbrowser.
+
+ Note: this function is overriden in remote-browser.xml, so any clean-up that
+ also applies to browser.isRemoteBrowser = true must be duplicated there. -->
+
+
- var purge = this.sessionHistory.count;
- if (this.currentURI != "about:blank")
- --purge; // Don't remove the page the user's staring at from shistory
-
- if (purge > 0)
- this.sessionHistory.PurgeHistory(purge);
+
+
+
diff --git a/toolkit/content/widgets/remote-browser.xml b/toolkit/content/widgets/remote-browser.xml
index 2d26842e390e..86d4eae2f291 100644
--- a/toolkit/content/widgets/remote-browser.xml
+++ b/toolkit/content/widgets/remote-browser.xml
@@ -261,6 +261,10 @@
this.messageManager.loadFrameScript("chrome://global/content/select-child.js", true);
}
+ if (!this.hasAttribute("disablehistory")) {
+ Services.obs.addObserver(this, "browser:purge-session-history", false)
+ }
+
jsm = "resource://gre/modules/RemoteController.jsm";
let RemoteController = Components.utils.import(jsm, {}).RemoteController;
this._controller = new RemoteController(this);
@@ -275,7 +279,9 @@
+ we are removed from a tabbrowser. This will be explicitly called by tabbrowser.
+
+ Note: This overrides the destroy() method from browser.xml. -->
@@ -389,6 +403,15 @@
+
+
+
+
+
diff --git a/toolkit/devtools/gcli/commands/cookie.js b/toolkit/devtools/gcli/commands/cookie.js
index 11efa87f68ef..e657d7dfadfc 100644
--- a/toolkit/devtools/gcli/commands/cookie.js
+++ b/toolkit/devtools/gcli/commands/cookie.js
@@ -21,7 +21,7 @@ XPCOMUtils.defineLazyGetter(this, "cookieMgr", function() {
*/
function sanitizeHost(host) {
if (host == null || host == "") {
- throw new Error(gcli.lookup("cookieListOutNonePage"));
+ throw new Error(l10n.lookup("cookieListOutNonePage"));
}
return host.split(':')[0];
}
diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
index 0a4e60df52e3..2933b95f1111 100644
--- a/toolkit/devtools/server/actors/inspector.js
+++ b/toolkit/devtools/server/actors/inspector.js
@@ -1298,7 +1298,13 @@ var WalkerActor = protocol.ActorClass({
form: function() {
return {
actor: this.actorID,
- root: this.rootNode.form()
+ root: this.rootNode.form(),
+ traits: {
+ // FF42+ Inspector starts managing the Walker, while the inspector also
+ // starts cleaning itself up automatically on client disconnection.
+ // So that there is no need to manually release the walker anymore.
+ autoReleased: true
+ }
}
},
@@ -3108,6 +3114,8 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
this.actorID = json.actor;
this.rootNode = types.getType("domnode").read(json.root, this);
this._rootNodeDeferred.resolve(this.rootNode);
+ // FF42+ the actor starts exposing traits
+ this.traits = json.traits || {};
},
/**
@@ -3522,6 +3530,7 @@ var InspectorActor = exports.InspectorActor = protocol.ActorClass({
let tabActor = this.tabActor;
window.removeEventListener("DOMContentLoaded", domReady, true);
this.walker = WalkerActor(this.conn, tabActor, options);
+ this.manage(this.walker);
events.once(this.walker, "destroyed", () => {
this._walkerPromise = null;
this._pageStylePromise = null;
diff --git a/toolkit/themes/faststripe/global/menu.css b/toolkit/themes/faststripe/global/menu.css
index 434c1322032a..1fe132c2de98 100644
--- a/toolkit/themes/faststripe/global/menu.css
+++ b/toolkit/themes/faststripe/global/menu.css
@@ -70,8 +70,7 @@ menuitem.spell-suggestion {
-moz-margin-end: 1.35em !important;
}
-.menu-iconic-left,
-.menu-iconic-right {
+.menu-iconic-left {
min-width: 1.45em;
}
@@ -156,11 +155,8 @@ menulist > menupopup > menu {
}
menulist > menupopup > menuitem > .menu-iconic-left,
-menulist > menupopup > menu > .menu-iconic-left,
-menulist > menupopup > menuitem > .menu-iconic-right,
-menulist > menupopup > menu > .menu-iconic-right {
+menulist > menupopup > menu > .menu-iconic-left {
display: none;
- padding-top: 0px;
}
menulist > menupopup > menuitem > label,
diff --git a/toolkit/themes/linux/global/menu.css b/toolkit/themes/linux/global/menu.css
index c2c779b5a4fb..aab929e9c6c6 100644
--- a/toolkit/themes/linux/global/menu.css
+++ b/toolkit/themes/linux/global/menu.css
@@ -160,10 +160,7 @@ menucaption > .menu-iconic-text {
menulist > menupopup > menuitem > .menu-iconic-left,
menulist > menupopup > menucaption > .menu-iconic-left,
-menulist > menupopup > menu > .menu-iconic-left,
-menulist > menupopup > menuitem > .menu-iconic-right,
-menulist > menupopup > menucaption > .menu-iconic-right,
-menulist > menupopup > menu > .menu-iconic-right {
+menulist > menupopup > menu > .menu-iconic-left {
display: none;
}
diff --git a/toolkit/themes/osx/global/menu.css b/toolkit/themes/osx/global/menu.css
index a42c26e93b71..2e6a696ee4b8 100644
--- a/toolkit/themes/osx/global/menu.css
+++ b/toolkit/themes/osx/global/menu.css
@@ -63,7 +63,6 @@ menucaption > .menu-iconic-text {
.menuitem-iconic,
.menu-iconic,
menuitem[image],
-menuitem[endimage],
menuitem[src] {
/* 2px higher than those without icons */
padding-top: 1px;
@@ -168,8 +167,7 @@ menulist[editable="true"] > menupopup > menucaption {
-moz-appearance: none;
}
-menulist[editable="true"] > menupopup > :-moz-any(menuitem, menucaption) > .menu-iconic-left,
-menulist[editable="true"] > menupopup > :-moz-any(menuitem, menucaption) > .menu-iconic-right {
+menulist[editable="true"] > menupopup > :-moz-any(menuitem, menucaption) > .menu-iconic-left {
display: none;
}
diff --git a/toolkit/themes/windows/global/menu.css b/toolkit/themes/windows/global/menu.css
index c657e5f6ac01..eedc03c2f5ec 100644
--- a/toolkit/themes/windows/global/menu.css
+++ b/toolkit/themes/windows/global/menu.css
@@ -92,8 +92,7 @@ menucaption > .menu-iconic-text {
-moz-margin-end: 1.35em !important;
}
-.menu-iconic-left,
-.menu-iconic-right {
+.menu-iconic-left {
min-width: 1.45em;
}
@@ -222,12 +221,8 @@ menulist > menupopup > menu[_moz-menuactive="true"] {
menulist > menupopup > menuitem > .menu-iconic-left,
menulist > menupopup > menucaption > .menu-iconic-left,
-menulist > menupopup > menu > .menu-iconic-left,
-menulist > menupopup > menuitem > .menu-iconic-right,
-menulist > menupopup > menucaption > .menu-iconic-right,
-menulist > menupopup > menu > .menu-iconic-right {
+menulist > menupopup > menu > .menu-iconic-left {
display: none;
- padding-top: 0px;
}
menulist > menupopup > menuitem > label,
@@ -250,7 +245,7 @@ menulist > menupopup > menuitem[disabled="true"]:not([_moz-menuactive="true"]):-
text-shadow: none;
}
-menulist > menupopup > :-moz-any(menuitem, menucaption):not(.menuitem-iconic):not([endimage]) > .menu-iconic-text {
+menulist > menupopup > :-moz-any(menuitem, menucaption):not(.menuitem-iconic) > .menu-iconic-text {
margin: 0 !important;
}