diff options
Diffstat (limited to 'toolkit/components/passwordmgr/test/mochitest')
18 files changed, 56 insertions, 122 deletions
diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js index 8b125897a5..1494c60bbd 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common.js @@ -30,15 +30,6 @@ let authPromptModalType = SpecialPowers.Services.prefs.getIntPref( "prompts.modalType.httpAuth" ); -// Whether the auth prompt is a commonDialog.xhtml or a TabModalPrompt -let authPromptIsCommonDialog = - authPromptModalType === SpecialPowers.Services.prompt.MODAL_TYPE_WINDOW || - (authPromptModalType === SpecialPowers.Services.prompt.MODAL_TYPE_TAB && - SpecialPowers.Services.prefs.getBoolPref( - "prompts.tabChromePromptSubDialog", - false - )); - /** * Recreate a DOM tree using the outerHTML to ensure that any event listeners * and internal state for the elements are removed. @@ -145,7 +136,7 @@ function setUserInputValues(parentNode, selectorValues, userInput = true) { */ function getSubmitMessage(aFilterFn = undefined) { info("getSubmitMessage"); - return new Promise((resolve, reject) => { + return new Promise(resolve => { PWMGR_COMMON_PARENT.addMessageListener( "formSubmissionProcessed", function processed(...args) { @@ -170,7 +161,7 @@ function getSubmitMessage(aFilterFn = undefined) { */ function getPasswordEditedMessage() { info("getPasswordEditedMessage"); - return new Promise((resolve, reject) => { + return new Promise(resolve => { PWMGR_COMMON_PARENT.addMessageListener( "passwordEditedOrGenerated", function listener(...args) { @@ -643,8 +634,8 @@ function registerRunTests(existingPasswordFieldsCount = 0, callback) { let foundForcer = false; var observer = SpecialPowers.wrapCallback(function ( - subject, - topic, + _subject, + _topic, data ) { if (data === "observerforcer") { @@ -714,8 +705,8 @@ function logoutPrimaryPassword() { */ function promiseFormsProcessedInSameProcess(expectedCount = 1) { var processedCount = 0; - return new Promise((resolve, reject) => { - function onProcessedForm(subject, topic, data) { + return new Promise(resolve => { + function onProcessedForm(subject, _topic, data) { processedCount++; if (processedCount == expectedCount) { info(`${processedCount} form(s) processed`); @@ -1068,7 +1059,7 @@ SimpleTest.registerCleanupFunction(() => { this.LoginManager = new Proxy( {}, { - get(target, prop, receiver) { + get(_target, prop, _receiver) { return (...args) => { let loginInfoIndices = []; let cloneableArgs = args.map((val, index) => { @@ -1159,7 +1150,7 @@ async function formAutofillResult(formId) { delete gPwmgrCommonCapturedAutofillResults[formId]; return autofillResult; } - return new Promise((resolve, reject) => { + return new Promise(resolve => { PWMGR_COMMON_PARENT.addMessageListener( "formProcessed", ({ formId: id, autofillResult }) => { diff --git a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js index 09ad80f467..e530fddf1c 100644 --- a/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js +++ b/toolkit/components/passwordmgr/test/mochitest/pwmgr_common_parent.js @@ -109,8 +109,8 @@ function dumpLogin(label, login) { } addMessageListener("storageChanged", async function ({ expectedChangeTypes }) { - return new Promise((resolve, reject) => { - function storageChanged(subject, topic, data) { + return new Promise(resolve => { + function storageChanged(_subject, _topic, data) { let changeType = expectedChangeTypes.shift(); if (data != changeType) { resolve("Unexpected change type " + data + ", expected " + changeType); @@ -129,7 +129,7 @@ addMessageListener("storageChanged", async function ({ expectedChangeTypes }) { addMessageListener("promptShown", async function () { return new Promise(resolve => { - function promptShown(subject, topic, data) { + function promptShown(_subject, topic, _data) { Services.obs.removeObserver(promptShown, "passwordmgr-prompt-change"); Services.obs.removeObserver(promptShown, "passwordmgr-prompt-save"); resolve(topic); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html b/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html index 091f9c8ad6..5d74cef106 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_https_downgrade.html @@ -30,7 +30,7 @@ let nsLoginInfo = SpecialPowers.wrap(SpecialPowers.Components).Constructor("@moz let win = window.open("about:blank"); SimpleTest.registerCleanupFunction(() => win.close()); -async function prepareAndProcessForm(url, login) { +async function prepareAndProcessForm(url) { let processedPromise = promiseFormsProcessed(); win.location = url; info("prepareAndProcessForm, assigned window location: " + url); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html b/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html index 429ec2269c..50d94dfbae 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_bug_627616.html @@ -56,7 +56,7 @@ function runNextTest() { is(gExpectedDialogs, 0, "received expected number of auth dialogs"); mm.sendAsyncMessage("prepareForNextTest"); - mm.addMessageListener("prepareForNextTestDone", function prepared(msg) { + mm.addMessageListener("prepareForNextTestDone", function prepared(_msg) { mm.removeMessageListener("prepareForNextTestDone", prepared); if (pendingTests.length) { ({expectedDialogs: gExpectedDialogs, @@ -92,7 +92,7 @@ const pps = parentCc["@mozilla.org/network/protocol-proxy-service;1"]. getService(parentCi.nsIProtocolProxyService); pps.asyncResolve(channel, 0, { - async onProxyAvailable(req, uri, pi, status) { + async onProxyAvailable(req, uri, pi, _status) { const mozproxy = "moz-proxy://" + pi.host + ":" + pi.port; const login1 = parentCc["@mozilla.org/login-manager/loginInfo;1"]. createInstance(parentCi.nsILoginInfo); @@ -110,54 +110,32 @@ QueryInterface: ChromeUtils.generateQI([parentCi.nsIProtocolProxyCallback]), }); - addMessageListener("prepareForNextTest", message => { + addMessageListener("prepareForNextTest", _message => { parentCc["@mozilla.org/network/http-auth-manager;1"]. getService(parentCi.nsIHttpAuthManager). clearAll(); sendAsyncMessage("prepareForNextTestDone"); }); - const modalType = Services.prefs.getIntPref( - "prompts.modalType.httpAuth" - ); - const authPromptIsCommonDialog = - modalType === Services.prompt.MODAL_TYPE_WINDOW - || (modalType === Services.prompt.MODAL_TYPE_TAB - && Services.prefs.getBoolPref( - "prompts.tabChromePromptSubDialog", - false - )); - - const dialogObserverTopic = authPromptIsCommonDialog - ? "common-dialog-loaded" : "tabmodal-dialog-loaded"; - - function dialogObserver(subj, topic, data) { - if (authPromptIsCommonDialog) { - subj.Dialog.ui.prompt.document - .getElementById("commonDialog") - .acceptDialog(); - } else { - const prompt = subj.ownerGlobal.gBrowser.selectedBrowser - .tabModalPromptBox.getPrompt(subj); - prompt.Dialog.ui.button0.click(); // Accept button - } + const dialogObserverTopic = "common-dialog-loaded"; + + function dialogObserver(subj, _topic, _data) { + subj.Dialog.ui.prompt.document + .getElementById("commonDialog") + .acceptDialog(); sendAsyncMessage("promptAccepted"); } Services.obs.addObserver(dialogObserver, dialogObserverTopic); - addMessageListener("cleanup", message => { + addMessageListener("cleanup", _message => { Services.obs.removeObserver(dialogObserver, dialogObserverTopic); sendAsyncMessage("cleanupDone"); }); }); - mm.addMessageListener("promptAccepted", msg => { - gExpectedDialogs--; - }); - mm.addMessageListener("setupDone", msg => { - runNextTest(); - }); + mm.addMessageListener("promptAccepted", _message => gExpectedDialogs--); + mm.addMessageListener("setupDone", _message => runNextTest()); </script> </body> </html> diff --git a/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html b/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html index 87638b1132..5d014124a1 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html @@ -67,13 +67,7 @@ async function editPasswordFieldInShadowDOM() { async function testForm(testcase) { const iframeLoaded = new Promise(resolve => { - IFRAME.addEventListener( - "load", - function(e) { - resolve(true); - }, - { once: true } - ); + IFRAME.addEventListener("load", _e => resolve(true), { once: true }); }); // This could complete before the page finishes loading. diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html index 06458893ea..722a86efc9 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html @@ -94,13 +94,7 @@ const TESTCASES = [ async function testForm(testcase) { const iframeLoaded = new Promise(resolve => { - IFRAME.addEventListener( - "load", - function(e) { - resolve(true); - }, - { once: true } - ); + IFRAME.addEventListener("load", _e => resolve(true), { once: true }); }); // This could complete before the page finishes loading. diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html index 4d1b7582a9..05be33e4dd 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html @@ -12,7 +12,7 @@ gTestDependsOnDeprecatedLogin = true; let doneSetupPromise = new Promise(resolve => { document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", async evt => { + document.getElementById("loginFrame").addEventListener("load", async _e => { // Tell the parent to setup test logins. await runChecksAfterCommonInit(); resolve(); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html index 5512c57db2..b2ff2d8845 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html @@ -10,10 +10,8 @@ <body> <script type="application/javascript"> let loadPromise = new Promise(resolve => { - document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", (evt) => { - resolve(); - }); + document.addEventListener("DOMContentLoaded", _event => { + document.getElementById("loginFrame").addEventListener("load", _e => resolve()); }); }); @@ -187,16 +185,14 @@ const TESTCASES = [ },*/ ]; -function filterFormSubmissions({ origin, data }) { +function filterFormSubmissions({ data }) { return data.newPasswordField.value != "ignore-form-submission"; } async function testFormlesSubmitFormRemoval(tc, testDoc, scriptName) { let loginFrame = document.getElementById("loginFrame"); - let loadedPromise = new Promise((resolve) => { - loginFrame.addEventListener("load", function() { - resolve(); - }, {once: true}); + let loadedPromise = new Promise(resolve => { + loginFrame.addEventListener("load", _e => resolve(), {once: true}); }); loginFrame.src = DEFAULT_ORIGIN + "/tests/toolkit/components/passwordmgr/test/mochitest/blank.html"; await loadedPromise; diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal_negative.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal_negative.html index dfd7670a12..845706e9a4 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal_negative.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal_negative.html @@ -13,9 +13,7 @@ SimpleTest.requestFlakyTimeout("Testing that a message doesn't arrive"); let loadPromise = new Promise(resolve => { document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", (evt) => { - resolve(); - }); + document.getElementById("loginFrame").addEventListener("load", _e => resolve()); }); }); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation.html index 348669a85c..78ddb18e4b 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation.html @@ -11,9 +11,7 @@ <script type="application/javascript"> let loadPromise = new Promise(resolve => { document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", (evt) => { - resolve(); - }); + document.getElementById("loginFrame").addEventListener("load", _e => resolve()); }); }); @@ -179,7 +177,7 @@ const TESTCASES = [ }, ]; -function filterFormSubmissions({ origin, data }) { +function filterFormSubmissions({ _origin, data }) { return data.newPasswordField.value != "ignore-form-submission"; } diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation_negative.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation_negative.html index 338cd5d2c1..f5bb29c14d 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation_negative.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_navigation_negative.html @@ -12,10 +12,8 @@ SimpleTest.requestFlakyTimeout("Testing that a message doesn't arrive"); let loadPromise = new Promise(resolve => { - document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", (evt) => { - resolve(); - }); + document.addEventListener("DOMContentLoaded", _event => { + document.getElementById("loginFrame").addEventListener("load", _e => resolve()); }); }); @@ -97,9 +95,7 @@ async function testFormlesSubmitNavigationNegative(tc, scriptName) { } let loadedPromise = new Promise((resolve) => { - loginFrame.addEventListener("load", function() { - resolve(); - }, {once: true}); + loginFrame.addEventListener("load", _e => resolve(), {once: true}); }); loginFrame.src = DEFAULT_ORIGIN + "/tests/toolkit/components/passwordmgr/test/mochitest/blank.html"; await loadedPromise; diff --git a/toolkit/components/passwordmgr/test/mochitest/test_munged_values.html b/toolkit/components/passwordmgr/test/mochitest/test_munged_values.html index d2fdf91d4a..8b0c243c4d 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_munged_values.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_munged_values.html @@ -113,7 +113,7 @@ add_task(async function test_new_logins() { <button type="submit" id="submitBtn">Submit</button> </form>`; await loadFormIntoWindow(DEFAULT_ORIGIN, html, win); - await SpecialPowers.spawn(win, [html], function(contentHtml) { + await SpecialPowers.spawn(win, [], function() { const doc = this.content.document; for (const field of doc.querySelectorAll("input")) { const actualValue = field.value; @@ -189,7 +189,7 @@ add_task(async function test_no_save_dialog_when_password_is_fully_munged() { <button type="submit" id="submitBtn">Submit</button> </form>`; await loadFormIntoWindow(DEFAULT_ORIGIN, html, win); - await SpecialPowers.spawn(win, [html], function(contentHtml) { + await SpecialPowers.spawn(win, [], function() { const doc = this.content.document; for (const field of doc.querySelectorAll("input")) { const actualValue = field.value; @@ -248,7 +248,7 @@ add_task(async function test_no_autofill_munged_username_matching_password() { <button type="submit" id="submitBtn">Submit</button> </form>`; await loadFormIntoWindow(DEFAULT_ORIGIN, html, win); - await SpecialPowers.spawn(win, [html], function(contentHtml) { + await SpecialPowers.spawn(win, [], function() { const doc = this.content.document; for (const field of doc.querySelectorAll("input")) { const actualValue = field.value; @@ -312,7 +312,7 @@ add_task(async function test_autofill_munged_username_matching_password() { <button type="submit" id="submitBtn">Submit</button> </form>`; await loadFormIntoWindow(DEFAULT_ORIGIN, html, win); - await SpecialPowers.spawn(win, [html], function(contentHtml) { + await SpecialPowers.spawn(win, [], function() { const doc = this.content.document; for (const field of doc.querySelectorAll("input")) { const actualValue = field.value; diff --git a/toolkit/components/passwordmgr/test/mochitest/test_one_doorhanger_per_un_pw.html b/toolkit/components/passwordmgr/test/mochitest/test_one_doorhanger_per_un_pw.html index 4d8dfd1fee..47e216ce4a 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_one_doorhanger_per_un_pw.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_one_doorhanger_per_un_pw.html @@ -47,9 +47,8 @@ is(password.value, "pass", "Checking for filled password"); let promptShown = false; - promptShownPromise = promisePromptShown("passwordmgr-prompt-save").then(value => { - promptShown = true; - }); + promptShownPromise = promisePromptShown("passwordmgr-prompt-save") + .then(_value => promptShown = true); submitButton.click(); await new Promise(resolve => setTimeout(resolve, 1000)); ok(!promptShown, "Prompt is not shown for the same login values a second time"); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_password_length.html b/toolkit/components/passwordmgr/test/mochitest/test_password_length.html index 724caf236f..10a79f2839 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_password_length.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_password_length.html @@ -12,19 +12,15 @@ let readyPromise = registerRunTests(); let loadPromise = new Promise(resolve => { - document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", (evt) => { - resolve(); - }); + document.addEventListener("DOMContentLoaded", _event => { + document.getElementById("loginFrame").addEventListener("load", _e => resolve()); }); }); async function loadFormIntoIframe(origin, html) { let loginFrame = document.getElementById("loginFrame"); let loadedPromise = new Promise((resolve) => { - loginFrame.addEventListener("load", function() { - resolve(); - }, {once: true}); + loginFrame.addEventListener("load", _e => resolve(), {once: true}); }); let processedPromise = promiseFormsProcessed(); loginFrame.src = origin + "/tests/toolkit/components/passwordmgr/test/mochitest/blank.html"; @@ -80,7 +76,7 @@ const TESTCASES = [ * @return {Promise} resolving when form submission was processed. */ function getSubmitMessage() { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { PWMGR_COMMON_PARENT.addMessageListener("formSubmissionProcessed", function processed(...args) { info("got formSubmissionProcessed"); PWMGR_COMMON_PARENT.removeMessageListener("formSubmissionProcessed", processed); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_prompt_async.html b/toolkit/components/passwordmgr/test/mochitest/test_prompt_async.html index 41a58cb416..1edbf8cf18 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_async.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_async.html @@ -58,9 +58,7 @@ function promiseLoadedContentDoc(frame) { return new Promise(resolve => { - frame.addEventListener("load", function onLoad(evt) { - resolve(SpecialPowers.wrap(frame).contentDocument); - }, { once: true }); + frame.addEventListener("load", _e => resolve(SpecialPowers.wrap(frame).contentDocument), { once: true }); }); } @@ -98,7 +96,7 @@ return this; }, - onProxyAvailable(req, uri, pi, status) { + onProxyAvailable(req, uri, pi, _status) { // Add logins using the proxy host and port used by the mochitest harness. mozproxyOrigin = "moz-proxy://" + SpecialPowers.wrap(pi).host + ":" + SpecialPowers.wrap(pi).port; diff --git a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html index 6f78d62f1b..75342cd4cb 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html @@ -86,10 +86,10 @@ let chromeScript = runInParent(() => { } class ProxyChannelListener { - onStartRequest(request) { + onStartRequest(_request) { sendAsyncMessage("initDone"); } - onStopRequest(request, status) {} + onStopRequest(_request, _status) {} } async function initLogins(pi) { @@ -126,7 +126,7 @@ let chromeScript = runInParent(() => { return this; }, - async onProxyAvailable(req, uri, pi, status) { + async onProxyAvailable(req, uri, pi, _status) { await initLogins(pi); // I'm cheating a bit here... We should probably do some magic foo to get diff --git a/toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html b/toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html index c31efe6a98..72740d3289 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_submit_without_field_modifications.html @@ -139,9 +139,7 @@ add_task(async function test_no_message_on_navigation() { await setup(PREFILLED_FORM_URL); let submitMessageSent = false; - getSubmitMessage().then(value => { - submitMessageSent = true; - }); + getSubmitMessage().then(_value => submitMessageSent = true); await navigateWithoutUserInteraction(); // allow time to pass before concluding no onFormSubmit message was sent @@ -197,9 +195,7 @@ add_task(async function test_no_message_on_autofill_without_user_interaction() { ); ok(!(await checkDocumentUserHasInteracted()), "document.userHasInteracted should be initially false"); let submitMessageSent = false; - getSubmitMessage().then(value => { - submitMessageSent = true; - }); + getSubmitMessage().then(_value => submitMessageSent = true); info("Navigating the page") await navigateWithoutUserInteraction(); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_xhr.html b/toolkit/components/passwordmgr/test/mochitest/test_xhr.html index 811a2e7759..4461195359 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_xhr.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_xhr.html @@ -21,7 +21,7 @@ Login Manager test: XHR prompt /** Test for Login Manager: XHR prompts. **/ function makeRequest(uri) { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { let request = new XMLHttpRequest(); request.open("GET", uri, true); request.addEventListener("loadend", function onLoadEnd() { |