Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: content/test/data/payments/payment_app.js

Issue 2893823004: [Payments] Implement openWindow for service worker based payment handler (Closed)
Patch Set: address comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698