mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1080088 - disable broken mozPay implementation in desktop runtime; r=marco
This commit is contained in:
parent
4a27d860ae
commit
fb313d2fa9
@ -49,7 +49,7 @@ pref("dom.mozTCPSocket.enabled", true);
|
||||
pref("general.smoothScroll", true);
|
||||
|
||||
// WebPayment
|
||||
pref("dom.mozPay.enabled", true);
|
||||
pref("dom.mozPay.enabled", false);
|
||||
|
||||
// System messages
|
||||
pref("dom.sysmsg.enabled", true);
|
||||
|
@ -12,10 +12,10 @@ function test() {
|
||||
providerUri: "https://example.com:443/webapprtChrome/webapprt/test/chrome/mozpay-success.html?req=",
|
||||
message: "Success."
|
||||
});
|
||||
tests.push({
|
||||
providerUri: "https://example.com:443/webapprtChrome/webapprt/test/chrome/mozpay-failure.html?req=",
|
||||
message: "Chocolate rejected."
|
||||
});
|
||||
// tests.push({
|
||||
// providerUri: "https://example.com:443/webapprtChrome/webapprt/test/chrome/mozpay-failure.html?req=",
|
||||
// message: "Chocolate rejected."
|
||||
// });
|
||||
|
||||
let jwt = "eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJhdWQiOiAibW9j" +
|
||||
"a3BheXByb3ZpZGVyLnBocGZvZ2FwcC5jb20iLCAiaXNzIjogIkVudGVyI" +
|
||||
@ -36,23 +36,25 @@ function test() {
|
||||
requestMethod: "GET"
|
||||
};
|
||||
|
||||
let providerWindow;
|
||||
|
||||
let winObserver = function(win, topic) {
|
||||
if (topic == "domwindowopened") {
|
||||
win.addEventListener("load", function onLoadWindow() {
|
||||
win.removeEventListener("load", onLoadWindow, false);
|
||||
|
||||
if (win.document.getElementById("content").getAttribute("src") ==
|
||||
(tests[curTest].providerUri + jwt)) {
|
||||
ok(true, "Payment provider window shown.");
|
||||
providerWindow = win;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
|
||||
Services.ww.registerNotification(winObserver);
|
||||
// Disabled because the mozPay API is disabled, so the provider window
|
||||
// won't be shown.
|
||||
//
|
||||
// let providerWindow;
|
||||
// let winObserver = function(win, topic) {
|
||||
// if (topic == "domwindowopened") {
|
||||
// win.addEventListener("load", function onLoadWindow() {
|
||||
// win.removeEventListener("load", onLoadWindow, false);
|
||||
//
|
||||
// if (win.document.getElementById("content") &&
|
||||
// win.document.getElementById("content").getAttribute("src") ==
|
||||
// (tests[curTest].providerUri + jwt)) {
|
||||
// ok(true, "Payment provider window shown.");
|
||||
// providerWindow = win;
|
||||
// }
|
||||
// }, false);
|
||||
// }
|
||||
// }
|
||||
// Services.ww.registerNotification(winObserver);
|
||||
|
||||
let mutObserver = null;
|
||||
|
||||
@ -61,12 +63,12 @@ function test() {
|
||||
mutObserver = new MutationObserver(function(mutations) {
|
||||
is(msg.textContent, tests[curTest].message, "Got: " + tests[curTest].message);
|
||||
|
||||
if (!providerWindow) {
|
||||
ok(false, "Payment provider window shown.");
|
||||
} else {
|
||||
providerWindow.close();
|
||||
providerWindow = null;
|
||||
}
|
||||
// if (!providerWindow) {
|
||||
// ok(false, "Payment provider window shown.");
|
||||
// } else {
|
||||
// providerWindow.close();
|
||||
// providerWindow = null;
|
||||
// }
|
||||
|
||||
runNextTest();
|
||||
});
|
||||
@ -76,7 +78,7 @@ function test() {
|
||||
loadWebapp("mozpay.webapp", undefined, onLoad);
|
||||
|
||||
function runNextTest() {
|
||||
providerWindow = null;
|
||||
// providerWindow = null;
|
||||
if (mutObserver) {
|
||||
mutObserver.disconnect();
|
||||
}
|
||||
@ -97,7 +99,7 @@ function test() {
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.ww.unregisterNotification(winObserver);
|
||||
// Services.ww.unregisterNotification(winObserver);
|
||||
mutObserver.disconnect();
|
||||
});
|
||||
}
|
||||
|
@ -32,13 +32,21 @@
|
||||
"gInR5cCI6ICJtb2NrL3BheW1lbnRzL2luYXBwL3YxIn0.QZxc62USCy4U" +
|
||||
"IyKIC1TKelVhNklvk-Ou1l_daKntaFI";
|
||||
|
||||
var request = navigator.mozPay(jwt);
|
||||
request.onsuccess = function onsuccess() {
|
||||
document.getElementById("msg").textContent = "Success.";
|
||||
};
|
||||
request.onerror = function onerror() {
|
||||
document.getElementById("msg").textContent = request.error.name;
|
||||
};
|
||||
// mozPay is currently disabled in the desktop runtime, so we check
|
||||
// that the property is set to null on the navigator object.
|
||||
window.addEventListener("load", function() {
|
||||
document.getElementById("msg").textContent =
|
||||
(navigator.mozPay === null) ? "Success." : "navigator.mozPay defined";
|
||||
}, false);
|
||||
|
||||
// This is the old code for checking the behavior of the API when enabled:
|
||||
// var request = navigator.mozPay(jwt);
|
||||
// request.onsuccess = function onsuccess() {
|
||||
// document.getElementById("msg").textContent = "Success.";
|
||||
// };
|
||||
// request.onerror = function onerror() {
|
||||
// document.getElementById("msg").textContent = request.error.name;
|
||||
// };
|
||||
</script>
|
||||
<p id="msg">Webapp waiting to be paid...</p>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user