blob: 69f17b15e12e337ff488e9aba4b733ec0e5b31b7 [file] [log] [blame]
<!DOCTYPE html>
<title>Credential Manager: invoke methods after the relevant document has been detached.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
async_test(t => {
let openedWindow = window.open("./resources/notify-opener-on-load.html");
let eventWatcher = new EventWatcher(t, window, ["message"]);
let navigatorCredentials = null;
eventWatcher.wait_for("message")
.then(_ => {
navigatorCredentials = openedWindow.navigator.credentials;
publicKeyCredential = openedWindow.PublicKeyCredential;
window.setTimeout(_ => openedWindow.location.reload());
return eventWatcher.wait_for("message");
})
.then(t.step_func_done(_ => {
assert_equals(navigatorCredentials.get(), undefined,
"navigator.credentials.get() should not crash nor return a Promise.");
assert_equals(navigatorCredentials.create(), undefined,
"navigator.credentials.create() should not crash nor return a Promise.");
assert_equals(
navigatorCredentials.store(new PasswordCredential({id: 'a', password: 'b'})),
undefined,
"navigator.credentials.store() should not crash nor return a Promise.");
assert_equals(navigatorCredentials.preventSilentAccess(), undefined,
"navigator.credentials.preventSilentAccess() should not crash nor return a Promise.");
assert_equals(publicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable(), undefined,
"window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() should not crash nor return a Promise.");
}));
});
</script>