diff --git a/browser/components/downloads/test/browser/browser_overflow_anchor.js b/browser/components/downloads/test/browser/browser_overflow_anchor.js index 595b2ebc316d..63387314eabf 100644 --- a/browser/components/downloads/test/browser/browser_overflow_anchor.js +++ b/browser/components/downloads/test/browser/browser_overflow_anchor.js @@ -98,11 +98,11 @@ function unlockWidth(aItemIDs) { * @param aIsOverflowed if we're waiting for the item to be overflowed. */ function waitForOverflowed(aItem, aIsOverflowed) { - return new Promise(resolve => { - if (aItem.overflowed == aIsOverflowed) { - return resolve(); - } + if (aItem.overflowed == aIsOverflowed) { + return Promise.resolve(); + } + return new Promise(resolve => { let observer = new MutationObserver(function(aMutations) { if (aItem.overflowed == aIsOverflowed) { observer.disconnect(); @@ -110,6 +110,5 @@ function waitForOverflowed(aItem, aIsOverflowed) { } }); observer.observe(aItem.node, {attributes: true}); - }); } diff --git a/browser/components/downloads/test/browser/head.js b/browser/components/downloads/test/browser/head.js index d86a87fda880..c24b729c6e26 100644 --- a/browser/components/downloads/test/browser/head.js +++ b/browser/components/downloads/test/browser/head.js @@ -113,11 +113,11 @@ function promiseFocus() { } function promisePanelOpened() { - return new Promise(resolve => { + if (DownloadsPanel.panel && DownloadsPanel.panel.state == "open") { + return Promise.resolve(); + } - if (DownloadsPanel.panel && DownloadsPanel.panel.state == "open") { - return resolve(); - } + return new Promise(resolve => { // Hook to wait until the panel is shown. let originalOnPopupShown = DownloadsPanel.onPopupShown; diff --git a/browser/experiments/Experiments.jsm b/browser/experiments/Experiments.jsm index ce38c84164ee..4129bc42923c 100644 --- a/browser/experiments/Experiments.jsm +++ b/browser/experiments/Experiments.jsm @@ -969,7 +969,7 @@ Experiments.Experiments.prototype = { xhr.send(null); } catch (e) { this._log.error("httpGetRequest() - Error opening request to " + url + ": " + e); - return Promise.reject(new Error("Experiments - Error opening XHR for " + url)); + reject(new Error("Experiments - Error opening XHR for " + url)); } }); }, diff --git a/browser/modules/ContentSearch.jsm b/browser/modules/ContentSearch.jsm index 3f4fd2f4d755..786c3b02d2f9 100644 --- a/browser/modules/ContentSearch.jsm +++ b/browser/modules/ContentSearch.jsm @@ -533,7 +533,7 @@ this.ContentSearch = { // This throws if the URI is erroneously encoded. xhr.send(); } catch (err) { - return Promise.resolve(null); + resolve(null); } }); }, diff --git a/browser/modules/test/browser/browser_ContentSearch.js b/browser/modules/test/browser/browser_ContentSearch.js index c37923e6713a..4946b13852f9 100644 --- a/browser/modules/test/browser/browser_ContentSearch.js +++ b/browser/modules/test/browser/browser_ContentSearch.js @@ -410,7 +410,7 @@ function arrayBufferFromDataURI(uri) { try { xhr.send(); } catch (err) { - return Promise.resolve(null); + resolve(null); } }); }