B2G/gecko/toolkit/components/places/tests/head_common.js
/**
 * Creates a JSON backup in the profile folder folder from a given source file.
 *
 * @param aFilename
 *        Name of the file to copy to the profile folder.  This file must
 *        exist in the directory that contains the test files.
 *
 * @return nsIFile object for the file.
 */
Creates a JSON backup in the profile folder folder from a given source file.
@param aFilename
Name of the file to copy to the profile folder.  This file must
exist in the directory that contains the test files.

@return nsIFile object for the file.
Creates a JSON backup in the profile folder folder from a given source file . @param aFilename Name of the file to copy to the profile folder . This file must exist in the directory that contains the test files . @return nsIFile object for the file .
function create_JSON_backup(aFilename) {
  if (!aFilename)
    do_throw("you must pass a filename to create_JSON_backup function");
  remove_all_JSON_backups();
  let bookmarksBackupDir = gProfD.clone();
  bookmarksBackupDir.append("bookmarkbackups");
  if (!bookmarksBackupDir.exists()) {
    bookmarksBackupDir.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755"));
    do_check_true(bookmarksBackupDir.exists());
  }
  let bookmarksJSONFile = gTestDir.clone();
  bookmarksJSONFile.append(aFilename);
  do_check_true(bookmarksJSONFile.exists());
  bookmarksJSONFile.copyTo(bookmarksBackupDir, FILENAME_BOOKMARKS_JSON);
  let profileBookmarksJSONFile = bookmarksBackupDir.clone();
  profileBookmarksJSONFile.append(FILENAME_BOOKMARKS_JSON);
  do_check_true(profileBookmarksJSONFile.exists());
  return profileBookmarksJSONFile;
}
function create_JSON_backup ( aFilename ) { if ( ! aFilename ) do_throw ( "you must pass a filename to create_JSON_backup function" ) ; remove_all_JSON_backups ( ) ; let bookmarksBackupDir = gProfD . clone ( ) ; bookmarksBackupDir . append ( "bookmarkbackups" ) ; if ( ! bookmarksBackupDir . exists ( ) ) { bookmarksBackupDir . create ( Ci . nsIFile . DIRECTORY_TYPE , parseInt ( "0755" ) ) ; do_check_true ( bookmarksBackupDir . exists ( ) ) ; } let bookmarksJSONFile = gTestDir . clone ( ) ; bookmarksJSONFile . append ( aFilename ) ; do_check_true ( bookmarksJSONFile . exists ( ) ) ; bookmarksJSONFile . copyTo ( bookmarksBackupDir , FILENAME_BOOKMARKS_JSON ) ; let profileBookmarksJSONFile = bookmarksBackupDir . clone ( ) ; profileBookmarksJSONFile . append ( FILENAME_BOOKMARKS_JSON ) ; do_check_true ( profileBookmarksJSONFile . exists ( ) ) ; return profileBookmarksJSONFile ; }
Creates a JSON backup in the profile folder folder from a given source file.
Creates a JSON backup in the profile folder folder from a given source file .