73 "Folder scope should be disabled for All Bookmarks");
82 "Folder scope should be disabled for History");
91 "Folder scope should be enabled for toolbar folder");
95 search(
bmsvc.toolbarFolder,
"dummy",
"scopeBarFolder");
100 var folderId =
bmsvc.createFolder(
bmsvc.toolbarFolder,
102 bmsvc.DEFAULT_INDEX);
104 search(folderId,
"dummy", defScope);
106 "Folder scope should be enabled for regular subfolder");
110 search(folderId,
"dummy",
"scopeBarFolder");
111 bmsvc.removeItem(folderId);
117 const bmsvc =
Cc[
"@mozilla.org/browser/nav-bookmarks-service;1"].
119 const histsvc =
Cc[
"@mozilla.org/browser/nav-history-service;1"].
133 return aFolderId ===
PlacesUIUtils.leftPaneQueries[
"History"] ?
144 var
doc = libraryWin.document;
145 var scopeButtons = doc.getElementById(
"organizerScopeBar").childNodes;
146 for (let
i = 0;
i < scopeButtons.length;
i++) {
147 if (scopeButtons[
i].checked)
148 return scopeButtons[
i].id;
162 histsvc.queryStringToQueries(aPlaceURI, queries, {}, {});
163 return queries.value[0];
190 function search(aFolderId, aSearchStr, aExpectedScopeButtonId) {
191 var
doc = libraryWin.document;
192 var folderTree = doc.getElementById(
"placesList");
193 var contentTree = doc.getElementById(
"placeContent");
198 folderTree.selectItems([aFolderId]);
199 isnot(folderTree.selectedNode,
null,
200 "Sanity check: left pane tree should have selection after selecting!");
204 if (aFolderId !==
PlacesUIUtils.leftPaneQueries[
"History"]) {
208 is(query.getFolders({}, {})[0], aFolderId,
209 "Content tree's folder should be what was selected in the left pane");
215 var searchBox =
doc.getElementById(
"searchFilter");
216 searchBox.value = aSearchStr;
217 libraryWin.PlacesSearchBox.search(searchBox.value);
220 is(query.searchTerms, aSearchStr,
221 "Content tree's searchTerms should be text in search box");
222 is(
doc.getElementById(
"searchModifiers").hidden,
false,
223 "Scope bar should not be hidden after searching");
226 aFolderId == PlacesUtils.bookmarks.unfiledBookmarksFolder) {
228 contentTree.view.selection.select(0);
229 var foundNode = contentTree.selectedNode;
230 isnot(foundNode,
null,
"Found a valid node");
235 is(query.hasSearchTerms,
false,
236 "Content tree's searchTerms should not exist after search reset");
237 ok(
doc.getElementById(
"searchModifiers").hidden,
238 "Scope bar should be hidden after search reset");
241 "Proper scope button should be selected after searching or resetting");
252 var
doc = libraryWin.document;
253 var button = doc.getElementById(aScopeButtonId);
255 "Sanity check: scope button with ID " + aScopeButtonId +
"should exist");
257 if (button.disabled || button.hidden)
271 libraryWin = aLibraryWin;
272 testCases.forEach(
function (aTest) aTest());
276 PlacesUtils.tagging.untagURI(PlacesUtils._uri(
TEST_URL), [
"dummyTag"]);
277 PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.bookmarks.unfiledBookmarksFolder);
278 PlacesUtils.history.QueryInterface(
Ci.nsIBrowserHistory).removeAllPages();
289 ok(PlacesUtils,
"PlacesUtils in context");
291 PlacesUtils.history.addVisit(PlacesUtils._uri(
TEST_URL),
292 Date.now() * 1000,
null,
293 PlacesUtils.history.TRANSITION_TYPED,
false, 0);
294 PlacesUtils.bookmarks.insertBookmark(PlacesUtils.bookmarks.unfiledBookmarksFolder,
296 PlacesUtils.bookmarks.DEFAULT_INDEX,
298 PlacesUtils.tagging.tagURI(PlacesUtils._uri(
TEST_URL), [
"dummyTag"]);
300 var
ww =
Cc[
"@mozilla.org/embedcomp/window-watcher;1"].
305 if (aTopic ===
"domwindowopened") {
306 ww.unregisterNotification(
this);
307 var
win = aSubject.QueryInterface(
Ci.nsIDOMWindow);
308 win.addEventListener(
"load",
function onLoad(
event) {
309 win.removeEventListener(
"load",
onLoad,
false);
316 ww.registerNotification(windowObserver);
318 "chrome://browser/content/places/places.xul",
320 "chrome,toolbar=yes,dialog=no,resizable",
function getSelectedScopeButtonId()
function doc() browser.contentDocument
function resetSearch(aExpectedScopeButtonId)
function selectScope(aScopeButtonId)
getService(Ci.sbIFaceplateManager)
function testHelper(aLibraryWin)
function search(aFolderId, aSearchStr, aExpectedScopeButtonId)
function queryStringToQuery(aPlaceURI)
function getDefaultScope(aFolderId)
_getSelectedPageStyle s i
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe