43 let
pb =
Cc[
"@mozilla.org/privatebrowsing;1"].
46 let oldPopupPolicy =
gPrefService.getBoolPref(
"dom.disable_open_during_load");
47 gPrefService.setBoolPref(
"dom.disable_open_during_load",
true);
49 const TEST_URI =
"http://localhost:8888/browser/browser/components/privatebrowsing/test/browser/popup.html";
53 function testPopupBlockerMenuItem(expectedDisabled,
callback) {
54 gBrowser.addEventListener(
"DOMUpdatePageReport",
function() {
55 gBrowser.removeEventListener(
"DOMUpdatePageReport",
arguments.callee,
false);
56 executeSoon(
function() {
57 let pageReportButton = document.getElementById(
"page-report-button");
58 let notification = gBrowser.getNotificationBox().getNotificationWithValue(
"popup-blocked");
60 ok(!pageReportButton.hidden,
"The page report button should not be hidden");
61 ok(notification,
"The notification box should be displayed");
64 document.addEventListener(
"popupshown",
function(
event) {
65 document.removeEventListener(
"popupshown",
arguments.callee,
false);
68 is(document.getElementById(
"blockedPopupAllowSite").getAttribute(
"disabled"),
"true",
69 "The allow popups menu item should be disabled");
71 event.originalTarget.hidePopup();
76 checkMenuItem(
function() {
77 checkMenuItem(
function() {
78 gBrowser.removeTab(
tab);
81 notification.querySelector(
"button").doCommand();
83 EventUtils.synthesizeMouse(document.getElementById(
"page-report-button"), 1, 1, {});
88 gBrowser.selectedTab =
tab;
91 pb.privateBrowsingEnabled =
true;
92 testPopupBlockerMenuItem(
true,
function() {
93 pb.privateBrowsingEnabled =
false;
94 gPrefService.setBoolPref(
"dom.disable_open_during_load", oldPopupPolicy);
getService(Ci.sbIFaceplateManager)
return!aWindow arguments!aWindow arguments[0]