зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1370225 - Enabled the ESLint comma-style rule across mozilla-central. r=standard8
MozReview-Commit-ID: 9OhLgBpYS4L --HG-- extra : rebase_source : 5155e715934e7acd2ffadb4856eb91f481cbf56c
This commit is contained in:
Родитель
8ba369c623
Коммит
fafb858b26
|
@ -13,7 +13,6 @@ module.exports = {
|
|||
"block-scoped-var": "error",
|
||||
"camelcase": "error",
|
||||
"comma-dangle": ["error", "never"],
|
||||
"comma-style": ["error", "last"],
|
||||
"complexity": ["error", 20],
|
||||
"consistent-this": "off",
|
||||
"curly": ["error", "multi-line"],
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
// * 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.
|
||||
|
|
|
@ -310,11 +310,11 @@ var StarUI = {
|
|||
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);
|
||||
},
|
||||
|
@ -499,8 +499,8 @@ var PlacesCommandHook = {
|
|||
}
|
||||
|
||||
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();
|
||||
|
@ -572,8 +572,8 @@ var PlacesCommandHook = {
|
|||
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;
|
||||
}
|
||||
|
@ -581,16 +581,16 @@ var PlacesCommandHook = {
|
|||
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);
|
||||
},
|
||||
|
||||
|
@ -623,10 +623,10 @@ var PlacesCommandHook = {
|
|||
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);
|
||||
}
|
||||
},
|
||||
|
@ -667,16 +667,16 @@ var PlacesCommandHook = {
|
|||
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);
|
||||
},
|
||||
|
||||
|
|
|
@ -5749,14 +5749,14 @@ function contentAreaClick(event, isPanelClick) {
|
|||
// 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;
|
||||
|
@ -6646,18 +6646,18 @@ function AddKeywordForSearchField() {
|
|||
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);
|
||||
|
|
|
@ -35,8 +35,7 @@ var panelProgressListener = {
|
|||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
window.parent.document.getElementById("sidebar-throbber").removeAttribute("loading");
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
|
||||
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
|
||||
UpdateBackForwardCommands(getPanelBrowser().webNavigation);
|
||||
|
|
|
@ -4,7 +4,6 @@ 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"}],
|
||||
|
|
|
@ -579,9 +579,9 @@ this.PlacesUIUtils = {
|
|||
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);
|
||||
|
@ -597,16 +597,16 @@ this.PlacesUIUtils = {
|
|||
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 });
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -309,18 +309,18 @@ var BookmarkPropertiesPanel = {
|
|||
|
||||
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
|
||||
|
@ -630,12 +630,12 @@ var BookmarkPropertiesPanel = {
|
|||
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;
|
||||
|
|
|
@ -290,14 +290,14 @@ PlacesController.prototype = {
|
|||
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;
|
||||
}
|
||||
|
@ -677,9 +677,9 @@ PlacesController.prototype = {
|
|||
if (!node)
|
||||
return;
|
||||
|
||||
PlacesUIUtils.showBookmarkDialog({ action: "edit"
|
||||
, node
|
||||
, hiddenRows: [ "folderPicker" ]
|
||||
PlacesUIUtils.showBookmarkDialog({ action: "edit",
|
||||
node,
|
||||
hiddenRows: [ "folderPicker" ]
|
||||
}, window.top);
|
||||
},
|
||||
|
||||
|
@ -734,10 +734,10 @@ PlacesController.prototype = {
|
|||
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.
|
||||
|
@ -765,8 +765,8 @@ PlacesController.prototype = {
|
|||
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.
|
||||
|
|
|
@ -51,8 +51,8 @@ var gMoveBookmarksDialog = {
|
|||
// 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);
|
||||
},
|
||||
|
|
|
@ -642,16 +642,16 @@ var PlacesOrganizer = {
|
|||
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",
|
||||
|
|
|
@ -149,8 +149,8 @@ function finishTest() {
|
|||
*/
|
||||
var bookmarksObserver = {
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsINavBookmarkObserver
|
||||
, Ci.nsIAnnotationObserver
|
||||
Ci.nsINavBookmarkObserver,
|
||||
Ci.nsIAnnotationObserver
|
||||
]),
|
||||
|
||||
// nsIAnnotationObserver
|
||||
|
|
|
@ -186,8 +186,8 @@ function finishTest() {
|
|||
*/
|
||||
var bookmarksObserver = {
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsINavBookmarkObserver
|
||||
, Ci.nsIAnnotationObserver
|
||||
Ci.nsINavBookmarkObserver,
|
||||
Ci.nsIAnnotationObserver
|
||||
]),
|
||||
|
||||
// nsIAnnotationObserver
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
*/
|
||||
|
||||
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 = [
|
||||
|
|
|
@ -32,9 +32,6 @@ module.exports = {
|
|||
// 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"],
|
||||
|
||||
|
|
|
@ -47,14 +47,14 @@ var ContentClick = {
|
|||
// 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;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ const PREF_TASKBAR_REFRESH = "refreshInSeconds";
|
|||
|
||||
// Hash keys for pendingStatements.
|
||||
const LIST_TYPE = {
|
||||
FREQUENT: 0
|
||||
, RECENT: 1
|
||||
FREQUENT: 0,
|
||||
RECENT: 1
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -405,8 +405,8 @@ this.WinTaskbarJumpList =
|
|||
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) {}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@ module.exports = {
|
|||
// 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",
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ AutoCompleteSearch.prototype = {
|
|||
this.stopSearchInvoked = true;
|
||||
},
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIFactory
|
||||
, Ci.nsIAutoCompleteSearch
|
||||
Ci.nsIFactory,
|
||||
Ci.nsIAutoCompleteSearch
|
||||
]),
|
||||
createInstance(outer, iid) {
|
||||
return this.QueryInterface(iid);
|
||||
|
|
|
@ -50,9 +50,6 @@ module.exports = {
|
|||
// 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",
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ module.exports = {
|
|||
"block-scoped-var": "error",
|
||||
"camelcase": "warn",
|
||||
"comma-dangle": "off",
|
||||
"comma-style": ["warn", "last"],
|
||||
"complexity": ["error", {"max": 20}],
|
||||
"curly": "error",
|
||||
"dot-location": ["warn", "property"],
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
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],
|
||||
|
|
|
@ -182,17 +182,17 @@ var Bookmarks = Object.freeze({
|
|||
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 () => {
|
||||
|
@ -342,21 +342,21 @@ var Bookmarks = Object.freeze({
|
|||
// 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;
|
||||
|
@ -463,10 +463,10 @@ var Bookmarks = Object.freeze({
|
|||
// 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.
|
||||
|
@ -490,13 +490,13 @@ var Bookmarks = Object.freeze({
|
|||
}
|
||||
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",
|
||||
|
@ -1100,8 +1100,8 @@ function updateBookmark(info, item, newParent) {
|
|||
// 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;
|
||||
|
@ -1159,8 +1159,8 @@ function updateBookmark(info, item, newParent) {
|
|||
}
|
||||
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" });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ PlacesCategoriesStarter.prototype = {
|
|||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(PlacesCategoriesStarter),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIObserver
|
||||
, Ci.nsINavBookmarkObserver
|
||||
Ci.nsIObserver,
|
||||
Ci.nsINavBookmarkObserver
|
||||
])
|
||||
};
|
||||
|
||||
|
|
|
@ -1351,32 +1351,32 @@ var updateBookmarkMetadata = async function(oldBookmarkItem,
|
|||
|
||||
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;
|
||||
|
|
|
@ -1014,12 +1014,12 @@ async function createItemsFromBookmarksTree(aBookmarksTree, aRestoring = false,
|
|||
}
|
||||
} 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;
|
||||
|
@ -1163,10 +1163,10 @@ 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);
|
||||
|
@ -1505,9 +1505,9 @@ PT.Tag.prototype = {
|
|||
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));
|
||||
|
|
|
@ -4,25 +4,25 @@
|
|||
* 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;
|
||||
|
@ -227,9 +227,9 @@ const BOOKMARK_VALIDATORS = Object.freeze({
|
|||
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)
|
||||
|
@ -584,8 +584,8 @@ this.PlacesUtils = {
|
|||
SYNC_CHANGE_RECORD_VALIDATORS,
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIObserver
|
||||
, Ci.nsITransactionListener
|
||||
Ci.nsIObserver,
|
||||
Ci.nsITransactionListener
|
||||
]),
|
||||
|
||||
_shutdownFunctions: [],
|
||||
|
@ -1952,10 +1952,10 @@ this.PlacesUtils = {
|
|||
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);
|
||||
}
|
||||
|
@ -3051,11 +3051,11 @@ PlacesCreateLivemarkTransaction.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) {
|
||||
|
@ -3122,12 +3122,12 @@ PlacesRemoveLivemarkTransaction.prototype = {
|
|||
// 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;
|
||||
|
|
|
@ -207,16 +207,16 @@ LivemarkService.prototype = {
|
|||
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);
|
||||
|
@ -393,11 +393,11 @@ LivemarkService.prototype = {
|
|||
_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
|
||||
])
|
||||
};
|
||||
|
||||
|
@ -866,10 +866,10 @@ LivemarkLoadListener.prototype = {
|
|||
|
||||
// nsISupports
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIFeedResultListener
|
||||
, Ci.nsIStreamListener
|
||||
, Ci.nsIRequestObserver
|
||||
, Ci.nsIInterfaceRequestor
|
||||
Ci.nsIFeedResultListener,
|
||||
Ci.nsIStreamListener,
|
||||
Ci.nsIRequestObserver,
|
||||
Ci.nsIInterfaceRequestor
|
||||
])
|
||||
}
|
||||
|
||||
|
|
|
@ -1086,11 +1086,11 @@ nsPlacesExpiration.prototype = {
|
|||
_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
|
||||
])
|
||||
};
|
||||
|
||||
|
|
|
@ -478,9 +478,9 @@ TaggingService.prototype = {
|
|||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(TaggingService),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsITaggingService
|
||||
, Ci.nsINavBookmarkObserver
|
||||
, Ci.nsIObserver
|
||||
Ci.nsITaggingService,
|
||||
Ci.nsINavBookmarkObserver,
|
||||
Ci.nsIObserver
|
||||
])
|
||||
};
|
||||
|
||||
|
|
|
@ -136,11 +136,11 @@ async function task_populateDB(aArray) {
|
|||
}
|
||||
|
||||
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)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
// 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');"
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -14,25 +14,25 @@ add_task(async function() {
|
|||
}
|
||||
|
||||
// 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;
|
||||
});
|
||||
|
|
|
@ -26,18 +26,18 @@ function run_test() {
|
|||
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
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -34,18 +34,18 @@ function run_test() {
|
|||
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
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
*/
|
||||
|
||||
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) {
|
||||
|
|
|
@ -45,21 +45,21 @@ var observer = {
|
|||
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,
|
||||
|
@ -80,10 +80,10 @@ var observer = {
|
|||
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);
|
||||
},
|
||||
|
||||
|
@ -91,11 +91,11 @@ var observer = {
|
|||
|
||||
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();
|
||||
|
@ -384,9 +384,9 @@ add_task(async function test_new_folder_with_annotation() {
|
|||
|
||||
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();
|
||||
};
|
||||
|
||||
|
@ -402,10 +402,10 @@ add_task(async function test_new_folder_with_annotation() {
|
|||
});
|
||||
|
||||
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);
|
||||
|
@ -420,9 +420,9 @@ add_task(async function test_new_bookmark() {
|
|||
};
|
||||
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();
|
||||
};
|
||||
|
||||
|
@ -440,9 +440,9 @@ add_task(async function test_new_bookmark() {
|
|||
|
||||
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);
|
||||
|
@ -478,10 +478,10 @@ add_task(async function test_merge_create_folder_and_item() {
|
|||
|
||||
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() {
|
||||
|
@ -498,26 +498,26 @@ add_task(async function test_move_items_to_folder() {
|
|||
|
||||
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();
|
||||
};
|
||||
|
||||
|
@ -536,34 +536,34 @@ add_task(async function test_move_items_to_folder() {
|
|||
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();
|
||||
};
|
||||
|
||||
|
@ -579,9 +579,9 @@ add_task(async function test_move_items_to_folder() {
|
|||
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();
|
||||
});
|
||||
|
@ -606,44 +606,44 @@ add_task(async function test_remove_folder() {
|
|||
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);
|
||||
|
@ -651,21 +651,21 @@ add_task(async function test_remove_folder() {
|
|||
|
||||
// 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();
|
||||
|
||||
|
@ -720,20 +720,20 @@ add_task(async function test_add_and_remove_bookmarks_with_additional_info() {
|
|||
// 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]);
|
||||
|
||||
|
@ -747,10 +747,10 @@ add_task(async function test_add_and_remove_bookmarks_with_additional_info() {
|
|||
// 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.
|
||||
|
@ -869,9 +869,9 @@ add_task(async function test_creating_and_removing_a_separator() {
|
|||
|
||||
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);
|
||||
|
@ -911,14 +911,14 @@ add_task(async function test_add_and_remove_livemark() {
|
|||
});
|
||||
|
||||
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();
|
||||
|
@ -951,9 +951,9 @@ add_task(async function test_edit_url() {
|
|||
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 : []);
|
||||
}
|
||||
|
@ -1011,14 +1011,14 @@ add_task(async function test_edit_url() {
|
|||
});
|
||||
|
||||
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();
|
||||
|
@ -1055,13 +1055,13 @@ add_task(async function test_edit_keyword() {
|
|||
});
|
||||
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1118,10 +1118,10 @@ add_task(async function test_edit_specific_keyword() {
|
|||
|
||||
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() {
|
||||
|
@ -1184,12 +1184,12 @@ add_task(async function test_tag_uri() {
|
|||
});
|
||||
|
||||
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();
|
||||
|
@ -1259,13 +1259,13 @@ add_task(async function test_untag_uri() {
|
|||
});
|
||||
|
||||
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();
|
||||
|
@ -1334,12 +1334,12 @@ add_task(async function test_annotate_multiple() {
|
|||
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);
|
||||
|
@ -1404,25 +1404,25 @@ add_task(async function test_sort_folder_by_name() {
|
|||
|
||||
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() {
|
||||
|
@ -1484,14 +1484,14 @@ add_task(async function test_copy() {
|
|||
}
|
||||
|
||||
// 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();
|
||||
|
@ -1502,16 +1502,16 @@ add_task(async function test_copy() {
|
|||
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;
|
||||
});
|
||||
|
||||
|
@ -1569,15 +1569,15 @@ add_task(async function test_copy_excluding_annotations() {
|
|||
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
|
||||
|
@ -1589,15 +1589,15 @@ add_task(async function test_copy_excluding_annotations() {
|
|||
|
||||
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() {
|
||||
|
@ -1642,18 +1642,18 @@ add_task(async function test_annotate_multiple_items() {
|
|||
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);
|
||||
});
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ add_task(async function() {
|
|||
|
||||
|
||||
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;
|
||||
|
|
|
@ -137,12 +137,12 @@ add_task(async function test_bookmark_removal() {
|
|||
|
||||
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);
|
||||
|
@ -153,13 +153,13 @@ add_task(async function test_moz_hosts_typed_update() {
|
|||
|
||||
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);
|
||||
|
@ -209,8 +209,8 @@ add_task(async function test_moz_hosts_update_2() {
|
|||
// 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
|
||||
}];
|
||||
|
|
|
@ -68,9 +68,9 @@ function* step() {
|
|||
},
|
||||
};
|
||||
|
||||
history.updatePlaces({ uri
|
||||
, visits: [ { transitionType: transition
|
||||
, visitDate: Date.now() * 1000
|
||||
history.updatePlaces({ uri,
|
||||
visits: [ { transitionType: transition,
|
||||
visitDate: Date.now() * 1000
|
||||
} ]
|
||||
}, callback);
|
||||
});
|
||||
|
|
|
@ -87,8 +87,8 @@ add_task(async function test_addLivemark_noIndex_throws() {
|
|||
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);
|
||||
|
@ -98,8 +98,8 @@ add_task(async function test_addLivemark_badIndex_throws() {
|
|||
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) {
|
||||
|
@ -120,8 +120,8 @@ add_task(async function test_addLivemark_noFeedURI_throws() {
|
|||
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);
|
||||
|
@ -131,9 +131,9 @@ add_task(async function test_addLivemark_badFeedURI_throws() {
|
|||
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);
|
||||
|
@ -143,9 +143,9 @@ add_task(async function test_addLivemark_badSiteURI_throws() {
|
|||
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);
|
||||
|
@ -168,18 +168,18 @@ add_task(async function test_addLivemark_parentId_succeeds() {
|
|||
});
|
||||
|
||||
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);
|
||||
|
@ -198,10 +198,10 @@ add_task(async function test_addLivemark_noSiteURI_succeeds() {
|
|||
|
||||
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);
|
||||
|
@ -221,11 +221,11 @@ add_task(async function test_addLivemark_succeeds() {
|
|||
|
||||
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);
|
||||
|
@ -234,9 +234,9 @@ add_task(async function test_addLivemark_bogusid_succeeds() {
|
|||
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) {}
|
||||
|
@ -245,9 +245,9 @@ add_task(async function test_addLivemark_bogusParentId_fails() {
|
|||
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) {}
|
||||
|
@ -255,16 +255,16 @@ add_task(async function test_addLivemark_bogusParentGuid_fails() {
|
|||
|
||||
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) {
|
||||
|
@ -274,10 +274,10 @@ add_task(async function test_addLivemark_intoLivemark_fails() {
|
|||
|
||||
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");
|
||||
|
@ -286,10 +286,10 @@ add_task(async function test_addLivemark_forceGuid_succeeds() {
|
|||
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);
|
||||
});
|
||||
|
@ -297,10 +297,10 @@ add_task(async function test_addLivemark_dateAdded_succeeds() {
|
|||
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);
|
||||
|
@ -334,10 +334,10 @@ add_task(async function test_removeLivemark_nonExistent_fails() {
|
|||
|
||||
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");
|
||||
|
@ -351,9 +351,9 @@ add_task(async function test_removeLivemark_guid_succeeds() {
|
|||
|
||||
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 });
|
||||
|
@ -395,10 +395,10 @@ add_task(async function test_getLivemark_nonExistentGUID_fails() {
|
|||
|
||||
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 =
|
||||
|
@ -417,9 +417,9 @@ add_task(async function test_getLivemark_guid_succeeds() {
|
|||
|
||||
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 });
|
||||
|
@ -437,15 +437,15 @@ add_task(async function test_getLivemark_id_succeeds() {
|
|||
|
||||
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 });
|
||||
|
@ -459,9 +459,9 @@ add_task(async function test_getLivemark_removeItem_contention() {
|
|||
|
||||
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,
|
||||
|
@ -477,9 +477,9 @@ add_task(async function test_title_change() {
|
|||
|
||||
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,
|
||||
|
@ -495,9 +495,9 @@ add_task(async function test_livemark_move() {
|
|||
|
||||
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.
|
||||
|
|
|
@ -17,7 +17,6 @@ module.exports = {
|
|||
"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}],
|
||||
|
|
|
@ -85,7 +85,7 @@ module.exports = {
|
|||
"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?
|
||||
|
|
Загрузка…
Ссылка в новой задаче