Tests which have to access bookmarks or history related functions can use the PlacesAPI to make testing easier.
Method overview
boolean isBookmarkInFolder(in |
restoreDefaultBookmarks(); |
Attributes
| Attribute | Type | Description |
|---|---|---|
bookmarksService | nsINavBookmarksService | Instance of the bookmarks service to ease the access to bookmark related functions. |
historyService | nsINavHistoryService | Instance of the history service to ease the access to history related functions. |
livemarkService | nsILivemarkService | Instance of the livemark service to ease the access to RSS related functions. |
Methods
isBookmarkInFolder()
Checks to see if the given URI is bookmarked inside the specified folder, which is given by ID.
boolean isBookmarkInFolder( in nsIURI uri, in string folderId );
Parameters
uri- An
nsIURIinstance specifies the URL to check. folderId- Folder which has to be checked for a bookmark with the given URL.
Return value
true if the URIĀ is bookmarked in the specified folder; otherwise false.
Example
// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PlacesAPI'];
var testBookmarkInFolder = function() {
var uri = UtilsAPI.createURI("http://www.mozilla.org");
if (PlacesAPI.isBookmarkInFolder(uri, PlacesAPI.bookmarksService.bookmarksMenuFolder))
controller.window.alert("URI has been bookmarked in the Bookmarks Menu folder");
}
restoreDefaultBookmarks()
Restores all the bookmarks to their initial state.
Warning: Be aware that this function will erase any of the already saved bookmarks.
restoreDefaultBookmarks();
Parameters
None.