46 var
Ci = Components.interfaces;
47 var
Cc = Components.classes;
48 var
Cr = Components.results;
51 aMsg = (
"*** PLACES TESTS: " + aMsg);
52 Cc[
"@mozilla.org/consoleservice;1"].getService(
Ci.nsIConsoleService).
53 logStringMessage(aMsg);
58 var
dirSvc =
Cc[
"@mozilla.org/file/directory_service;1"].
62 getFile:
function(prop, persistent) {
63 persistent.value =
true;
65 var bmarks =
gProfD.clone();
66 bmarks.append(
"bookmarks.html");
72 if (iid.equals(
Ci.nsIDirectoryServiceProvider) ||
73 iid.equals(
Ci.nsISupports)) {
76 throw Cr.NS_ERROR_NO_INTERFACE;
84 ID:
"{230de50e-4cd1-11dc-8314-0800200c9a66}",
86 appBuildID:
"2007010101",
88 platformBuildID:
"2007010101",
90 logConsoleErrors:
true,
92 XPCOMABI:
"noarch-spidermonkey",
95 if (iid.equals(
Ci.nsIXULAppInfo) ||
96 iid.equals(
Ci.nsIXULRuntime) ||
97 iid.equals(
Ci.nsISupports))
99 throw Cr.NS_ERROR_NO_INTERFACE;
106 throw Cr.NS_ERROR_NO_AGGREGATION;
107 return XULAppInfo.QueryInterface(iid);
111 var
registrar = Components.manager.QueryInterface(
Ci.nsIComponentRegistrar);
112 registrar.registerFactory(Components.ID(
"{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"),
113 "XULAppInfo",
"@mozilla.org/xre/app-info;1",
116 var
iosvc =
Cc[
"@mozilla.org/network/io-service;1"].getService(
Ci.nsIIOService);
119 return iosvc.newURI(spec,
null,
null);
126 var
bs =
Cc[
"@mozilla.org/browser/nav-bookmarks-service;1"].
129 bs.removeFolderChildren(bs.bookmarksMenuFolder);
130 bs.removeFolderChildren(bs.toolbarFolder);
131 bs.removeFolderChildren(bs.unfiledBookmarksFolder);
140 var
hs =
Cc[
"@mozilla.org/browser/nav-history-service;1"].
142 var
bs =
Cc[
"@mozilla.org/browser/nav-bookmarks-service;1"].
144 var query = hs.getNewQuery();
145 query.setFolders([bs.toolbarFolder, bs.bookmarksMenuFolder, bs.unfiledBookmarksFolder], 3);
146 var
options = hs.getNewQueryOptions();
147 options.queryType =
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
148 var result = hs.executeQuery(query, options);
149 var root = result.root;
150 root.containerOpen =
true;
152 root.containerOpen =
false;
180 do_throw(
"you must pass a filename to create_bookmarks_html function");
182 let bookmarksHTMLFile = gTestDir.clone();
183 bookmarksHTMLFile.append(aFilename);
184 do_check_true(bookmarksHTMLFile.exists());
186 let profileBookmarksHTMLFile =
gProfD.clone();
188 do_check_true(profileBookmarksHTMLFile.exists());
189 return profileBookmarksHTMLFile;
196 let profileBookmarksHTMLFile =
gProfD.clone();
198 if (profileBookmarksHTMLFile.exists()) {
199 profileBookmarksHTMLFile.remove(
false);
200 do_check_false(profileBookmarksHTMLFile.exists());
210 let profileBookmarksHTMLFile =
gProfD.clone();
212 do_check_true(profileBookmarksHTMLFile.exists());
213 return profileBookmarksHTMLFile;
227 do_throw(
"you must pass a filename to create_JSON_backup function");
229 let bookmarksBackupDir =
gProfD.clone();
230 bookmarksBackupDir.append(
"bookmarkbackups");
231 if (!bookmarksBackupDir.exists()) {
232 bookmarksBackupDir.create(
Ci.nsIFile.DIRECTORY_TYPE, 0777);
233 do_check_true(bookmarksBackupDir.exists());
235 let bookmarksJSONFile = gTestDir.clone();
236 bookmarksJSONFile.append(aFilename);
237 do_check_true(bookmarksJSONFile.exists());
239 let profileBookmarksJSONFile = bookmarksBackupDir.clone();
241 do_check_true(profileBookmarksJSONFile.exists());
242 return profileBookmarksJSONFile;
249 let bookmarksBackupDir =
gProfD.clone();
250 bookmarksBackupDir.append(
"bookmarkbackups");
251 if (bookmarksBackupDir.exists()) {
252 bookmarksBackupDir.remove(
true);
253 do_check_false(bookmarksBackupDir.exists());
263 let profileBookmarksJSONFile =
gProfD.clone();
264 profileBookmarksJSONFile.append(
"bookmarkbackups");
266 do_check_true(profileBookmarksJSONFile.exists());
267 return profileBookmarksJSONFile;
278 let db =
Cc[
"@mozilla.org/browser/nav-history-service;1"].
281 let stmt = db.createStatement(
"SELECT * FROM " +
aName);
283 dump(
"\n*** Printing data from " +
aName +
":\n");
285 while (stmt.executeStep()) {
291 dump(stmt.getColumnName(
i) +
"\t");
297 switch (stmt.getTypeOfIndex(
i)) {
298 case Ci.mozIStorageValueArray.VALUE_TYPE_NULL:
301 case Ci.mozIStorageValueArray.VALUE_TYPE_INTEGER:
302 dump(stmt.getInt64(
i) +
"\t");
304 case Ci.mozIStorageValueArray.VALUE_TYPE_FLOAT:
305 dump(stmt.getDouble(
i) +
"\t");
307 case Ci.mozIStorageValueArray.VALUE_TYPE_TEXT:
308 dump(stmt.getString(
i) +
"\t");
316 dump(
"*** There were a total of " + count +
" rows of data.\n\n");
328 let tm =
Cc[
"@mozilla.org/thread-manager;1"].getService(
Ci.nsIThreadManager);
329 while (tm.mainThread.hasPendingEvents())
330 tm.mainThread.processNextEvent(
false);
const NS_APP_USER_PROFILE_50_DIR
do_check_eq(typeof PlacesUtils,"object")
const SMART_BOOKMARKS_VERSION
function check_no_bookmarks()
const FILENAME_BOOKMARKS_JSON
const DEFAULT_BOOKMARKS_ON_TOOLBAR
function create_bookmarks_html(aFilename)
const FILENAME_BOOKMARKS_HTML
const DEFAULT_BOOKMARKS_ON_MENU
function remove_all_bookmarks()
const NS_APP_BOOKMARKS_50_FILE
const SMART_BOOKMARKS_ON_TOOLBAR
getService(Ci.sbIFaceplateManager)
function flush_main_thread_events()
function getFile(fileName)
dirSvc QueryInterface(Ci.nsIDirectoryService).registerProvider(dirProvider)
function dump_table(aName)
function check_JSON_backup()
function remove_all_JSON_backups()
function create_JSON_backup(aFilename)
const NS_APP_PROFILE_DIR_STARTUP
function remove_bookmarks_html()
const SMART_BOOKMARKS_ON_MENU
function check_bookmarks_html()
_getSelectedPageStyle s i