- a/Source/WebCore/ChangeLog +13 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2018-01-21  Andy Estes  <aestes@apple.com>
2
3
        [ios] LayoutTest imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html is crashing in JSC::JSONParse
4
        https://bugs.webkit.org/show_bug.cgi?id=177832
5
        <rdar://problem/34805315>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Test: http/tests/paymentrequest/rejects_if_not_active.https.html
10
11
        * Modules/paymentrequest/PaymentRequest.cpp:
12
        (WebCore::PaymentRequest::show): Rejected promise if the document is not active.
13
1
2018-01-20  Andy Estes  <aestes@apple.com>
14
2018-01-20  Andy Estes  <aestes@apple.com>
2
15
3
        [Apple Pay] Stop eagerly loading PassKit.framework
16
        [Apple Pay] Stop eagerly loading PassKit.framework
- a/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp +5 lines
Lines 382-387 static ExceptionOr<JSC::JSValue> parse(ScriptExecutionContext& context, const St a/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp_sec1
382
// https://www.w3.org/TR/payment-request/#show()-method
382
// https://www.w3.org/TR/payment-request/#show()-method
383
void PaymentRequest::show(Document& document, ShowPromise&& promise)
383
void PaymentRequest::show(Document& document, ShowPromise&& promise)
384
{
384
{
385
    if (!document.frame()) {
386
        promise.reject(Exception { AbortError });
387
        return;
388
    }
389
385
    if (!UserGestureIndicator::processingUserGesture()) {
390
    if (!UserGestureIndicator::processingUserGesture()) {
386
        promise.reject(Exception { SecurityError, "show() must be triggered by user activation." });
391
        promise.reject(Exception { SecurityError, "show() must be triggered by user activation." });
387
        return;
392
        return;
- a/LayoutTests/ChangeLog +18 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2018-01-21  Andy Estes  <aestes@apple.com>
2
3
        [ios] LayoutTest imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html is crashing in JSC::JSONParse
4
        https://bugs.webkit.org/show_bug.cgi?id=177832
5
        <rdar://problem/34805315>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Made a copy of imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html
10
        and modified it to handle Apple Pay and user gesture requirements.
11
12
        * http/tests/paymentrequest/rejects_if_not_active.https-expected.txt: Added.
13
        * http/tests/paymentrequest/rejects_if_not_active.https.html: Added.
14
        * http/tests/paymentrequest/resources/page1.html: Added.
15
        * http/tests/paymentrequest/resources/page2.html: Added.
16
        * platform/ios-wk2/TestExpectations:
17
        * platform/mac-wk2/TestExpectations:
18
1
2018-01-20  Jer Noble  <jer.noble@apple.com>
19
2018-01-20  Jer Noble  <jer.noble@apple.com>
2
20
3
        Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout
21
        Release ASSERT when reloading Vimeo page @ WebCore: WebCore::Document::updateLayout
- a/LayoutTests/http/tests/paymentrequest/rejects_if_not_active.https-expected.txt +5 lines
Line 0 a/LayoutTests/http/tests/paymentrequest/rejects_if_not_active.https-expected.txt_sec1
1
2
PASS PaymentRequest.show() aborts if the document is not active 
3
PASS PaymentRequest.show() aborts if the document is active, but not fully active 
4
PASS If a payment request is showing, but its document is navigated away (so no longer fully active), the payment request aborts. 
5
- a/LayoutTests/http/tests/paymentrequest/rejects_if_not_active.https.html +178 lines
Line 0 a/LayoutTests/http/tests/paymentrequest/rejects_if_not_active.https.html_sec1
1
<!DOCTYPE html>
2
<meta charset=utf-8>
3
<link rel="help" href="https://w3c.github.io/payment-request/#show()-method">
4
<title>PaymentRequest show() rejects if doc is not fully active</title>
5
<script src="/js-test-resources/ui-helper.js"></script>
6
<script src="/resources/payment-request.js"></script>
7
<script src="/resources/testharness.js"></script>
8
<script src="/resources/testharnessreport.js"></script>
9
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentrequest-show()">
10
<body>
11
<script>
12
const basicCardMethod = Object.freeze({
13
  supportedMethods: "basic-card",
14
});
15
const applePayMethod = Object.freeze({
16
  supportedMethods: "https://apple.com/apple-pay",
17
  data: {
18
    version: 2,
19
    merchantIdentifier: '',
20
    merchantCapabilities: ['supports3DS'],
21
    supportedNetworks: ['visa', 'masterCard'],
22
    countryCode: 'US',
23
  },
24
});
25
const validMethods = Object.freeze([basicCardMethod, applePayMethod]);
26
const validAmount = Object.freeze({
27
  currency: "USD",
28
  value: "5.00",
29
});
30
const validTotal = Object.freeze({
31
  label: "Total due",
32
  amount: validAmount,
33
});
34
const validDetails = Object.freeze({
35
  total: validTotal,
36
});
37
38
function getLoadedPaymentRequest(iframe, url) {
39
  return new Promise(resolve => {
40
    iframe.addEventListener(
41
      "load",
42
      () => {
43
        const { PaymentRequest } = iframe.contentWindow;
44
        const request = new PaymentRequest(validMethods, validDetails);
45
        resolve(request);
46
      },
47
      { once: true }
48
    );
49
    iframe.src = url;
50
  });
51
}
52
53
promise_test(async t => {
54
  // Check that PaymentRequests can be constructed.
55
  new PaymentRequest(validMethods, validDetails);
56
  const iframe = document.createElement("iframe");
57
  iframe.allowPaymentRequest = true;
58
  document.body.appendChild(iframe);
59
60
  // We first got to page1.html, grab a PaymentRequest instance.
61
  const request1 = await getLoadedPaymentRequest(
62
    iframe,
63
    "resources/page1.html"
64
  );
65
66
  // We navigate the iframe again, putting request1's document into an inactive state.
67
  const request2 = await getLoadedPaymentRequest(
68
    iframe,
69
    "resources/page2.html"
70
  );
71
72
  // Now, request1's relevant global object's document is no longer active.
73
  // So, call .show(), and make sure it rejects appropriately.
74
  await promise_rejects(
75
    t,
76
    "AbortError",
77
    request1.show(),
78
    "Inactive document, so must throw AbortError"
79
  );
80
81
  // request2 has an active document tho, so confirm it's working as expected:
82
  await activateThen(async () => {
83
      request2.show().catch((error) => {});
84
    await request2.abort();
85
  });
86
87
  await activateThen(async () => {
88
    await promise_rejects(
89
      t,
90
      "InvalidStateError",
91
      request2.show(),
92
      "Abort already called, so InvalidStateError"
93
    );
94
  });
95
96
  // We are done, so clean up.
97
  iframe.remove();
98
}, "PaymentRequest.show() aborts if the document is not active");
99
100
promise_test(async t => {
101
  // check that PaymentRequests can be constructed (smoke test).
102
  new PaymentRequest(validMethods, validDetails);
103
104
  // We nest two iframes and wait for them to load.
105
  const outerIframe = document.createElement("iframe");
106
  outerIframe.allowPaymentRequest = true;
107
  document.body.appendChild(outerIframe);
108
  // Load the outer iframe (we don't care about the awaited request)
109
  await getLoadedPaymentRequest(
110
    outerIframe,
111
    "resources/page1.html"
112
  );
113
114
  // Now we create the inner iframe
115
  const innerIframe = outerIframe.contentDocument.createElement("iframe");
116
  innerIframe.allowPaymentRequest = true;
117
118
  // nest them
119
  outerIframe.contentDocument.body.appendChild(innerIframe);
120
121
  // load innerIframe, and get the PaymentRequest instance
122
  const request = await getLoadedPaymentRequest(
123
    innerIframe,
124
    "resources/page2.html"
125
  );
126
127
  // Navigate the outer iframe to a new location.
128
  // Wait for the load event to fire.
129
  await new Promise(resolve => {
130
    outerIframe.addEventListener("load", resolve);
131
    outerIframe.src = "resources/page2.html";
132
  });
133
  // Now, request's relevant global object's document is still active
134
  // (it is the active document of the inner iframe), but is not fully active
135
  // (since the parent of the inner iframe is itself no longer active).
136
  // So, call request.show() and make sure it rejects appropriately.
137
  await promise_rejects(
138
    t,
139
    "AbortError",
140
    request.show(),
141
    "Active, but not fully active, so must throw AbortError"
142
  );
143
144
  // We are done, so clean up.
145
  outerIframe.remove();
146
}, "PaymentRequest.show() aborts if the document is active, but not fully active");
147
148
promise_test(async t => {
149
  // Check that PaymentRequests can be constructed.
150
  new PaymentRequest(validMethods, validDetails);
151
  const iframe = document.createElement("iframe");
152
  iframe.allowPaymentRequest = true;
153
  document.body.appendChild(iframe);
154
  // Make a request in the iframe.
155
  const request = await getLoadedPaymentRequest(
156
    iframe,
157
    "resources/page1.html"
158
  );
159
  // Present the payment sheet.
160
  await activateThen(async () => {
161
    const showPromise = request.show();
162
    // Navigate the iframe to a new location. Wait for the load event to fire.
163
    await new Promise(resolve => {
164
      iframe.addEventListener("load", resolve);
165
      iframe.src = "resources/page2.html";
166
    });
167
    await promise_rejects(
168
      t,
169
      "AbortError",
170
      showPromise,
171
      "The iframe was navigated away, so showPromise must reject with AbortError"
172
    );
173
  });
174
175
  // We are done, so clean up.
176
  iframe.remove();
177
}, "If a payment request is showing, but its document is navigated away (so no longer fully active), the payment request aborts.");
178
</script>
- a/LayoutTests/http/tests/paymentrequest/resources/page1.html +1 lines
Line 0 a/LayoutTests/http/tests/paymentrequest/resources/page1.html_sec1
1
<meta charset="utf-8">
- a/LayoutTests/http/tests/paymentrequest/resources/page2.html +1 lines
Line 0 a/LayoutTests/http/tests/paymentrequest/resources/page2.html_sec1
1
<meta charset="utf-8">
- a/LayoutTests/platform/ios-wk2/TestExpectations -2 / +1 lines
Lines 43-48 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpayment a/LayoutTests/platform/ios-wk2/TestExpectations_sec1
43
imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
43
imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
44
imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
44
imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
45
imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ WontFix ]
45
imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ WontFix ]
46
imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ WontFix ]
46
47
47
 # skip manual payment-request tests
48
 # skip manual payment-request tests
48
imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
49
imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
Lines 1295-1302 imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm a/LayoutTests/platform/ios-wk2/TestExpectations_sec2
1295
1296
1296
webkit.org/b/176240 http/tests/websocket/tests/hybi/handshake-ok-with-legacy-websocket-response-headers.html [ Pass Failure ]
1297
webkit.org/b/176240 http/tests/websocket/tests/hybi/handshake-ok-with-legacy-websocket-response-headers.html [ Pass Failure ]
1297
1298
1298
webkit.org/b/177832 imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ Skip ]
1299
1300
webkit.org/b/173608 webrtc/video-replace-muted-track.html [ Skip ]
1299
webkit.org/b/173608 webrtc/video-replace-muted-track.html [ Skip ]
1301
1300
1302
webkit.org/b/177501 webrtc/video-mute.html [ Pass Timeout ]
1301
webkit.org/b/177501 webrtc/video-mute.html [ Pass Timeout ]
- a/LayoutTests/platform/mac-wk2/TestExpectations -1 / +1 lines
Lines 37-48 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpayment a/LayoutTests/platform/mac-wk2/TestExpectations_sec1
37
webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html [ Skip ]
37
webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html [ Skip ]
38
webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Skip ]
38
webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Skip ]
39
webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
39
webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
40
webkit.org/b/177783 imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ Skip ]
41
40
42
# skip in favor of tests in http/tests/paymentrequest
41
# skip in favor of tests in http/tests/paymentrequest
43
imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
42
imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
44
imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
43
imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
45
imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ WontFix ]
44
imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ WontFix ]
45
imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ WontFix ]
46
46
47
# skip manual payment-request tests
47
# skip manual payment-request tests
48
imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
48
imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]

Return to Bug 177832