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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/webusb/resources/open-in-iframe.html

Issue 2789723003: Migrate WebUSB LayoutTests into external/wpt (Closed)
Patch Set: Add README.md and more comments explaining the polyfill 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script> 2 <script>
3 'use strict'; 3 'use strict';
4 window.onmessage = messageEvent => { 4 window.onmessage = messageEvent => {
5 if (messageEvent.data === 'Ready') { 5 if (messageEvent.data === 'Ready') {
6 navigator.usb.addEventListener('connect', connectEvent => { 6 navigator.usb.addEventListener('connect', connectEvent => {
7 connectEvent.device.open().then(() => { 7 connectEvent.device.open().then(() => {
8 parent.postMessage('Success', '*'); 8 parent.postMessage('Success', '*');
9 }).catch(error => { 9 }).catch(error => {
10 console.log(error);
11 parent.postMessage('FAIL: open rejected ' + error, '*'); 10 parent.postMessage('FAIL: open rejected ' + error, '*');
12 }); 11 });
13 }); 12 });
14 parent.postMessage('Ready', '*'); 13 parent.postMessage('Ready', '*');
15 } 14 }
16 }; 15 };
17 </script> 16 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698