mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1446472 - Part 2: Add a test for ensuring that the identity block icon will show without the doorhanger when canvas auto-blocking happens. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D14260 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1e2c28f939
commit
02c605cb9d
@ -118,8 +118,8 @@ async function withNewTabNoInput(grantPermission, browser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function doTestNoInput(grantPermission) {
|
async function doTestNoInput(grantPermission) {
|
||||||
Services.perms.removeFromPrincipal(kPrincipal, kPermission);
|
|
||||||
await BrowserTestUtils.withNewTab(kUrl, withNewTabNoInput.bind(null, grantPermission));
|
await BrowserTestUtils.withNewTab(kUrl, withNewTabNoInput.bind(null, grantPermission));
|
||||||
|
Services.perms.removeFromPrincipal(kPrincipal, kPermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
// With auto-declining disabled (not the default)
|
// With auto-declining disabled (not the default)
|
||||||
@ -129,8 +129,39 @@ add_task(doTestNoInput.bind(null, false));
|
|||||||
// Tests clicking "Allow" button of the permission prompt.
|
// Tests clicking "Allow" button of the permission prompt.
|
||||||
add_task(doTestNoInput.bind(null, true));
|
add_task(doTestNoInput.bind(null, true));
|
||||||
|
|
||||||
// I don't know how to write a test for "Make sure a prompt is not shown"...
|
async function withNewTabAutoBlockNoInput(browser) {
|
||||||
// But ideally we would have one of those...
|
await ContentTask.spawn(browser, null, initTab);
|
||||||
|
await enableResistFingerprinting(true);
|
||||||
|
|
||||||
|
let noShowHandler = () => {
|
||||||
|
ok(false, "The popup notification should not show in this case.");
|
||||||
|
};
|
||||||
|
PopupNotifications.panel.addEventListener("popupshown",
|
||||||
|
noShowHandler, {once: true});
|
||||||
|
|
||||||
|
let promisePopupObserver =
|
||||||
|
TestUtils.topicObserved("PopupNotifications-updateNotShowing");
|
||||||
|
|
||||||
|
// Try to extract canvas data without user inputs.
|
||||||
|
await ContentTask.spawn(browser, null, extractCanvasData);
|
||||||
|
|
||||||
|
await promisePopupObserver;
|
||||||
|
info("There should be no popup shown on the panel.");
|
||||||
|
|
||||||
|
// Check that the icon of canvas permission is shown.
|
||||||
|
let canvasNotification =
|
||||||
|
PopupNotifications.getNotification("canvas-permissions-prompt", browser);
|
||||||
|
|
||||||
|
is(canvasNotification.anchorElement.getAttribute("showing"), "true",
|
||||||
|
"The canvas permission icon is correctly shown.");
|
||||||
|
PopupNotifications.panel.removeEventListener("popupshown", noShowHandler);
|
||||||
|
|
||||||
|
await SpecialPowers.popPrefEnv();
|
||||||
|
}
|
||||||
|
|
||||||
|
add_task(async function doTestAutoBlockNoInput() {
|
||||||
|
await BrowserTestUtils.withNewTab(kUrl, withNewTabAutoBlockNoInput);
|
||||||
|
});
|
||||||
|
|
||||||
function extractCanvasDataUserInput(grantPermission) {
|
function extractCanvasDataUserInput(grantPermission) {
|
||||||
let contentWindow = content.wrappedJSObject;
|
let contentWindow = content.wrappedJSObject;
|
||||||
@ -174,8 +205,8 @@ async function withNewTabInput(grantPermission, browser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function doTestInput(grantPermission, autoDeclineNoInput) {
|
async function doTestInput(grantPermission, autoDeclineNoInput) {
|
||||||
Services.perms.removeFromPrincipal(kPrincipal, kPermission);
|
|
||||||
await BrowserTestUtils.withNewTab(kUrl, withNewTabInput.bind(null, grantPermission));
|
await BrowserTestUtils.withNewTab(kUrl, withNewTabInput.bind(null, grantPermission));
|
||||||
|
Services.perms.removeFromPrincipal(kPrincipal, kPermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
// With auto-declining enabled (the default)
|
// With auto-declining enabled (the default)
|
||||||
|
Loading…
Reference in New Issue
Block a user