Revision 5cddf5d5dabdadf78da597c02f23905b8f4c2265 authored by Rouslan Solomakhin on 06 March 2018, 14:25:18 UTC, committed by Rouslan Solomakhin on 06 March 2018, 14:25:18 UTC
1 parent cee6896
nfc_insecure_context.html
<!DOCTYPE html>
<meta charset=utf-8>
<title>Web NFC Test: insecure context</title>
<link rel="author" title="Intel" href="http://www.intel.com"/>
<link rel="help" href="https://w3c.github.io/web-nfc/"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/nfc_help.js"></script>
<h2>Note</h2>
<ol>
<li>
Run test is an insecure context, e.g. http://example.com/
</li>
</ol>
<div id="log"></div>
<script>
"use strict";
promise_test(t => {
return promise_rejects(t, 'SecurityError', navigator.nfc.push(test_text_data));
}, "nfc.push should fail with SecurityError in an insecure context.");
promise_test(t => {
return promise_rejects(t, 'SecurityError', navigator.nfc.cancelPush());
}, "nfc.cancelPush should fail with SecurityError in an insecure context.");
promise_test(t => {
return promise_rejects(t, 'SecurityError', navigator.nfc.watch(noop));
}, "nfc.watch should fail with SecurityError in an insecure context.");
promise_test(t => {
return promise_rejects(t, 'SecurityError', navigator.nfc.cancelWatch());
}, "nfc.cancelWatch should fail with SecurityError in an insecure context.");
</script>
Computing file changes ...