From 5c2d5eb30cd540fb65238f15900299e35e9adc68 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Fri, 23 Jan 2015 17:55:56 +0000 Subject: [PATCH 01/16] Bug 1111540 - setting app in about:preferences should also work on Windows, r=jaws --- .../preferences/in-content/applications.js | 64 ++++++---- .../preferences/in-content/tests/browser.ini | 2 + .../tests/browser_change_app_handler.js | 110 ++++++++++++++++++ .../preferences/in-content/tests/head.js | 68 +++++++---- 4 files changed, 197 insertions(+), 47 deletions(-) create mode 100644 browser/components/preferences/in-content/tests/browser_change_app_handler.js diff --git a/browser/components/preferences/in-content/applications.js b/browser/components/preferences/in-content/applications.js index 218c1b379637..1db83aabaf22 100644 --- a/browser/components/preferences/in-content/applications.js +++ b/browser/components/preferences/in-content/applications.js @@ -1506,16 +1506,21 @@ var gApplicationsPane = { } // Create a menu item for selecting a local application. + let canOpenWithOtherApp = true; #ifdef XP_WIN // On Windows, selecting an application to open another application // would be meaningless so we special case executables. - var executableType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService) + let executableType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService) .getTypeFromExtension("exe"); - if (handlerInfo.type != executableType) + canOpenWithOtherApp = handlerInfo.type != executableType; #endif + if (canOpenWithOtherApp) { let menuItem = document.createElement("menuitem"); - menuItem.setAttribute("oncommand", "gApplicationsPane.chooseApp(event)"); + menuItem.className = "choose-app-item"; + menuItem.addEventListener("command", function(e) { + gApplicationsPane.chooseApp(e); + }); let label = this._prefsBundle.getString("useOtherApp"); menuItem.setAttribute("label", label); menuItem.setAttribute("tooltiptext", label); @@ -1527,7 +1532,10 @@ var gApplicationsPane = { let menuItem = document.createElement("menuseparator"); menuPopup.appendChild(menuItem); menuItem = document.createElement("menuitem"); - menuItem.setAttribute("oncommand", "gApplicationsPane.manageApp(event)"); + menuItem.className = "manage-app-item"; + menuItem.addEventListener("command", function(e) { + gApplicationsPane.manageApp(e); + }); menuItem.setAttribute("label", this._prefsBundle.getString("manageApp")); menuPopup.appendChild(menuItem); } @@ -1700,20 +1708,23 @@ var gApplicationsPane = { var typeItem = this._list.selectedItem; var handlerInfo = this._handledTypes[typeItem.type]; + let onComplete = () => { + // Rebuild the actions menu so that we revert to the previous selection, + // or "Always ask" if the previous default application has been removed + this.rebuildActionsMenu(); + + // update the richlistitem too. Will be visible when selecting another row + typeItem.setAttribute("actionDescription", + this._describePreferredAction(handlerInfo)); + if (!this._setIconClassForPreferredAction(handlerInfo, typeItem)) { + typeItem.setAttribute("actionIcon", + this._getIconURLForPreferredAction(handlerInfo)); + } + }; + gSubDialog.open("chrome://browser/content/preferences/applicationManager.xul", - "resizable=no", handlerInfo); + "resizable=no", handlerInfo, onComplete); - // Rebuild the actions menu so that we revert to the previous selection, - // or "Always ask" if the previous default application has been removed - this.rebuildActionsMenu(); - - // update the richlistitem too. Will be visible when selecting another row - typeItem.setAttribute("actionDescription", - this._describePreferredAction(handlerInfo)); - if (!this._setIconClassForPreferredAction(handlerInfo, typeItem)) { - typeItem.setAttribute("actionIcon", - this._getIconURLForPreferredAction(handlerInfo)); - } }, chooseApp: function(aEvent) { @@ -1762,17 +1773,20 @@ var gApplicationsPane = { params.filename = null; params.handlerApp = null; + let onAppSelected = () => { + if (this.isValidHandlerApp(params.handlerApp)) { + handlerApp = params.handlerApp; + + // Add the app to the type's list of possible handlers. + handlerInfo.addPossibleApplicationHandler(handlerApp); + } + + chooseAppCallback(handlerApp); + }; + gSubDialog.open("chrome://global/content/appPicker.xul", - null, params); + null, params, onAppSelected); - if (this.isValidHandlerApp(params.handlerApp)) { - handlerApp = params.handlerApp; - - // Add the app to the type's list of possible handlers. - handlerInfo.addPossibleApplicationHandler(handlerApp); - } - - chooseAppCallback(handlerApp); #else let winTitle = this._prefsBundle.getString("fpTitleChooseApp"); let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); diff --git a/browser/components/preferences/in-content/tests/browser.ini b/browser/components/preferences/in-content/tests/browser.ini index a0783fcfc99c..0d9bc7613fb1 100644 --- a/browser/components/preferences/in-content/tests/browser.ini +++ b/browser/components/preferences/in-content/tests/browser.ini @@ -10,6 +10,8 @@ support-files = [browser_bug795764_cachedisabled.js] [browser_bug1018066_resetScrollPosition.js] [browser_bug1020245_openPreferences_to_paneContent.js] +[browser_change_app_handler.js] +run-if = os == "win" # This test tests the windows-specific app selection dialog, so can't run on non-Windows [browser_connection.js] [browser_connection_bug388287.js] [browser_healthreport.js] diff --git a/browser/components/preferences/in-content/tests/browser_change_app_handler.js b/browser/components/preferences/in-content/tests/browser_change_app_handler.js new file mode 100644 index 000000000000..7a5dde31336c --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_change_app_handler.js @@ -0,0 +1,110 @@ +let gMimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService); +let gHandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService); + +function setupFakeHandler() { + let info = gMimeSvc.getFromTypeAndExtension("text/plain", "foo.txt"); + ok(info.possibleLocalHandlers.length, "Should have at least one known handler"); + let handler = info.possibleLocalHandlers.queryElementAt(0, Ci.nsILocalHandlerApp); + + let infoToModify = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); + infoToModify.possibleApplicationHandlers.appendElement(handler, false); + + gHandlerSvc.store(infoToModify); +} + +function promisePopupEvent(popup, ev) { + return new Promise((resolve, reject) => { + popup.addEventListener(ev, () => { + popup.removeEventListener(ev, arguments.callee); + resolve(); + }, false); + }); +} + +add_task(function*() { + setupFakeHandler(); + yield openPreferencesViaOpenPreferencesAPI("applications", null, {leaveOpen: true}); + let win = gBrowser.selectedBrowser.contentWindow; + + let container = win.document.getElementById("handlersView"); + let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']"); + ok(ourItem, "handlersView is present"); + ourItem.scrollIntoView(); + container.selectItem(ourItem); + ok(ourItem.selected, "Should be able to select our item."); + + let list = yield waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu")); + let popup = list.firstChild; + let popupShownPromise = promisePopupEvent(popup, "popupshown"); + list.boxObject.openMenu(true); + yield popupShownPromise; + + let dialogLoadedPromise = promiseLoadSubDialog("chrome://global/content/appPicker.xul"); + let popupHiddenPromise = promisePopupEvent(popup, "popuphidden"); + + let chooseItem = popup.querySelector(".choose-app-item"); + chooseItem.click(); + popup.hidePopup(); // Not clear why we need to do this manually, but we do. :-\ + + yield popupHiddenPromise; + let dialog = yield dialogLoadedPromise; + let dialogDoc = dialog.document; + let dialogList = dialogDoc.getElementById("app-picker-listbox"); + dialogList.selectItem(dialogList.firstChild); + let selectedApp = dialogList.firstChild.handlerApp; + dialogDoc.documentElement.acceptDialog(); + + // Verify results are correct in mime service: + let mimeInfo = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); + ok(mimeInfo.preferredApplicationHandler.equals(selectedApp), "App should be set as preferred."); + + // Check that we display this result: + list = yield waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu")); + ok(list.selectedItem, "Should have a selected item"); + ok(mimeInfo.preferredApplicationHandler.equals(list.selectedItem.handlerApp), + "App should be visible as preferred item."); + + + // Now try to 'manage' this list: + popup = list.firstChild; + popupShownPromise = promisePopupEvent(popup, "popupshown"); + list.boxObject.openMenu(true); + yield popupShownPromise; + + dialogLoadedPromise = promiseLoadSubDialog("chrome://browser/content/preferences/applicationManager.xul"); + popupHiddenPromise = promisePopupEvent(popup, "popuphidden"); + + let manageItem = popup.querySelector(".manage-app-item"); + manageItem.click(); + popup.hidePopup(); + + yield popupHiddenPromise; + dialog = yield dialogLoadedPromise; + dialogDoc = dialog.document; + dialogList = dialogDoc.getElementById("appList"); + let itemToRemove = dialogList.querySelector('listitem[label="' + selectedApp.name + '"]'); + dialogList.selectItem(itemToRemove); + let itemsBefore = dialogList.children.length; + dialogDoc.getElementById("remove").click(); + ok(!itemToRemove.parentNode, "Item got removed from DOM"); + is(dialogList.children.length, itemsBefore - 1, "Item got removed"); + dialogDoc.documentElement.acceptDialog(); + + // Verify results are correct in mime service: + mimeInfo = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); + ok(!mimeInfo.preferredApplicationHandler, "App should no longer be set as preferred."); + + // Check that we display this result: + list = yield waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu")); + ok(list.selectedItem, "Should have a selected item"); + ok(!list.selectedItem.handlerApp, + "No app should be visible as preferred item."); + + gBrowser.removeCurrentTab(); +}); + +registerCleanupFunction(function() { + let infoToModify = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); + gHandlerSvc.remove(infoToModify); +}); + diff --git a/browser/components/preferences/in-content/tests/head.js b/browser/components/preferences/in-content/tests/head.js index 9ab30d42c750..6ee86d02e3e9 100644 --- a/browser/components/preferences/in-content/tests/head.js +++ b/browser/components/preferences/in-content/tests/head.js @@ -39,35 +39,38 @@ function open_preferences(aCallback) { } function openAndLoadSubDialog(aURL, aFeatures = null, aParams = null, aClosingCallback = null) { - let dialog = content.gSubDialog.open(aURL, aFeatures, aParams, aClosingCallback); - let deferred = Promise.defer(); + let promise = promiseLoadSubDialog(aURL); + content.gSubDialog.open(aURL, aFeatures, aParams, aClosingCallback); + return promise; +} - content.gSubDialog._frame.addEventListener("load", function load(aEvent) { - if (aEvent.target.contentWindow.location == "about:blank") - return; - content.gSubDialog._frame.removeEventListener("load", load); +function promiseLoadSubDialog(aURL) { + return new Promise((resolve, reject) => { + content.gSubDialog._frame.addEventListener("load", function load(aEvent) { + if (aEvent.target.contentWindow.location == "about:blank") + return; + content.gSubDialog._frame.removeEventListener("load", load); - ise(content.gSubDialog._frame.contentWindow.location.toString(), aURL, - "Check the proper URL is loaded"); + ise(content.gSubDialog._frame.contentWindow.location.toString(), aURL, + "Check the proper URL is loaded"); - // Check visibility - is_element_visible(content.gSubDialog._overlay, "Overlay is visible"); + // Check visibility + is_element_visible(content.gSubDialog._overlay, "Overlay is visible"); - // Check that stylesheets were injected - let expectedStyleSheetURLs = content.gSubDialog._injectedStyleSheets.slice(0); - for (let styleSheet of content.gSubDialog._frame.contentDocument.styleSheets) { - let i = expectedStyleSheetURLs.indexOf(styleSheet.href); - if (i >= 0) { - info("found " + styleSheet.href); - expectedStyleSheetURLs.splice(i, 1); + // Check that stylesheets were injected + let expectedStyleSheetURLs = content.gSubDialog._injectedStyleSheets.slice(0); + for (let styleSheet of content.gSubDialog._frame.contentDocument.styleSheets) { + let i = expectedStyleSheetURLs.indexOf(styleSheet.href); + if (i >= 0) { + info("found " + styleSheet.href); + expectedStyleSheetURLs.splice(i, 1); + } } - } - ise(expectedStyleSheetURLs.length, 0, "All expectedStyleSheetURLs should have been found"); + ise(expectedStyleSheetURLs.length, 0, "All expectedStyleSheetURLs should have been found"); - deferred.resolve(dialog); + resolve(content.gSubDialog._frame.contentWindow); + }); }); - - return deferred.promise; } /** @@ -139,3 +142,24 @@ function openPreferencesViaOpenPreferencesAPI(aPane, aAdvancedTab, aOptions) { return deferred.promise; } + +function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) { + return new Promise((resolve, reject) => { + function tryNow() { + tries++; + let rv = aConditionFn(); + if (rv) { + resolve(rv); + } else if (tries < aMaxTries) { + tryAgain(); + } else { + reject("Condition timed out: " + aConditionFn.toSource()); + } + } + function tryAgain() { + setTimeout(tryNow, aCheckInterval); + } + let tries = 0; + tryAgain(); + }); +} From 040349c46ff398bb3641233cda4c41555dab5b29 Mon Sep 17 00:00:00 2001 From: Victor Porof Date: Wed, 28 Jan 2015 10:24:52 -0500 Subject: [PATCH 02/16] Bug 1126372 - Timeline actor emits memory information twice when it's started, r=jsantell --- toolkit/devtools/server/actors/timeline.js | 1 - 1 file changed, 1 deletion(-) diff --git a/toolkit/devtools/server/actors/timeline.js b/toolkit/devtools/server/actors/timeline.js index 3fbd86e44d42..8a986602ff43 100644 --- a/toolkit/devtools/server/actors/timeline.js +++ b/toolkit/devtools/server/actors/timeline.js @@ -251,7 +251,6 @@ let TimelineActor = exports.TimelineActor = protocol.ActorClass({ if (withMemory) { this._memoryActor = new MemoryActor(this.conn, this.tabActor, this._stackFrames); - events.emit(this, "memory", this._startTime, this._memoryActor.measure()); } if (withTicks) { From a011b7e263bf5a78154a233ad342d796d80b3d63 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 28 Jan 2015 16:43:31 +0000 Subject: [PATCH 03/16] Bug 1066166 - Add localized tooltip captions for each tab button on the Loop panel. r=jaws --- browser/components/loop/content/js/panel.js | 1 + browser/components/loop/content/js/panel.jsx | 1 + browser/locales/en-US/chrome/browser/loop/loop.properties | 3 +++ 3 files changed, 5 insertions(+) diff --git a/browser/components/loop/content/js/panel.js b/browser/components/loop/content/js/panel.js index 3f36b224de67..9eb82a556586 100644 --- a/browser/components/loop/content/js/panel.js +++ b/browser/components/loop/content/js/panel.js @@ -67,6 +67,7 @@ loop.panel = (function(_, mozL10n) { React.createElement("li", {className: cx({selected: isSelected}), key: i, "data-tab-name": tabName, + title: mozL10n.get(tabName + "_tab_button_tooltip"), onClick: this.handleSelectTab}) ); } diff --git a/browser/components/loop/content/js/panel.jsx b/browser/components/loop/content/js/panel.jsx index 736dcfc7702d..35ce9bb221c4 100644 --- a/browser/components/loop/content/js/panel.jsx +++ b/browser/components/loop/content/js/panel.jsx @@ -67,6 +67,7 @@ loop.panel = (function(_, mozL10n) {
  • ); } diff --git a/browser/locales/en-US/chrome/browser/loop/loop.properties b/browser/locales/en-US/chrome/browser/loop/loop.properties index 8ef078c5aa90..4728050a9151 100644 --- a/browser/locales/en-US/chrome/browser/loop/loop.properties +++ b/browser/locales/en-US/chrome/browser/loop/loop.properties @@ -8,6 +8,9 @@ ## should remain "Firefox Hello" for all locales. clientShortname2=Firefox Hello +rooms_tab_button_tooltip=Conversations +contacts_tab_button_tooltip=Contacts + ## LOCALIZATION_NOTE(first_time_experience.title): clientShortname will be ## replaced by the brand name first_time_experience_title={{clientShortname}} — Join the conversation From 138f9bcb760cf9721ffb2ae17e186a8abd8d62c1 Mon Sep 17 00:00:00 2001 From: Brian Grinstead Date: Wed, 28 Jan 2015 08:50:00 -0800 Subject: [PATCH 04/16] Backed out changeset 34d0394ad69d (bug 1122726) for tart regressions in linux and windows --- browser/themes/shared/tabs.inc.css | 32 ++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/browser/themes/shared/tabs.inc.css b/browser/themes/shared/tabs.inc.css index dce0be4ec8e0..2fd3f05aa101 100644 --- a/browser/themes/shared/tabs.inc.css +++ b/browser/themes/shared/tabs.inc.css @@ -7,10 +7,11 @@ :root { --tab-toolbar-navbar-overlap: 1px; --tab-min-height: 31px; - --tab-curve-width: 30px; - --tab-curve-half-width: 15px; } +%define tabCurveWidth 30px +%define tabCurveHalfWidth 15px + /* image preloading hack */ #tabbrowser-tabs::before { /* Because of bug 853415, we need to ordinal this to the first position: */ @@ -54,12 +55,9 @@ .tab-background-middle { -moz-box-flex: 1; background-clip: padding-box; - border-left: var(--tab-curve-half-width) solid transparent; - border-right: var(--tab-curve-half-width) solid transparent; - /* XXX: Switch to `margin: 0 calc(-1 * var(--tab-curve-half-width))` after bug 1099448 */ - margin: 0; - -moz-margin-start: calc(-1 * var(--tab-curve-half-width)); - -moz-margin-end: calc(-1 * var(--tab-curve-half-width)); + border-left: @tabCurveHalfWidth@ solid transparent; + border-right: @tabCurveHalfWidth@ solid transparent; + margin: 0 -@tabCurveHalfWidth@; } .tab-content { @@ -110,13 +108,13 @@ .tab-background, .tabs-newtab-button { /* overlap the tab curves */ - -moz-margin-end: calc(-1 * var(--tab-curve-half-width)); - -moz-margin-start: calc(-1 * var(--tab-curve-half-width)); + -moz-margin-end: -@tabCurveHalfWidth@; + -moz-margin-start: -@tabCurveHalfWidth@; } .tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox { - -moz-padding-end: var(--tab-curve-half-width); - -moz-padding-start: var(--tab-curve-half-width); + -moz-padding-end: @tabCurveHalfWidth@; + -moz-padding-start: @tabCurveHalfWidth@; } /* Tab Overflow */ @@ -163,7 +161,7 @@ .tab-background-end[selected=true]::after, .tab-background-end[selected=true]::before { min-height: var(--tab-min-height); - width: var(--tab-curve-width); + width: @tabCurveWidth@; } .tabbrowser-tab:not([selected=true]), @@ -185,7 +183,7 @@ .tab-background-start[selected=true]::after, .tab-background-end[selected=true]::after { /* position ::after on top of its parent */ - -moz-margin-start: calc(-1 * var(--tab-curve-width)); + -moz-margin-start: -@tabCurveWidth@; background-size: 100% 100%; content: ""; display: -moz-box; @@ -276,9 +274,9 @@ background-image: url(chrome://browser/skin/tabbrowser/tab-background-start.png), url(chrome://browser/skin/tabbrowser/tab-background-middle.png), url(chrome://browser/skin/tabbrowser/tab-background-end.png); - background-position: left bottom, var(--tab-curve-width) bottom, right bottom; + background-position: left bottom, @tabCurveWidth@ bottom, right bottom; background-repeat: no-repeat; - background-size: var(--tab-curve-width) 100%, calc(100% - (2 * var(--tab-curve-width))) 100%, var(--tab-curve-width) 100%; + background-size: @tabCurveWidth@ 100%, calc(100% - (2 * @tabCurveWidth@)) 100%, @tabCurveWidth@ 100%; } /* Tab pointer-events */ @@ -334,5 +332,5 @@ /* New tab button */ .tabs-newtab-button { - width: calc(36px + var(--tab-curve-width)); + width: calc(36px + @tabCurveWidth@); } From e1b476337f0a81890f0314c80a58145d26f3a39c Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 28 Jan 2015 12:45:40 -0500 Subject: [PATCH 05/16] Backed out changeset cd65efe1b24c (bug 1111540) for frequent Win8 M-e10s failures. --- .../preferences/in-content/applications.js | 64 ++++------ .../preferences/in-content/tests/browser.ini | 2 - .../tests/browser_change_app_handler.js | 110 ------------------ .../preferences/in-content/tests/head.js | 68 ++++------- 4 files changed, 47 insertions(+), 197 deletions(-) delete mode 100644 browser/components/preferences/in-content/tests/browser_change_app_handler.js diff --git a/browser/components/preferences/in-content/applications.js b/browser/components/preferences/in-content/applications.js index 1db83aabaf22..218c1b379637 100644 --- a/browser/components/preferences/in-content/applications.js +++ b/browser/components/preferences/in-content/applications.js @@ -1506,21 +1506,16 @@ var gApplicationsPane = { } // Create a menu item for selecting a local application. - let canOpenWithOtherApp = true; #ifdef XP_WIN // On Windows, selecting an application to open another application // would be meaningless so we special case executables. - let executableType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService) + var executableType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService) .getTypeFromExtension("exe"); - canOpenWithOtherApp = handlerInfo.type != executableType; + if (handlerInfo.type != executableType) #endif - if (canOpenWithOtherApp) { let menuItem = document.createElement("menuitem"); - menuItem.className = "choose-app-item"; - menuItem.addEventListener("command", function(e) { - gApplicationsPane.chooseApp(e); - }); + menuItem.setAttribute("oncommand", "gApplicationsPane.chooseApp(event)"); let label = this._prefsBundle.getString("useOtherApp"); menuItem.setAttribute("label", label); menuItem.setAttribute("tooltiptext", label); @@ -1532,10 +1527,7 @@ var gApplicationsPane = { let menuItem = document.createElement("menuseparator"); menuPopup.appendChild(menuItem); menuItem = document.createElement("menuitem"); - menuItem.className = "manage-app-item"; - menuItem.addEventListener("command", function(e) { - gApplicationsPane.manageApp(e); - }); + menuItem.setAttribute("oncommand", "gApplicationsPane.manageApp(event)"); menuItem.setAttribute("label", this._prefsBundle.getString("manageApp")); menuPopup.appendChild(menuItem); } @@ -1708,23 +1700,20 @@ var gApplicationsPane = { var typeItem = this._list.selectedItem; var handlerInfo = this._handledTypes[typeItem.type]; - let onComplete = () => { - // Rebuild the actions menu so that we revert to the previous selection, - // or "Always ask" if the previous default application has been removed - this.rebuildActionsMenu(); - - // update the richlistitem too. Will be visible when selecting another row - typeItem.setAttribute("actionDescription", - this._describePreferredAction(handlerInfo)); - if (!this._setIconClassForPreferredAction(handlerInfo, typeItem)) { - typeItem.setAttribute("actionIcon", - this._getIconURLForPreferredAction(handlerInfo)); - } - }; - gSubDialog.open("chrome://browser/content/preferences/applicationManager.xul", - "resizable=no", handlerInfo, onComplete); + "resizable=no", handlerInfo); + // Rebuild the actions menu so that we revert to the previous selection, + // or "Always ask" if the previous default application has been removed + this.rebuildActionsMenu(); + + // update the richlistitem too. Will be visible when selecting another row + typeItem.setAttribute("actionDescription", + this._describePreferredAction(handlerInfo)); + if (!this._setIconClassForPreferredAction(handlerInfo, typeItem)) { + typeItem.setAttribute("actionIcon", + this._getIconURLForPreferredAction(handlerInfo)); + } }, chooseApp: function(aEvent) { @@ -1773,20 +1762,17 @@ var gApplicationsPane = { params.filename = null; params.handlerApp = null; - let onAppSelected = () => { - if (this.isValidHandlerApp(params.handlerApp)) { - handlerApp = params.handlerApp; - - // Add the app to the type's list of possible handlers. - handlerInfo.addPossibleApplicationHandler(handlerApp); - } - - chooseAppCallback(handlerApp); - }; - gSubDialog.open("chrome://global/content/appPicker.xul", - null, params, onAppSelected); + null, params); + if (this.isValidHandlerApp(params.handlerApp)) { + handlerApp = params.handlerApp; + + // Add the app to the type's list of possible handlers. + handlerInfo.addPossibleApplicationHandler(handlerApp); + } + + chooseAppCallback(handlerApp); #else let winTitle = this._prefsBundle.getString("fpTitleChooseApp"); let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); diff --git a/browser/components/preferences/in-content/tests/browser.ini b/browser/components/preferences/in-content/tests/browser.ini index 0d9bc7613fb1..a0783fcfc99c 100644 --- a/browser/components/preferences/in-content/tests/browser.ini +++ b/browser/components/preferences/in-content/tests/browser.ini @@ -10,8 +10,6 @@ support-files = [browser_bug795764_cachedisabled.js] [browser_bug1018066_resetScrollPosition.js] [browser_bug1020245_openPreferences_to_paneContent.js] -[browser_change_app_handler.js] -run-if = os == "win" # This test tests the windows-specific app selection dialog, so can't run on non-Windows [browser_connection.js] [browser_connection_bug388287.js] [browser_healthreport.js] diff --git a/browser/components/preferences/in-content/tests/browser_change_app_handler.js b/browser/components/preferences/in-content/tests/browser_change_app_handler.js deleted file mode 100644 index 7a5dde31336c..000000000000 --- a/browser/components/preferences/in-content/tests/browser_change_app_handler.js +++ /dev/null @@ -1,110 +0,0 @@ -let gMimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService); -let gHandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService); - -function setupFakeHandler() { - let info = gMimeSvc.getFromTypeAndExtension("text/plain", "foo.txt"); - ok(info.possibleLocalHandlers.length, "Should have at least one known handler"); - let handler = info.possibleLocalHandlers.queryElementAt(0, Ci.nsILocalHandlerApp); - - let infoToModify = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); - infoToModify.possibleApplicationHandlers.appendElement(handler, false); - - gHandlerSvc.store(infoToModify); -} - -function promisePopupEvent(popup, ev) { - return new Promise((resolve, reject) => { - popup.addEventListener(ev, () => { - popup.removeEventListener(ev, arguments.callee); - resolve(); - }, false); - }); -} - -add_task(function*() { - setupFakeHandler(); - yield openPreferencesViaOpenPreferencesAPI("applications", null, {leaveOpen: true}); - let win = gBrowser.selectedBrowser.contentWindow; - - let container = win.document.getElementById("handlersView"); - let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']"); - ok(ourItem, "handlersView is present"); - ourItem.scrollIntoView(); - container.selectItem(ourItem); - ok(ourItem.selected, "Should be able to select our item."); - - let list = yield waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu")); - let popup = list.firstChild; - let popupShownPromise = promisePopupEvent(popup, "popupshown"); - list.boxObject.openMenu(true); - yield popupShownPromise; - - let dialogLoadedPromise = promiseLoadSubDialog("chrome://global/content/appPicker.xul"); - let popupHiddenPromise = promisePopupEvent(popup, "popuphidden"); - - let chooseItem = popup.querySelector(".choose-app-item"); - chooseItem.click(); - popup.hidePopup(); // Not clear why we need to do this manually, but we do. :-\ - - yield popupHiddenPromise; - let dialog = yield dialogLoadedPromise; - let dialogDoc = dialog.document; - let dialogList = dialogDoc.getElementById("app-picker-listbox"); - dialogList.selectItem(dialogList.firstChild); - let selectedApp = dialogList.firstChild.handlerApp; - dialogDoc.documentElement.acceptDialog(); - - // Verify results are correct in mime service: - let mimeInfo = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); - ok(mimeInfo.preferredApplicationHandler.equals(selectedApp), "App should be set as preferred."); - - // Check that we display this result: - list = yield waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu")); - ok(list.selectedItem, "Should have a selected item"); - ok(mimeInfo.preferredApplicationHandler.equals(list.selectedItem.handlerApp), - "App should be visible as preferred item."); - - - // Now try to 'manage' this list: - popup = list.firstChild; - popupShownPromise = promisePopupEvent(popup, "popupshown"); - list.boxObject.openMenu(true); - yield popupShownPromise; - - dialogLoadedPromise = promiseLoadSubDialog("chrome://browser/content/preferences/applicationManager.xul"); - popupHiddenPromise = promisePopupEvent(popup, "popuphidden"); - - let manageItem = popup.querySelector(".manage-app-item"); - manageItem.click(); - popup.hidePopup(); - - yield popupHiddenPromise; - dialog = yield dialogLoadedPromise; - dialogDoc = dialog.document; - dialogList = dialogDoc.getElementById("appList"); - let itemToRemove = dialogList.querySelector('listitem[label="' + selectedApp.name + '"]'); - dialogList.selectItem(itemToRemove); - let itemsBefore = dialogList.children.length; - dialogDoc.getElementById("remove").click(); - ok(!itemToRemove.parentNode, "Item got removed from DOM"); - is(dialogList.children.length, itemsBefore - 1, "Item got removed"); - dialogDoc.documentElement.acceptDialog(); - - // Verify results are correct in mime service: - mimeInfo = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); - ok(!mimeInfo.preferredApplicationHandler, "App should no longer be set as preferred."); - - // Check that we display this result: - list = yield waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu")); - ok(list.selectedItem, "Should have a selected item"); - ok(!list.selectedItem.handlerApp, - "No app should be visible as preferred item."); - - gBrowser.removeCurrentTab(); -}); - -registerCleanupFunction(function() { - let infoToModify = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null); - gHandlerSvc.remove(infoToModify); -}); - diff --git a/browser/components/preferences/in-content/tests/head.js b/browser/components/preferences/in-content/tests/head.js index 6ee86d02e3e9..9ab30d42c750 100644 --- a/browser/components/preferences/in-content/tests/head.js +++ b/browser/components/preferences/in-content/tests/head.js @@ -39,38 +39,35 @@ function open_preferences(aCallback) { } function openAndLoadSubDialog(aURL, aFeatures = null, aParams = null, aClosingCallback = null) { - let promise = promiseLoadSubDialog(aURL); - content.gSubDialog.open(aURL, aFeatures, aParams, aClosingCallback); - return promise; -} + let dialog = content.gSubDialog.open(aURL, aFeatures, aParams, aClosingCallback); + let deferred = Promise.defer(); -function promiseLoadSubDialog(aURL) { - return new Promise((resolve, reject) => { - content.gSubDialog._frame.addEventListener("load", function load(aEvent) { - if (aEvent.target.contentWindow.location == "about:blank") - return; - content.gSubDialog._frame.removeEventListener("load", load); + content.gSubDialog._frame.addEventListener("load", function load(aEvent) { + if (aEvent.target.contentWindow.location == "about:blank") + return; + content.gSubDialog._frame.removeEventListener("load", load); - ise(content.gSubDialog._frame.contentWindow.location.toString(), aURL, - "Check the proper URL is loaded"); + ise(content.gSubDialog._frame.contentWindow.location.toString(), aURL, + "Check the proper URL is loaded"); - // Check visibility - is_element_visible(content.gSubDialog._overlay, "Overlay is visible"); + // Check visibility + is_element_visible(content.gSubDialog._overlay, "Overlay is visible"); - // Check that stylesheets were injected - let expectedStyleSheetURLs = content.gSubDialog._injectedStyleSheets.slice(0); - for (let styleSheet of content.gSubDialog._frame.contentDocument.styleSheets) { - let i = expectedStyleSheetURLs.indexOf(styleSheet.href); - if (i >= 0) { - info("found " + styleSheet.href); - expectedStyleSheetURLs.splice(i, 1); - } + // Check that stylesheets were injected + let expectedStyleSheetURLs = content.gSubDialog._injectedStyleSheets.slice(0); + for (let styleSheet of content.gSubDialog._frame.contentDocument.styleSheets) { + let i = expectedStyleSheetURLs.indexOf(styleSheet.href); + if (i >= 0) { + info("found " + styleSheet.href); + expectedStyleSheetURLs.splice(i, 1); } - ise(expectedStyleSheetURLs.length, 0, "All expectedStyleSheetURLs should have been found"); + } + ise(expectedStyleSheetURLs.length, 0, "All expectedStyleSheetURLs should have been found"); - resolve(content.gSubDialog._frame.contentWindow); - }); + deferred.resolve(dialog); }); + + return deferred.promise; } /** @@ -142,24 +139,3 @@ function openPreferencesViaOpenPreferencesAPI(aPane, aAdvancedTab, aOptions) { return deferred.promise; } - -function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) { - return new Promise((resolve, reject) => { - function tryNow() { - tries++; - let rv = aConditionFn(); - if (rv) { - resolve(rv); - } else if (tries < aMaxTries) { - tryAgain(); - } else { - reject("Condition timed out: " + aConditionFn.toSource()); - } - } - function tryAgain() { - setTimeout(tryNow, aCheckInterval); - } - let tries = 0; - tryAgain(); - }); -} From a828f1bfdece07cb4bacc6b71b77f7e34b642f82 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Wed, 28 Jan 2015 19:01:02 +0100 Subject: [PATCH 06/16] Bug 1124147 - Get rid of browser.__SS_restore_tab r=smacleod --- browser/components/sessionstore/SessionStore.jsm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index b30c4a5441b2..cc771af85e14 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -615,7 +615,7 @@ let SessionStoreInternal = { let tab = win.gBrowser.getTabForBrowser(browser); // Ensure we receive only specific messages from s that - // have no tab assigned, e.g. the ones that preload aobut:newtab pages. + // have no tab assigned, e.g. the ones that preload about:newtab pages. if (!tab && !FMM_NOTAB_MESSAGES.has(aMessage.name)) { throw new Error(`received unexpected message '${aMessage.name}' ` + `from a browser that has no tab`); @@ -688,10 +688,7 @@ let SessionStoreInternal = { Services.obs.notifyObservers(browser, NOTIFY_TAB_RESTORED, null); } - let tab = browser.__SS_restore_tab; - delete browser.__SS_restore_data; - delete browser.__SS_restore_tab; delete browser.__SS_data; SessionStoreInternal._resetLocalTabRestoringState(tab); @@ -702,7 +699,7 @@ let SessionStoreInternal = { break; case "SessionStore:reloadPendingTab": if (this.isCurrentEpoch(browser, aMessage.data.epoch)) { - if (tab && browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) { + if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) { this.restoreTabContent(tab); } } @@ -2729,8 +2726,6 @@ let SessionStoreInternal = { browser.__SS_restore_data = {}; } - browser.__SS_restore_tab = aTab; - browser.messageManager.sendAsyncMessage("SessionStore:restoreTabContent", {loadArguments: aLoadArguments}); }, From d02ecf71cf4857b0018f1ab5709746736cdd559f Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Wed, 28 Jan 2015 15:06:19 +0100 Subject: [PATCH 07/16] Bug 1023565 - Remove setTimeout() when restoring contentEditable values r=smacleod --- toolkit/modules/sessionstore/FormData.jsm | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/toolkit/modules/sessionstore/FormData.jsm b/toolkit/modules/sessionstore/FormData.jsm index 329c7d6a6934..aa44bb636ce1 100644 --- a/toolkit/modules/sessionstore/FormData.jsm +++ b/toolkit/modules/sessionstore/FormData.jsm @@ -9,7 +9,6 @@ this.EXPORTED_SYMBOLS = ["FormData"]; const Cu = Components.utils; const Ci = Components.interfaces; -Cu.import("resource://gre/modules/Timer.jsm"); Cu.import("resource://gre/modules/XPathGenerator.jsm"); /** @@ -262,17 +261,10 @@ let FormDataInternal = { } if ("innerHTML" in data) { - // We know that the URL matches data.url right now, but the user - // may navigate away before the setTimeout handler runs. We do - // a simple comparison against savedURL to check for that. - let savedURL = doc.documentURI; - - setTimeout(() => { - if (doc.body && doc.designMode == "on" && doc.documentURI == savedURL) { - doc.body.innerHTML = data.innerHTML; - this.fireEvent(doc.body, "input"); - } - }); + if (doc.body && doc.designMode == "on") { + doc.body.innerHTML = data.innerHTML; + this.fireEvent(doc.body, "input"); + } } }, From 7b9cf79f10e6a0896675fbf332ca73aa5bcdce06 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Wed, 28 Jan 2015 10:42:30 -0800 Subject: [PATCH 08/16] Bug 1123013 - Set project SDK explicitly in Gradle configuration. r=me,f=mcomella This is a sad, but necessary, loss of generality that will cause the Gradle configuration to lag behind the rest of the build system over time. The existing Gradle build worked fine, but IDEA based IDEs can not yet read build.gradle files containing arbitrary Groovy code. I can find no alternative to including the values in the build.gradle file directly. We will just try to keep them up to date. The versions chosen (compileSdkVersion 21 and buildTools "21.1.1") correspond to the current versions used on the buildbots. Changing compileSdkVersion to an integer absolutely requires Gradle-Android plugin version 1.0.0 or higher, which in turn mandates IntelliJ version 14.0.3 EAP or higher. I took the opportunity to update some settings and bump dependency versions from v19 to v21 as well. --HG-- extra : rebase_source : 7ada8da4dec7bd56ca3d276d833788d895e12e25 --- mobile/android/gradle/android.gradle | 29 --------------- mobile/android/gradle/app/build.gradle | 24 +++++++++++-- mobile/android/gradle/base/build.gradle | 36 ++++++++++++++----- mobile/android/gradle/branding/build.gradle | 26 ++++++++++---- .../gradle/preprocessed_code/build.gradle | 26 ++++++++++---- .../preprocessed_resources/build.gradle | 26 ++++++++++---- mobile/android/gradle/thirdparty/build.gradle | 28 ++++++++++----- 7 files changed, 126 insertions(+), 69 deletions(-) delete mode 100644 mobile/android/gradle/android.gradle diff --git a/mobile/android/gradle/android.gradle b/mobile/android/gradle/android.gradle deleted file mode 100644 index 2c9cd85a8e18..000000000000 --- a/mobile/android/gradle/android.gradle +++ /dev/null @@ -1,29 +0,0 @@ -// Configure shared Android settings. This should be run (using "apply from") -// immediately after applying the Android plugin. Be aware that IntelliJ does -// not parse these values correctly: the Android-Gradle facet panel manually -// parses build.gradle rather than interrogating the Gradle model. - -android { - compileSdkVersion "android-${mozconfig.defines.ANDROID_TARGET_SDK}" - // Turn "android-sdk/build-tools/21.1.1" into "21.1.1". - buildToolsVersion (new File(mozconfig.substs.ANDROID_BUILD_TOOLS).getName()) - - defaultConfig { - targetSdkVersion mozconfig.defines.ANDROID_TARGET_SDK - minSdkVersion mozconfig.defines.MOZ_ANDROID_MIN_SDK_VERSION - if (mozconfig.defines.MOZ_ANDROID_MAX_SDK_VERSION) { - maxSdkVersion mozconfig.defines.MOZ_ANDROID_MAX_SDK_VERSION - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - android { - lintOptions { - abortOnError false - } - } -} diff --git a/mobile/android/gradle/app/build.gradle b/mobile/android/gradle/app/build.gradle index 42278a070e7e..bd200e6eb856 100644 --- a/mobile/android/gradle/app/build.gradle +++ b/mobile/android/gradle/app/build.gradle @@ -1,8 +1,28 @@ apply plugin: 'com.android.application' -apply from: rootProject.file("${topsrcdir}/mobile/android/gradle/android.gradle") - android { + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + targetSdkVersion 21 + minSdkVersion 9 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + dexOptions { + incremental true + preDexLibraries true + } + + lintOptions { + abortOnError false + } + buildTypes { release { minifyEnabled true diff --git a/mobile/android/gradle/base/build.gradle b/mobile/android/gradle/base/build.gradle index 171a45239f03..f8f0ebfc533a 100644 --- a/mobile/android/gradle/base/build.gradle +++ b/mobile/android/gradle/base/build.gradle @@ -1,8 +1,27 @@ apply plugin: 'com.android.library' -apply from: "${topsrcdir}/mobile/android/gradle/android.gradle" - android { + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + targetSdkVersion 21 + minSdkVersion 9 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + dexOptions { + incremental true + } + + lintOptions { + abortOnError false + } + buildTypes { release { minifyEnabled false @@ -31,12 +50,13 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:support-v4:19.1.+' + compile 'com.android.support:support-v4:21.+' if (mozconfig.substs.MOZ_NATIVE_DEVICES) { - compile 'com.android.support:appcompat-v7:19.1.+' - compile 'com.android.support:mediarouter-v7:19.1.+' - compile 'com.google.android.gms:play-services:5.+' + compile 'com.android.support:appcompat-v7:21.+' + compile 'com.android.support:mediarouter-v7:21.+' + compile 'com.google.android.gms:play-services-base:6.5.+' + compile 'com.google.android.gms:play-services-cast:6.5.+' } compile project(':branding') @@ -53,9 +73,7 @@ apply plugin: 'idea' idea { module { - // excludeDirs = [] - excludeDirs += file('src/main/java/org/mozilla/gecko/tests') + excludeDirs += file('org/mozilla/gecko/resources') excludeDirs += file('org/mozilla/gecko/tests') - excludeDirs += file('tests') } } diff --git a/mobile/android/gradle/branding/build.gradle b/mobile/android/gradle/branding/build.gradle index 91aed323f0cb..4edae070a57f 100644 --- a/mobile/android/gradle/branding/build.gradle +++ b/mobile/android/gradle/branding/build.gradle @@ -1,12 +1,24 @@ apply plugin: 'com.android.library' -apply from: "${topsrcdir}/mobile/android/gradle/android.gradle" - android { - buildTypes { - release { - minifyEnabled false - proguardFile getDefaultProguardFile('proguard-android.txt') - } + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + targetSdkVersion 21 + minSdkVersion 9 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + dexOptions { + incremental true + } + + lintOptions { + abortOnError false } } diff --git a/mobile/android/gradle/preprocessed_code/build.gradle b/mobile/android/gradle/preprocessed_code/build.gradle index c1c5e4cbb8b2..34b0662ad259 100644 --- a/mobile/android/gradle/preprocessed_code/build.gradle +++ b/mobile/android/gradle/preprocessed_code/build.gradle @@ -1,13 +1,25 @@ apply plugin: 'android-library' -apply from: "${topsrcdir}/mobile/android/gradle/android.gradle" - android { - buildTypes { - release { - minifyEnabled false - proguardFile getDefaultProguardFile('proguard-android.txt') - } + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + targetSdkVersion 21 + minSdkVersion 9 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + dexOptions { + incremental true + } + + lintOptions { + abortOnError false } } diff --git a/mobile/android/gradle/preprocessed_resources/build.gradle b/mobile/android/gradle/preprocessed_resources/build.gradle index aa0c197c24f4..5c3c2b38576a 100644 --- a/mobile/android/gradle/preprocessed_resources/build.gradle +++ b/mobile/android/gradle/preprocessed_resources/build.gradle @@ -1,13 +1,25 @@ apply plugin: 'com.android.library' -apply from: "${topsrcdir}/mobile/android/gradle/android.gradle" - android { - buildTypes { - release { - minifyEnabled false - proguardFile getDefaultProguardFile('proguard-android.txt') - } + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + targetSdkVersion 21 + minSdkVersion 9 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + dexOptions { + incremental true + } + + lintOptions { + abortOnError false } } diff --git a/mobile/android/gradle/thirdparty/build.gradle b/mobile/android/gradle/thirdparty/build.gradle index 3786575e32f6..62adcbbcb9a2 100644 --- a/mobile/android/gradle/thirdparty/build.gradle +++ b/mobile/android/gradle/thirdparty/build.gradle @@ -1,17 +1,29 @@ apply plugin: 'com.android.library' -apply from: "${topsrcdir}/mobile/android/gradle/android.gradle" - android { - buildTypes { - release { - minifyEnabled false - proguardFile getDefaultProguardFile('proguard-android.txt') - } + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + targetSdkVersion 21 + minSdkVersion 9 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + dexOptions { + incremental true + } + + lintOptions { + abortOnError false } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:support-v4:19.1.+' + compile 'com.android.support:support-v4:21.+' } From 177f286d2b0f9c4a197ed8ae6cab6c3c8a4acc66 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Tue, 27 Jan 2015 21:41:14 -0800 Subject: [PATCH 09/16] Bug 1125330 - Expose |mach| output after failures invoking from Gradle. r=me,f=ally --HG-- extra : rebase_source : 8d801f739f77640a587231404e22506f52342438 --- mobile/android/gradle/build.gradle | 10 ++++++++++ mobile/android/gradle/omnijar/build.gradle | 10 ++++++++++ mobile/android/gradle/settings.gradle | 14 +++++++------- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/mobile/android/gradle/build.gradle b/mobile/android/gradle/build.gradle index 3dbfddd44ffb..18ad76071371 100644 --- a/mobile/android/gradle/build.gradle +++ b/mobile/android/gradle/build.gradle @@ -33,5 +33,15 @@ subprojects { commandLine "${topsrcdir}/mach" args 'build' args 'mobile/android/base/gradle-targets' + + // Only show the output if something went wrong. + ignoreExitValue = true + standardOutput = new ByteArrayOutputStream() + errorOutput = standardOutput + doLast { + if (execResult.exitValue != 0) { + throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}") + } + } } } diff --git a/mobile/android/gradle/omnijar/build.gradle b/mobile/android/gradle/omnijar/build.gradle index 3d9065080978..44ea426383fa 100644 --- a/mobile/android/gradle/omnijar/build.gradle +++ b/mobile/android/gradle/omnijar/build.gradle @@ -23,6 +23,16 @@ task buildOmnijar(type:Exec) { args '-C' args 'mobile/android/base' args 'gradle-omnijar' + + // Only show the output if something went wrong. + ignoreExitValue = true + standardOutput = new ByteArrayOutputStream() + errorOutput = standardOutput + doLast { + if (execResult.exitValue != 0) { + throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}") + } + } } apply plugin: 'idea' diff --git a/mobile/android/gradle/settings.gradle b/mobile/android/gradle/settings.gradle index 8ce2199a406e..3c26b3f9acd9 100644 --- a/mobile/android/gradle/settings.gradle +++ b/mobile/android/gradle/settings.gradle @@ -8,20 +8,20 @@ if (!hasProperty('topsrcdir')) { logger.warn("topsrcdir is undefined: assuming source directory Gradle invocation with topsrcdir=${topsrcdir}.") } -def command = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"] -def proc = command.execute(null, new File(topsrcdir)) -def sout = new StringBuffer() -def serr = new StringBuffer() -proc.consumeProcessOutput(sout, serr) +def commandLine = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"] +def proc = commandLine.execute(null, new File(topsrcdir)) +def standardOutput = new ByteArrayOutputStream() +proc.consumeProcessOutput(standardOutput, standardOutput) proc.waitFor() +// Only show the output if something went wrong. if (proc.exitValue() != 0) { - throw new GradleException("Could not extract mozconfig/build environment from |${topsrcdir}/mach environment|!"); + throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\n${standardOutput.toString()}") } import groovy.json.JsonSlurper def slurper = new JsonSlurper() -def json = slurper.parseText(sout.toString()) +def json = slurper.parseText(standardOutput.toString()) include ':app' include ':base' From cf61b5d84629f3dc5d3a8fcb10fd0d9ea4132282 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Mon, 26 Jan 2015 21:52:43 -0800 Subject: [PATCH 10/16] No bug - Make Gradle debug test APK look like Robocop. r=me --HG-- extra : rebase_source : 996cf9f9e2460e19864a7b32bea8d1a1c162b0a1 extra : source : 5ffffd68e04193bc90768667a8f34f5904f531d6 --- mobile/android/gradle/app/build.gradle | 5 +++++ mobile/android/mach_commands.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/mobile/android/gradle/app/build.gradle b/mobile/android/gradle/app/build.gradle index bd200e6eb856..ac2b9b0c7b8e 100644 --- a/mobile/android/gradle/app/build.gradle +++ b/mobile/android/gradle/app/build.gradle @@ -30,6 +30,11 @@ android { } } + defaultConfig { + testApplicationId 'org.mozilla.roboexample.test' + testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner' + } + sourceSets { androidTest { java { diff --git a/mobile/android/mach_commands.py b/mobile/android/mach_commands.py index 595279afe0b6..a0cae0471854 100644 --- a/mobile/android/mach_commands.py +++ b/mobile/android/mach_commands.py @@ -112,6 +112,8 @@ class MachCommands(MachCommandBase): srcdir('app/build.gradle', 'mobile/android/gradle/app/build.gradle') objdir('app/src/main/AndroidManifest.xml', 'mobile/android/base/AndroidManifest.xml') + srcdir('app/src/androidTest/res', 'build/mobile/robocop/res') + srcdir('app/src/androidTest/assets', 'mobile/android/base/tests/assets') objdir('app/src/debug/assets', 'dist/fennec/assets') objdir('app/src/debug/jniLibs', 'dist/fennec/lib') # Test code. From 65b7fd2bf77f76f115e44ab5ff5313da14059820 Mon Sep 17 00:00:00 2001 From: Brian Grinstead Date: Wed, 28 Jan 2015 11:57:27 -0800 Subject: [PATCH 11/16] Bug 1121110 - Add a shared.properties file for localizing strings used across tools;r=vporof --- browser/devtools/canvasdebugger/canvasdebugger.js | 7 +++++-- .../test/browser_canvas-frontend-img-screenshots.js | 2 +- browser/devtools/layoutview/view.js | 5 ++++- browser/devtools/responsivedesign/responsivedesign.jsm | 6 +++++- .../en-US/chrome/browser/devtools/shared.properties | 7 +++++++ browser/locales/jar.mn | 1 + 6 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 browser/locales/en-US/chrome/browser/devtools/shared.properties diff --git a/browser/devtools/canvasdebugger/canvasdebugger.js b/browser/devtools/canvasdebugger/canvasdebugger.js index 95cf0fbc353e..07b91121e90e 100644 --- a/browser/devtools/canvasdebugger/canvasdebugger.js +++ b/browser/devtools/canvasdebugger/canvasdebugger.js @@ -70,7 +70,8 @@ const EVENTS = { }; const HTML_NS = "http://www.w3.org/1999/xhtml"; -const STRINGS_URI = "chrome://browser/locale/devtools/canvasdebugger.properties" +const STRINGS_URI = "chrome://browser/locale/devtools/canvasdebugger.properties"; +const SHARED_STRINGS_URI = "chrome://browser/locale/devtools/shared.properties"; const SNAPSHOT_START_RECORDING_DELAY = 10; // ms const SNAPSHOT_DATA_EXPORT_MAX_BLOCK = 1000; // ms @@ -701,7 +702,8 @@ let CallsListView = Heritage.extend(WidgetMethods, { let dimensionsNode = $("#screenshot-dimensions"); let actualWidth = (width / scaling) | 0; let actualHeight = (height / scaling) | 0; - dimensionsNode.setAttribute("value", actualWidth + " \u00D7 " + actualHeight); + dimensionsNode.setAttribute("value", + SHARED_L10N.getFormatStr("dimensions", actualWidth, actualHeight)); window.emit(EVENTS.CALL_SCREENSHOT_DISPLAYED); }, @@ -1050,6 +1052,7 @@ let CallsListView = Heritage.extend(WidgetMethods, { * Localization convenience methods. */ let L10N = new ViewHelpers.L10N(STRINGS_URI); +let SHARED_L10N = new ViewHelpers.L10N(SHARED_STRINGS_URI); /** * Convenient way of emitting events from the panel window. diff --git a/browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-screenshots.js b/browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-screenshots.js index 90e149eca259..18c763216a3e 100644 --- a/browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-screenshots.js +++ b/browser/devtools/canvasdebugger/test/browser_canvas-frontend-img-screenshots.js @@ -20,7 +20,7 @@ function ifTestingSupported() { is($("#screenshot-container").hidden, false, "The screenshot container should now be visible."); - is($("#screenshot-dimensions").getAttribute("value"), "128" + " \u00D7 " + "128", + is($("#screenshot-dimensions").getAttribute("value"), "128" + "\u00D7" + "128", "The screenshot dimensions label has the expected value."); is($("#screenshot-image").getAttribute("flipped"), "false", diff --git a/browser/devtools/layoutview/view.js b/browser/devtools/layoutview/view.js index f13cbc89c4a3..0548e5edc393 100644 --- a/browser/devtools/layoutview/view.js +++ b/browser/devtools/layoutview/view.js @@ -14,12 +14,14 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/devtools/Loader.jsm"); Cu.import("resource://gre/modules/devtools/Console.jsm"); +Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {}); const {InplaceEditor, editableItem} = devtools.require("devtools/shared/inplace-editor"); const {parseDeclarations} = devtools.require("devtools/styleinspector/css-parsing-utils"); const {ReflowFront} = devtools.require("devtools/server/actors/layout"); +const SHARED_L10N = new ViewHelpers.L10N("chrome://browser/locale/devtools/shared.properties"); const NUMERIC = /^-?[\d\.]+$/; const LONG_TEXT_ROTATE_LIMIT = 3; @@ -401,7 +403,8 @@ LayoutView.prototype = { this._lastRequest = null; let width = layout.width; let height = layout.height; - let newLabel = width + "\u00D7" + height; + let newLabel = SHARED_L10N.getFormatStr("dimensions", width, height); + if (this.sizeHeadingLabel.textContent != newLabel) { this.sizeHeadingLabel.textContent = newLabel; } diff --git a/browser/devtools/responsivedesign/responsivedesign.jsm b/browser/devtools/responsivedesign/responsivedesign.jsm index bbd72cc71c27..bf5f99fb9792 100644 --- a/browser/devtools/responsivedesign/responsivedesign.jsm +++ b/browser/devtools/responsivedesign/responsivedesign.jsm @@ -11,6 +11,7 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/devtools/gDevTools.jsm"); Cu.import("resource://gre/modules/devtools/event-emitter.js"); +Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {}); XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy", "resource://gre/modules/SystemAppProxy.jsm"); @@ -33,6 +34,8 @@ const ROUND_RATIO = 10; const INPUT_PARSER = /(\d+)[^\d]+(\d+)/; +const SHARED_L10N = new ViewHelpers.L10N("chrome://browser/locale/devtools/shared.properties"); + let ActiveTabs = new Map(); this.ResponsiveUIManager = { @@ -604,7 +607,8 @@ ResponsiveUI.prototype = { * @param aPreset associated preset. */ setMenuLabel: function RUI_setMenuLabel(aMenuitem, aPreset) { - let size = Math.round(aPreset.width) + "\u00D7" + Math.round(aPreset.height); + let size = SHARED_L10N.getFormatStr("dimensions", + Math.round(aPreset.width), Math.round(aPreset.height)); // .inputField might be not reachable yet (async XBL loading) if (this.menulist.inputField) { diff --git a/browser/locales/en-US/chrome/browser/devtools/shared.properties b/browser/locales/en-US/chrome/browser/devtools/shared.properties new file mode 100644 index 000000000000..ad2ad2245df9 --- /dev/null +++ b/browser/locales/en-US/chrome/browser/devtools/shared.properties @@ -0,0 +1,7 @@ +# 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/. + +# LOCALIZATION NOTE (dimensions): This is used to display the dimensions +# of a node or image, like 100×200. +dimensions=%S\u00D7%S diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn index b96a6daf06a2..fc739544d9ba 100644 --- a/browser/locales/jar.mn +++ b/browser/locales/jar.mn @@ -45,6 +45,7 @@ locale/browser/devtools/webconsole.properties (%chrome/browser/devtools/webconsole.properties) locale/browser/devtools/inspector.properties (%chrome/browser/devtools/inspector.properties) locale/browser/devtools/tilt.properties (%chrome/browser/devtools/tilt.properties) + locale/browser/devtools/shared.properties (%chrome/browser/devtools/shared.properties) locale/browser/devtools/scratchpad.properties (%chrome/browser/devtools/scratchpad.properties) locale/browser/devtools/scratchpad.dtd (%chrome/browser/devtools/scratchpad.dtd) locale/browser/devtools/storage.properties (%chrome/browser/devtools/storage.properties) From 13824b3d7b3e9fbee0a0964cc885da6fea6e0878 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Wed, 28 Jan 2015 12:05:20 -0800 Subject: [PATCH 12/16] Bug 1126139 - Add an android:label for the reading list provider. r=nalexander --HG-- extra : rebase_source : 1ada67e2c44058871d6a2b6ca5ccae1cf9b582f5 --- mobile/android/base/AndroidManifest.xml.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in index 93704d2e6df9..d9f7be15ced0 100644 --- a/mobile/android/base/AndroidManifest.xml.in +++ b/mobile/android/base/AndroidManifest.xml.in @@ -428,6 +428,8 @@ Date: Tue, 27 Jan 2015 10:59:00 -0500 Subject: [PATCH 13/16] Bug 1076735 - Improve display of super DevTools mode request. r=jryans --- .../devtools/webide/content/runtimedetails.js | 21 ++++++++++++------- .../webide/content/runtimedetails.xhtml | 4 ++-- .../devtools/webide/themes/runtimedetails.css | 5 +++++ .../en-US/chrome/browser/devtools/webide.dtd | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/browser/devtools/webide/content/runtimedetails.js b/browser/devtools/webide/content/runtimedetails.js index 65f513b6b118..123ac2065434 100644 --- a/browser/devtools/webide/content/runtimedetails.js +++ b/browser/devtools/webide/content/runtimedetails.js @@ -10,11 +10,16 @@ const {Connection} = require("devtools/client/connection-manager"); const {RuntimeTypes} = require("devtools/webide/runtimes"); const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties"); +const UNRESTRICTED_HELP_URL = "https://developer.mozilla.org/docs/Tools/WebIDE#Unrestricted_app_debugging_%28including_certified_apps.2C_main_process.2C_etc.%29"; + window.addEventListener("load", function onLoad() { window.removeEventListener("load", onLoad); document.querySelector("#close").onclick = CloseUI; - document.querySelector("#certified-check button").onclick = EnableCertApps; + document.querySelector("#devtools-check button").onclick = EnableCertApps; document.querySelector("#adb-check button").onclick = RootADB; + document.querySelector("#unrestricted-privileges").onclick = function() { + window.parent.UI.openInBrowser(UNRESTRICTED_HELP_URL); + }; AppManager.on("app-manager-update", OnAppManagerUpdate); BuildUI(); CheckLockState(); @@ -63,10 +68,10 @@ function BuildUI() { function CheckLockState() { let adbCheckResult = document.querySelector("#adb-check > .yesno"); - let certCheckResult = document.querySelector("#certified-check > .yesno"); - let flipCertPerfButton = document.querySelector("#certified-check button"); + let devtoolsCheckResult = document.querySelector("#devtools-check > .yesno"); + let flipCertPerfButton = document.querySelector("#devtools-check button"); let adbRootButton = document.querySelector("#adb-check button"); - let flipCertPerfAction = document.querySelector("#certified-check > .action"); + let flipCertPerfAction = document.querySelector("#devtools-check > .action"); let adbRootAction = document.querySelector("#adb-check > .action"); let sYes = Strings.GetStringFromName("runtimedetails_checkyes"); @@ -79,7 +84,7 @@ function CheckLockState() { adbRootAction.setAttribute("hidden", "true"); adbCheckResult.textContent = sUnknown; - certCheckResult.textContent = sUnknown; + devtoolsCheckResult.textContent = sUnknown; if (AppManager.connection && AppManager.connection.status == Connection.Status.CONNECTED) { @@ -109,15 +114,15 @@ function CheckLockState() { let prefFront = AppManager.preferenceFront; prefFront.getBoolPref("devtools.debugger.forbid-certified-apps").then(isForbidden => { if (isForbidden) { - certCheckResult.textContent = sYes; + devtoolsCheckResult.textContent = sNo; flipCertPerfAction.removeAttribute("hidden"); } else { - certCheckResult.textContent = sNo; + devtoolsCheckResult.textContent = sYes; } }, e => console.error(e)); } catch(e) { // Exception. pref actor is only accessible if forbird-certified-apps is false - certCheckResult.textContent = sYes; + devtoolsCheckResult.textContent = sYes; flipCertPerfAction.removeAttribute("hidden"); } diff --git a/browser/devtools/webide/content/runtimedetails.xhtml b/browser/devtools/webide/content/runtimedetails.xhtml index 378f12f25ce4..7a46fd307515 100644 --- a/browser/devtools/webide/content/runtimedetails.xhtml +++ b/browser/devtools/webide/content/runtimedetails.xhtml @@ -32,8 +32,8 @@ &runtimedetails_ADBRootWarning;

    -

    - &runtimedetails_restrictedPrivileges; +

    + &runtimedetails_unrestrictedPrivileges;

    &runtimedetails_privilegesWarning; diff --git a/browser/devtools/webide/themes/runtimedetails.css b/browser/devtools/webide/themes/runtimedetails.css index 1d0ac20bba0a..91ced5bff9f9 100644 --- a/browser/devtools/webide/themes/runtimedetails.css +++ b/browser/devtools/webide/themes/runtimedetails.css @@ -11,6 +11,11 @@ html, body { padding-left: 6px; } +#devtools-check > a { + color: #4C9ED9; + cursor: pointer; +} + .action { display: inline; } diff --git a/browser/locales/en-US/chrome/browser/devtools/webide.dtd b/browser/locales/en-US/chrome/browser/devtools/webide.dtd index 4e945006aebe..02823c37277e 100644 --- a/browser/locales/en-US/chrome/browser/devtools/webide.dtd +++ b/browser/locales/en-US/chrome/browser/devtools/webide.dtd @@ -145,7 +145,7 @@ - + From 38f0ba075af065d9de8f1ebe91f5d00c8e6c9cc4 Mon Sep 17 00:00:00 2001 From: Jordan Santell Date: Wed, 28 Jan 2015 02:29:00 -0500 Subject: [PATCH 14/16] Bug 1092571 - Disable intermittent tests failing due to AudioNodeActor::connectParam. r=vp --- browser/devtools/webaudioeditor/test/browser.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/browser/devtools/webaudioeditor/test/browser.ini b/browser/devtools/webaudioeditor/test/browser.ini index 366b06673309..ca1ac106e11d 100644 --- a/browser/devtools/webaudioeditor/test/browser.ini +++ b/browser/devtools/webaudioeditor/test/browser.ini @@ -24,6 +24,7 @@ support-files = [browser_audionode-actor-bypass.js] [browser_audionode-actor-connectnode-disconnect.js] [browser_audionode-actor-connectparam.js] +skip-if = true # bug 1092571 [browser_audionode-actor-add-automation-event.js] [browser_audionode-actor-get-automation-data-01.js] [browser_audionode-actor-get-automation-data-02.js] @@ -49,6 +50,7 @@ support-files = [browser_wa_graph-render-03.js] [browser_wa_graph-render-04.js] [browser_wa_graph-render-05.js] +skip-if = true # bug 1092571 [browser_wa_graph-selected.js] [browser_wa_graph-zoom.js] From 07301b3a429453b236a4d676c20bb69584b6e4d6 Mon Sep 17 00:00:00 2001 From: Jordan Santell Date: Wed, 28 Jan 2015 02:12:00 -0500 Subject: [PATCH 15/16] Bug 1125819 - Add cancelScheduledValues for automation tracking in web audio editor. r=vp --- .../devtools/webaudioeditor/test/browser.ini | 1 + ..._audionode-actor-get-automation-data-03.js | 34 +++++++++++++++++++ toolkit/devtools/server/actors/webaudio.js | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 browser/devtools/webaudioeditor/test/browser_audionode-actor-get-automation-data-03.js diff --git a/browser/devtools/webaudioeditor/test/browser.ini b/browser/devtools/webaudioeditor/test/browser.ini index ca1ac106e11d..4090858f844f 100644 --- a/browser/devtools/webaudioeditor/test/browser.ini +++ b/browser/devtools/webaudioeditor/test/browser.ini @@ -28,6 +28,7 @@ skip-if = true # bug 1092571 [browser_audionode-actor-add-automation-event.js] [browser_audionode-actor-get-automation-data-01.js] [browser_audionode-actor-get-automation-data-02.js] +[browser_audionode-actor-get-automation-data-03.js] [browser_webaudio-actor-simple.js] [browser_webaudio-actor-destroy-node.js] [browser_webaudio-actor-connect-param.js] diff --git a/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-automation-data-03.js b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-automation-data-03.js new file mode 100644 index 000000000000..13fb287b31c1 --- /dev/null +++ b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-automation-data-03.js @@ -0,0 +1,34 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test that `cancelScheduledEvents` clears out events on and after + * its argument. + */ + +add_task(function*() { + let { target, front } = yield initBackend(SIMPLE_CONTEXT_URL); + let [_, [destNode, oscNode, gainNode]] = yield Promise.all([ + front.setup({ reload: true }), + get3(front, "create-node") + ]); + + yield oscNode.addAutomationEvent("frequency", "setValueAtTime", [300, 0]); + yield oscNode.addAutomationEvent("frequency", "linearRampToValueAtTime", [500, 0.9]); + yield oscNode.addAutomationEvent("frequency", "setValueAtTime", [700, 1]); + yield oscNode.addAutomationEvent("frequency", "exponentialRampToValueAtTime", [1000, 2]); + yield oscNode.addAutomationEvent("frequency", "cancelScheduledValues", [1]); + + var { events, values } = yield oscNode.getAutomationData("frequency"); + + is(events.length, 2, "2 recorded events returned."); + is(values.length, 2000, "2000 value points returned"); + + checkAutomationValue(values, 0, 300); + checkAutomationValue(values, 0.5, 411.15); + checkAutomationValue(values, 0.9, 499.9); + checkAutomationValue(values, 1, 499.9); + checkAutomationValue(values, 2, 499.9); + + yield removeTab(target.tab); +}); diff --git a/toolkit/devtools/server/actors/webaudio.js b/toolkit/devtools/server/actors/webaudio.js index 8aa610f2d8f1..b17db9ea1f0e 100644 --- a/toolkit/devtools/server/actors/webaudio.js +++ b/toolkit/devtools/server/actors/webaudio.js @@ -35,7 +35,7 @@ const NODE_CREATION_METHODS = [ const AUTOMATION_METHODS = [ "setValueAtTime", "linearRampToValueAtTime", "exponentialRampToValueAtTime", - "setTargetAtTime", "setValueCurveAtTime" + "setTargetAtTime", "setValueCurveAtTime", "cancelScheduledValues" ]; const NODE_ROUTING_METHODS = [ From 1adc493a26a22bf1b06d3a6622568c3b1b58c6c1 Mon Sep 17 00:00:00 2001 From: Giovanny Andres Gongora Granada Date: Wed, 28 Jan 2015 23:18:14 +0100 Subject: [PATCH 16/16] Bug 1126738 - Use arrow functions in browser-data-submission-info-bar.js. r=dao --- .../base/content/browser-data-submission-info-bar.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/browser/base/content/browser-data-submission-info-bar.js b/browser/base/content/browser-data-submission-info-bar.js index bac33c63e4b4..36f4f4f4a0b6 100644 --- a/browser/base/content/browser-data-submission-info-bar.js +++ b/browser/base/content/browser-data-submission-info-bar.js @@ -25,11 +25,11 @@ let gDataNotificationInfoBar = { }, init: function() { - window.addEventListener("unload", function onUnload() { + window.addEventListener("unload", () => { for (let o of this._OBSERVERS) { Services.obs.removeObserver(this, o); } - }.bind(this), false); + }, false); for (let o of this._OBSERVERS) { Services.obs.addObserver(this, o, true); @@ -59,10 +59,10 @@ let gDataNotificationInfoBar = { label: gNavigatorBundle.getString("dataReportingNotification.button.label"), accessKey: gNavigatorBundle.getString("dataReportingNotification.button.accessKey"), popup: null, - callback: function () { + callback: () => { this._actionTaken = true; window.openAdvancedPreferences("dataChoicesTab"); - }.bind(this), + }, }]; this._log.info("Creating data reporting policy notification."); @@ -72,11 +72,11 @@ let gDataNotificationInfoBar = { null, this._notificationBox.PRIORITY_INFO_HIGH, buttons, - function onEvent(event) { + event => { if (event == "removed") { Services.obs.notifyObservers(null, "datareporting:notify-data-policy:close", null); } - }.bind(this) + } ); // It is important to defer calling onUserNotifyComplete() until we're // actually sure the notification was displayed. If we ever called