--- a/accessible/tests/browser/.eslintrc.js
+++ b/accessible/tests/browser/.eslintrc.js
@@ -8,17 +8,16 @@ module.exports = {
"mozilla/no-aArgs": "error",
"mozilla/no-cpows-in-tests": "error",
"mozilla/reject-importGlobalProperties": "error",
"mozilla/var-only-at-top-level": "error",
"block-scoped-var": "error",
"camelcase": "error",
"comma-dangle": ["error", "never"],
- "comma-style": ["error", "last"],
"complexity": ["error", 20],
"consistent-this": "off",
"curly": ["error", "multi-line"],
"default-case": "off",
"dot-location": ["error", "property"],
"dot-notation": "error",
"eqeqeq": "off",
"func-names": "off",
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -7,18 +7,18 @@
/* import-globals-from ../contentSearchUI.js */
// The process of adding a new default snippet involves:
// * add a new entity to aboutHome.dtd
// * add a <span/> for it in aboutHome.xhtml
// * add an entry here in the proper ordering (based on spans)
// The <a/> part of the snippet will be linked to the corresponding url.
const DEFAULT_SNIPPETS_URLS = [
- "https://www.mozilla.org/firefox/features/?utm_source=snippet&utm_medium=snippet&utm_campaign=default+feature+snippet"
-, "https://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons"
+ "https://www.mozilla.org/firefox/features/?utm_source=snippet&utm_medium=snippet&utm_campaign=default+feature+snippet",
+ "https://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons"
];
const SNIPPETS_UPDATE_INTERVAL_MS = 14400000; // 4 hours.
// IndexedDB storage constants.
const DATABASE_NAME = "abouthome";
const DATABASE_VERSION = 1;
const DATABASE_STORAGE = "persistent";
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -305,21 +305,21 @@ var StarUI = {
// can have our listener called before others waiting for the panel to
// be shown (which probably expect the panel to be fully initialized)
target = target.parentNode;
}
target.addEventListener("popupshown", function(event) {
fn();
}, {"capture": true, "once": true});
};
- gEditItemOverlay.initPanel({ node: aNode
- , onPanelReady
- , hiddenRows: ["description", "location",
- "loadInSidebar", "keyword"]
- , focusedElement: "preferred"});
+ gEditItemOverlay.initPanel({ node: aNode,
+ onPanelReady,
+ hiddenRows: ["description", "location",
+ "loadInSidebar", "keyword"],
+ focusedElement: "preferred"});
this.panel.openPopup(aAnchorElement, aPosition);
},
panelShown:
function SU_panelShown(aEvent) {
if (aEvent.target == this.panel) {
if (this._element("editBookmarkPanelContent").hidden) {
@@ -494,18 +494,18 @@ var PlacesCommandHook = {
if (aShowEditUI && isNewBookmark) {
// If we bookmark the page here but open right into a cancelable
// state (i.e. new bookmark in Library), start batching here so
// all of the actions can be undone in a single undo step.
StarUI.beginBatch();
}
if (description) {
- info.annotations = [{ name: PlacesUIUtils.DESCRIPTION_ANNO
- , value: description }];
+ info.annotations = [{ name: PlacesUIUtils.DESCRIPTION_ANNO,
+ value: description }];
}
info.guid = await PlacesTransactions.NewBookmark(info).transact();
// Set the character-set
if (charset && !PrivateBrowsingUtils.isBrowserPrivate(aBrowser))
PlacesUtils.setCharsetForURI(makeURI(url.href), charset);
}
@@ -567,35 +567,35 @@ var PlacesCommandHook = {
* @param aTitle
* The link text
* @param [optional] aDescription
* The linked page description, if available
*/
async bookmarkLink(aParentId, aURL, aTitle, aDescription = "") {
let node = await PlacesUIUtils.fetchNodeLike({ url: aURL });
if (node) {
- PlacesUIUtils.showBookmarkDialog({ action: "edit"
- , node
+ PlacesUIUtils.showBookmarkDialog({ action: "edit",
+ node
}, window.top);
return;
}
let ip = new InsertionPoint(aParentId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
Components.interfaces.nsITreeView.DROP_ON);
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: "bookmark"
- , uri: makeURI(aURL)
- , title: aTitle
- , description: aDescription
- , defaultInsertionPoint: ip
- , hiddenRows: [ "description"
- , "location"
- , "loadInSidebar"
- , "keyword" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: "bookmark",
+ uri: makeURI(aURL),
+ title: aTitle,
+ description: aDescription,
+ defaultInsertionPoint: ip,
+ hiddenRows: [ "description",
+ "location",
+ "loadInSidebar",
+ "keyword" ]
}, window.top);
},
/**
* List of nsIURI objects characterizing the tabs currently open in the
* browser, modulo pinned tabs. The URIs will be in the order in which their
* corresponding tabs appeared and duplicates are discarded.
*/
@@ -618,20 +618,20 @@ var PlacesCommandHook = {
/**
* Adds a folder with bookmarks to all of the currently open tabs in this
* window.
*/
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
let pages = this.uniqueCurrentPages;
if (pages.length > 1) {
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: "folder"
- , URIList: pages
- , hiddenRows: [ "description" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: "folder",
+ URIList: pages,
+ hiddenRows: [ "description" ]
}, window);
}
},
/**
* Updates disabled state for the "Bookmark All Tabs" command.
*/
updateBookmarkAllTabsCommand:
@@ -662,26 +662,26 @@ var PlacesCommandHook = {
let feedURI = makeURI(url);
let title = feedTitle || gBrowser.contentTitle;
let description = feedSubtitle;
if (!description) {
description = (await this._getPageDetails(gBrowser.selectedBrowser)).description;
}
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: "livemark"
- , feedURI
- , siteURI: gBrowser.currentURI
- , title
- , description
- , defaultInsertionPoint: toolbarIP
- , hiddenRows: [ "feedLocation"
- , "siteLocation"
- , "description" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: "livemark",
+ feedURI,
+ siteURI: gBrowser.currentURI,
+ title,
+ description,
+ defaultInsertionPoint: toolbarIP,
+ hiddenRows: [ "feedLocation",
+ "siteLocation",
+ "description" ]
}, window);
},
/**
* Opens the Places Organizer.
* @param aLeftPaneRoot
* The query to select in the organizer window - options
* are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar,
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5730,24 +5730,24 @@ function contentAreaClick(event, isPanel
event.preventDefault();
return;
}
if (linkNode.getAttribute("rel") == "sidebar") {
// This is the Opera convention for a special link that, when clicked,
// allows to add a sidebar panel. The link's title attribute contains
// the title that should be used for the sidebar panel.
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: "bookmark"
- , uri: makeURI(href)
- , title: linkNode.getAttribute("title")
- , loadBookmarkInSidebar: true
- , hiddenRows: [ "description"
- , "location"
- , "keyword" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: "bookmark",
+ uri: makeURI(href),
+ title: linkNode.getAttribute("title"),
+ loadBookmarkInSidebar: true,
+ hiddenRows: [ "description",
+ "location",
+ "keyword" ]
}, window);
event.preventDefault();
return;
}
}
handleLinkClick(event, href, linkNode);
@@ -6627,28 +6627,28 @@ function AddKeywordForSearchField() {
let mm = gBrowser.selectedBrowser.messageManager;
let onMessage = (message) => {
mm.removeMessageListener("ContextMenu:SearchFieldBookmarkData:Result", onMessage);
let bookmarkData = message.data;
let title = gNavigatorBundle.getFormattedString("addKeywordTitleAutoFill",
[bookmarkData.title]);
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: "bookmark"
- , uri: makeURI(bookmarkData.spec)
- , title
- , description: bookmarkData.description
- , keyword: ""
- , postData: bookmarkData.postData
- , charSet: bookmarkData.charset
- , hiddenRows: [ "location"
- , "description"
- , "tags"
- , "loadInSidebar" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: "bookmark",
+ uri: makeURI(bookmarkData.spec),
+ title,
+ description: bookmarkData.description,
+ keyword: "",
+ postData: bookmarkData.postData,
+ charSet: bookmarkData.charset,
+ hiddenRows: [ "location",
+ "description",
+ "tags",
+ "loadInSidebar" ]
}, window);
}
mm.addMessageListener("ContextMenu:SearchFieldBookmarkData:Result", onMessage);
mm.sendAsyncMessage("ContextMenu:SearchFieldBookmarkData", {}, { target: gContextMenu.target });
}
/**
--- a/browser/base/content/web-panels.js
+++ b/browser/base/content/web-panels.js
@@ -30,18 +30,17 @@ var panelProgressListener = {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
window.parent.document.getElementById("sidebar-throbber").setAttribute("loading", "true");
} else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
window.parent.document.getElementById("sidebar-throbber").removeAttribute("loading");
}
- }
- ,
+ },
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
UpdateBackForwardCommands(getPanelBrowser().webNavigation);
},
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
},
--- a/browser/components/migration/.eslintrc.js
+++ b/browser/components/migration/.eslintrc.js
@@ -1,15 +1,14 @@
"use strict";
module.exports = {
"rules": {
"block-scoped-var": "error",
"comma-dangle": "off",
- "comma-style": ["error", "last"],
"complexity": ["error", {"max": 21}],
"dot-notation": "error",
"indent": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
"max-nested-callbacks": ["error", 3],
"new-parens": "error",
"no-extend-native": "error",
"no-fallthrough": ["error", { "commentPattern": ".*[Ii]ntentional(?:ly)?\\s+fall(?:ing)?[\\s-]*through.*" }],
"no-multi-str": "error",
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -574,44 +574,44 @@ this.PlacesUIUtils = {
getTransactionForData(aData, aType, aNewParentGuid, aIndex, aCopy) {
if (!this.SUPPORTED_FLAVORS.includes(aData.type))
throw new Error(`Unsupported '${aData.type}' data type`);
if ("itemGuid" in aData) {
if (!this.PLACES_FLAVORS.includes(aData.type))
throw new Error(`itemGuid unexpectedly set on ${aData.type} data`);
- let info = { guid: aData.itemGuid
- , newParentGuid: aNewParentGuid
- , newIndex: aIndex };
+ let info = { guid: aData.itemGuid,
+ newParentGuid: aNewParentGuid,
+ newIndex: aIndex };
if (aCopy) {
info.excludingAnnotation = "Places/SmartBookmark";
return PlacesTransactions.Copy(info);
}
return PlacesTransactions.Move(info);
}
// Since it's cheap and harmless, we allow the paste of separators and
// bookmarks from builds that use legacy transactions (i.e. when itemGuid
// was not set on PLACES_FLAVORS data). Containers are a different story,
// and thus disallowed.
if (aData.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER)
throw new Error("Can't copy a container from a legacy-transactions build");
if (aData.type == PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR) {
- return PlacesTransactions.NewSeparator({ parentGuid: aNewParentGuid
- , index: aIndex });
+ return PlacesTransactions.NewSeparator({ parentGuid: aNewParentGuid,
+ index: aIndex });
}
let title = aData.type != PlacesUtils.TYPE_UNICODE ? aData.title
: aData.uri;
- return PlacesTransactions.NewBookmark({ uri: NetUtil.newURI(aData.uri)
- , title
- , parentGuid: aNewParentGuid
- , index: aIndex });
+ return PlacesTransactions.NewBookmark({ uri: NetUtil.newURI(aData.uri),
+ title,
+ parentGuid: aNewParentGuid,
+ index: aIndex });
},
/**
* Shows the bookmark dialog corresponding to the specified info.
*
* @param aInfo
* Describes the item to be edited/added in the dialog.
* See documentation at the top of bookmarkProperties.js
--- a/browser/components/places/content/bookmarkProperties.js
+++ b/browser/components/places/content/bookmarkProperties.js
@@ -304,28 +304,28 @@ var BookmarkPropertiesPanel = {
// Some controls are flexible and we want to update their cached size when
// the dialog is resized.
window.addEventListener("resize", this);
this._beginBatch();
switch (this._action) {
case ACTION_EDIT:
- gEditItemOverlay.initPanel({ node: this._node
- , hiddenRows: this._hiddenRows
- , focusedElement: "first" });
+ gEditItemOverlay.initPanel({ node: this._node,
+ hiddenRows: this._hiddenRows,
+ focusedElement: "first" });
acceptButton.disabled = gEditItemOverlay.readOnly;
break;
case ACTION_ADD:
this._node = await this._promiseNewItem();
// Edit the new item
- gEditItemOverlay.initPanel({ node: this._node
- , hiddenRows: this._hiddenRows
- , postData: this._postData
- , focusedElement: "first" });
+ gEditItemOverlay.initPanel({ node: this._node,
+ hiddenRows: this._hiddenRows,
+ postData: this._postData,
+ focusedElement: "first" });
// Empty location field if the uri is about:blank, this way inserting a new
// url will be easier for the user, Accept button will be automatically
// disabled by the input listener until the user fills the field.
let locationField = this._element("locationField");
if (locationField.value == "about:blank")
locationField.value = "";
@@ -625,22 +625,22 @@ var BookmarkPropertiesPanel = {
async _promiseNewItem() {
if (!PlacesUIUtils.useAsyncTransactions)
return this._createNewItem();
let [containerId, index] = this._getInsertionPointDetails();
let parentGuid = await PlacesUtils.promiseItemGuid(containerId);
let annotations = [];
if (this._description) {
- annotations.push({ name: PlacesUIUtils.DESCRIPTION_ANNO
- , value: this._description });
+ annotations.push({ name: PlacesUIUtils.DESCRIPTION_ANNO,
+ value: this._description });
}
if (this._loadInSidebar) {
- annotations.push({ name: PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO
- , value: true });
+ annotations.push({ name: PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO,
+ value: true });
}
let itemGuid;
let info = { parentGuid, index, title: this._title, annotations };
if (this._itemType == BOOKMARK_ITEM) {
info.url = this._uri;
if (this._keyword)
info.keyword = this._keyword;
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -285,24 +285,24 @@ PlacesController.prototype = {
case "placesCmd_reload":
this.reloadSelectedLivemark();
break;
case "placesCmd_sortBy:name":
this.sortFolderByName().then(null, Components.utils.reportError);
break;
case "placesCmd_createBookmark":
let node = this._view.selectedNode;
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: "bookmark"
- , hiddenRows: [ "description"
- , "keyword"
- , "location"
- , "loadInSidebar" ]
- , uri: NetUtil.newURI(node.uri)
- , title: node.title
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: "bookmark",
+ hiddenRows: [ "description",
+ "keyword",
+ "location",
+ "loadInSidebar" ],
+ uri: NetUtil.newURI(node.uri),
+ title: node.title
}, window.top);
break;
}
},
onEvent: function PC_onEvent(eventName) { },
@@ -672,19 +672,19 @@ PlacesController.prototype = {
/**
* Opens the bookmark properties for the selected URI Node.
*/
showBookmarkPropertiesForSelection() {
let node = this._view.selectedNode;
if (!node)
return;
- PlacesUIUtils.showBookmarkDialog({ action: "edit"
- , node
- , hiddenRows: [ "folderPicker" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "edit",
+ node,
+ hiddenRows: [ "folderPicker" ]
}, window.top);
},
/**
* This method can be run on a URI parameter to ensure that it didn't
* receive a string instead of an nsIURI object.
*/
_assertURINotString: function PC__assertURINotString(value) {
@@ -729,20 +729,20 @@ PlacesController.prototype = {
* the type of the new item (bookmark/livemark/folder)
*/
newItem: function PC_newItem(aType) {
let ip = this._view.insertionPoint;
if (!ip)
throw Cr.NS_ERROR_NOT_AVAILABLE;
let performed =
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: aType
- , defaultInsertionPoint: ip
- , hiddenRows: [ "folderPicker" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: aType,
+ defaultInsertionPoint: ip,
+ hiddenRows: [ "folderPicker" ]
}, window.top);
if (performed) {
// Select the new item.
let insertedNodeId = PlacesUtils.bookmarks
.getIdForItemAt(ip.itemId, ip.index);
this._view.selectItems([insertedNodeId], false);
}
},
@@ -760,18 +760,18 @@ PlacesController.prototype = {
PlacesUtils.transactionManager.doTransaction(txn);
// Select the new item.
let insertedNodeId = PlacesUtils.bookmarks
.getIdForItemAt(ip.itemId, ip.index);
this._view.selectItems([insertedNodeId], false);
return;
}
- let txn = PlacesTransactions.NewSeparator({ parentGuid: await ip.promiseGuid()
- , index: ip.index });
+ let txn = PlacesTransactions.NewSeparator({ parentGuid: await ip.promiseGuid(),
+ index: ip.index });
let guid = await txn.transact();
let itemId = await PlacesUtils.promiseItemId(guid);
// Select the new item.
this._view.selectItems([itemId], false);
},
/**
* Opens a dialog for moving the selected nodes.
--- a/browser/components/places/content/moveBookmarks.js
+++ b/browser/components/places/content/moveBookmarks.js
@@ -46,18 +46,18 @@ var gMoveBookmarksDialog = {
}
PlacesTransactions.batch(async () => {
let newParentGuid = await PlacesUtils.promiseItemGuid(selectedFolderId);
for (let node of this._nodes) {
// Nothing to do if the node is already under the selected folder.
if (node.parent.itemId == selectedFolderId)
continue;
- await PlacesTransactions.Move({ guid: node.bookmarkGuid
- , newParentGuid }).transact();
+ await PlacesTransactions.Move({ guid: node.bookmarkGuid,
+ newParentGuid }).transact();
}
}).then(null, Components.utils.reportError);
},
newFolder: function MBD_newFolder() {
// The command is disabled when the tree is not focused
this.foldersTree.focus();
goDoCommand("placesCmd_new:folder");
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -637,26 +637,26 @@ var PlacesOrganizer = {
}
// Clean up the panel before initing it again.
gEditItemOverlay.uninitPanel(false);
if (selectedNode && !PlacesUtils.nodeIsSeparator(selectedNode)) {
detailsDeck.selectedIndex = 1;
- gEditItemOverlay.initPanel({ node: selectedNode
- , hiddenRows: ["folderPicker"] });
+ gEditItemOverlay.initPanel({ node: selectedNode,
+ hiddenRows: ["folderPicker"] });
this._detectAndSetDetailsPaneMinimalState(selectedNode);
} else if (!selectedNode && aNodeList[0]) {
if (aNodeList.every(PlacesUtils.nodeIsURI)) {
let uris = aNodeList.map(node => PlacesUtils._uri(node.uri));
detailsDeck.selectedIndex = 1;
- gEditItemOverlay.initPanel({ uris
- , hiddenRows: ["folderPicker",
+ gEditItemOverlay.initPanel({ uris,
+ hiddenRows: ["folderPicker",
"loadInSidebar",
"location",
"keyword",
"description",
"name"]});
this._detectAndSetDetailsPaneMinimalState(selectedNode);
} else {
detailsDeck.selectedIndex = 0;
--- a/browser/components/places/tests/browser/browser_library_views_liveupdate.js
+++ b/browser/components/places/tests/browser/browser_library_views_liveupdate.js
@@ -144,18 +144,18 @@ function finishTest() {
}
/**
* The observer is where magic happens, for every change we do it will look for
* nodes positions in the affected views.
*/
var bookmarksObserver = {
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsINavBookmarkObserver
- , Ci.nsIAnnotationObserver
+ Ci.nsINavBookmarkObserver,
+ Ci.nsIAnnotationObserver
]),
// nsIAnnotationObserver
onItemAnnotationSet() {},
onItemAnnotationRemoved() {},
onPageAnnotationSet() {},
onPageAnnotationRemoved() {},
--- a/browser/components/places/tests/browser/browser_views_liveupdate.js
+++ b/browser/components/places/tests/browser/browser_views_liveupdate.js
@@ -181,18 +181,18 @@ function finishTest() {
}
/**
* The observer is where magic happens, for every change we do it will look for
* nodes positions in the affected views.
*/
var bookmarksObserver = {
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsINavBookmarkObserver
- , Ci.nsIAnnotationObserver
+ Ci.nsINavBookmarkObserver,
+ Ci.nsIAnnotationObserver
]),
// nsIAnnotationObserver
onItemAnnotationSet() {},
onItemAnnotationRemoved() {},
onPageAnnotationSet() {},
onPageAnnotationRemoved() {},
--- a/browser/components/places/tests/unit/test_clearHistory_shutdown.js
+++ b/browser/components/places/tests/unit/test_clearHistory_shutdown.js
@@ -4,29 +4,29 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Tests that requesting clear history at shutdown will really clear history.
*/
const URIS = [
- "http://a.example1.com/"
-, "http://b.example1.com/"
-, "http://b.example2.com/"
-, "http://c.example3.com/"
+ "http://a.example1.com/",
+ "http://b.example1.com/",
+ "http://b.example2.com/",
+ "http://c.example3.com/"
];
const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
var EXPECTED_NOTIFICATIONS = [
- "places-shutdown"
-, "places-will-close-connection"
-, "places-expiration-finished"
-, "places-connection-closed"
+ "places-shutdown",
+ "places-will-close-connection",
+ "places-expiration-finished",
+ "places-connection-closed"
];
const UNEXPECTED_NOTIFICATIONS = [
"xpcom-shutdown"
];
const FTP_URL = "ftp://localhost/clearHistoryOnShutdown/";
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -27,19 +27,16 @@ module.exports = {
"array-bracket-spacing": ["error", "never"],
// Forbid spaces inside the curly brackets of object literals.
"object-curly-spacing": ["error", "never"],
// No space padding in parentheses
"space-in-parens": ["error", "never"],
- // Commas at the end of the line not the start
- "comma-style": "error",
-
// Require braces around blocks that start a new line
"curly": ["error", "all"],
// Require function* name()
"generator-star-spacing": ["error", {"before": false, "after": true}],
// Two space indent
"indent": ["error", 2, {"SwitchCase": 1}],
--- a/browser/modules/ContentClick.jsm
+++ b/browser/modules/ContentClick.jsm
@@ -42,24 +42,24 @@ var ContentClick = {
}
return;
}
if (json.bookmark) {
// This is the Opera convention for a special link that, when clicked,
// allows to add a sidebar panel. The link's title attribute contains
// the title that should be used for the sidebar panel.
- PlacesUIUtils.showBookmarkDialog({ action: "add"
- , type: "bookmark"
- , uri: Services.io.newURI(json.href)
- , title: json.title
- , loadBookmarkInSidebar: true
- , hiddenRows: [ "description"
- , "location"
- , "keyword" ]
+ PlacesUIUtils.showBookmarkDialog({ action: "add",
+ type: "bookmark",
+ uri: Services.io.newURI(json.href),
+ title: json.title,
+ loadBookmarkInSidebar: true,
+ hiddenRows: [ "description",
+ "location",
+ "keyword" ]
}, window);
return;
}
// Note: We don't need the sidebar code here.
// Mark the page as a user followed link. This is done so that history can
// distinguish automatic embed visits from user activated ones. For example
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -17,18 +17,18 @@ const PREF_TASKBAR_ENABLED = "enabled"
const PREF_TASKBAR_ITEMCOUNT = "maxListItemCount";
const PREF_TASKBAR_FREQUENT = "frequent.enabled";
const PREF_TASKBAR_RECENT = "recent.enabled";
const PREF_TASKBAR_TASKS = "tasks.enabled";
const PREF_TASKBAR_REFRESH = "refreshInSeconds";
// Hash keys for pendingStatements.
const LIST_TYPE = {
- FREQUENT: 0
-, RECENT: 1
+ FREQUENT: 0,
+ RECENT: 1
}
/**
* Exports
*/
this.EXPORTED_SYMBOLS = [
"WinTaskbarJumpList",
@@ -400,18 +400,18 @@ this.WinTaskbarJumpList =
// Return the pending statement to the caller, to allow cancelation.
return PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
.asyncExecuteLegacyQueries([query], 1, options, {
handleResult(aResultSet) {
for (let row; (row = aResultSet.getNextRow());) {
try {
aCallback.call(aScope,
- { uri: row.getResultByIndex(1)
- , title: row.getResultByIndex(2)
+ { uri: row.getResultByIndex(1),
+ title: row.getResultByIndex(2)
});
} catch (e) {}
}
},
handleError(aError) {
Cu.reportError(
"Async execution error (" + aError.result + "): " + aError.message);
},
--- a/security/.eslintrc.js
+++ b/security/.eslintrc.js
@@ -3,19 +3,16 @@
module.exports = {
"rules": {
// Enforce return statements in callbacks of array methods.
"array-callback-return": "error",
// Braces only needed for multi-line arrow function blocks
"arrow-body-style": ["error", "as-needed"],
- // Commas at the end of the line not the start
- "comma-style": "error",
-
// Verify calls of super() in constructors.
"constructor-super": "error",
// Require braces around blocks that start a new line
"curly": ["error", "multi-line"],
// Require default case in switch statements.
"default-case": "error",
--- a/toolkit/components/autocomplete/tests/unit/test_stopSearch.js
+++ b/toolkit/components/autocomplete/tests/unit/test_stopSearch.js
@@ -60,18 +60,18 @@ AutoCompleteSearch.prototype = {
print("Check stop search has been called");
do_check_true(this.stopSearchInvoked);
this.stopSearchInvoked = false;
},
stopSearch() {
this.stopSearchInvoked = true;
},
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIFactory
- , Ci.nsIAutoCompleteSearch
+ Ci.nsIFactory,
+ Ci.nsIAutoCompleteSearch
]),
createInstance(outer, iid) {
return this.QueryInterface(iid);
}
}
/**
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/extensions/.eslintrc.js
@@ -45,19 +45,16 @@ module.exports = {
"array-bracket-spacing": ["error", "never"],
// Forbid spaces inside the curly brackets of object literals.
"object-curly-spacing": ["error", "never"],
// No space padding in parentheses
"space-in-parens": ["error", "never"],
- // Commas at the end of the line not the start
- "comma-style": "error",
-
// Functions are not required to consistently return something or nothing
"consistent-return": "off",
// Require braces around blocks that start a new line
"curly": ["error", "all"],
// Require function* name()
"generator-star-spacing": ["error", {"before": false, "after": true}],
--- a/toolkit/components/narrate/.eslintrc.js
+++ b/toolkit/components/narrate/.eslintrc.js
@@ -3,17 +3,16 @@
module.exports = {
"rules": {
"mozilla/no-aArgs": "warn",
"mozilla/reject-importGlobalProperties": "warn",
"mozilla/var-only-at-top-level": "warn",
"block-scoped-var": "error",
"camelcase": "warn",
"comma-dangle": "off",
- "comma-style": ["warn", "last"],
"complexity": ["error", {"max": 20}],
"curly": "error",
"dot-location": ["warn", "property"],
"dot-notation": "error",
"generator-star-spacing": ["warn", "after"],
"indent": ["warn", 2, {"SwitchCase": 1}],
"max-len": ["warn", 80, 2, {"ignoreUrls": true}],
"max-nested-callbacks": ["error", 3],
--- a/toolkit/components/passwordmgr/.eslintrc.js
+++ b/toolkit/components/passwordmgr/.eslintrc.js
@@ -1,14 +1,13 @@
"use strict";
module.exports = {
"rules": {
- "comma-style": "error",
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
"complexity": ["error", 43],
"no-unused-vars": ["error", {"args": "none", "vars": "local", "varsIgnorePattern": "^(ids|ignored|unused)$"}],
"semi": ["error", "always"],
}
};
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -177,27 +177,27 @@ var Bookmarks = Object.freeze({
insert(info) {
let now = new Date();
let addedTime = (info && info.dateAdded) || now;
let modTime = addedTime;
if (addedTime > now) {
modTime = now;
}
let insertInfo = validateBookmarkObject(info,
- { type: { defaultValue: this.TYPE_BOOKMARK }
- , index: { defaultValue: this.DEFAULT_INDEX }
- , url: { requiredIf: b => b.type == this.TYPE_BOOKMARK
- , validIf: b => b.type == this.TYPE_BOOKMARK }
- , parentGuid: { required: true }
- , title: { validIf: b => [ this.TYPE_BOOKMARK
- , this.TYPE_FOLDER ].includes(b.type) }
- , dateAdded: { defaultValue: addedTime }
- , lastModified: { defaultValue: modTime,
- validIf: b => b.lastModified >= now || (b.dateAdded && b.lastModified >= b.dateAdded) }
- , source: { defaultValue: this.SOURCES.DEFAULT }
+ { type: { defaultValue: this.TYPE_BOOKMARK },
+ index: { defaultValue: this.DEFAULT_INDEX },
+ url: { requiredIf: b => b.type == this.TYPE_BOOKMARK,
+ validIf: b => b.type == this.TYPE_BOOKMARK },
+ parentGuid: { required: true },
+ title: { validIf: b => [ this.TYPE_BOOKMARK,
+ this.TYPE_FOLDER ].includes(b.type) },
+ dateAdded: { defaultValue: addedTime },
+ lastModified: { defaultValue: modTime,
+ validIf: b => b.lastModified >= now || (b.dateAdded && b.lastModified >= b.dateAdded) },
+ source: { defaultValue: this.SOURCES.DEFAULT }
});
return (async () => {
// Ensure the parent exists.
let parent = await fetchBookmark({ guid: insertInfo.parentGuid });
if (!parent)
throw new Error("parentGuid must be valid");
@@ -337,31 +337,31 @@ var Bookmarks = Object.freeze({
info.guid = PlacesUtils.history.makeGuid();
}
// Set the correct parent guid.
info.parentGuid = parentGuid;
// Ensure to use the same date for dateAdded and lastModified, even if
// dateAdded may be imposed by the caller.
let time = (info && info.dateAdded) || fallbackLastAdded;
let insertInfo = validateBookmarkObject(info, {
- type: { defaultValue: TYPE_BOOKMARK }
- , url: { requiredIf: b => b.type == TYPE_BOOKMARK
- , validIf: b => b.type == TYPE_BOOKMARK }
- , parentGuid: { required: true }
- , title: { validIf: b => [ TYPE_BOOKMARK
- , TYPE_FOLDER ].includes(b.type) }
- , dateAdded: { defaultValue: time
- , validIf: b => !b.lastModified ||
- b.dateAdded <= b.lastModified }
- , lastModified: { defaultValue: time,
- validIf: b => (!b.dateAdded && b.lastModified >= time) ||
- (b.dateAdded && b.lastModified >= b.dateAdded) }
- , index: { replaceWith: indexToUse++ }
- , source: { replaceWith: source }
- , children: { validIf: b => b.type == TYPE_FOLDER && Array.isArray(b.children) }
+ type: { defaultValue: TYPE_BOOKMARK },
+ url: { requiredIf: b => b.type == TYPE_BOOKMARK,
+ validIf: b => b.type == TYPE_BOOKMARK },
+ parentGuid: { required: true },
+ title: { validIf: b => [ TYPE_BOOKMARK,
+ TYPE_FOLDER ].includes(b.type) },
+ dateAdded: { defaultValue: time,
+ validIf: b => !b.lastModified ||
+ b.dateAdded <= b.lastModified },
+ lastModified: { defaultValue: time,
+ validIf: b => (!b.dateAdded && b.lastModified >= time) ||
+ (b.dateAdded && b.lastModified >= b.dateAdded) },
+ index: { replaceWith: indexToUse++ },
+ source: { replaceWith: source },
+ children: { validIf: b => b.type == TYPE_FOLDER && Array.isArray(b.children) }
});
if (shouldUseNullIndices) {
insertInfo.index = null;
}
// Store the URL if this is a bookmark, so we can ensure we create an
// entry in moz_places for it.
if (insertInfo.type == Bookmarks.TYPE_BOOKMARK) {
urlsThatMightNeedPlaces.push(insertInfo.url);
@@ -458,20 +458,20 @@ var Bookmarks = Object.freeze({
* @rejects if it's not possible to update the given bookmark.
* @throws if the arguments are invalid.
*/
update(info) {
// The info object is first validated here to ensure it's consistent, then
// it's compared to the existing item to remove any properties that don't
// need to be updated.
let updateInfo = validateBookmarkObject(info,
- { guid: { required: true }
- , index: { requiredIf: b => b.hasOwnProperty("parentGuid")
- , validIf: b => b.index >= 0 || b.index == this.DEFAULT_INDEX }
- , source: { defaultValue: this.SOURCES.DEFAULT }
+ { guid: { required: true },
+ index: { requiredIf: b => b.hasOwnProperty("parentGuid"),
+ validIf: b => b.index >= 0 || b.index == this.DEFAULT_INDEX },
+ source: { defaultValue: this.SOURCES.DEFAULT }
});
// There should be at last one more property in addition to guid and source.
if (Object.keys(updateInfo).length < 3)
throw new Error("Not enough properties to update");
return (async () => {
// Ensure the item exists.
@@ -485,23 +485,23 @@ var Bookmarks = Object.freeze({
removeSameValueProperties(updateInfo, item);
// Check if anything should still be updated.
if (Object.keys(updateInfo).length < 3) {
// Remove non-enumerable properties.
return Object.assign({}, item);
}
const now = new Date();
updateInfo = validateBookmarkObject(updateInfo,
- { url: { validIf: () => item.type == this.TYPE_BOOKMARK }
- , title: { validIf: () => [ this.TYPE_BOOKMARK
- , this.TYPE_FOLDER ].includes(item.type) }
- , lastModified: { defaultValue: now
- , validIf: b => b.lastModified >= now ||
- b.lastModified >= (b.dateAdded || item.dateAdded) }
- , dateAdded: { defaultValue: item.dateAdded }
+ { url: { validIf: () => item.type == this.TYPE_BOOKMARK },
+ title: { validIf: () => [ this.TYPE_BOOKMARK,
+ this.TYPE_FOLDER ].includes(item.type) },
+ lastModified: { defaultValue: now,
+ validIf: b => b.lastModified >= now ||
+ b.lastModified >= (b.dateAdded || item.dateAdded) },
+ dateAdded: { defaultValue: item.dateAdded }
});
return PlacesUtils.withConnectionWrapper("Bookmarks.jsm: update",
async db => {
let parent;
if (updateInfo.hasOwnProperty("parentGuid")) {
if (item.type == this.TYPE_FOLDER) {
// Make sure we are not moving a folder into itself or one of its
@@ -1086,18 +1086,18 @@ function updateBookmark(info, item, newP
let isTagging = item._grandParentId == PlacesUtils.tagsFolderId;
let syncChangeDelta =
PlacesSyncUtils.bookmarks.determineSyncChangeDelta(info.source);
if (info.hasOwnProperty("url")) {
// Ensure a page exists in moz_places for this URL.
await maybeInsertPlace(db, info.url);
// Update tuples for the update query.
- tuples.set("url", { value: info.url.href
- , fragment: "fk = (SELECT id FROM moz_places WHERE url_hash = hash(:url) AND url = :url)" });
+ tuples.set("url", { value: info.url.href,
+ fragment: "fk = (SELECT id FROM moz_places WHERE url_hash = hash(:url) AND url = :url)" });
}
let newIndex = info.hasOwnProperty("index") ? info.index : item.index;
if (newParent) {
// For simplicity, update the index regardless.
tuples.set("position", { value: newIndex });
if (newParent.guid == item.parentGuid) {
@@ -1145,18 +1145,18 @@ function updateBookmark(info, item, newP
if (info.hasOwnProperty("index") && info.index != item.index) {
++sizeThreshold;
}
if (tuples.has("dateAdded")) {
++sizeThreshold;
}
let needsSyncChange = tuples.size > sizeThreshold;
if (needsSyncChange) {
- tuples.set("syncChangeDelta", { value: syncChangeDelta
- , fragment: "syncChangeCounter = syncChangeCounter + :syncChangeDelta" });
+ tuples.set("syncChangeDelta", { value: syncChangeDelta,
+ fragment: "syncChangeCounter = syncChangeCounter + :syncChangeDelta" });
}
}
if (isTagging) {
// If we're updating a tag entry, bump the sync change counter for
// bookmarks with the tagged URL.
await PlacesSyncUtils.bookmarks.addSyncChangesForBookmarksWithURL(
db, item.url, syncChangeDelta);
--- a/toolkit/components/places/PlacesCategoriesStarter.js
+++ b/toolkit/components/places/PlacesCategoriesStarter.js
@@ -85,17 +85,17 @@ PlacesCategoriesStarter.prototype = {
// nsISupports
classID: Components.ID("803938d5-e26d-4453-bf46-ad4b26e41114"),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(PlacesCategoriesStarter),
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIObserver
- , Ci.nsINavBookmarkObserver
+ Ci.nsIObserver,
+ Ci.nsINavBookmarkObserver
])
};
// Module Registration
var components = [PlacesCategoriesStarter];
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/toolkit/components/places/PlacesSyncUtils.jsm
+++ b/toolkit/components/places/PlacesSyncUtils.jsm
@@ -1346,42 +1346,42 @@ var updateBookmarkMetadata = async funct
newItem.query = updateInfo.query;
}
return newItem;
};
function validateNewBookmark(info) {
let insertInfo = validateSyncBookmarkObject(info,
- { kind: { required: true }
- , syncId: { required: true }
- , url: { requiredIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
- , BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind)
- , validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
- , BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
- , parentSyncId: { required: true }
- , title: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
- , BookmarkSyncUtils.KINDS.QUERY
- , BookmarkSyncUtils.KINDS.FOLDER
- , BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) }
- , query: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY }
- , folder: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY }
- , tags: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
- , BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
- , keyword: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
- , BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
- , description: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
- , BookmarkSyncUtils.KINDS.QUERY
- , BookmarkSyncUtils.KINDS.FOLDER
- , BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) }
- , loadInSidebar: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
- , BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
- , feed: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK }
- , site: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK }
- , dateAdded: { required: false }
+ { kind: { required: true },
+ syncId: { required: true },
+ url: { requiredIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
+ BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind),
+ validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
+ BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
+ parentSyncId: { required: true },
+ title: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
+ BookmarkSyncUtils.KINDS.QUERY,
+ BookmarkSyncUtils.KINDS.FOLDER,
+ BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) },
+ query: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY },
+ folder: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY },
+ tags: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
+ BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
+ keyword: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
+ BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
+ description: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
+ BookmarkSyncUtils.KINDS.QUERY,
+ BookmarkSyncUtils.KINDS.FOLDER,
+ BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) },
+ loadInSidebar: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
+ BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
+ feed: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK },
+ site: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK },
+ dateAdded: { required: false }
});
return insertInfo;
}
// Returns an array of GUIDs for items that have an `anno` with the given `val`.
var fetchGuidsWithAnno = async function(anno, val) {
let db = await PlacesUtils.promiseDBConnection();
--- a/toolkit/components/places/PlacesTransactions.jsm
+++ b/toolkit/components/places/PlacesTransactions.jsm
@@ -1009,22 +1009,22 @@ async function createItemsFromBookmarksT
guid = await PlacesUtils.promiseItemGuid(itemId);
if ("children" in aItem) {
for (let child of aItem.children) {
await createItem(child, guid);
}
}
} else {
let livemark =
- await PlacesUtils.livemarks.addLivemark({ title: aItem.title
- , feedURI
- , siteURI
- , parentId
- , index: aIndex
- , guid});
+ await PlacesUtils.livemarks.addLivemark({ title: aItem.title,
+ feedURI,
+ siteURI,
+ parentId,
+ index: aIndex,
+ guid});
itemId = livemark.id;
}
break;
}
case PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR: {
itemId = PlacesUtils.bookmarks.insertSeparator(parentId, aIndex, guid);
break;
}
@@ -1158,20 +1158,20 @@ PT.NewSeparator.prototype = Object.seal(
*
* When this transaction is executed, it's resolved to the new livemark's
* GUID.
*/
PT.NewLivemark = DefineTransaction(["feedUrl", "title", "parentGuid"],
["siteUrl", "index", "annotations"]);
PT.NewLivemark.prototype = Object.seal({
async execute(aFeedURI, aTitle, aParentGuid, aSiteURI, aIndex, aAnnos) {
- let livemarkInfo = { title: aTitle
- , feedURI: aFeedURI
- , siteURI: aSiteURI
- , index: aIndex };
+ let livemarkInfo = { title: aTitle,
+ feedURI: aFeedURI,
+ siteURI: aSiteURI,
+ index: aIndex };
let createItem = async function() {
livemarkInfo.parentId = await PlacesUtils.promiseItemId(aParentGuid);
let livemark = await PlacesUtils.livemarks.addLivemark(livemarkInfo);
if (aAnnos.length > 0)
PlacesUtils.setAnnotationsForItem(livemark.id, aAnnos);
if ("dateAdded" in livemarkInfo) {
PlacesUtils.bookmarks.setItemDateAdded(livemark.id,
@@ -1500,19 +1500,19 @@ PT.RemoveBookmarksForUrls.prototype = {
PT.Tag = DefineTransaction(["urls", "tags"]);
PT.Tag.prototype = {
async execute(aURIs, aTags) {
let onUndo = [], onRedo = [];
for (let uri of aURIs) {
if (!(await PlacesUtils.bookmarks.fetch({ url: uri }))) {
// Tagging is only allowed for bookmarked URIs (but see 424160).
let createTxn = TransactionsHistory.getRawTransaction(
- PT.NewBookmark({ url: uri
- , tags: aTags
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid }));
+ PT.NewBookmark({ url: uri,
+ tags: aTags,
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid }));
await createTxn.execute();
onUndo.unshift(createTxn.undo.bind(createTxn));
onRedo.push(createTxn.redo.bind(createTxn));
} else {
let currentTags = PlacesUtils.tagging.getTagsForURI(uri);
let newTags = aTags.filter(t => !currentTags.includes(t));
PlacesUtils.tagging.tagURI(uri, newTags);
onUndo.unshift(() => {
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1,33 +1,33 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
this.EXPORTED_SYMBOLS = [
- "PlacesUtils"
-, "PlacesAggregatedTransaction"
-, "PlacesCreateFolderTransaction"
-, "PlacesCreateBookmarkTransaction"
-, "PlacesCreateSeparatorTransaction"
-, "PlacesCreateLivemarkTransaction"
-, "PlacesMoveItemTransaction"
-, "PlacesRemoveItemTransaction"
-, "PlacesEditItemTitleTransaction"
-, "PlacesEditBookmarkURITransaction"
-, "PlacesSetItemAnnotationTransaction"
-, "PlacesSetPageAnnotationTransaction"
-, "PlacesEditBookmarkKeywordTransaction"
-, "PlacesEditBookmarkPostDataTransaction"
-, "PlacesEditItemDateAddedTransaction"
-, "PlacesEditItemLastModifiedTransaction"
-, "PlacesSortFolderByNameTransaction"
-, "PlacesTagURITransaction"
-, "PlacesUntagURITransaction"
+ "PlacesUtils",
+ "PlacesAggregatedTransaction",
+ "PlacesCreateFolderTransaction",
+ "PlacesCreateBookmarkTransaction",
+ "PlacesCreateSeparatorTransaction",
+ "PlacesCreateLivemarkTransaction",
+ "PlacesMoveItemTransaction",
+ "PlacesRemoveItemTransaction",
+ "PlacesEditItemTitleTransaction",
+ "PlacesEditBookmarkURITransaction",
+ "PlacesSetItemAnnotationTransaction",
+ "PlacesSetPageAnnotationTransaction",
+ "PlacesEditBookmarkKeywordTransaction",
+ "PlacesEditBookmarkPostDataTransaction",
+ "PlacesEditItemDateAddedTransaction",
+ "PlacesEditItemLastModifiedTransaction",
+ "PlacesSortFolderByNameTransaction",
+ "PlacesTagURITransaction",
+ "PlacesUntagURITransaction"
];
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
Cu.importGlobalProperties(["URL"]);
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
@@ -222,19 +222,19 @@ const BOOKMARK_VALIDATORS = Object.freez
guid: simpleValidateFunc(v => PlacesUtils.isValidGuid(v)),
parentGuid: simpleValidateFunc(v => typeof(v) == "string" &&
/^[a-zA-Z0-9\-_]{12}$/.test(v)),
index: simpleValidateFunc(v => Number.isInteger(v) &&
v >= PlacesUtils.bookmarks.DEFAULT_INDEX),
dateAdded: simpleValidateFunc(v => v.constructor.name == "Date"),
lastModified: simpleValidateFunc(v => v.constructor.name == "Date"),
type: simpleValidateFunc(v => Number.isInteger(v) &&
- [ PlacesUtils.bookmarks.TYPE_BOOKMARK
- , PlacesUtils.bookmarks.TYPE_FOLDER
- , PlacesUtils.bookmarks.TYPE_SEPARATOR ].includes(v)),
+ [ PlacesUtils.bookmarks.TYPE_BOOKMARK,
+ PlacesUtils.bookmarks.TYPE_FOLDER,
+ PlacesUtils.bookmarks.TYPE_SEPARATOR ].includes(v)),
title: v => {
simpleValidateFunc(val => val === null || typeof(val) == "string").call(this, v);
if (!v)
return null;
return v.slice(0, DB_TITLE_LENGTH_MAX);
},
url: v => {
simpleValidateFunc(val => (typeof(val) == "string" && val.length <= DB_URL_LENGTH_MAX) ||
@@ -579,18 +579,18 @@ this.PlacesUtils = {
return normalizedInput;
},
BOOKMARK_VALIDATORS,
SYNC_BOOKMARK_VALIDATORS,
SYNC_CHANGE_RECORD_VALIDATORS,
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIObserver
- , Ci.nsITransactionListener
+ Ci.nsIObserver,
+ Ci.nsITransactionListener
]),
_shutdownFunctions: [],
registerShutdownFunction: function PU_registerShutdownFunction(aFunc) {
// If this is the first registered function, add the shutdown observer.
if (this._shutdownFunctions.length == 0) {
Services.obs.addObserver(this, this.TOPIC_SHUTDOWN);
}
@@ -1947,20 +1947,20 @@ this.PlacesUtils = {
item_guid: aItemGuid });
let yieldCounter = 0;
for (let row of rows) {
let item;
if (!rootItem) {
try {
// This is the first row.
rootItem = item = await createItemInfoObject(row, true);
- Object.defineProperty(rootItem, "itemsCount", { value: 1
- , writable: true
- , enumerable: false
- , configurable: false });
+ Object.defineProperty(rootItem, "itemsCount", { value: 1,
+ writable: true,
+ enumerable: false,
+ configurable: false });
} catch (ex) {
throw new Error("Failed to fetch the data for the root item " + ex);
}
} else {
try {
// Our query guarantees that we always visit parents ahead of their
// children.
item = await createItemInfoObject(row, false);
@@ -3046,21 +3046,21 @@ this.PlacesCreateLivemarkTransaction =
this.item.annotations = aAnnotations;
}
PlacesCreateLivemarkTransaction.prototype = {
__proto__: BaseTransaction.prototype,
doTransaction: function CLTXN_doTransaction() {
this._promise = PlacesUtils.livemarks.addLivemark(
- { title: this.item.title
- , feedURI: this.item.feedURI
- , parentId: this.item.parentId
- , index: this.item.index
- , siteURI: this.item.siteURI
+ { title: this.item.title,
+ feedURI: this.item.feedURI,
+ parentId: this.item.parentId,
+ index: this.item.index,
+ siteURI: this.item.siteURI
}).then(aLivemark => {
this.item.id = aLivemark.id;
if (this.item.annotations && this.item.annotations.length > 0) {
PlacesUtils.setAnnotationsForItem(this.item.id,
this.item.annotations);
}
}, Cu.reportError);
},
@@ -3117,22 +3117,22 @@ PlacesRemoveLivemarkTransaction.prototyp
undoTransaction: function RLTXN_undoTransaction() {
// Undo work must be serialized, otherwise won't be able to know the
// feedURI and siteURI of the livemark.
// The getLivemark callback is expected to receive a failure status but it
// is used just to serialize, so doesn't matter.
PlacesUtils.livemarks.getLivemark({ id: this.item.id })
.then(null, () => {
- PlacesUtils.livemarks.addLivemark({ parentId: this.item.parentId
- , title: this.item.title
- , siteURI: this.item.siteURI
- , feedURI: this.item.feedURI
- , index: this.item.index
- , lastModified: this.item.lastModified
+ PlacesUtils.livemarks.addLivemark({ parentId: this.item.parentId,
+ title: this.item.title,
+ siteURI: this.item.siteURI,
+ feedURI: this.item.feedURI,
+ index: this.item.index,
+ lastModified: this.item.lastModified
}).then(
aLivemark => {
let itemId = aLivemark.id;
PlacesUtils.bookmarks.setItemDateAdded(itemId, this.item.dateAdded);
PlacesUtils.setAnnotationsForItem(itemId, this.item.annotations);
}, Cu.reportError);
});
}
--- a/toolkit/components/places/nsLivemarkService.js
+++ b/toolkit/components/places/nsLivemarkService.js
@@ -202,26 +202,26 @@ LivemarkService.prototype = {
dateAdded: toDate(aLivemarkInfo.dateAdded) || toDate(aLivemarkInfo.lastModified),
source: aLivemarkInfo.source,
});
// Set feed and site URI annotations.
let id = await PlacesUtils.promiseItemId(folder.guid);
// Create the internal Livemark object.
- let livemark = new Livemark({ id
- , title: folder.title
- , parentGuid: folder.parentGuid
- , parentId: await PlacesUtils.promiseItemId(folder.parentGuid)
- , index: folder.index
- , feedURI: aLivemarkInfo.feedURI
- , siteURI: aLivemarkInfo.siteURI
- , guid: folder.guid
- , dateAdded: toPRTime(folder.dateAdded)
- , lastModified: toPRTime(folder.lastModified)
+ let livemark = new Livemark({ id,
+ title: folder.title,
+ parentGuid: folder.parentGuid,
+ parentId: await PlacesUtils.promiseItemId(folder.parentGuid),
+ index: folder.index,
+ feedURI: aLivemarkInfo.feedURI,
+ siteURI: aLivemarkInfo.siteURI,
+ guid: folder.guid,
+ dateAdded: toPRTime(folder.dateAdded),
+ lastModified: toPRTime(folder.lastModified)
});
livemark.writeFeedURI(aLivemarkInfo.feedURI, aLivemarkInfo.source);
if (aLivemarkInfo.siteURI) {
livemark.writeSiteURI(aLivemarkInfo.siteURI, aLivemarkInfo.source);
}
if (aLivemarkInfo.lastModified) {
@@ -388,21 +388,21 @@ LivemarkService.prototype = {
// nsISupports
classID: Components.ID("{dca61eb5-c7cd-4df1-b0fb-d0722baba251}"),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(LivemarkService),
QueryInterface: XPCOMUtils.generateQI([
- Ci.mozIAsyncLivemarks
- , Ci.nsINavBookmarkObserver
- , Ci.nsINavHistoryObserver
- , Ci.nsIObserver
- , Ci.nsISupportsWeakReference
+ Ci.mozIAsyncLivemarks,
+ Ci.nsINavBookmarkObserver,
+ Ci.nsINavHistoryObserver,
+ Ci.nsIObserver,
+ Ci.nsISupportsWeakReference
])
};
// Livemark
/**
* Object used internally to represent a livemark.
*
@@ -861,16 +861,16 @@ LivemarkLoadListener.prototype = {
// nsIInterfaceRequestor
getInterface(aIID) {
return this.QueryInterface(aIID);
},
// nsISupports
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIFeedResultListener
- , Ci.nsIStreamListener
- , Ci.nsIRequestObserver
- , Ci.nsIInterfaceRequestor
+ Ci.nsIFeedResultListener,
+ Ci.nsIStreamListener,
+ Ci.nsIRequestObserver,
+ Ci.nsIInterfaceRequestor
])
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LivemarkService]);
--- a/toolkit/components/places/nsPlacesExpiration.js
+++ b/toolkit/components/places/nsPlacesExpiration.js
@@ -1081,20 +1081,20 @@ nsPlacesExpiration.prototype = {
// nsISupports
classID: Components.ID("705a423f-2f69-42f3-b9fe-1517e0dee56f"),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesExpiration),
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIObserver
- , Ci.nsINavHistoryObserver
- , Ci.nsITimerCallback
- , Ci.mozIStorageStatementCallback
- , Ci.nsISupportsWeakReference
+ Ci.nsIObserver,
+ Ci.nsINavHistoryObserver,
+ Ci.nsITimerCallback,
+ Ci.mozIStorageStatementCallback,
+ Ci.nsISupportsWeakReference
])
};
// Module Registration
var components = [nsPlacesExpiration];
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/toolkit/components/places/nsTaggingService.js
+++ b/toolkit/components/places/nsTaggingService.js
@@ -473,19 +473,19 @@ TaggingService.prototype = {
// nsISupports
classID: Components.ID("{bbc23860-2553-479d-8b78-94d9038334f7}"),
_xpcom_factory: XPCOMUtils.generateSingletonFactory(TaggingService),
QueryInterface: XPCOMUtils.generateQI([
- Ci.nsITaggingService
- , Ci.nsINavBookmarkObserver
- , Ci.nsIObserver
+ Ci.nsITaggingService,
+ Ci.nsINavBookmarkObserver,
+ Ci.nsIObserver
])
};
function TagAutoCompleteResult(searchString, searchResult,
defaultIndex, errorDescription,
results, comments) {
this._searchString = searchString;
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -131,21 +131,21 @@ async function task_populateDB(aArray) {
parentGuid: qdata.parentGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: qdata.title,
index: qdata.index
});
}
if (qdata.isLivemark) {
- await PlacesUtils.livemarks.addLivemark({ title: qdata.title
- , parentId: (await PlacesUtils.promiseItemId(qdata.parentGuid))
- , index: qdata.index
- , feedURI: uri(qdata.feedURI)
- , siteURI: uri(qdata.uri)
+ await PlacesUtils.livemarks.addLivemark({ title: qdata.title,
+ parentId: (await PlacesUtils.promiseItemId(qdata.parentGuid)),
+ index: qdata.index,
+ feedURI: uri(qdata.feedURI),
+ siteURI: uri(qdata.uri)
});
}
if (qdata.isBookmark) {
let data = {
parentGuid: qdata.parentGuid,
index: qdata.index,
title: qdata.title,
--- a/toolkit/components/places/tests/queries/test_searchterms-bookmarklets.js
+++ b/toolkit/components/places/tests/queries/test_searchterms-bookmarklets.js
@@ -1,24 +1,24 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Check that bookmarklets are returned by searches with searchTerms.
var testData = [
- { isInQuery: true
- , isBookmark: true
- , title: "bookmark 1"
- , uri: "http://mozilla.org/script/"
+ { isInQuery: true,
+ isBookmark: true,
+ title: "bookmark 1",
+ uri: "http://mozilla.org/script/"
},
- { isInQuery: true
- , isBookmark: true
- , title: "bookmark 2"
- , uri: "javascript:alert('moz');"
+ { isInQuery: true,
+ isBookmark: true,
+ title: "bookmark 2",
+ uri: "javascript:alert('moz');"
}
];
function run_test() {
run_next_test();
}
add_task(async function test_initalize() {
--- a/toolkit/components/places/tests/unit/test_1085291.js
+++ b/toolkit/components/places/tests/unit/test_1085291.js
@@ -9,34 +9,34 @@ add_task(async function() {
bmInfo = await PlacesUtils.bookmarks.insert(bmInfo);
let node = root.getChild(root.childCount - 1);
Assert.equal(node.bookmarkGuid, bmInfo.guid);
Assert.equal(node.dateAdded, bmInfo.dateAdded * 1000);
Assert.equal(node.lastModified, bmInfo.lastModified * 1000);
}
// Normal bookmark.
- await insertAndTest({ parentGuid: root.bookmarkGuid
- , type: PlacesUtils.bookmarks.TYPE_BOOKMARK
- , title: "Test Bookmark"
- , url: "http://test.url.tld" });
+ await insertAndTest({ parentGuid: root.bookmarkGuid,
+ type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
+ title: "Test Bookmark",
+ url: "http://test.url.tld" });
// place: query
- await insertAndTest({ parentGuid: root.bookmarkGuid
- , type: PlacesUtils.bookmarks.TYPE_BOOKMARK
- , title: "Test Query"
- , url: "place:folder=BOOKMARKS_MENU" });
+ await insertAndTest({ parentGuid: root.bookmarkGuid,
+ type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
+ title: "Test Query",
+ url: "place:folder=BOOKMARKS_MENU" });
// folder
- await insertAndTest({ parentGuid: root.bookmarkGuid
- , type: PlacesUtils.bookmarks.TYPE_FOLDER
- , title: "Test Folder" });
+ await insertAndTest({ parentGuid: root.bookmarkGuid,
+ type: PlacesUtils.bookmarks.TYPE_FOLDER,
+ title: "Test Folder" });
// separator
- await insertAndTest({ parentGuid: root.bookmarkGuid
- , type: PlacesUtils.bookmarks.TYPE_SEPARATOR });
+ await insertAndTest({ parentGuid: root.bookmarkGuid,
+ type: PlacesUtils.bookmarks.TYPE_SEPARATOR });
root.containerOpen = false;
});
function run_test() {
run_next_test();
}
--- a/toolkit/components/places/tests/unit/test_399264_query_to_string.js
+++ b/toolkit/components/places/tests/unit/test_399264_query_to_string.js
@@ -21,28 +21,28 @@ function query_string(aFolderID) {
return hs.queriesToQueryString([query], 1, options);
}
function run_test() {
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
const QUERIES = [
- "folder=PLACES_ROOT"
- , "folder=BOOKMARKS_MENU"
- , "folder=TAGS"
- , "folder=UNFILED_BOOKMARKS"
- , "folder=TOOLBAR"
+ "folder=PLACES_ROOT",
+ "folder=BOOKMARKS_MENU",
+ "folder=TAGS",
+ "folder=UNFILED_BOOKMARKS",
+ "folder=TOOLBAR"
];
const FOLDER_IDS = [
- bs.placesRoot
- , bs.bookmarksMenuFolder
- , bs.tagsFolder
- , bs.unfiledBookmarksFolder
- , bs.toolbarFolder
+ bs.placesRoot,
+ bs.bookmarksMenuFolder,
+ bs.tagsFolder,
+ bs.unfiledBookmarksFolder,
+ bs.toolbarFolder
];
for (var i = 0; i < QUERIES.length; i++) {
var result = query_string(FOLDER_IDS[i]);
dump("Looking for '" + QUERIES[i] + "' in '" + result + "'\n");
do_check_neq(-1, result.indexOf(QUERIES[i]));
}
--- a/toolkit/components/places/tests/unit/test_399264_string_to_query.js
+++ b/toolkit/components/places/tests/unit/test_399264_string_to_query.js
@@ -29,28 +29,28 @@ function folder_id(aQuery) {
return folderID;
}
function run_test() {
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
const QUERIES = [
- "place:folder=PLACES_ROOT"
- , "place:folder=BOOKMARKS_MENU"
- , "place:folder=TAGS"
- , "place:folder=UNFILED_BOOKMARKS"
- , "place:folder=TOOLBAR"
+ "place:folder=PLACES_ROOT",
+ "place:folder=BOOKMARKS_MENU",
+ "place:folder=TAGS",
+ "place:folder=UNFILED_BOOKMARKS",
+ "place:folder=TOOLBAR"
];
const FOLDER_IDS = [
- bs.placesRoot
- , bs.bookmarksMenuFolder
- , bs.tagsFolder
- , bs.unfiledBookmarksFolder
- , bs.toolbarFolder
+ bs.placesRoot,
+ bs.bookmarksMenuFolder,
+ bs.tagsFolder,
+ bs.unfiledBookmarksFolder,
+ bs.toolbarFolder
];
// add something in the bookmarks menu folder so a query to it returns results
bs.insertBookmark(bs.bookmarksMenuFolder, uri("http://example.com/bmf/"),
Ci.nsINavBookmarksService.DEFAULT_INDEX, "bmf");
// add something to the tags folder
var ts = Cc["@mozilla.org/browser/tagging-service;1"].
--- a/toolkit/components/places/tests/unit/test_463863.js
+++ b/toolkit/components/places/tests/unit/test_463863.js
@@ -7,24 +7,24 @@
/*
* TEST DESCRIPTION:
*
* This test checks that in a basic history query all transition types visits
* appear but TRANSITION_EMBED and TRANSITION_FRAMED_LINK ones.
*/
var transitions = [
- TRANSITION_LINK
-, TRANSITION_TYPED
-, TRANSITION_BOOKMARK
-, TRANSITION_EMBED
-, TRANSITION_FRAMED_LINK
-, TRANSITION_REDIRECT_PERMANENT
-, TRANSITION_REDIRECT_TEMPORARY
-, TRANSITION_DOWNLOAD
+ TRANSITION_LINK,
+ TRANSITION_TYPED,
+ TRANSITION_BOOKMARK,
+ TRANSITION_EMBED,
+ TRANSITION_FRAMED_LINK,
+ TRANSITION_REDIRECT_PERMANENT,
+ TRANSITION_REDIRECT_TEMPORARY,
+ TRANSITION_DOWNLOAD
];
function runQuery(aResultType) {
let options = PlacesUtils.history.getNewQueryOptions();
options.resultType = aResultType;
let root = PlacesUtils.history.executeQuery(PlacesUtils.history.getNewQuery(),
options).root;
root.containerOpen = true;
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -40,31 +40,31 @@ var observer = {
// Ignore tag items.
if (aParentId == PlacesUtils.tagsFolderId ||
(aParentId != PlacesUtils.placesRootId &&
bmsvc.getFolderIdForItem(aParentId) == PlacesUtils.tagsFolderId)) {
this.tagRelatedGuids.add(aGuid);
return;
}
- this.itemsAdded.set(aGuid, { itemId: aItemId
- , parentGuid: aParentGuid
- , index: aIndex
- , itemType: aItemType
- , title: aTitle
- , url: aURI });
+ this.itemsAdded.set(aGuid, { itemId: aItemId,
+ parentGuid: aParentGuid,
+ index: aIndex,
+ itemType: aItemType,
+ title: aTitle,
+ url: aURI });
},
onItemRemoved(aItemId, aParentId, aIndex, aItemType, aURI, aGuid, aParentGuid) {
if (this.tagRelatedGuids.has(aGuid))
return;
- this.itemsRemoved.set(aGuid, { parentGuid: aParentGuid
- , index: aIndex
- , itemType: aItemType });
+ this.itemsRemoved.set(aGuid, { parentGuid: aParentGuid,
+ index: aIndex,
+ itemType: aItemType });
},
onItemChanged(aItemId, aProperty, aIsAnnoProperty, aNewValue, aLastModified,
aItemType, aParentId, aGuid, aParentGuid) {
if (this.tagRelatedGuids.has(aGuid))
return;
let changesForGuid = this.itemsChanged.get(aGuid);
@@ -75,32 +75,32 @@ var observer = {
let newValue = aNewValue;
if (aIsAnnoProperty) {
if (annosvc.itemHasAnnotation(aItemId, aProperty))
newValue = annosvc.getItemAnnotation(aItemId, aProperty);
else
newValue = null;
}
- let change = { isAnnoProperty: aIsAnnoProperty
- , newValue
- , lastModified: aLastModified
- , itemType: aItemType };
+ let change = { isAnnoProperty: aIsAnnoProperty,
+ newValue,
+ lastModified: aLastModified,
+ itemType: aItemType };
changesForGuid.set(aProperty, change);
},
onItemVisited: () => {},
onItemMoved(aItemId, aOldParent, aOldIndex, aNewParent, aNewIndex, aItemType,
aGuid, aOldParentGuid, aNewParentGuid) {
- this.itemsMoved.set(aGuid, { oldParentGuid: aOldParentGuid
- , oldIndex: aOldIndex
- , newParentGuid: aNewParentGuid
- , newIndex: aNewIndex
- , itemType: aItemType });
+ this.itemsMoved.set(aGuid, { oldParentGuid: aOldParentGuid,
+ oldIndex: aOldIndex,
+ newParentGuid: aNewParentGuid,
+ newIndex: aNewIndex,
+ itemType: aItemType });
}
};
observer.reset();
// index at which items should begin
var bmStartIndex = 0;
function run_test() {
@@ -379,55 +379,55 @@ add_task(async function test_new_folder_
ensureAnnotationsSet(folder_info.guid, [ANNO]);
if (aRedo)
ensureTimestampsUpdated(folder_info.guid, true);
observer.reset();
};
let ensureUndo = () => {
ensureUndoState([[txn]], 1);
- ensureItemsRemoved({ guid: folder_info.guid
- , parentGuid: folder_info.parentGuid
- , index: bmStartIndex });
+ ensureItemsRemoved({ guid: folder_info.guid,
+ parentGuid: folder_info.parentGuid,
+ index: bmStartIndex });
observer.reset();
};
await ensureDo();
await PT.undo();
await ensureUndo();
await PT.redo();
await ensureDo(true);
await PT.undo();
ensureUndo();
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_new_bookmark() {
- let bm_info = { parentGuid: rootGuid
- , url: NetUtil.newURI("http://test_create_item.com")
- , index: bmStartIndex
- , title: "Test creating an item" };
+ let bm_info = { parentGuid: rootGuid,
+ url: NetUtil.newURI("http://test_create_item.com"),
+ index: bmStartIndex,
+ title: "Test creating an item" };
ensureUndoState();
let txn = PT.NewBookmark(bm_info);
bm_info.guid = await txn.transact();
let ensureDo = async function(aRedo = false) {
ensureUndoState([[txn]], 0);
await ensureItemsAdded(bm_info);
if (aRedo)
ensureTimestampsUpdated(bm_info.guid, true);
observer.reset();
};
let ensureUndo = () => {
ensureUndoState([[txn]], 1);
- ensureItemsRemoved({ guid: bm_info.guid
- , parentGuid: bm_info.parentGuid
- , index: bmStartIndex });
+ ensureItemsRemoved({ guid: bm_info.guid,
+ parentGuid: bm_info.parentGuid,
+ index: bmStartIndex });
observer.reset();
};
await ensureDo();
await PT.undo();
ensureUndo();
await PT.redo(true);
await ensureDo();
@@ -435,19 +435,19 @@ add_task(async function test_new_bookmar
ensureUndo();
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_merge_create_folder_and_item() {
let folder_info = createTestFolderInfo();
- let bm_info = { url: NetUtil.newURI("http://test_create_item_to_folder.com")
- , title: "Test Bookmark"
- , index: bmStartIndex };
+ let bm_info = { url: NetUtil.newURI("http://test_create_item_to_folder.com"),
+ title: "Test Bookmark",
+ index: bmStartIndex };
let [folderTxnResult, bkmTxnResult] = await PT.batch(async function() {
let folderTxn = PT.NewFolder(folder_info);
folder_info.guid = bm_info.parentGuid = await folderTxn.transact();
let bkmTxn = PT.NewBookmark(bm_info);
bm_info.guid = await bkmTxn.transact();
return [folderTxn, bkmTxn];
});
@@ -473,56 +473,56 @@ add_task(async function test_merge_creat
ensureUndo();
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_move_items_to_folder() {
let folder_a_info = createTestFolderInfo("Folder A");
- let bkm_a_info = { url: new URL("http://test_move_items.com")
- , title: "Bookmark A" };
- let bkm_b_info = { url: NetUtil.newURI("http://test_move_items.com")
- , title: "Bookmark B" };
+ let bkm_a_info = { url: new URL("http://test_move_items.com"),
+ title: "Bookmark A" };
+ let bkm_b_info = { url: NetUtil.newURI("http://test_move_items.com"),
+ title: "Bookmark B" };
// Test moving items within the same folder.
let [folder_a_txn_result, bkm_a_txn_result, bkm_b_txn_result] = await PT.batch(async function() {
let folder_a_txn = PT.NewFolder(folder_a_info);
folder_a_info.guid = bkm_a_info.parentGuid = bkm_b_info.parentGuid =
await folder_a_txn.transact();
let bkm_a_txn = PT.NewBookmark(bkm_a_info);
bkm_a_info.guid = await bkm_a_txn.transact();
let bkm_b_txn = PT.NewBookmark(bkm_b_info);
bkm_b_info.guid = await bkm_b_txn.transact();
return [folder_a_txn, bkm_a_txn, bkm_b_txn];
});
ensureUndoState([[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
- let moveTxn = PT.Move({ guid: bkm_a_info.guid
- , newParentGuid: folder_a_info.guid });
+ let moveTxn = PT.Move({ guid: bkm_a_info.guid,
+ newParentGuid: folder_a_info.guid });
await moveTxn.transact();
let ensureDo = () => {
ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
- ensureItemsMoved({ guid: bkm_a_info.guid
- , oldParentGuid: folder_a_info.guid
- , newParentGuid: folder_a_info.guid
- , oldIndex: 0
- , newIndex: 1 });
+ ensureItemsMoved({ guid: bkm_a_info.guid,
+ oldParentGuid: folder_a_info.guid,
+ newParentGuid: folder_a_info.guid,
+ oldIndex: 0,
+ newIndex: 1 });
observer.reset();
};
let ensureUndo = () => {
ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 1);
- ensureItemsMoved({ guid: bkm_a_info.guid
- , oldParentGuid: folder_a_info.guid
- , newParentGuid: folder_a_info.guid
- , oldIndex: 1
- , newIndex: 0 });
+ ensureItemsMoved({ guid: bkm_a_info.guid,
+ oldParentGuid: folder_a_info.guid,
+ newParentGuid: folder_a_info.guid,
+ oldIndex: 1,
+ newIndex: 0 });
observer.reset();
};
ensureDo();
await PT.undo();
ensureUndo();
await PT.redo();
ensureDo();
@@ -531,62 +531,62 @@ add_task(async function test_move_items_
await PT.clearTransactionsHistory(false, true);
ensureUndoState([[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
// Test moving items between folders.
let folder_b_info = createTestFolderInfo("Folder B");
let folder_b_txn = PT.NewFolder(folder_b_info);
folder_b_info.guid = await folder_b_txn.transact();
- ensureUndoState([ [folder_b_txn]
- , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
+ ensureUndoState([ [folder_b_txn],
+ [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
- moveTxn = PT.Move({ guid: bkm_a_info.guid
- , newParentGuid: folder_b_info.guid
- , newIndex: bmsvc.DEFAULT_INDEX });
+ moveTxn = PT.Move({ guid: bkm_a_info.guid,
+ newParentGuid: folder_b_info.guid,
+ newIndex: bmsvc.DEFAULT_INDEX });
await moveTxn.transact();
ensureDo = () => {
- ensureUndoState([ [moveTxn]
- , [folder_b_txn]
- , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
- ensureItemsMoved({ guid: bkm_a_info.guid
- , oldParentGuid: folder_a_info.guid
- , newParentGuid: folder_b_info.guid
- , oldIndex: 0
- , newIndex: 0 });
+ ensureUndoState([ [moveTxn],
+ [folder_b_txn],
+ [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
+ ensureItemsMoved({ guid: bkm_a_info.guid,
+ oldParentGuid: folder_a_info.guid,
+ newParentGuid: folder_b_info.guid,
+ oldIndex: 0,
+ newIndex: 0 });
observer.reset();
};
ensureUndo = () => {
- ensureUndoState([ [moveTxn]
- , [folder_b_txn]
- , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 1);
- ensureItemsMoved({ guid: bkm_a_info.guid
- , oldParentGuid: folder_b_info.guid
- , newParentGuid: folder_a_info.guid
- , oldIndex: 0
- , newIndex: 0 });
+ ensureUndoState([ [moveTxn],
+ [folder_b_txn],
+ [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 1);
+ ensureItemsMoved({ guid: bkm_a_info.guid,
+ oldParentGuid: folder_b_info.guid,
+ newParentGuid: folder_a_info.guid,
+ oldIndex: 0,
+ newIndex: 0 });
observer.reset();
};
ensureDo();
await PT.undo();
ensureUndo();
await PT.redo();
ensureDo();
await PT.undo();
ensureUndo();
// Clean up
await PT.undo(); // folder_b_txn
await PT.undo(); // folder_a_txn + the bookmarks;
do_check_eq(observer.itemsRemoved.size, 4);
- ensureUndoState([ [moveTxn]
- , [folder_b_txn]
- , [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 3);
+ ensureUndoState([ [moveTxn],
+ [folder_b_txn],
+ [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 3);
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_remove_folder() {
let folder_level_1_info = createTestFolderInfo("Folder Level 1");
let folder_level_2_info = { title: "Folder Level 2" };
let [folder_level_1_txn_result,
@@ -601,76 +601,76 @@ add_task(async function test_remove_fold
ensureUndoState([[folder_level_2_txn_result, folder_level_1_txn_result]]);
await ensureItemsAdded(folder_level_1_info, folder_level_2_info);
observer.reset();
let remove_folder_2_txn = PT.Remove(folder_level_2_info);
await remove_folder_2_txn.transact();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ]);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ]);
await ensureItemsRemoved(folder_level_2_info);
// Undo Remove "Folder Level 2"
await PT.undo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
await ensureItemsAdded(folder_level_2_info);
ensureTimestampsUpdated(folder_level_2_info.guid, true);
observer.reset();
// Redo Remove "Folder Level 2"
await PT.redo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ]);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ]);
await ensureItemsRemoved(folder_level_2_info);
observer.reset();
// Undo it again
await PT.undo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
await ensureItemsAdded(folder_level_2_info);
ensureTimestampsUpdated(folder_level_2_info.guid, true);
observer.reset();
// Undo the creation of both folders
await PT.undo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
await ensureItemsRemoved(folder_level_2_info, folder_level_1_info);
observer.reset();
// Redo the creation of both folders
await PT.redo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
await ensureItemsAdded(folder_level_1_info, folder_level_2_info);
ensureTimestampsUpdated(folder_level_1_info.guid, true);
ensureTimestampsUpdated(folder_level_2_info.guid, true);
observer.reset();
// Redo Remove "Folder Level 2"
await PT.redo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ]);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ]);
await ensureItemsRemoved(folder_level_2_info);
observer.reset();
// Undo everything one last time
await PT.undo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
await ensureItemsAdded(folder_level_2_info);
observer.reset();
await PT.undo();
- ensureUndoState([ [remove_folder_2_txn]
- , [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
+ ensureUndoState([ [remove_folder_2_txn],
+ [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
await ensureItemsRemoved(folder_level_2_info, folder_level_2_info);
observer.reset();
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_add_and_remove_bookmarks_with_additional_info() {
@@ -715,47 +715,47 @@ add_task(async function test_add_and_rem
await PT.undo();
ensureTimestampsUpdated(b1_info.guid, true);
ensureTags([TAG_1]);
// * Check that no-op tagging (the uri is already tagged with TAG_1) is
// also a no-op on undo.
// * Test the "keyword" property of the NewBookmark transaction.
observer.reset();
- let b2_info = { parentGuid: folder_info.guid
- , url: testURI, tags: [TAG_1, TAG_2]
- , keyword: KEYWORD
- , postData: POST_DATA
- , annotations: [ANNO] };
+ let b2_info = { parentGuid: folder_info.guid,
+ url: testURI, tags: [TAG_1, TAG_2],
+ keyword: KEYWORD,
+ postData: POST_DATA,
+ annotations: [ANNO] };
b2_info.guid = await PT.NewBookmark(b2_info).transact();
let b2_post_creation_changes = [
- { guid: b2_info.guid
- , isAnnoProperty: true
- , property: ANNO.name
- , newValue: ANNO.value },
- { guid: b2_info.guid
- , property: "keyword"
- , newValue: KEYWORD } ];
+ { guid: b2_info.guid,
+ isAnnoProperty: true,
+ property: ANNO.name,
+ newValue: ANNO.value },
+ { guid: b2_info.guid,
+ property: "keyword",
+ newValue: KEYWORD } ];
ensureItemsChanged(...b2_post_creation_changes);
ensureTags([TAG_1, TAG_2]);
observer.reset();
await PT.undo();
await ensureItemsRemoved(b2_info);
ensureTags([TAG_1]);
// Check if Remove correctly restores keywords, tags and annotations.
// Since both bookmarks share the same uri, they also share the keyword that
// is not removed along with one of the bookmarks.
observer.reset();
await PT.redo();
- ensureItemsChanged({ guid: b2_info.guid
- , isAnnoProperty: true
- , property: ANNO.name
- , newValue: ANNO.value });
+ ensureItemsChanged({ guid: b2_info.guid,
+ isAnnoProperty: true,
+ property: ANNO.name,
+ newValue: ANNO.value });
ensureTags([TAG_1, TAG_2]);
// Test Remove for multiple items.
observer.reset();
await PT.Remove(b1_info.guid).transact();
await PT.Remove(b2_info.guid).transact();
await PT.Remove(folder_info.guid).transact();
await ensureItemsRemoved(b1_info, b2_info, folder_info);
@@ -864,19 +864,19 @@ add_task(async function test_creating_an
ensureUndoState(undoEntries, 1);
ensureItemsRemoved(folder_info, separator_info);
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_add_and_remove_livemark() {
let createLivemarkTxn = PT.NewLivemark(
- { feedUrl: NetUtil.newURI("http://test.remove.livemark")
- , parentGuid: rootGuid
- , title: "Test Remove Livemark" });
+ { feedUrl: NetUtil.newURI("http://test.remove.livemark"),
+ parentGuid: rootGuid,
+ title: "Test Remove Livemark" });
let guid = await createLivemarkTxn.transact();
let originalInfo = await PlacesUtils.promiseBookmarksTree(guid);
Assert.ok(originalInfo);
await ensureLivemarkCreatedByAddLivemark(guid);
let removeTxn = PT.Remove(guid);
await removeTxn.transact();
await ensureNonExistent(guid);
@@ -906,24 +906,24 @@ add_task(async function test_add_and_rem
// Cleanup
await undo();
observer.reset();
await PT.clearTransactionsHistory();
});
add_task(async function test_edit_title() {
- let bm_info = { parentGuid: rootGuid
- , url: NetUtil.newURI("http://test_create_item.com")
- , title: "Original Title" };
+ let bm_info = { parentGuid: rootGuid,
+ url: NetUtil.newURI("http://test_create_item.com"),
+ title: "Original Title" };
function ensureTitleChange(aCurrentTitle) {
- ensureItemsChanged({ guid: bm_info.guid
- , property: "title"
- , newValue: aCurrentTitle});
+ ensureItemsChanged({ guid: bm_info.guid,
+ property: "title",
+ newValue: aCurrentTitle});
}
bm_info.guid = await PT.NewBookmark(bm_info).transact();
observer.reset();
await PT.EditTitle({ guid: bm_info.guid, title: "New Title" }).transact();
ensureTitleChange("New Title");
@@ -946,19 +946,19 @@ add_task(async function test_edit_title(
ensureUndoState();
});
add_task(async function test_edit_url() {
let oldURI = NetUtil.newURI("http://old.test_editing_item_uri.com/");
let newURI = NetUtil.newURI("http://new.test_editing_item_uri.com/");
let bm_info = { parentGuid: rootGuid, url: oldURI, tags: ["TestTag"] };
function ensureURIAndTags(aPreChangeURI, aPostChangeURI, aOLdURITagsPreserved) {
- ensureItemsChanged({ guid: bm_info.guid
- , property: "uri"
- , newValue: aPostChangeURI.spec });
+ ensureItemsChanged({ guid: bm_info.guid,
+ property: "uri",
+ newValue: aPostChangeURI.spec });
ensureTagsForURI(aPostChangeURI, bm_info.tags);
ensureTagsForURI(aPreChangeURI, aOLdURITagsPreserved ? bm_info.tags : []);
}
bm_info.guid = await PT.NewBookmark(bm_info).transact();
ensureTagsForURI(oldURI, bm_info.tags);
// When there's a single bookmark for the same url, tags should be moved.
@@ -1006,24 +1006,24 @@ add_task(async function test_edit_url()
await PT.undo();
ensureItemsRemoved(bm3_info, bm2_info, bm_info);
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_edit_keyword() {
- let bm_info = { parentGuid: rootGuid
- , url: NetUtil.newURI("http://test.edit.keyword") };
+ let bm_info = { parentGuid: rootGuid,
+ url: NetUtil.newURI("http://test.edit.keyword") };
const KEYWORD = "test_keyword";
bm_info.guid = await PT.NewBookmark(bm_info).transact();
function ensureKeywordChange(aCurrentKeyword = "") {
- ensureItemsChanged({ guid: bm_info.guid
- , property: "keyword"
- , newValue: aCurrentKeyword });
+ ensureItemsChanged({ guid: bm_info.guid,
+ property: "keyword",
+ newValue: aCurrentKeyword });
}
bm_info.guid = await PT.NewBookmark(bm_info).transact();
observer.reset();
await PT.EditKeyword({ guid: bm_info.guid, keyword: KEYWORD, postData: "postData" }).transact();
ensureKeywordChange(KEYWORD);
let entry = await PlacesUtils.keywords.fetch(KEYWORD);
@@ -1050,23 +1050,23 @@ add_task(async function test_edit_keywor
await PT.undo();
ensureItemsRemoved(bm_info);
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_edit_specific_keyword() {
- let bm_info = { parentGuid: rootGuid
- , url: NetUtil.newURI("http://test.edit.keyword") };
+ let bm_info = { parentGuid: rootGuid,
+ url: NetUtil.newURI("http://test.edit.keyword") };
bm_info.guid = await PT.NewBookmark(bm_info).transact();
function ensureKeywordChange(aCurrentKeyword = "", aPreviousKeyword = "") {
- ensureItemsChanged({ guid: bm_info.guid
- , property: "keyword"
- , newValue: aCurrentKeyword
+ ensureItemsChanged({ guid: bm_info.guid,
+ property: "keyword",
+ newValue: aCurrentKeyword
});
}
await PlacesUtils.keywords.insert({ keyword: "kw1", url: bm_info.url.spec, postData: "postData1" });
await PlacesUtils.keywords.insert({ keyword: "kw2", url: bm_info.url.spec, postData: "postData2" });
bm_info.guid = await PT.NewBookmark(bm_info).transact();
observer.reset();
@@ -1113,20 +1113,20 @@ add_task(async function test_edit_specif
ensureItemsRemoved(bm_info);
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_tag_uri() {
// This also tests passing uri specs.
- let bm_info_a = { url: "http://bookmarked.uri"
- , parentGuid: rootGuid };
- let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri")
- , parentGuid: rootGuid };
+ let bm_info_a = { url: "http://bookmarked.uri",
+ parentGuid: rootGuid };
+ let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"),
+ parentGuid: rootGuid };
let unbookmarked_uri = NetUtil.newURI("http://un.bookmarked.uri");
await PT.batch(async function() {
bm_info_a.guid = await PT.NewBookmark(bm_info_a).transact();
bm_info_b.guid = await PT.NewBookmark(bm_info_b).transact();
});
async function doTest(aInfo) {
@@ -1179,22 +1179,22 @@ add_task(async function test_tag_uri() {
await PT.undo();
ensureItemsRemoved(bm_info_a, bm_info_b);
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_untag_uri() {
- let bm_info_a = { url: NetUtil.newURI("http://bookmarked.uri")
- , parentGuid: rootGuid
- , tags: ["A", "B"] };
- let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri")
- , parentGuid: rootGuid
- , tag: "B" };
+ let bm_info_a = { url: NetUtil.newURI("http://bookmarked.uri"),
+ parentGuid: rootGuid,
+ tags: ["A", "B"] };
+ let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"),
+ parentGuid: rootGuid,
+ tag: "B" };
await PT.batch(async function() {
bm_info_a.guid = await PT.NewBookmark(bm_info_a).transact();
ensureTagsForURI(bm_info_a.url, bm_info_a.tags);
bm_info_b.guid = await PT.NewBookmark(bm_info_b).transact();
ensureTagsForURI(bm_info_b.url, [bm_info_b.tag]);
});
@@ -1254,23 +1254,23 @@ add_task(async function test_untag_uri()
await PT.undo();
ensureItemsRemoved(bm_info_a, bm_info_b);
await PT.clearTransactionsHistory();
ensureUndoState();
});
add_task(async function test_annotate() {
- let bm_info = { url: NetUtil.newURI("http://test.item.annotation")
- , parentGuid: rootGuid };
+ let bm_info = { url: NetUtil.newURI("http://test.item.annotation"),
+ parentGuid: rootGuid };
let anno_info = { name: "TestAnno", value: "TestValue" };
function ensureAnnoState(aSet) {
ensureAnnotationsSet(bm_info.guid,
- [{ name: anno_info.name
- , value: aSet ? anno_info.value : null }]);
+ [{ name: anno_info.name,
+ value: aSet ? anno_info.value : null }]);
}
bm_info.guid = await PT.NewBookmark(bm_info).transact();
observer.reset();
await PT.Annotate({ guid: bm_info.guid, annotation: anno_info }).transact();
ensureAnnoState(true);
@@ -1329,22 +1329,22 @@ add_task(async function test_annotate_mu
await PT.Annotate({ guid, annotations: annos(1, 2) }).transact();
verifyAnnoValues(1, 2);
await PT.undo();
verifyAnnoValues();
await PT.redo();
verifyAnnoValues(1, 2);
- await PT.Annotate({ guid
- , annotation: { name: "A" } }).transact();
+ await PT.Annotate({ guid,
+ annotation: { name: "A" } }).transact();
verifyAnnoValues(null, 2);
- await PT.Annotate({ guid
- , annotation: { name: "B", value: 0 } }).transact();
+ await PT.Annotate({ guid,
+ annotation: { name: "B", value: 0 } }).transact();
verifyAnnoValues(null, 0);
await PT.undo();
verifyAnnoValues(null, 2);
await PT.redo();
verifyAnnoValues(null, 0);
await PT.undo();
verifyAnnoValues(null, 2);
await PT.undo();
@@ -1399,35 +1399,35 @@ add_task(async function test_sort_folder
await PT.undo();
ensureOrder(originalOrder);
await PT.undo();
ensureItemsRemoved(...originalOrder, folder_info);
});
add_task(async function test_livemark_txns() {
let livemark_info =
- { feedUrl: NetUtil.newURI("http://test.feed.uri")
- , parentGuid: rootGuid
- , title: "Test Livemark" };
+ { feedUrl: NetUtil.newURI("http://test.feed.uri"),
+ parentGuid: rootGuid,
+ title: "Test Livemark" };
function ensureLivemarkAdded() {
- ensureItemsAdded({ guid: livemark_info.guid
- , title: livemark_info.title
- , parentGuid: livemark_info.parentGuid
- , itemType: bmsvc.TYPE_FOLDER });
- let annos = [{ name: PlacesUtils.LMANNO_FEEDURI
- , value: livemark_info.feedUrl.spec }];
+ ensureItemsAdded({ guid: livemark_info.guid,
+ title: livemark_info.title,
+ parentGuid: livemark_info.parentGuid,
+ itemType: bmsvc.TYPE_FOLDER });
+ let annos = [{ name: PlacesUtils.LMANNO_FEEDURI,
+ value: livemark_info.feedUrl.spec }];
if ("siteUrl" in livemark_info) {
- annos.push({ name: PlacesUtils.LMANNO_SITEURI
- , value: livemark_info.siteUrl.spec });
+ annos.push({ name: PlacesUtils.LMANNO_SITEURI,
+ value: livemark_info.siteUrl.spec });
}
ensureAnnotationsSet(livemark_info.guid, annos);
}
function ensureLivemarkRemoved() {
- ensureItemsRemoved({ guid: livemark_info.guid
- , parentGuid: livemark_info.parentGuid });
+ ensureItemsRemoved({ guid: livemark_info.guid,
+ parentGuid: livemark_info.parentGuid });
}
async function _testDoUndoRedoUndo() {
observer.reset();
livemark_info.guid = await PT.NewLivemark(livemark_info).transact();
ensureLivemarkAdded();
observer.reset();
@@ -1479,44 +1479,44 @@ add_task(async function test_copy() {
// Cleanup. This also remove the original item.
await PT.undo();
observer.reset();
await PT.clearTransactionsHistory();
}
// Test duplicating leafs (bookmark, separator, empty folder)
- PT.NewBookmark({ url: new URL("http://test.item.duplicate")
- , parentGuid: rootGuid
- , annos: [{ name: "Anno", value: "AnnoValue"}] });
+ PT.NewBookmark({ url: new URL("http://test.item.duplicate"),
+ parentGuid: rootGuid,
+ annos: [{ name: "Anno", value: "AnnoValue"}] });
let sepTxn = PT.NewSeparator({ parentGuid: rootGuid, index: 1 });
let livemarkTxn = PT.NewLivemark(
- { feedUrl: new URL("http://test.feed.uri")
- , parentGuid: rootGuid
- , title: "Test Livemark", index: 1 });
+ { feedUrl: new URL("http://test.feed.uri"),
+ parentGuid: rootGuid,
+ title: "Test Livemark", index: 1 });
let emptyFolderTxn = PT.NewFolder(createTestFolderInfo());
for (let txn of [livemarkTxn, sepTxn, emptyFolderTxn]) {
let guid = await txn.transact();
await duplicate_and_test(guid);
}
// Test duplicating a folder having some contents.
let filledFolderGuid = await PT.batch(async function() {
let folderGuid = await PT.NewFolder(createTestFolderInfo()).transact();
let nestedFolderGuid =
- await PT.NewFolder({ parentGuid: folderGuid
- , title: "Nested Folder" }).transact();
+ await PT.NewFolder({ parentGuid: folderGuid,
+ title: "Nested Folder" }).transact();
// Insert a bookmark under the nested folder.
- await PT.NewBookmark({ url: new URL("http://nested.nested.bookmark")
- , parentGuid: nestedFolderGuid }).transact();
+ await PT.NewBookmark({ url: new URL("http://nested.nested.bookmark"),
+ parentGuid: nestedFolderGuid }).transact();
// Insert a separator below the nested folder
await PT.NewSeparator({ parentGuid: folderGuid }).transact();
// And another bookmark.
- await PT.NewBookmark({ url: new URL("http://nested.bookmark")
- , parentGuid: folderGuid }).transact();
+ await PT.NewBookmark({ url: new URL("http://nested.bookmark"),
+ parentGuid: folderGuid }).transact();
return folderGuid;
});
await duplicate_and_test(filledFolderGuid);
// Cleanup
await PT.clearTransactionsHistory();
});
@@ -1564,45 +1564,45 @@ add_task(async function test_copy_exclud
let annoNames = "annos" in tree ?
tree.annos.map(a => a.name).sort() : [];
Assert.deepEqual(annoNames, expectedAnnoNames);
};
await ensureAnnosSet(folderGuid, "a", "b", "c");
let excluding_a_dupeGuid =
- await PT.Copy({ guid: folderGuid
- , newParentGuid: rootGuid
- , excludingAnnotation: "a" }).transact();
+ await PT.Copy({ guid: folderGuid,
+ newParentGuid: rootGuid,
+ excludingAnnotation: "a" }).transact();
await ensureAnnosSet(excluding_a_dupeGuid, "b", "c");
let excluding_ac_dupeGuid =
- await PT.Copy({ guid: folderGuid
- , newParentGuid: rootGuid
- , excludingAnnotations: ["a", "c"] }).transact();
+ await PT.Copy({ guid: folderGuid,
+ newParentGuid: rootGuid,
+ excludingAnnotations: ["a", "c"] }).transact();
await ensureAnnosSet(excluding_ac_dupeGuid, "b");
// Cleanup
await PT.undo();
await PT.undo();
await PT.undo();
await PT.clearTransactionsHistory();
});
add_task(async function test_invalid_uri_spec_throws() {
Assert.throws(() =>
- PT.NewBookmark({ parentGuid: rootGuid
- , url: "invalid uri spec"
- , title: "test bookmark" }));
+ PT.NewBookmark({ parentGuid: rootGuid,
+ url: "invalid uri spec",
+ title: "test bookmark" }));
Assert.throws(() =>
- PT.Tag({ tag: "TheTag"
- , urls: ["invalid uri spec"] }));
+ PT.Tag({ tag: "TheTag",
+ urls: ["invalid uri spec"] }));
Assert.throws(() =>
- PT.Tag({ tag: "TheTag"
- , urls: ["about:blank", "invalid uri spec"] }));
+ PT.Tag({ tag: "TheTag",
+ urls: ["about:blank", "invalid uri spec"] }));
});
add_task(async function test_annotate_multiple_items() {
let parentGuid = rootGuid;
let guids = [
await PT.NewBookmark({ url: "about:blank", parentGuid }).transact(),
await PT.NewFolder({ title: "Test Folder", parentGuid }).transact()];
@@ -1637,28 +1637,28 @@ add_task(async function test_annotate_mu
await ensureNonExistent(...guids);
await PT.clearTransactionsHistory();
observer.reset();
});
add_task(async function test_remove_multiple() {
let guids = [];
await PT.batch(async function() {
- let folderGuid = await PT.NewFolder({ title: "Test Folder"
- , parentGuid: rootGuid }).transact();
+ let folderGuid = await PT.NewFolder({ title: "Test Folder",
+ parentGuid: rootGuid }).transact();
let nestedFolderGuid =
- await PT.NewFolder({ title: "Nested Test Folder"
- , parentGuid: folderGuid }).transact();
+ await PT.NewFolder({ title: "Nested Test Folder",
+ parentGuid: folderGuid }).transact();
await PT.NewSeparator(nestedFolderGuid).transact();
guids.push(folderGuid);
let bmGuid =
- await PT.NewBookmark({ url: new URL("http://test.bookmark.removed")
- , parentGuid: rootGuid }).transact();
+ await PT.NewBookmark({ url: new URL("http://test.bookmark.removed"),
+ parentGuid: rootGuid }).transact();
guids.push(bmGuid);
});
let originalInfos = [];
for (let guid of guids) {
originalInfos.push(await PlacesUtils.promiseBookmarksTree(guid));
}
--- a/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js
+++ b/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js
@@ -15,21 +15,21 @@ add_task(async function() {
Ci.nsIAnnotationObserver
]),
};
PlacesUtils.annotations.addObserver(annoObserver);
});
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "livemark title"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , index: PlacesUtils.bookmarks.DEFAULT_INDEX
- , siteURI: uri("http://example.com/")
- , feedURI: uri("http://example.com/rdf")
+ { title: "livemark title",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ index: PlacesUtils.bookmarks.DEFAULT_INDEX,
+ siteURI: uri("http://example.com/"),
+ feedURI: uri("http://example.com/rdf")
});
await annoPromise;
livemark = await PlacesUtils.livemarks.getLivemark({ guid: livemark.guid });
Assert.ok(livemark);
await PlacesUtils.livemarks.removeLivemark({ guid: livemark.guid });
});
--- a/toolkit/components/places/tests/unit/test_hosts_triggers.js
+++ b/toolkit/components/places/tests/unit/test_hosts_triggers.js
@@ -132,39 +132,39 @@ add_task(async function test_bookmark_re
PlacesUtils.bookmarks.removeItem(itemId);
await PlacesTestUtils.clearHistory();
checkHostNotInMozHosts(newUri, false, null);
});
add_task(async function test_moz_hosts_typed_update() {
const TEST_URI = NetUtil.newURI("http://typed.mozilla.com");
- let places = [{ uri: TEST_URI
- , title: "test for " + TEST_URI.spec
+ let places = [{ uri: TEST_URI,
+ title: "test for " + TEST_URI.spec
},
- { uri: TEST_URI
- , title: "test for " + TEST_URI.spec
- , transition: TRANSITION_TYPED
+ { uri: TEST_URI,
+ title: "test for " + TEST_URI.spec,
+ transition: TRANSITION_TYPED
}];
await PlacesTestUtils.addVisits(places);
checkHostInMozHosts(TEST_URI, true, null);
await PlacesTestUtils.clearHistory();
});
add_task(async function test_moz_hosts_www_remove() {
async function test_removal(aURIToRemove, aURIToKeep, aCallback) {
- let places = [{ uri: aURIToRemove
- , title: "test for " + aURIToRemove.spec
- , transition: TRANSITION_TYPED
+ let places = [{ uri: aURIToRemove,
+ title: "test for " + aURIToRemove.spec,
+ transition: TRANSITION_TYPED
},
- { uri: aURIToKeep
- , title: "test for " + aURIToKeep.spec
- , transition: TRANSITION_TYPED
+ { uri: aURIToKeep,
+ title: "test for " + aURIToKeep.spec,
+ transition: TRANSITION_TYPED
}];
await PlacesTestUtils.addVisits(places);
print("removing " + aURIToRemove.spec + " keeping " + aURIToKeep);
dump_table("moz_hosts");
dump_table("moz_places");
await PlacesUtils.history.remove(aURIToRemove);
let prefix = /www/.test(aURIToKeep.spec) ? "www." : null;
@@ -204,18 +204,18 @@ add_task(async function test_moz_hosts_f
checkHostInMozHosts(TEST_URI_1, true, null);
});
add_task(async function test_moz_hosts_update_2() {
// Check that updating trigger takes into account prefixes for different
// rev_hosts.
const TEST_URI_1 = NetUtil.newURI("https://www.google.it/");
const TEST_URI_2 = NetUtil.newURI("https://google.it/");
- let places = [{ uri: TEST_URI_1
- , transition: TRANSITION_TYPED
+ let places = [{ uri: TEST_URI_1,
+ transition: TRANSITION_TYPED
},
{ uri: TEST_URI_2
}];
await PlacesTestUtils.addVisits(places);
checkHostInMozHosts(TEST_URI_1, true, "https://www.");
});
--- a/toolkit/components/places/tests/unit/test_isURIVisited.js
+++ b/toolkit/components/places/tests/unit/test_isURIVisited.js
@@ -63,19 +63,19 @@ function* step() {
do_check_false(aIsVisited3);
gRunner.next();
});
});
});
},
};
- history.updatePlaces({ uri
- , visits: [ { transitionType: transition
- , visitDate: Date.now() * 1000
+ history.updatePlaces({ uri,
+ visits: [ { transitionType: transition,
+ visitDate: Date.now() * 1000
} ]
}, callback);
});
yield undefined;
}
}
do_test_finished();
--- a/toolkit/components/places/tests/unit/test_mozIAsyncLivemarks.js
+++ b/toolkit/components/places/tests/unit/test_mozIAsyncLivemarks.js
@@ -82,29 +82,29 @@ add_task(async function test_addLivemark
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_badIndex_throws() {
try {
await PlacesUtils.livemarks.addLivemark(
- { parentId: PlacesUtils.unfiledBookmarksFolderId
- , index: "test" });
+ { parentId: PlacesUtils.unfiledBookmarksFolderId,
+ index: "test" });
do_throw("Invoking addLivemark with a bad index should throw");
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_invalidIndex_throws() {
try {
await PlacesUtils.livemarks.addLivemark(
- { parentId: PlacesUtils.unfiledBookmarksFolderId
- , index: -2
+ { parentId: PlacesUtils.unfiledBookmarksFolderId,
+ index: -2
});
do_throw("Invoking addLivemark with an invalid index should throw");
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_noFeedURI_throws() {
@@ -115,42 +115,42 @@ add_task(async function test_addLivemark
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_badFeedURI_throws() {
try {
await PlacesUtils.livemarks.addLivemark(
- { parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: "test" });
+ { parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: "test" });
do_throw("Invoking addLivemark with a bad feedURI should throw");
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_badSiteURI_throws() {
try {
await PlacesUtils.livemarks.addLivemark(
- { parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , siteURI: "test" });
+ { parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ siteURI: "test" });
do_throw("Invoking addLivemark with a bad siteURI should throw");
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_badGuid_throws() {
try {
await PlacesUtils.livemarks.addLivemark(
- { parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , guid: "123456" });
+ { parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ guid: "123456" });
do_throw("Invoking addLivemark with a bad guid should throw");
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_parentId_succeeds() {
let onItemAddedCalled = false;
@@ -163,28 +163,28 @@ add_task(async function test_addLivemark
do_check_eq(aParentId, PlacesUtils.unfiledBookmarksFolderId);
do_check_eq(aIndex, 0);
do_check_eq(aItemType, Ci.nsINavBookmarksService.TYPE_FOLDER);
do_check_eq(aTitle, "test");
}
});
await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentId: PlacesUtils.unfiledBookmarksFolderId
- , feedURI: FEED_URI });
+ { title: "test",
+ parentId: PlacesUtils.unfiledBookmarksFolderId,
+ feedURI: FEED_URI });
do_check_true(onItemAddedCalled);
});
add_task(async function test_addLivemark_noSiteURI_succeeds() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI
});
do_check_true(livemark.id > 0);
do_check_valid_places_guid(livemark.guid);
do_check_eq(livemark.title, "test");
do_check_eq(livemark.parentId, PlacesUtils.unfiledBookmarksFolderId);
do_check_eq(livemark.parentGuid, PlacesUtils.bookmarks.unfiledGuid);
do_check_true(livemark.feedURI.equals(FEED_URI));
do_check_eq(livemark.siteURI, null);
@@ -193,20 +193,20 @@ add_task(async function test_addLivemark
let bookmark = await PlacesUtils.bookmarks.fetch(livemark.guid);
do_check_eq(livemark.index, bookmark.index);
do_check_eq(livemark.dateAdded, bookmark.dateAdded * 1000);
});
add_task(async function test_addLivemark_succeeds() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , siteURI: SITE_URI
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ siteURI: SITE_URI
});
do_check_true(livemark.id > 0);
do_check_valid_places_guid(livemark.guid);
do_check_eq(livemark.title, "test");
do_check_eq(livemark.parentId, PlacesUtils.unfiledBookmarksFolderId);
do_check_eq(livemark.parentGuid, PlacesUtils.bookmarks.unfiledGuid);
do_check_true(livemark.feedURI.equals(FEED_URI));
@@ -216,96 +216,96 @@ add_task(async function test_addLivemark
PlacesUtils.LMANNO_FEEDURI));
do_check_true(PlacesUtils.annotations
.itemHasAnnotation(livemark.id,
PlacesUtils.LMANNO_SITEURI));
});
add_task(async function test_addLivemark_bogusid_succeeds() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { id: 100 // Should be ignored.
- , title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , siteURI: SITE_URI
+ { id: 100, // Should be ignored.
+ title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ siteURI: SITE_URI
});
do_check_true(livemark.id > 0);
do_check_neq(livemark.id, 100);
});
add_task(async function test_addLivemark_bogusParentId_fails() {
try {
await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentId: 187
- , feedURI: FEED_URI
+ { title: "test",
+ parentId: 187,
+ feedURI: FEED_URI
});
do_throw("Adding a livemark with a bogus parent should fail");
} catch (ex) {}
});
add_task(async function test_addLivemark_bogusParentGuid_fails() {
try {
await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: "123456789012"
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: "123456789012",
+ feedURI: FEED_URI
});
do_throw("Adding a livemark with a bogus parent should fail");
} catch (ex) {}
})
add_task(async function test_addLivemark_intoLivemark_fails() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI
});
try {
await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: livemark.guid
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: livemark.guid,
+ feedURI: FEED_URI
});
do_throw("Adding a livemark into a livemark should fail");
} catch (ex) {
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
}
});
add_task(async function test_addLivemark_forceGuid_succeeds() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , guid: "1234567890AB"
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ guid: "1234567890AB"
});
do_check_eq(livemark.guid, "1234567890AB");
do_check_guid_for_bookmark(livemark.id, "1234567890AB");
});
add_task(async function test_addLivemark_dateAdded_succeeds() {
let dateAdded = new Date("2013-03-01T01:10:00") * 1000;
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , dateAdded
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ dateAdded
});
do_check_eq(livemark.dateAdded, dateAdded);
});
add_task(async function test_addLivemark_lastModified_succeeds() {
let now = Date.now() * 1000;
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , lastModified: now
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ lastModified: now
});
do_check_eq(livemark.dateAdded, now);
do_check_eq(livemark.lastModified, now);
});
add_task(async function test_removeLivemark_emptyObject_throws() {
try {
await PlacesUtils.livemarks.removeLivemark({});
@@ -329,36 +329,36 @@ add_task(async function test_removeLivem
await PlacesUtils.livemarks.removeLivemark({ id: 1337 });
do_throw("Removing a non-existent livemark should fail");
} catch (ex) {
}
});
add_task(async function test_removeLivemark_guid_succeeds() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , guid: "234567890ABC"
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ guid: "234567890ABC"
});
do_check_eq(livemark.guid, "234567890ABC");
await PlacesUtils.livemarks.removeLivemark({
id: 789, guid: "234567890ABC"
});
do_check_eq((await PlacesUtils.bookmarks.fetch("234567890ABC")), null);
});
add_task(async function test_removeLivemark_id_succeeds() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI
});
await PlacesUtils.livemarks.removeLivemark({ id: livemark.id });
do_check_eq((await PlacesUtils.bookmarks.fetch("234567890ABC")), null);
});
add_task(async function test_getLivemark_emptyObject_throws() {
@@ -390,20 +390,20 @@ add_task(async function test_getLivemark
try {
await PlacesUtils.livemarks.getLivemark({ guid: "34567890ABCD" });
do_throw("getLivemark for a non-existent guid should fail");
} catch (ex) {}
});
add_task(async function test_getLivemark_guid_succeeds() {
await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
- , guid: "34567890ABCD" });
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI,
+ guid: "34567890ABCD" });
// invalid id to check the guid wins.
let livemark =
await PlacesUtils.livemarks.getLivemark({ id: 789, guid: "34567890ABCD" });
do_check_eq(livemark.title, "test");
do_check_eq(livemark.parentId, PlacesUtils.unfiledBookmarksFolderId);
do_check_eq(livemark.parentGuid, PlacesUtils.bookmarks.unfiledGuid);
@@ -412,19 +412,19 @@ add_task(async function test_getLivemark
do_check_eq(livemark.guid, "34567890ABCD");
let bookmark = await PlacesUtils.bookmarks.fetch("34567890ABCD");
do_check_eq(livemark.index, bookmark.index);
});
add_task(async function test_getLivemark_id_succeeds() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI
});
livemark = await PlacesUtils.livemarks.getLivemark({ id: livemark.id });
do_check_eq(livemark.title, "test");
do_check_eq(livemark.parentId, PlacesUtils.unfiledBookmarksFolderId);
do_check_eq(livemark.parentGuid, PlacesUtils.bookmarks.unfiledGuid);
do_check_true(livemark.feedURI.equals(FEED_URI));
@@ -432,77 +432,77 @@ add_task(async function test_getLivemark
do_check_guid_for_bookmark(livemark.id, livemark.guid);
let bookmark = await PlacesUtils.bookmarks.fetch(livemark.guid);
do_check_eq(livemark.index, bookmark.index);
});
add_task(async function test_getLivemark_removeItem_contention() {
// do not yield.
- PlacesUtils.livemarks.addLivemark({ title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
+ PlacesUtils.livemarks.addLivemark({ title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI
}).catch(() => { /* swallow errors*/ });
await PlacesUtils.bookmarks.eraseEverything();
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI
});
livemark = await PlacesUtils.livemarks.getLivemark({ guid: livemark.guid });
do_check_eq(livemark.title, "test");
do_check_eq(livemark.parentId, PlacesUtils.unfiledBookmarksFolderId);
do_check_true(livemark.feedURI.equals(FEED_URI));
do_check_eq(livemark.siteURI, null);
do_check_guid_for_bookmark(livemark.id, livemark.guid);
});
add_task(async function test_title_change() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI
});
await PlacesUtils.bookmarks.update({ guid: livemark.guid,
title: "test2" });
// Poll for the title change.
while (true) {
let lm = await PlacesUtils.livemarks.getLivemark({ guid: livemark.guid });
if (lm.title == "test2")
break;
await new Promise(resolve => do_timeout(resolve, 100));
}
});
add_task(async function test_livemark_move() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI } );
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI } );
await PlacesUtils.bookmarks.update({ guid: livemark.guid,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX });
// Poll for the parent change.
while (true) {
let lm = await PlacesUtils.livemarks.getLivemark({ guid: livemark.guid });
if (lm.parentGuid == PlacesUtils.bookmarks.toolbarGuid)
break;
await new Promise(resolve => do_timeout(resolve, 100));
}
});
add_task(async function test_livemark_removed() {
let livemark = await PlacesUtils.livemarks.addLivemark(
- { title: "test"
- , parentGuid: PlacesUtils.bookmarks.unfiledGuid
- , feedURI: FEED_URI } );
+ { title: "test",
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ feedURI: FEED_URI } );
await PlacesUtils.bookmarks.remove(livemark.guid);
// Poll for the livemark removal.
while (true) {
try {
await PlacesUtils.livemarks.getLivemark({ guid: livemark.guid });
} catch (ex) {
break;
--- a/tools/lint/eslint/.eslintrc.js
+++ b/tools/lint/eslint/.eslintrc.js
@@ -12,17 +12,16 @@
module.exports = {
"env": {
"node": true
},
"rules": {
"camelcase": "error",
"comma-dangle": ["error", "never"],
- "comma-style": ["error", "last"],
"curly": ["error", "multi-line"],
"handle-callback-err": ["error", "er"],
"indent": ["error", 2, {"SwitchCase": 1}],
// Longer max-len due to AST selectors
"max-len": ["error", 150, 2],
"no-multiple-empty-lines": ["error", {"max": 1}],
"no-shadow": "error",
"no-undef-init": "error",
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -80,17 +80,17 @@ module.exports = {
// No newline before open brace for a block
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
// No space before always a space after a comma
"comma-spacing": ["error", {"after": true, "before": false}],
// Commas at the end of the line not the start
- // "comma-style": "error",
+ "comma-style": "error",
// Warn about cyclomatic complexity in functions.
// XXX Get this down to 20?
"complexity": ["error", 32],
// Don't require spaces around computed properties
"computed-property-spacing": ["error", "never"],