43 let
pb =
Cc[
"@mozilla.org/privatebrowsing;1"].
45 let
ww =
Cc[
"@mozilla.org/embedcomp/window-watcher;1"].
50 const TEST_URI =
"http://www.mozilla.org/privatebrowsing";
51 ok(PlacesUtils,
"checking PlacesUtils, running in chrome context?");
52 let
history = PlacesUtils.history;
53 let visitId = history.addVisit(PlacesUtils._uri(
TEST_URI), Date.now() * 1000,
54 null, PlacesUtils.history.TRANSITION_TYPED,
false, 0);
55 ok(visitId > 0,
TEST_URI +
" successfully marked visited");
57 function testForgetThisSiteVisibility(
expected, funcNext) {
60 if (aTopic ===
"domwindowopened") {
61 ww.unregisterNotification(
this);
62 let organizer = aSubject.QueryInterface(
Ci.nsIDOMWindow);
63 organizer.addEventListener(
"load",
function onLoad(
event) {
64 organizer.removeEventListener(
"load",
onLoad,
false);
65 executeSoon(
function () {
67 let PO = organizer.PlacesOrganizer;
68 PO.selectLeftPaneQuery(
'History');
69 let histContainer = PO._places.selectedNode.QueryInterface(
Ci.nsINavHistoryContainerResultNode);
70 histContainer.containerOpen =
true;
71 PO._places.selectNode(histContainer.getChild(0));
73 let
doc = organizer.document;
74 let tree = PO._content;
75 let selection = tree.view.selection;
76 selection.clearSelection();
77 selection.rangedSelect(0, 0,
true);
78 is(tree.selectedNode.uri,
TEST_URI,
"The correct history item has been selected");
80 let contextmenu = doc.getElementById(
"placesContext");
81 contextmenu.addEventListener(
"popupshown",
function() {
82 contextmenu.removeEventListener(
"popupshown",
arguments.callee,
false);
83 let forgetThisSite = doc.getElementById(
"placesContext_deleteHost");
85 "The Forget This Site menu item should " + (
expected ?
"not " :
"") +
"be hidden");
86 let forgetThisSiteCmd = doc.getElementById(
"placesCmd_deleteDataHost");
87 if (forgetThisSiteCmd.disabled, !
expected,
88 "The Forget This Site command should " + (
expected ?
"not " :
"") +
"be disabled");
90 contextmenu.hidePopup();
96 let
event = document.createEvent(
"MouseEvents");
97 event.initMouseEvent(
"contextmenu",
true,
true, organizer, 0,
98 0, 0, 0, 0,
false,
false,
false,
false,
100 tree.dispatchEvent(
event);
107 ww.registerNotification(observer);
109 "chrome://browser/content/places/places.xul",
111 "chrome,toolbar=yes,dialog=no,resizable",
115 testForgetThisSiteVisibility(
true,
function() {
117 pb.privateBrowsingEnabled =
true;
118 testForgetThisSiteVisibility(
false,
function() {
120 pb.privateBrowsingEnabled =
false;
121 testForgetThisSiteVisibility(
true,
function() {
123 history.QueryInterface(
Ci.nsIBrowserHistory)
function doc() browser.contentDocument
getService(Ci.sbIFaceplateManager)
return!aWindow arguments!aWindow arguments[0]
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe