B2G/gecko/browser/components/places/content/places.js
/**
   * Restores bookmarks from a JSON file.
   */
Restores bookmarks from a JSON file.
Restores bookmarks from a JSON file .
function PO_restoreBookmarksFromFile(aFile) {
    if (!aFile.leafName.match(/\.json$/)) {
      this._showErrorAlert(PlacesUIUtils.getString("bookmarksRestoreFormatError"));
      return;
    }
    var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].
                  getService(Ci.nsIPromptService);
    if (!prompts.confirm(null,
                         PlacesUIUtils.getString("bookmarksRestoreAlertTitle"),
                         PlacesUIUtils.getString("bookmarksRestoreAlert")))
      return;
    try {
      PlacesUtils.restoreBookmarksFromJSONFile(aFile);
    }
    catch(ex) {
      this._showErrorAlert(PlacesUIUtils.getString("bookmarksRestoreParseError"));
    }
  }
function PO_restoreBookmarksFromFile ( aFile ) { if ( ! aFile . leafName . match ( / \.json$ / ) ) { this . _showErrorAlert ( PlacesUIUtils . getString ( "bookmarksRestoreFormatError" ) ) ; return ; } var prompts = Cc [ "@mozilla.org/embedcomp/prompt-service;1" ] . getService ( Ci . nsIPromptService ) ; if ( ! prompts . confirm ( null , PlacesUIUtils . getString ( "bookmarksRestoreAlertTitle" ) , PlacesUIUtils . getString ( "bookmarksRestoreAlert" ) ) ) return ; try { PlacesUtils . restoreBookmarksFromJSONFile ( aFile ) ; } catch ( ex ) { this . _showErrorAlert ( PlacesUIUtils . getString ( "bookmarksRestoreParseError" ) ) ; } }
Restores bookmarks from a JSON file.
Restores bookmarks from a JSON file .
// check file extension // confirm ok to delete existing bookmarks