43 let
pb =
Cc[
"@mozilla.org/privatebrowsing;1"].
46 const TEST_URI =
"http://localhost:8888/browser/browser/components/privatebrowsing/test/browser/ctxmenu.html";
50 function checkBlockImageMenuItem(expectedHidden,
callback) {
51 let
tab = gBrowser.addTab();
52 gBrowser.selectedTab =
tab;
53 let
browser = gBrowser.getBrowserForTab(tab);
54 browser.addEventListener(
"load",
function() {
55 browser.removeEventListener(
"load",
arguments.callee,
true);
57 executeSoon(
function() {
58 let contextMenu = document.getElementById(
"contentAreaContextMenu");
59 let blockImage = document.getElementById(
"context-blockimage");
60 let image = browser.contentDocument.getElementsByTagName(
"img")[0];
61 ok(image,
"The content image should be accessible");
63 contextMenu.addEventListener(
"popupshown",
function() {
64 contextMenu.removeEventListener(
"popupshown",
arguments.callee,
false);
66 is(blockImage.hidden, expectedHidden,
67 "The Block Image menu item should " + (expectedHidden ?
"" :
"not ") +
"be hidden");
68 contextMenu.hidePopup();
69 gBrowser.removeTab(tab);
73 document.popupNode = image;
74 EventUtils.synthesizeMouse(image, 2, 2,
75 {type:
"contextmenu", button: 2},
76 browser.contentWindow);
82 checkBlockImageMenuItem(
false,
function() {
83 pb.privateBrowsingEnabled =
true;
84 checkBlockImageMenuItem(
true,
function() {
85 pb.privateBrowsingEnabled =
false;
86 checkBlockImageMenuItem(
false, finish);
getService(Ci.sbIFaceplateManager)
return!aWindow arguments!aWindow arguments[0]