blob: 639d8982fcc587fcd52ff16079c124eeb1234df3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
const URL =
"http://mochi.test:8888/browser/browser/base/content/test/protectionsUI/file_protectionsUI_fetch.html";
add_task(async function test_fetch() {
await SpecialPowers.pushPrefEnv({
set: [["privacy.trackingprotection.enabled", true]],
});
await BrowserTestUtils.withNewTab(
{ gBrowser, url: URL },
async function (newTabBrowser) {
let contentBlockingEvent = waitForContentBlockingEvent();
await SpecialPowers.spawn(newTabBrowser, [], async function () {
await content.wrappedJSObject
.test_fetch()
.then(response => Assert.ok(false, "should have denied the request"))
.catch(e => Assert.ok(true, `Caught exception: ${e}`));
});
await contentBlockingEvent;
let gProtectionsHandler = newTabBrowser.ownerGlobal.gProtectionsHandler;
ok(gProtectionsHandler, "got CB object");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
"has detected content blocking"
);
ok(
gProtectionsHandler.iconBox.hasAttribute("active"),
"icon box is active"
);
is(
gProtectionsHandler._trackingProtectionIconTooltipLabel.textContent,
gNavigatorBundle.getString("trackingProtection.icon.activeTooltip2"),
"correct tooltip"
);
}
);
});
|