Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<meta charset="utf-8">
<title>navigator.credentials frame tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body></body>
<script>
promise_test(async t => {
let PROBE_CREDENTIALS = "<script>window.parent.postMessage(String(navigator.credentials), '*');<\/script>";
let frame = document.createElement("iframe");
const loadPromise = new EventWatcher(t, frame, "load").wait_for("load");
frame.src = "data:text/html," + PROBE_CREDENTIALS;
document.body.append(frame);
await loadPromise;
let eventWatcher = new EventWatcher(t, window, "message");
const { data } = await eventWatcher.wait_for("message");
assert_equals(data, "undefined");
}, "navigator.credentials should be undefined in documents generated from `data:` URLs.");
</script>