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

Unified Diff: third_party/WebKit/LayoutTests/nfc/nfc-block-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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html
diff --git a/third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html b/third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..8ee6e38684c31bd794063c414b88e7cacf520c3f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/mojo-helpers.js"></script>
+<script src="resources/nfc-helpers.js"></script>
+<script>
+'use strict';
+
+nfc_test(nfc => {
+ return new Promise((resolve,reject) => {
+ let iframeMockNFC = new nfc.MockNFC;
+ let iframe = document.createElement('iframe');
+ iframe.src = 'resources/push-from-iframe.html';
+ iframe.onload = () => {
+ iframe.contentWindow.gin.define(
+ "Mojo Service Registry",
+ [ 'content/public/renderer/frame_interfaces' ],
+ (frameInterfaces) => {
+ frameInterfaces.addInterfaceOverrideForTesting(
+ nfc.NFC.name,
+ handle => { iframeMockNFC.bindingSet.addBinding(
+ iframeMockNFC, handle); });
+ iframe.contentWindow.postMessage('Ready', '*');
+ });
+ }
+
+ document.body.appendChild(iframe);
+
+ window.onmessage = message => {
+ if (message.data == 'Success') {
+ resolve();
+ } else if (message.data == 'Failure') {
+ reject();
+ }
+ }
+ });
+}, 'Test that WebNFC API is not accessible from iframe context.');
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698