43 let
ww =
Cc[
"@mozilla.org/embedcomp/window-watcher;1"].
48 let TEST_URIs = [
"http://www.mozilla.org/test1",
"http://www.mozilla.org/test2"];
49 ok(PlacesUtils,
"checking PlacesUtils, running in chrome context?");
50 let
history = PlacesUtils.history;
51 TEST_URIs.forEach(
function(
TEST_URI) {
52 let visitId = history.addVisit(PlacesUtils._uri(
TEST_URI), Date.now() * 1000,
53 null, PlacesUtils.history.TRANSITION_TYPED,
false, 0);
54 ok(visitId > 0,
TEST_URI +
" successfully marked visited");
57 function testForgetThisSiteVisibility(selectionCount, 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 organizer.PlacesOrganizer.selectLeftPaneQuery(
'History');
68 let PO = organizer.PlacesOrganizer;
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, selectionCount - 1,
true);
78 is(selection.count, selectionCount,
79 "The selected range is as big as expected");
81 let contextmenu = doc.getElementById(
"placesContext");
82 contextmenu.addEventListener(
"popupshown",
function() {
83 contextmenu.removeEventListener(
"popupshown",
arguments.callee,
false);
84 let forgetThisSite = doc.getElementById(
"placesContext_deleteHost");
85 let hideForgetThisSite = (selectionCount != 1);
86 is(forgetThisSite.hidden, hideForgetThisSite,
87 "The Forget this site menu item should " + (hideForgetThisSite ?
"" :
"not ") +
88 "be hidden with " + selectionCount +
" items selected");
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(1,
function() {
116 testForgetThisSiteVisibility(2,
function() {
118 history.QueryInterface(
Ci.nsIBrowserHistory)
function doc() browser.contentDocument
getService(Ci.sbIFaceplateManager)
return!aWindow arguments!aWindow arguments[0]
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe