Bug 1435871 - Open prefs from Payment Request in a tab. r=jaws

Differential Revision: https://phabricator.services.mozilla.com/D8497

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matthew Noorenberghe 2018-10-17 18:46:12 +00:00
parent 72a245b99d
commit 27419e1f5b
3 changed files with 9 additions and 11 deletions

View File

@ -19,6 +19,8 @@ ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserWindowTracker",
"resource:///modules/BrowserWindowTracker.jsm");
ChromeUtils.defineModuleGetter(this, "OSKeyStore",
"resource://formautofill/OSKeyStore.jsm");
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
@ -486,10 +488,7 @@ var paymentDialogWrapper = {
},
onOpenPreferences() {
let prefsURL = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
prefsURL.data = "about:preferences#privacy-form-autofill";
Services.ww.openWindow(null, AppConstants.BROWSER_CHROME_URL, "_blank", "chrome,all,dialog=no",
prefsURL);
BrowserWindowTracker.getTopWindow().openPreferences("privacy-form-autofill");
},
onPaymentCancel() {

View File

@ -385,7 +385,7 @@ export default class PaymentDialog extends PaymentStateSubscriberMixin(HTMLEleme
let link = manageTextEl.querySelector("a");
// The href is only set to be exposed to accessibility tools so users know what will open.
// The actual opening happens from the click event listener.
link.href = "about:preferences#privacy-address-autofill";
link.href = "about:preferences#privacy-form-autofill";
}
this._renderPayButton(state);

View File

@ -20,9 +20,8 @@ add_task(async function test_openPreferences() {
merchantTaskFn: PTU.ContentTasks.createAndShowRequest,
});
let prefsWindowPromise = BrowserTestUtils.waitForNewWindow({
url: "about:preferences#privacy",
});
let prefsTabPromise = BrowserTestUtils.waitForNewTab(gBrowser,
"about:preferences#privacy-form-autofill");
let prefsLoadedPromise = TestUtils.topicObserved("sync-pane-loaded");
@ -49,11 +48,11 @@ add_task(async function test_openPreferences() {
isMac: AppConstants.platform == "macosx",
});
let browserWin = await prefsWindowPromise;
ok(browserWin, "Ensure a window was opened");
let prefsTab = await prefsTabPromise;
ok(prefsTab, "Ensure a tab was opened");
await prefsLoadedPromise;
await BrowserTestUtils.closeWindow(browserWin);
await BrowserTestUtils.removeTab(prefsTab);
spawnPaymentDialogTask(frame, PTU.DialogContentTasks.manuallyClickCancel);
await BrowserTestUtils.waitForCondition(() => win.closed, "dialog should be closed");