OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 self.addEventListener('paymentrequest', e => { | 5 self.addEventListener('paymentrequest', e => { |
6 e.waitUntil(clients.matchAll({includeUncontrolled: true}).then(clients => { | 6 e.waitUntil(clients.matchAll({includeUncontrolled: true}).then(clients => { |
7 clients.forEach(client => { | 7 clients.forEach(client => { |
8 if (client.url.indexOf('payment_app_invocation.html') != -1) { | 8 if (client.url.indexOf('payment_app_invocation.html') != -1) { |
9 client.postMessage(e.topLevelOrigin); | 9 client.postMessage(e.topLevelOrigin); |
10 client.postMessage(e.paymentRequestOrigin); | 10 client.postMessage(e.paymentRequestOrigin); |
(...skipping 26 matching lines...) Expand all Loading... |
37 return; | 37 return; |
38 } | 38 } |
39 | 39 |
40 if (e.data.methodName) { | 40 if (e.data.methodName) { |
41 resolve(e.data); | 41 resolve(e.data); |
42 return; | 42 return; |
43 } | 43 } |
44 }); | 44 }); |
45 | 45 |
46 // Open a window | 46 // Open a window |
47 clients.openWindow('payment_app_window.html') | 47 e.openWindow('payment_app_window.html') |
48 .then(window_client => { | 48 .then(window_client => { |
49 payment_app_window = window_client; | 49 payment_app_window = window_client; |
50 maybeSendPaymentRequest(); | 50 maybeSendPaymentRequest(); |
51 }) | 51 }) |
52 })); | 52 })); |
53 }); | 53 }); |
OLD | NEW |