B2G/gecko/browser/components/places/content/places.js
/**
   * Called when 'Choose File...' is selected from the restore menu.
   * Prompts for a file and restores bookmarks to those in the file.
   */
Called when 'Choose File...' is selected from the restore menu.
Prompts for a file and restores bookmarks to those in the file.
Called when ' Choose File ... ' is selected from the restore menu . Prompts for a file and restores bookmarks to those in the file .
function PO_onRestoreBookmarksFromFile() {
    let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
                 getService(Ci.nsIProperties);
    let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
    let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
    let fpCallback = function fpCallback_done(aResult) {
      if (aResult != Ci.nsIFilePicker.returnCancel) {
        this.restoreBookmarksFromFile(fp.file);
      }
    }.bind(this);
    fp.init(window, PlacesUIUtils.getString("bookmarksRestoreTitle"),
            Ci.nsIFilePicker.modeOpen);
    fp.appendFilter(PlacesUIUtils.getString("bookmarksRestoreFilterName"),
                    PlacesUIUtils.getString("bookmarksRestoreFilterExtension"));
    fp.appendFilters(Ci.nsIFilePicker.filterAll);
    fp.displayDirectory = backupsDir;
    fp.open(fpCallback);
  }
function PO_onRestoreBookmarksFromFile ( ) { let dirSvc = Cc [ "@mozilla.org/file/directory_service;1" ] . getService ( Ci . nsIProperties ) ; let backupsDir = dirSvc . get ( "Desk" , Ci . nsILocalFile ) ; let fp = Cc [ "@mozilla.org/filepicker;1" ] . createInstance ( Ci . nsIFilePicker ) ; let fpCallback = function fpCallback_done ( aResult ) { if ( aResult != Ci . nsIFilePicker . returnCancel ) { this . restoreBookmarksFromFile ( fp . file ) ; } } . bind ( this ) ; fp . init ( window , PlacesUIUtils . getString ( "bookmarksRestoreTitle" ) , Ci . nsIFilePicker . modeOpen ) ; fp . appendFilter ( PlacesUIUtils . getString ( "bookmarksRestoreFilterName" ) , PlacesUIUtils . getString ( "bookmarksRestoreFilterExtension" ) ) ; fp . appendFilters ( Ci . nsIFilePicker . filterAll ) ; fp . displayDirectory = backupsDir ; fp . open ( fpCallback ) ; }
Called when 'Choose File...' is selected from the restore menu.
Called when ' Choose File ... ' is selected from the restore menu .