toolkit/components/places/nsIPlacesImportExportService.idlScriptable
Provides methods for exporting Places data.
1.0
66
Introduced
Gecko 1.9
Inherits from: nsISupports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11)

In the past, this interface also offered methods for importing Places data, but those methods are now part of the BookmarkHTMLUtils.jsm JavaScript code module. The interface name has been kept for compatibility reasons for code using the export service.

Implemented by: @mozilla.org/import-export-service;1 as a service:

var placesImportExportService = Components.classes["@mozilla.org/import-export-service;1"]
                                .getService(Components.interfaces.nsIPlacesImportExportService);

Method overview

void backupBookmarksFile();
void exportHTMLToFile(in nsILocalFile aFile);
void importHTMLFromFile(in nsILocalFile aFile, in boolean aIsInitialImport); Obsolete since Gecko 14.0
void importHTMLFromFileToFolder(in nsILocalFile aFile, in PRInt64 aFolder, in boolean aIsInitialImport); Obsolete since Gecko 14.0
void importHTMLFromURI(in nsIURI aURI, in boolean aIsInitialImport); Obsolete since Gecko 14.0

Methods

backupBookmarksFile()

Backs up the bookmarks.html file.

void backupBookmarksFile();
Parameters

None.

exportHTMLToFile()

Saves the current bookmarks hierarchy to a bookmarks.html file.

void exportHTMLToFile(
  in nsILocalFile aFile
);
Parameters
aFile
An nsILocalFile indicating where to save the new bookmarks.html file.

importHTMLFromFile()

Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11)

Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code module instead.

Loads the given bookmarks.html file and replaces it with the current bookmarks hierarchy (if aIsInitialImport is true) or appends it (if aIsInitialImport is false).

Three nsIObserverService notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks. Observers will be passed through their data parameters either "html" if aIsInitialImport is false or "html-initial" if aIsInitialImport is true. The observer subject will be null.

void importHTMLFromFile(
  in nsILocalFile aFile,
  in boolean aIsInitialImport
);
Parameters
aFile
The HTML file to import into Places.
aIsInitialImport
Whether this is an initial import or not.

importHTMLFromFileToFolder()

Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11)

Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code module instead.Loads the given bookmarks.html file and puts it in the given folder.

Three nsIObserverService notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the bookmarks. Observers will be passed through their data parameters either "html" if aIsInitialImport is false or "html-initial" if aIsInitialImport is true. The observer subject will be an nsISupportsPRInt64 whose value is aFolder.

void importHTMLFromFileToFolder(
  in nsILocalFile aFile,
  in PRInt64 aFolder,
  in boolean aIsInitialImport
);
Parameters
aFile
The file to import.
aFolder
The ID of the bookmarks folder into which to import the bookmarks.
aIsInitialImport
Whether or not this is an initial import.

importHTMLFromURI()

Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code module instead.

Same thing as importHTMLFromFile(), but takes a URI instead.

void importHTMLFromURI(
  in nsIURI aURI,
  in boolean aIsInitialImport
);
Parameters
aURI
The URI from which to import bookmarks.
aIsInitialImport
Whether or not this is an initial import.

See also