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

Unified Diff: third_party/WebKit/LayoutTests/nfc/resources/push-from-iframe.html

Issue 2657023005: [webnfc] Allow access to WebNFC API only from main frame (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/nfc/resources/push-from-iframe.html
diff --git a/third_party/WebKit/LayoutTests/nfc/resources/push-from-iframe.html b/third_party/WebKit/LayoutTests/nfc/resources/push-from-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..cb7faed99b0f550a638b0e43dad737a9fecd1888
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/nfc/resources/push-from-iframe.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<script>
+'use strict';
+
+window.onmessage = message => {
+ if (message.data === 'Ready') {
+ let onSuccess = () => { parent.postMessage('Failure', '*'); };
+ let onError = error => {
+ if (error.name == 'SecurityError') {
+ parent.postMessage('Success', '*');
+ } else {
+ parent.postMessage('Failure', '*');
+ }
+ }
+ navigator.nfc.push('Test').then(onSuccess, onError);
+ }
+};
+
+</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js ('k') | third_party/WebKit/Source/modules/nfc/NFC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698