Bug 1447555 [wpt PR 10120] - Prevent false positives, a=testonly
authorMarcos Cáceres <marcos@marcosc.com>
Mon, 09 Apr 2018 17:36:17 +0000
changeset 467151 08a3796277e9b6407c125eaaa66faa585d735708
parent 467150 27db33dd8cc4c2acad32c772a371cc0ebf552f70
child 467152 e86c0b63db6224e0dee57d54591ee75c6f2b8a15
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1447555, 10120
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1447555 [wpt PR 10120] - Prevent false positives, a=testonly Automatic update from web-platform-testsPrevent false positives (#10120) wpt-commits: f5b48cf93c0c76afacfc7a503b7b100a4c738b71 wpt-pr: 10120 wpt-commits: f5b48cf93c0c76afacfc7a503b7b100a4c738b71 wpt-pr: 10120
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -582613,17 +582613,17 @@
    "a07f98e117bce1f040c5e62ef3acbd2ef7475338",
    "manual"
   ],
   "payment-request/show-method-postmessage-iframe.html": [
    "05167546e8763cb39873de4ca8f4e8e758ba0147",
    "support"
   ],
   "payment-request/show-method-postmessage-manual.https.html": [
-   "d2be1d2872a473a48df7139ecd3804f33187ec8f",
+   "e9ca854ea9e13e7b662f0fa66890832bb2f13b69",
    "manual"
   ],
   "payment-request/updateWith-method-pmi-handling-manual.https.html": [
    "b473073ad106e9e0732adb6bfbed5f54d6ec3194",
    "manual"
   ],
   "payment-request/user-abort-algorithm-manual.https.html": [
    "31a6f480d015c6c715df2001b03f487a205a7311",
--- a/testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html
+++ b/testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html
@@ -4,16 +4,45 @@
 <link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
 "use strict";
 setup({
   explicit_done: true,
   explicit_timeout: true,
+  allow_uncaught_exception: true,
+});
+
+const defaultMethods = Object.freeze([
+  { supportedMethods: "basic-card" },
+  { supportedMethods: "https://apple.com/pay" },
+]);
+
+const defaultDetails = Object.freeze({
+  id: "fail",
+  total: {
+    label: "Total",
+    amount: {
+      currency: "USD",
+      value: "1.00",
+    },
+  },
+});
+
+test(() => {
+  assert_throws(
+    "SecurityError",
+    () => {
+      const request = new PaymentRequest(defaultMethods, defaultDetails);
+      request.show(); // <--- should throw here
+      request.abort();
+    },
+    "throws a SecurityError if not triggered by user activation"
+  );
 });
 
 async function runUserActivation(button) {
   button.disabled = true;
   const { contentWindow: iframeWindow } = document.getElementById("iframe");
   const expectedId = "pass123";
   await Promise.resolve(); // next tick
   const promiseForResponse = new Promise(resolve => {
@@ -22,16 +51,17 @@ async function runUserActivation(button)
   const ops = { id: expectedId, request: "show-payment-request" };
   iframeWindow.postMessage(ops, window.location.origin);
   promise_test(async () => {
     const actualId = await promiseForResponse;
     assert_equals(actualId, expectedId, "ids must match");
   }, button.textContent.trim());
   done();
 }
+
 </script>
 <h2>Test PaymentRequest.show() triggered by user activation using postMessage()</h2>
 <p>
   Tests that user activation works over postMessage().
 </p>
 <p>
   Click on bottom below. Hit "Pay".
 </p>