From dd651366278ede24385b7eace6f688879f11b177 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Thu, 8 Oct 2015 17:57:48 +0200 Subject: [PATCH 01/54] Bug 1207194 - Temporarily hardcode targetSdkVersion to 22 in AndroidManifest.xml. r=nalexander --- build/mobile/robocop/AndroidManifest.xml.in | 2 +- mobile/android/base/AndroidManifest.xml.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/mobile/robocop/AndroidManifest.xml.in b/build/mobile/robocop/AndroidManifest.xml.in index d925ffe6500..50f53f9a093 100644 --- a/build/mobile/robocop/AndroidManifest.xml.in +++ b/build/mobile/robocop/AndroidManifest.xml.in @@ -12,7 +12,7 @@ #ifdef MOZ_ANDROID_MAX_SDK_VERSION android:maxSdkVersion="@MOZ_ANDROID_MAX_SDK_VERSION@" #endif - android:targetSdkVersion="@ANDROID_TARGET_SDK@"/> + android:targetSdkVersion="22"/> diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in index ffa99c0f090..7b723737074 100644 --- a/mobile/android/base/AndroidManifest.xml.in +++ b/mobile/android/base/AndroidManifest.xml.in @@ -13,7 +13,7 @@ #ifdef MOZ_ANDROID_MAX_SDK_VERSION android:maxSdkVersion="@MOZ_ANDROID_MAX_SDK_VERSION@" #endif - android:targetSdkVersion="@ANDROID_TARGET_SDK@"/> + android:targetSdkVersion="22"/> #include ../services/manifests/FxAccountAndroidManifest_permissions.xml.in #include ../services/manifests/HealthReportAndroidManifest_permissions.xml.in From cd279eacf287e9a8cd0921f4fa6bc5cd02d34225 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 7 Oct 2015 12:04:00 +0200 Subject: [PATCH 02/54] Bug 965181 - respect default color unit when choosing a color. r=mratcliffe --- devtools/client/shared/widgets/Tooltip.js | 5 +- .../client/styleinspector/test/browser.ini | 1 + .../test/browser_ruleview_colorUnit.js | 59 +++++++++++++++++++ devtools/shared/css-color.js | 14 +++++ devtools/shared/tests/unit/test_cssColor.js | 5 ++ 5 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 devtools/client/styleinspector/test/browser_ruleview_colorUnit.js diff --git a/devtools/client/shared/widgets/Tooltip.js b/devtools/client/shared/widgets/Tooltip.js index 0e82e4adaa1..ce7634a83dc 100644 --- a/devtools/client/shared/widgets/Tooltip.js +++ b/devtools/client/shared/widgets/Tooltip.js @@ -1145,8 +1145,7 @@ SwatchColorPickerTooltip.prototype = Heritage.extend(SwatchBasedEditorTooltip.pr // Then set spectrum's color and listen to color changes to preview them if (this.activeSwatch) { this.currentSwatchColor = this.activeSwatch.nextSibling; - this._colorUnit = - colorUtils.classifyColor(this.currentSwatchColor.textContent); + this._originalColor = this.currentSwatchColor.textContent; let color = this.activeSwatch.style.backgroundColor; this.spectrum.then(spectrum => { spectrum.off("changed", this._onSpectrumColorChange); @@ -1224,7 +1223,7 @@ SwatchColorPickerTooltip.prototype = Heritage.extend(SwatchBasedEditorTooltip.pr _toDefaultType: function(color) { let colorObj = new colorUtils.CssColor(color); - colorObj.colorUnit = this._colorUnit; + colorObj.setAuthoredUnitFromColor(this._originalColor); return colorObj.toString(); }, diff --git a/devtools/client/styleinspector/test/browser.ini b/devtools/client/styleinspector/test/browser.ini index 31e59c5e00f..7e052e42b65 100644 --- a/devtools/client/styleinspector/test/browser.ini +++ b/devtools/client/styleinspector/test/browser.ini @@ -72,6 +72,7 @@ support-files = [browser_ruleview_colorpicker-release-outside-frame.js] [browser_ruleview_colorpicker-revert-on-ESC.js] [browser_ruleview_colorpicker-swatch-displayed.js] +[browser_ruleview_colorUnit.js] [browser_ruleview_completion-existing-property_01.js] [browser_ruleview_completion-existing-property_02.js] [browser_ruleview_completion-new-property_01.js] diff --git a/devtools/client/styleinspector/test/browser_ruleview_colorUnit.js b/devtools/client/styleinspector/test/browser_ruleview_colorUnit.js new file mode 100644 index 00000000000..b8ee7a9f9f8 --- /dev/null +++ b/devtools/client/styleinspector/test/browser_ruleview_colorUnit.js @@ -0,0 +1,59 @@ +/* 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"; + +// Test that color selection respects the user pref. + +const TEST_URI = ` + +
Styled Node
+`; + +add_task(function*() { + let TESTS = [ + {name: "hex", result: "#0F0"}, + {name: "rgb", result: "rgb(0, 255, 0)"} + ]; + + for (let {name, result} of TESTS) { + info("starting test for " + name); + Services.prefs.setCharPref("devtools.defaultColorUnit", name); + + yield addTab("data:text/html;charset=utf-8," + + encodeURIComponent(TEST_URI)); + let {inspector, view} = yield openRuleView(); + yield selectNode("#testid", inspector); + yield basicTest(view, name, result); + } +}); + +function* basicTest(view, name, result) { + let cPicker = view.tooltips.colorPicker; + let swatch = getRuleViewProperty(view, "#testid", "color").valueSpan + .querySelector(".ruleview-colorswatch"); + let onShown = cPicker.tooltip.once("shown"); + swatch.click(); + yield onShown; + + let testNode = yield getNode("#testid"); + + yield simulateColorPickerChange(view, cPicker, [0, 255, 0, 1], { + element: testNode, + name: "color", + value: "rgb(0, 255, 0)" + }); + + let spectrum = yield cPicker.spectrum; + let onHidden = cPicker.tooltip.once("hidden"); + EventUtils.sendKey("RETURN", spectrum.element.ownerDocument.defaultView); + yield onHidden; + + is(getRuleViewPropertyValue(view, "#testid", "color"), result, + "changing the color used the " + name + " unit"); +} diff --git a/devtools/shared/css-color.js b/devtools/shared/css-color.js index d4fa84ba0c9..9d37fde384a 100644 --- a/devtools/shared/css-color.js +++ b/devtools/shared/css-color.js @@ -92,6 +92,20 @@ CssColor.prototype = { this._colorUnit = unit; }, + /** + * If the current color unit pref is "authored", then set the + * default color unit from the given color. Otherwise, leave the + * color unit untouched. + * + * @param {String} color The color to use + */ + setAuthoredUnitFromColor: function(color) { + if (Services.prefs.getCharPref(COLOR_UNIT_PREF) === + CssColor.COLORUNIT.authored) { + this._colorUnit = classifyColor(color); + } + }, + get hasAlpha() { if (!this.valid) { return false; diff --git a/devtools/shared/tests/unit/test_cssColor.js b/devtools/shared/tests/unit/test_cssColor.js index e7b05c937b8..2a4f1d1b61a 100644 --- a/devtools/shared/tests/unit/test_cssColor.js +++ b/devtools/shared/tests/unit/test_cssColor.js @@ -25,5 +25,10 @@ function run_test() { for (let test of CLASSIFY_TESTS) { let result = colorUtils.classifyColor(test.input); equal(result, test.output, "test classifyColor(" + test.input + ")"); + + let obj = new colorUtils.CssColor("purple"); + obj.setAuthoredUnitFromColor(test.input); + equal(obj.colorUnit, test.output, + "test setAuthoredUnitFromColor(" + test.input + ")"); } } From 15a1b4198b776119fc82baa341e7e90f16d7c40c Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Wed, 7 Oct 2015 11:33:00 +0200 Subject: [PATCH 03/54] Bug 1157789 - Add a test for the Inspector's collapse/expandAll context menu items. r=janx --- devtools/client/inspector/test/browser.ini | 1 + .../test/browser_inspector_expand-collapse.js | 54 +++++++++++++++++ devtools/client/inspector/test/head.js | 59 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 devtools/client/inspector/test/browser_inspector_expand-collapse.js diff --git a/devtools/client/inspector/test/browser.ini b/devtools/client/inspector/test/browser.ini index 146045654ce..542a8919a6e 100644 --- a/devtools/client/inspector/test/browser.ini +++ b/devtools/client/inspector/test/browser.ini @@ -39,6 +39,7 @@ support-files = [browser_inspector_delete-selected-node-03.js] [browser_inspector_destroy-after-navigation.js] [browser_inspector_destroy-before-ready.js] +[browser_inspector_expand-collapse.js] [browser_inspector_gcli-inspect-command.js] skip-if = e10s # GCLI isn't e10s compatible. See bug 1128988. [browser_inspector_highlighter-01.js] diff --git a/devtools/client/inspector/test/browser_inspector_expand-collapse.js b/devtools/client/inspector/test/browser_inspector_expand-collapse.js new file mode 100644 index 00000000000..fc27bea2724 --- /dev/null +++ b/devtools/client/inspector/test/browser_inspector_expand-collapse.js @@ -0,0 +1,54 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests that context menu items exapnd all and collapse are shown properly. + +const TEST_URL = "data:text/html;charset=utf-8,
"; + +add_task(function* () { + + // Test is often exceeding time-out threshold, similar to Bug 1137765 + requestLongerTimeout(2); + + let {inspector, testActor} = yield openInspectorForURL(TEST_URL); + + let nodeMenuCollapseElement = inspector.panelDoc.getElementById("node-menu-collapse"); + let nodeMenuExpandElement = inspector.panelDoc.getElementById("node-menu-expand"); + + info("Selecting the parent node"); + + let front = yield getNodeFrontForSelector("#parent-node", inspector); + + yield selectNode(front, inspector); + + info("Simulating context menu click on the selected node container."); + contextMenuClick(getContainerForNodeFront(front, inspector).tagLine); + + ok(nodeMenuCollapseElement.hasAttribute("disabled"), "Collapse option is disabled"); + + ok(!nodeMenuExpandElement.hasAttribute("disabled"), "ExpandAll option is enabled"); + + info("Testing whether expansion works properly"); + dispatchCommandEvent(nodeMenuExpandElement); + info("Waiting for expansion to occur"); + yield waitForMultipleChildrenUpdates(inspector); + let markUpContainer = getContainerForNodeFront(front, inspector); + ok(markUpContainer.expanded, "node has been successfully expanded"); + + //reslecting node after expansion + yield selectNode(front, inspector); + + info("Testing whether collapse works properly"); + info("Simulating context menu click on the selected node container."); + contextMenuClick(getContainerForNodeFront(front, inspector).tagLine); + + ok(!nodeMenuCollapseElement.hasAttribute("disabled"), "Collapse option is enabled"); + + dispatchCommandEvent(nodeMenuCollapseElement); + info("Waiting for collapse to occur"); + yield waitForMultipleChildrenUpdates(inspector); + ok(!markUpContainer.expanded, "node has been successfully collapsed"); +}); \ No newline at end of file diff --git a/devtools/client/inspector/test/head.js b/devtools/client/inspector/test/head.js index fd87a96d2ff..0bb62241aca 100644 --- a/devtools/client/inspector/test/head.js +++ b/devtools/client/inspector/test/head.js @@ -481,6 +481,35 @@ function dispatchCommandEvent(node) { node.dispatchEvent(commandEvent); } +/** + * A helper that simulates a contextmenu event on the given chrome DOM element. + */ +function contextMenuClick(element) { + let evt = element.ownerDocument.createEvent('MouseEvents'); + let button = 2; // right click + + evt.initMouseEvent('contextmenu', true, true, + element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, + false, false, false, button, null); + + element.dispatchEvent(evt); +} + +/** + * A helper that fetches a front for a node that matches the given selector or + * doctype node if the selector is falsy. + */ +function* getNodeFrontForSelector(selector, inspector) { + if (selector) { + info("Retrieving front for selector " + selector); + return getNodeFront(selector, inspector); + } else { + info("Retrieving front for doctype node"); + let {nodes} = yield inspector.walker.children(inspector.walker.rootNode); + return nodes[0]; + } +} + /** * Encapsulate some common operations for highlighter's tests, to have * the tests cleaner, without exposing directly `inspector`, `highlighter`, and @@ -534,3 +563,33 @@ const getHighlighterHelperFor = (type) => Task.async( }; } ); + +// The expand all operation of the markup-view calls itself recursively and +// there's not one event we can wait for to know when it's done +// so use this helper function to wait until all recursive children updates are done. +function* waitForMultipleChildrenUpdates(inspector) { +// As long as child updates are queued up while we wait for an update already +// wait again + if (inspector.markup._queuedChildUpdates && + inspector.markup._queuedChildUpdates.size) { + yield waitForChildrenUpdated(inspector); + return yield waitForMultipleChildrenUpdates(inspector); + } +} + +/** + * Using the markupview's _waitForChildren function, wait for all queued + * children updates to be handled. + * @param {InspectorPanel} inspector The instance of InspectorPanel currently + * loaded in the toolbox + * @return a promise that resolves when all queued children updates have been + * handled + */ +function waitForChildrenUpdated({markup}) { + info("Waiting for queued children updates to be handled"); + let def = promise.defer(); + markup._waitForChildren().then(() => { + executeSoon(def.resolve); + }); + return def.promise; +} From 02ec809160194f13507f312f5504694e46830628 Mon Sep 17 00:00:00 2001 From: Kapeel Sable Date: Thu, 8 Oct 2015 06:53:00 +0200 Subject: [PATCH 04/54] Bug 1212171 - Change for referencing a different object Component.utils. instead of Cu. r=mak --- browser/components/places/content/controller.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js index f5e4f74c528..6057e78a1c6 100644 --- a/browser/components/places/content/controller.js +++ b/browser/components/places/content/controller.js @@ -274,7 +274,7 @@ PlacesController.prototype = { this.newItem("bookmark"); break; case "placesCmd_new:separator": - this.newSeparator().catch(Cu.reportError); + this.newSeparator().catch(Components.utils.reportError); break; case "placesCmd_show:info": this.showBookmarkPropertiesForSelection(); @@ -1309,8 +1309,8 @@ PlacesController.prototype = { // source, otherwise report an error and fallback to a copy. if (!doCopy && !PlacesControllerDragHelper.canMoveUnwrappedNode(item)) { - Cu.reportError("Tried to move an unmovable Places node, " + - "reverting to a copy operation."); + Components.utils.reportError("Tried to move an unmovable " + + "Places node, reverting to a copy operation."); doCopy = true; } let guid = yield PlacesUIUtils.getTransactionForData( @@ -1346,8 +1346,8 @@ PlacesController.prototype = { // If this is not a copy, check for safety that we can move the source, // otherwise report an error and fallback to a copy. if (action != "copy" && !PlacesControllerDragHelper.canMoveUnwrappedNode(items[i])) { - Components.utils.reportError("Tried to move an unmovable Places node, " + - "reverting to a copy operation."); + Components.utils.reportError("Tried to move an unmovable Places " + + "node, reverting to a copy operation."); action = "copy"; } transactions.push( @@ -1625,8 +1625,8 @@ var PlacesControllerDragHelper = { // If this is not a copy, check for safety that we can move the source, // otherwise report an error and fallback to a copy. if (!doCopy && !PlacesControllerDragHelper.canMoveUnwrappedNode(unwrapped)) { - Components.utils.reportError("Tried to move an unmovable Places node, " + - "reverting to a copy operation."); + Components.utils.reportError("Tried to move an unmovable Places " + + "node, reverting to a copy operation."); doCopy = true; } if (PlacesUIUtils.useAsyncTransactions) { From 0dbf656888b4d4a015e9da38afaa895e7f254fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20M=C3=BCffke?= Date: Mon, 5 Oct 2015 12:58:00 +0200 Subject: [PATCH 05/54] Bug 1208519 - Add smooth scrolling of item list on range item click. r=sebastian --- mobile/android/base/home/HistoryPanel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/mobile/android/base/home/HistoryPanel.java b/mobile/android/base/home/HistoryPanel.java index 8a6c8aadcfe..8b4556c39f4 100644 --- a/mobile/android/base/home/HistoryPanel.java +++ b/mobile/android/base/home/HistoryPanel.java @@ -147,6 +147,7 @@ public class HistoryPanel extends HomeFragment { selected = rangeItem; mRangeAdapter.notifyDataSetChanged(); getLoaderManager().getLoader(LOADER_ID_HISTORY).forceLoad(); + mList.smoothScrollToPosition(0); } } }); From 4fead35ef4fb876f91963a325ba3b9352ded18c3 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 7 Oct 2015 10:25:23 -0400 Subject: [PATCH 06/54] Bug 1212347 - Disable GeckoView globally by default. r=nalexander --- mobile/android/confvars.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mobile/android/confvars.sh b/mobile/android/confvars.sh index 1f2f809cec0..6d2f124c9d8 100644 --- a/mobile/android/confvars.sh +++ b/mobile/android/confvars.sh @@ -123,3 +123,6 @@ fi if ! test "$NIGHTLY_BUILD"; then MOZ_ANDROID_NATIVE_ACCOUNT_UI=1 fi + +# Disable GeckoView by default. +export MOZ_DISABLE_GECKOVIEW=1 From 34f4c28b41ebde53d2a9745fc955b264b6ce822c Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Tue, 15 Sep 2015 14:33:45 -0700 Subject: [PATCH 07/54] Bug 1201206 - Inherit from Theme.AppCompat style at all API levels. r=mhaigh --- mobile/android/base/resources/values-v11/themes.xml | 2 +- mobile/android/base/resources/values-v21/themes.xml | 2 +- mobile/android/base/resources/values/themes.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/resources/values-v11/themes.xml b/mobile/android/base/resources/values-v11/themes.xml index b59526bb17c..430e2b8b936 100644 --- a/mobile/android/base/resources/values-v11/themes.xml +++ b/mobile/android/base/resources/values-v11/themes.xml @@ -9,7 +9,7 @@ Base application theme. This could be overridden by GeckoBaseTheme in other res/values-XXX/themes.xml. --> - From 1e114dab9d6aa124a42e05535efac942be4853df Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Tue, 22 Sep 2015 16:26:29 -0700 Subject: [PATCH 08/54] Bug 1201206 - Inherit from version specific styles for prefs. r=mhaigh This excludes Material design in v21+, which will be overridden with AppCompat in the following changeset. --- mobile/android/base/resources/values-v11/themes.xml | 3 ++- mobile/android/base/resources/values/themes.xml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/resources/values-v11/themes.xml b/mobile/android/base/resources/values-v11/themes.xml index 430e2b8b936..62c34ab746f 100644 --- a/mobile/android/base/resources/values-v11/themes.xml +++ b/mobile/android/base/resources/values-v11/themes.xml @@ -24,7 +24,8 @@ + + + + + + + + diff --git a/mobile/android/base/resources/values-v21/themes.xml b/mobile/android/base/resources/values-v21/themes.xml index 5fb669213e4..151d30b1381 100644 --- a/mobile/android/base/resources/values-v21/themes.xml +++ b/mobile/android/base/resources/values-v21/themes.xml @@ -14,14 +14,23 @@ true @null @style/GeckoActionBar + @style/ActionBarTheme @color/action_orange + + - - - - diff --git a/mobile/android/base/resources/values-v21/themes.xml b/mobile/android/base/resources/values-v21/themes.xml index 151d30b1381..47be8cdda54 100644 --- a/mobile/android/base/resources/values-v21/themes.xml +++ b/mobile/android/base/resources/values-v21/themes.xml @@ -8,29 +8,20 @@ - - - - - - - - From 69e3562e0680c7f31c698249325c6b063fa193b7 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Tue, 22 Sep 2015 16:26:29 -0700 Subject: [PATCH 28/54] Bug 1201206 - Inherit from version specific styles for prefs. r=mhaigh This excludes Material design in v21+, which will be overridden with AppCompat in the following changeset. --- mobile/android/base/resources/values-v11/themes.xml | 3 ++- mobile/android/base/resources/values/themes.xml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/resources/values-v11/themes.xml b/mobile/android/base/resources/values-v11/themes.xml index 430e2b8b936..62c34ab746f 100644 --- a/mobile/android/base/resources/values-v11/themes.xml +++ b/mobile/android/base/resources/values-v11/themes.xml @@ -24,7 +24,8 @@ + + + + + + + + diff --git a/mobile/android/base/resources/values-v21/themes.xml b/mobile/android/base/resources/values-v21/themes.xml index 5fb669213e4..151d30b1381 100644 --- a/mobile/android/base/resources/values-v21/themes.xml +++ b/mobile/android/base/resources/values-v21/themes.xml @@ -14,14 +14,23 @@ true @null @style/GeckoActionBar + @style/ActionBarTheme @color/action_orange + +