Bug 1435880 - Remove stale XUL references from docs along with dead test code.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matthew Noorenberghe 2020-02-20 16:06:28 +00:00
parent 9122f59cc3
commit bc357bb206
2 changed files with 2 additions and 51 deletions

View File

@ -63,7 +63,8 @@ in the array by checking the file name is `paymentRequest.xhtml` (e.g. ``tabs[0]
Dialog Architecture
===================
Privileged wrapper XUL document (paymentDialogWrapper.xul) containing a remote ``<xul:browser="true" remote="true">`` containing unprivileged XHTML (paymentRequest.xhtml).
A remote ``<xul:browser="true" remote="true">`` is `added to the Browser Window <https://searchfox.org/mozilla-central/search?q=%20_createPaymentFrame&case=false&regexp=false&path=>`_
containing unprivileged XHTML (paymentRequest.xhtml).
Keeping the dialog contents unprivileged is useful since the dialog will render payment line items and shipping options that are provided by web developers and should therefore be considered untrusted.
In order to communicate across the process boundary a privileged frame script (`paymentDialogFrameScript.js`) is loaded into the iframe to relay messages.
This is because the unprivileged document cannot access message managers.

View File

@ -125,39 +125,6 @@ async function withMerchantTab(
});
}
/**
* Load the privileged payment dialog wrapper document in a new tab and run the
* task function.
*
* @param {string} requestId of the PaymentRequest
* @param {Function} taskFn to run in the dialog with the frame as an argument.
* @returns {Promise} which resolves when the dialog document is loaded
*/
function withNewDialogFrame(requestId, taskFn) {
async function dialogTabTask(dialogBrowser) {
let paymentRequestFrame = dialogBrowser.contentDocument.getElementById(
"paymentRequestFrame"
);
// Ensure the inner frame is loaded
await spawnPaymentDialogTask(
paymentRequestFrame,
async function ensureLoaded() {
await ContentTaskUtils.waitForCondition(
() => content.document.readyState == "complete",
"Waiting for the unprivileged frame to load"
);
}
);
await taskFn(paymentRequestFrame);
}
let args = {
gBrowser,
url: `chrome://payments/content/paymentDialogWrapper.xul?requestId=${requestId}`,
};
return BrowserTestUtils.withNewTab(args, dialogTabTask);
}
async function withNewTabInPrivateWindow(args = {}, taskFn) {
let privateWin = await BrowserTestUtils.openNewBrowserWindow({
private: true,
@ -169,23 +136,6 @@ async function withNewTabInPrivateWindow(args = {}, taskFn) {
await BrowserTestUtils.closeWindow(privateWin);
}
/**
* Spawn a content task inside the inner unprivileged frame of a privileged Payment Request dialog.
*
* @param {string} requestId
* @param {Function} contentTaskFn
* @param {object?} [args = null] for the content task
* @returns {Promise}
*/
function spawnTaskInNewDialog(requestId, contentTaskFn, args = null) {
return withNewDialogFrame(
requestId,
async function spawnTaskInNewDialog_tabTask(reqFrame) {
await spawnPaymentDialogTask(reqFrame, contentTaskFn, args);
}
);
}
async function addAddressRecord(address) {
let onChanged = TestUtils.topicObserved(
"formautofill-storage-changed",