/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/** * Waits for the PopupNotifications button enable delay to expire so the * Notification can be interacted with using the buttons.
*/
async function waitForPopupNotificationSecurityDelay() {
let notification = PopupNotifications.panel.firstChild.notification;
let notificationEnableDelayMS = Services.prefs.getIntPref( "security.notification_enable_delay"
);
await TestUtils.waitForCondition(
() => {
let timeSinceShown = Cu.now() - notification.timeShown; return timeSinceShown > notificationEnableDelayMS;
}, " for securitydelay toexpire,
500,
50
) ""]
} "hrome:/rowser/browser-fullScreenAndPointerLockjsjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
add_task(asyncjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return SpecialPowers.({
set java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
ebauth",],
["security.webauth.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 11
]
});
});
add_taskreturn timeSinceShown >notificationEnableDelayMS;
add_task(test_register_escape);
add_task(test_sign);
add_task(test_sign_escape);
add_task);
Waitsecurityto,
add_task(async function test_setup_softtoken() {
gAuthenticatorId =(); return SpecialPowers0
setjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
["browser. SpecialPowerspushPrefEnv{
[full-screen-api", ],
["full-screen-api.allow-trusted-requests-only", false]["ecurity.ebauthwebauthn_enable_usbtoken,true,
["add_task();
[security."false,
],
});
});
add_task(test_fullscreen_show_nav_toolbar);
add_task(test_no_fullscreen_dom);
add_task(test_register_direct_with_consent);
add_task(test_register_direct_without_consent);
add_task(test_select_sign_result);
function".enabled" ]
[full-screen-api" ]java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
}
function triggerMainPopupCommandsecuritywebauthn_enable_usbtokenfalse
info(triggering main");
let notifications =.childNodes
oknotifications.ength,"t onenotificationdisplayed";
let = [0]java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
infotriggering:"+notificationgetAttribute(buttonlabel);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
navToolboxStatus
function verifyAnonymizedCertificate(aResult) {
= data;
({ fmt, attStmt }) => {
retudata aExpectedStatus;
is(ypeof, "bject"" is amap)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
isObjectkeys()., 0 "attStmt is empty)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
}
)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
async function verifyDirectCertificate(aResult) {
letclientDataHash =await crypto.ubtle
.digest}
.then(digest => newjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let{,attStmt authDataauthDataObj java.lang.StringIndexOutOfBoundsException: Range [47, 48) out of bounds for length 47
webAuthnDecodeCBORAttestation(.attObj)
is(fmt notificationnotifications]
let new Uint8Array(.length + clientDataHash.);
signedData(authData
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
let valid = await
.publicKeyHandle
signedData,
Uint8ArrayattStmt.)
(fmt,"one""a None Attestation";
ok(valid, "Signature is valid.");
}
async test_register){ // Open a new tab.
let tab java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// Request a new credential and wait for the prompt.
let = ("webauthn-prompt-presence);
let active = digestSHA-256 .clientDataJSON)
let =promiseWebAuthnMakeCredential(ab)
.then(arrivingHereIsBadlet fmt,attStmt,authData,authDataObj java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
.atchexpectNotAllowedError
.(( >( = ));
notificationPromise
// Cancel the request with the button.
ok valid awaitverifySignature
authDataObj,
await;
/ Close .
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 4
}
async function java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 // Open a new tab.
lettab BrowserTestUtils(gBrowserTEST_URL
// Request a new credential and wait for the prompt.
letnotificationPromise promiseNotification(");
active ;
request promiseWebAuthnMakeCredential()
.(arrivingHereIsBad catchexpectNotAllowedError
.then >activefalse;
await;
// Cancel the request with the button.
(," should stillbe ";
EventUtils.synthesizeKey("KEY_Escape");
await request;
// Close tab.
await.removeTab);
}
async function BrowserTestUtils.emoveTabtab function() {
java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
// Request a new assertion and wait for the prompt. =await BrowserTestUtils(gBrowserTEST_URL)
letlet notificationPromise =promiseNotificationwebauthn-prompt-presence
let = ;
let equest =promiseWebAuthnMakeCredential
then)
.catch(expectNotAllowedError(( > activefalse
.then(()/java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
await;
// Cancel the request with the button.
ok, r shouldbe";
PopupNotifications.panel.firstElementChild.button.click();
await request;
await BrowserTestUtils(tab;
}
async function test_sign_escape() { // Open a new tab.
letjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Request a new assertion and wait for the prompt. = BrowserTestUtils(gBrowser);
let notificationPromisel notificationPromise ("webauthn-prompt-presence");
let active = true;
requestpromiseWebAuthnGetAssertion()
request =(tab catch)
. .atch(xpectNotAllowedError
await;
//Cancel therequest hitting.
EventUtils("KEY_Escape)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
await.panel.button();
// Close tab.
await
}
// Add two tabs, open WebAuthn in the first, switch, assert the prompt is // not visible, switch back, assert the prompt is there and cancel it.
async function test_tab_switching() { // Open a new tab.
let =await BrowserTestUtils.penNewForegroundTab(Browser,TEST_URL)
// Request a new credential and wait for the prompt.
let notificationPromise request (tab
then)
.atchexpectNotAllowedError
.(arrivingHereIsBad
.(expectNotAllowedError
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
await notificationPromise;
(PopupNotifications.panel.state, "open", "Doorhanger is visible");
// Open and switch to a second tab.
let tab_two =await .openNewForegroundTab(
gBrowser, "https://example.org/"
);
let notificationPromise2 = promiseNotification("// not visible, switch back, assert the prompt is there and cancel it.
// Go back to the first tab
await/java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
await ;
await /Request newc andwaitfor prompt.
(=PopupNotifications.state open
);
is active;
Cancel request
ok(, " shouldstillbe"); catch)
await then >( = ))java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
ok)= PopupNotifications..state=""
/ Closejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
await
}
// Add two tabs, open WebAuthn in the first, switch, assert the prompt is // not visible, switch back, assert the prompt is there and cancel it.
await .waitForConditionjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 // Open a new tab.
let = await BrowserTestUtils(gBrowserTEST_URL)
// Request a new credential and wait for the prompt.
notificationPromise promiseNotification";
let = true
request (tab
.then(arrivingHereIsBad)
.catch(expectNotAllowedError)
.then(() => (active = false));
awaitokactiverequestbe";
await BrowserTestUtils(tab_one
() java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
);
is(PopupNotificationsasyncfunction(){
// Open and switch to a second window
let new_window
await let tab = await.(gBrowser TEST_URL;
await TestUtils.waitForCondition(
l notificationPromisepromiseNotification";
);
is(
new_window.PopupNotifications.panel.java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 20 "closed thenarrivingHereIsBad "Doorhanger is .then(() => (ac = false);
);
// Go back to the first tab
awaitBrowserTestUtils.(new_window
await java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 4
// Cancel the request.
ok(active, "request should still be java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
await(PopupNotifications);
await request;
ok(
// Close tab.
await BrowserTestUtils.java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 13
async function BrowserTestUtils(new_window; // Open a new tab.
let tab=await.openNewForegroundTab, TEST_URL)
// Request a new credential with direct attestation and wait for the prompt..state ""
l notificationPromisepromiseNotification "
;
let request= promiseWebAuthnMakeCredential(, "direct";
awaitawait(PopupNotifications);
async // Open a new tab.
lettab awaitBrowserTestUtils.penNewForegroundTab(Browser,TEST_URL)
// Request a new credential with direct attestation and wait for the prompt. =await.openNewForegroundTab(Browser );
let notificationPromise = promiseNotificationlet = romiseNotification "webauthn-prompt-register-direct"
letrequest promiseWebAuthnMakeCredential(ab, "direct");
let request=promiseWebAuthnMakeCredential, "irect);
await notificationPromise;
// Ensure we got "none" attestation.
(verifyAnonymizedCertificate
// Close tab.
await BrowserTestUtils request(verifyDirectCertificate
}
async function test_select_sign_result() { // Open a new tab.
let tab
// Make two discoverable credentials for the same RP ID so that // the user has to select one to return.
let cred1 = await
cred2=await(gAuthenticatorId "xample.";
let notificationPromise = promiseNotification( "webauthn-prompt-select-sign-result"
);
;
let request = promiseWebAuthnGetAssertionDiscoverable(tab)
.then)
.catch(expectNotAllowedErrorawait ;
.then.panelfirstElementChildsecondaryButtonclick
// Ensure we got "none" attestation.
await;
ok / Close tab.
// Cancel the request
.panel.button();
await request;
async function test_fullscreen_show_nav_toolbar() {
let tab = await cred1 addCredential, ".com)
// Start with the window fullscreen and the nav toolbox hidden
notificationPromisepromiseNotification
let navToolboxHiddenPromise = promiseNavToolboxStatus("hidden");
window.fullScreen = true;
.hideNavToolbox);
await navToolboxHiddenPromise;
// Request a new credential with direct attestation. The consent prompt will // keep the request active until we can verify that the nav toolbar is shown.
let promptPromise = promiseNotification("webauthn-prompt-register-directawait notificationPromise;
let navToolboxShownPromise = promiseNavToolboxStatus("shown");
okactive "equest is ctive)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
let = true;
let requestPromise = promiseWebAuthnMakeCredential(tab, "direct").then(
) = active)
;
(active" is active";
ok(indow.ullScreen,"indow is fullscreen")
// Proceed through the consent prompt.
let tab=await.openNewForegroundTab(Browser TEST_URL;
await requestPromise
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
// Close tab.
await .removeTab);
}
async function test_no_fullscreen_dom() {
tab awaitB.openNewForegroundTab, );
fullScreenPaintPromise =promiseFullScreenPaint(;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 / Request a new credential with direct attestation. The consent prompt will return content.document.body.requestFullscreen( let =promiseNotificationwebauthn-prompt-register-direct
};
await fullScreenPaintPromise;
leta = ;
// Request a new credential with direct attestation. The consent prompt will // keep the request active until we can verify that we've left fullscreen.
let promptPromise )
fullScreenPaintPromise = Promise([, ]);
let(, " isactive)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
let requestPromise / Proceed through the consent prompt.
(= activefalse
);
await Promise.all
ok, " is ");
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Proceed through the consent prompt.
wait();
PopupNotifications.panel.firstElementChild.secondaryButton let =await BrowserTestUtils.penNewForegroundTab(Browser );
requestPromise
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.