зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 970675) for causing failures in browser_privatebrowsing_popupblocker.js CLOSED TREE
Backed out changeset 98f78b0795b7 (bug 970675) Backed out changeset ec59b5b4094a (bug 970675) Backed out changeset 5a1853ea9693 (bug 970675)
This commit is contained in:
Родитель
cd0dc9663a
Коммит
727c4d984a
|
@ -1095,7 +1095,7 @@ var gPopupBlockerObserver = {
|
|||
// XXXjst - Note that when this is fixed to work with multi-framed sites,
|
||||
// also back out the fix for bug 343772 where
|
||||
// nsGlobalWindow::CheckOpenAllow() was changed to also
|
||||
// check if the top window's location is allow-listed.
|
||||
// check if the top window's location is whitelisted.
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
var uriOrPrincipal = browser.contentPrincipal.isContentPrincipal
|
||||
? browser.contentPrincipal
|
||||
|
@ -1113,7 +1113,7 @@ var gPopupBlockerObserver = {
|
|||
pm.testPermissionFromPrincipal(browser.contentPrincipal, "popup") ==
|
||||
pm.ALLOW_ACTION
|
||||
) {
|
||||
// Offer an item to block popups for this site, if an allow-list entry exists
|
||||
// Offer an item to block popups for this site, if a whitelist entry exists
|
||||
// already for it.
|
||||
let blockString = gNavigatorBundle.getFormattedString("popupBlock", [
|
||||
uriHost,
|
||||
|
@ -1132,6 +1132,12 @@ var gPopupBlockerObserver = {
|
|||
blockedPopupAllowSite.hidden = true;
|
||||
}
|
||||
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||
blockedPopupAllowSite.setAttribute("disabled", "true");
|
||||
} else {
|
||||
blockedPopupAllowSite.removeAttribute("disabled");
|
||||
}
|
||||
|
||||
let blockedPopupDontShowMessage = document.getElementById(
|
||||
"blockedPopupDontShowMessage"
|
||||
);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
const baseURL = getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
"https://example.com"
|
||||
"http://example.com"
|
||||
);
|
||||
|
||||
function clearAllPermissionsByPrefix(aPrefix) {
|
||||
|
@ -60,42 +60,21 @@ add_task(async function test_opening_blocked_popups() {
|
|||
baseURL + "popup_blocker.html"
|
||||
);
|
||||
|
||||
await testPopupBlockingToolbar(tab);
|
||||
});
|
||||
|
||||
add_task(async function test_opening_blocked_popups_privateWindow() {
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow({
|
||||
private: true,
|
||||
});
|
||||
// Open the test page.
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
win.gBrowser,
|
||||
baseURL + "popup_blocker.html"
|
||||
);
|
||||
await testPopupBlockingToolbar(tab);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
async function testPopupBlockingToolbar(tab) {
|
||||
let win = tab.ownerGlobal;
|
||||
// Wait for the popup-blocked notification.
|
||||
let notification;
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
(notification = win.gBrowser
|
||||
(notification = gBrowser
|
||||
.getNotificationBox()
|
||||
.getNotificationWithValue("popup-blocked"))
|
||||
);
|
||||
|
||||
// Show the menu.
|
||||
let popupShown = BrowserTestUtils.waitForEvent(win, "popupshown");
|
||||
let popupFilled = waitForBlockedPopups(2, {
|
||||
doc: win.document,
|
||||
});
|
||||
let popupShown = BrowserTestUtils.waitForEvent(window, "popupshown");
|
||||
let popupFilled = waitForBlockedPopups(2);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
notification.buttonContainer.querySelector("button"),
|
||||
{},
|
||||
win
|
||||
{}
|
||||
);
|
||||
let popup_event = await popupShown;
|
||||
let menu = popup_event.target;
|
||||
|
@ -108,10 +87,10 @@ async function testPopupBlockingToolbar(tab) {
|
|||
function onTabOpen(event) {
|
||||
popupTabs.push(event.target);
|
||||
}
|
||||
win.gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen);
|
||||
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen);
|
||||
|
||||
// Press the button.
|
||||
let allow = win.document.getElementById("blockedPopupAllowSite");
|
||||
let allow = document.getElementById("blockedPopupAllowSite");
|
||||
allow.doCommand();
|
||||
await TestUtils.waitForCondition(
|
||||
() =>
|
||||
|
@ -121,7 +100,7 @@ async function testPopupBlockingToolbar(tab) {
|
|||
)
|
||||
);
|
||||
|
||||
win.gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
|
||||
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
|
||||
|
||||
ok(
|
||||
popupTabs[0].linkedBrowser.currentURI.spec.endsWith("popup_blocker_a.html"),
|
||||
|
@ -132,24 +111,12 @@ async function testPopupBlockingToolbar(tab) {
|
|||
"Popup b"
|
||||
);
|
||||
|
||||
let popupPerms = Services.perms.getAllByTypeSince("popup", 0);
|
||||
is(popupPerms.length, 1, "One popup permission added");
|
||||
let popupPerm = popupPerms[0];
|
||||
let expectedExpireType = PrivateBrowsingUtils.isWindowPrivate(win)
|
||||
? Services.perms.EXPIRE_SESSION
|
||||
: Services.perms.EXPIRE_NEVER;
|
||||
is(
|
||||
popupPerm.expireType,
|
||||
expectedExpireType,
|
||||
"Check expireType is appropriate for the window"
|
||||
);
|
||||
|
||||
// Clean up.
|
||||
win.gBrowser.removeTab(tab);
|
||||
gBrowser.removeTab(tab);
|
||||
for (let popup of popupTabs) {
|
||||
win.gBrowser.removeTab(popup);
|
||||
gBrowser.removeTab(popup);
|
||||
}
|
||||
clearAllPermissionsByPrefix("popup");
|
||||
// Ensure the menu closes.
|
||||
menu.hidePopup();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
async function waitForBlockedPopups(numberOfPopups, { doc }) {
|
||||
let toolbarDoc = doc || document;
|
||||
let menupopup = toolbarDoc.getElementById("blockedPopupOptions");
|
||||
async function waitForBlockedPopups(numberOfPopups) {
|
||||
let menupopup = document.getElementById("blockedPopupOptions");
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
let popups = menupopup.querySelectorAll("[popupReportIndex]");
|
||||
return popups.length == numberOfPopups;
|
||||
|
|
|
@ -223,15 +223,6 @@ var gPermissionManager = {
|
|||
return;
|
||||
}
|
||||
|
||||
// Skip private browsing session permissions.
|
||||
if (
|
||||
perm.principal.privateBrowsingId !==
|
||||
Services.scriptSecurityManager.DEFAULT_PRIVATE_BROWSING_ID &&
|
||||
perm.expireType === Services.perms.EXPIRE_SESSION
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
let p = new Permission(perm.principal, perm.type, perm.capability);
|
||||
this._permissions.set(p.origin, p);
|
||||
},
|
||||
|
|
|
@ -792,8 +792,7 @@
|
|||
<button id="popupPolicyButton"
|
||||
is="highlightable-button"
|
||||
class="accessory-button"
|
||||
data-l10n-id="permissions-block-popups-exceptions-button"
|
||||
data-l10n-attrs="searchkeywords"
|
||||
data-l10n-id="permissions-block-popups-exceptions"
|
||||
search-l10n-ids="
|
||||
permissions-address,
|
||||
permissions-exceptions-popup-window.title,
|
||||
|
|
|
@ -475,35 +475,6 @@ add_task(async function testSort() {
|
|||
);
|
||||
});
|
||||
|
||||
add_task(async function testPrivateBrowsingSessionPermissionsAreHidden() {
|
||||
await runTest(
|
||||
async (params, observeAllPromise, apply) => {
|
||||
assertListContents(params, []);
|
||||
|
||||
let uri = Services.io.newURI("http://test.com");
|
||||
let privateBrowsingPrincipal = Services.scriptSecurityManager.createContentPrincipal(
|
||||
uri,
|
||||
{ privateBrowsingId: 1 }
|
||||
);
|
||||
|
||||
// Add a session permission for private browsing.
|
||||
PermissionTestUtils.add(
|
||||
privateBrowsingPrincipal,
|
||||
"cookie",
|
||||
Services.perms.ALLOW_ACTION,
|
||||
Services.perms.EXPIRE_SESSION
|
||||
);
|
||||
|
||||
assertListContents(params, []);
|
||||
|
||||
PermissionTestUtils.remove(uri, "cookie");
|
||||
},
|
||||
params => {
|
||||
return [];
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
function assertListContents(params, expected) {
|
||||
Assert.equal(params.richlistbox.itemCount, expected.length);
|
||||
|
||||
|
|
|
@ -1235,12 +1235,9 @@ permissions-block-popups =
|
|||
.label = Block pop-up windows
|
||||
.accesskey = B
|
||||
|
||||
# "popup" is a misspelling that is more popular than the correct spelling of
|
||||
# "pop-up" so it's included as a search keyword, not displayed in the UI.
|
||||
permissions-block-popups-exceptions-button =
|
||||
permissions-block-popups-exceptions =
|
||||
.label = Exceptions…
|
||||
.accesskey = E
|
||||
.searchkeywords = popups
|
||||
|
||||
permissions-addon-install-warning =
|
||||
.label = Warn you when websites try to install add-ons
|
||||
|
|
Загрузка…
Ссылка в новой задаче