Index: content/test/data/payments/payment_app.js |
diff --git a/content/test/data/payments/payment_app.js b/content/test/data/payments/payment_app.js |
index ce0246420a7d16d230adb2c358fdc5a69ff162b9..9cb0fd08bc9dd846da4a794f76e40ad15756cc29 100644 |
--- a/content/test/data/payments/payment_app.js |
+++ b/content/test/data/payments/payment_app.js |
@@ -2,7 +2,25 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+function sendResultToTest(data) { |
+ clients.matchAll({includeUncontrolled: true}).then(clients => { |
+ clients.forEach(client => { |
+ if (client.url.indexOf('payment_app_invocation.html') != -1) { |
+ client.postMessage(data); |
+ } |
+ }); |
+ }); |
+} |
+ |
self.addEventListener('paymentrequest', e => { |
+ sendResultToTest(e.topLevelOrigin); |
+ sendResultToTest(e.paymentRequestOrigin); |
+ sendResultToTest(e.paymentRequestId); |
+ sendResultToTest(JSON.stringify(e.methodData)); |
+ sendResultToTest(JSON.stringify(e.total)); |
+ sendResultToTest(JSON.stringify(e.modifiers)); |
+ sendResultToTest(e.instrumentKey); |
nhiroki
2017/05/21 23:41:40
sendResultToTest()s run async operations, so we ma
zino
2017/05/23 14:51:29
Done.
|
+ |
// SW -------------------- openWindow() ------------------> payment_app_window |
// SW <----- postMessage('payment_app_window_ready') ------ payment_app_window |
// SW -------- postMessage('payment_app_request') --------> payment_app_window |