зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435871 - Back out changeset 3f6664786e85 (Bug 1470584) since it's for a windowed dialog. r=jaws
Differential Revision: https://phabricator.services.mozilla.com/D8272 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
178d22bbc4
Коммит
1e439596ae
|
@ -32,7 +32,6 @@ function PaymentUIService() {
|
|||
prefix: "Payment UI Service",
|
||||
});
|
||||
});
|
||||
Services.wm.addListener(this);
|
||||
this.log.debug("constructor");
|
||||
}
|
||||
|
||||
|
@ -42,19 +41,6 @@ PaymentUIService.prototype = {
|
|||
DIALOG_URL: "chrome://payments/content/paymentDialogWrapper.xul",
|
||||
REQUEST_ID_PREFIX: "paymentRequest-",
|
||||
|
||||
// nsIWindowMediatorListener implementation:
|
||||
|
||||
onOpenWindow(aWindow) {},
|
||||
onCloseWindow(aWindow) {
|
||||
let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
|
||||
let requestId = this.requestIdForWindow(domWindow);
|
||||
if (!requestId || !paymentSrv.getPaymentRequestById(requestId)) {
|
||||
return;
|
||||
}
|
||||
this.log.debug(`onCloseWindow, close of window for active requestId: ${requestId}`);
|
||||
this.rejectPaymentForClosedDialog(requestId);
|
||||
},
|
||||
|
||||
// nsIPaymentUIService implementation:
|
||||
|
||||
showPayment(requestId) {
|
||||
|
@ -81,20 +67,6 @@ PaymentUIService.prototype = {
|
|||
paymentSrv.respondPayment(abortResponse);
|
||||
},
|
||||
|
||||
rejectPaymentForClosedDialog(requestId) {
|
||||
this.log.debug("rejectPaymentForClosedDialog:", requestId);
|
||||
const rejectResponse = Cc["@mozilla.org/dom/payments/payment-show-action-response;1"]
|
||||
.createInstance(Ci.nsIPaymentShowActionResponse);
|
||||
rejectResponse.init(requestId,
|
||||
Ci.nsIPaymentActionResponse.PAYMENT_REJECTED,
|
||||
"", // payment method
|
||||
null, // payment method data
|
||||
"", // payer name
|
||||
"", // payer email
|
||||
"");// payer phone
|
||||
paymentSrv.respondPayment(rejectResponse);
|
||||
},
|
||||
|
||||
completePayment(requestId) {
|
||||
// completeStatus should be one of "timeout", "success", "fail", ""
|
||||
let {completeStatus} = paymentSrv.getPaymentRequestById(requestId);
|
||||
|
|
|
@ -122,19 +122,6 @@ var PaymentTestUtils = {
|
|||
|
||||
handle.destruct();
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a rejection handler for the `showPromise` created by createAndShowRequest
|
||||
* and stash details of any eventual exception or response in `rqResult`
|
||||
*/
|
||||
catchShowPromiseRejection: () => {
|
||||
content.rqResult = {};
|
||||
content.showPromise.then(res => content.rqResult.response = res)
|
||||
.catch(ex => content.rqResult.showException = {
|
||||
name: ex.name,
|
||||
message: ex.message,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
DialogContentTasks: {
|
||||
|
|
|
@ -143,31 +143,6 @@ add_task(async function test_show_completePayment2() {
|
|||
});
|
||||
});
|
||||
|
||||
add_task(async function test_show_closeReject_dialog() {
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: BLANK_PAGE_URL,
|
||||
}, async browser => {
|
||||
let {win} =
|
||||
await setupPaymentDialog(browser, {
|
||||
methodData,
|
||||
details,
|
||||
merchantTaskFn: PTU.ContentTasks.createAndShowRequest,
|
||||
}
|
||||
);
|
||||
await ContentTask.spawn(browser, null, PTU.ContentTasks.catchShowPromiseRejection);
|
||||
|
||||
info("Closing the dialog to reject the payment request");
|
||||
BrowserTestUtils.closeWindow(win);
|
||||
await BrowserTestUtils.waitForCondition(() => win.closed, "dialog should be closed");
|
||||
|
||||
let result = await ContentTask.spawn(browser, null, async () => content.rqResult);
|
||||
ok(result.showException, "Expected promise rejection from the rq.show() promise");
|
||||
ok(!result.response,
|
||||
"rq.show() shouldn't resolve to a response");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_localized() {
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
|
|
Загрузка…
Ссылка в новой задаче