Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

TPS Bookmark Lists

A bookmark asset list is an object with one or more key-value pairs. Each key is the full path for the array of contents specified in the key's value. For example:

var bookmarks_after_second_modify = {
  "menu": [
    { uri: "https://www.getfirefox.com/",
      title: "Get Firefox"
    }
  ],
  "menu/foldera": [
    { uri: "https://mozilla.com",
      title: "Mozilla"
    },
  ]
};

This describes two bookmarks, one in the "menu" folder, and the other in the "folder1" subfolder of "menu".

All bookmark paths must begin with one of the following:

  • "menu": the normal bookmarks menu
  • "toolbar": the bookmarks toolbar
  • "tags": the tags folder
  • "unfiled": the unfiled bookmarks folder
  • "places": the places root folder ("menu", "toolbar", and "unfiled" are all children of this)

Sub-folders are preceded with forward slashes, so "menu/folder1" denotes that "folder1" is a sub-folder of "menu". TPS does not support forward slashes as part of a folder name.

Folder contents

The contents for a folder are given as an array of objects, representing various bookmark types, described below.

Bookmark objects

Valid properties are:

  • uri: the bookmark uri. Required.
  • title: the bookmark title. Optional. Defaults to the bookmark uri.
  • loadInSidebar: true or false. Optional. Toggles the "load in sidebar" property.
  • description: the bookmark description. Optional.
  • tags: an array of tags for the bookmark. Optional.
  • keyword: the keyword for the bookmark. Optional.
  • after: the title of the bookmark item expected to be found AFTER this bookmark; used only in verify and modify actions.
  • before: the title of the bookmark item expected to be found BEFORE this bookmark; used only in verify and modify actions.
  • changes: an object containing new properties to be set for this bookmark when this asset list is used in a modify action. The properties for this object include the uri, title, loadInSidebar, description, tags, keyword properties above, plus two additional properties:
    • location: the full path of the folder that the bookmark should be moved to
    • position: the title of the existing bookmark item, in the current folder, where this bookmark should be moved to (i.e., this bookmark would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below the current one)

Example:

{ uri: "https://www.google.com",
  title: "Google",
  loadInSidebar: false,
  tags: [ "google", "computers", "misc" ]
}

Livemark objects

Valid properties are:

  • livemark: the livemark name. Required.
  • siteURI: the livemark's uri. Optional.
  • feedURI: the livemark's feed uri. Required.
  • after: the title of the bookmark item expected to be found AFTER this livemark; used only in verify and modify actions.
  • before: the title of the bookmark item expected to be found BEFORE this livemark; used only in verify and modify actions.
  • changes: an object containing new properties to be set for this livemark when this asset list is used in a modify action. The properties for this object include the livemark, siteURI, feedURI properties above, plus two additional properties:
    • location: the full path of the folder that the livemark should be moved to
    • position: the title of the existing bookmark item, in the current folder, where this livemark should be moved to (i.e., this livemark would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below the current one)

Example:

{ livemark: "LivemarkOne",
  feedUri: "https://rss.wunderground.com/blog/JeffMasters/rss.xml",
  siteUri: "https://www.wunderground.com/blog/JeffMasters/show.html"
}

Folder objects

Valid properties are:

  • folder: the folder's name. Required.
  • description: the folder's description. Optional.
  • after: the title of the bookmark item expected to be found AFTER this folder; used only in verify and modify actions.
  • before: the title of the bookmark item expected to be found BEFORE this folder; used only in verify and modify actions.
  • changes: an object containing new properties to be set for this folder when this asset list is used in a modify action. The properties for this object include the folder, description properties above, plus two additional properties:
    • location: the full path of the folder that this folder should be moved to
    • position: the title of the existing bookmark item, in the current folder, where this folder should be moved to (i.e., this folder would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below this folder)

Example:

{ folder: "folderb",
  changes: {
    location: "menu/foldera",
    folder: "Folder B",
    description: "folder description"
  }
}

Separator objects

Valid properties are:

  • separator: true, always set for separators
  • before: the title of the bookmark item expected to be found BEFORE this separator; used only in verify and modify actions.
  • changes: an object containing new properties to be set for this separator when this asset list is used in a modify action. The properties for this object are:
    • location: the full path of the folder that this separator should be moved to
    • position: the title of the existing bookmark item, in the current folder, where this separator should be moved to (i.e., this separator would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below this separator)

Example:

{
  separator: true
} 

Bookmark lists and phase actions

Following are the functions you can use in phase actions related to bookmarks:

  • Bookmarks.add - The bookmark items in the list are added to the end of their parent folder in the specified order. That is, the first item is appended to its parent folder, then the second, and so forth. after and before properties are ignored.
  • Bookmarks.verify - The bookmark items in the list are verified to be present. Within each folder, the second item in the list is assumed to be immediately after the first item, and so forth. If the second item in a given folder is not directly after the first item in that folder, it's an error. after and before properties, if specified, are also used to verify an item's position. However, because CrossWeave verifies that bookmark items appear in the order that they are given in the asset list, after and before are not very useful except in verifying the position of the first item in the list.
  • Bookmarks.verifyNot - The bookmark items in the list are verified NOT to be present.
  • Bookmarks.modify - The changes properties of the bookmark items are applied, after the items have been verified to exist. If a location property exists inside the changes object, it is applied before the position property. If location is specified without position, then the bookmark is moved to the end of the specified folder. If position is specified without location, then the bookmark is moved to the specified position within the current folder.
  • Bookmarks.delete - The bookmarks in this list are deleted from the browser.

Document Tags and Contributors

Tags: 
 Contributors to this page: teoli, jgriffin
 Last updated by: teoli,