зеркало из 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",
|
"block-scoped-var": "error",
|
||||||
"camelcase": "error",
|
"camelcase": "error",
|
||||||
"comma-dangle": ["error", "never"],
|
"comma-dangle": ["error", "never"],
|
||||||
"comma-style": ["error", "last"],
|
|
||||||
"complexity": ["error", 20],
|
"complexity": ["error", 20],
|
||||||
"consistent-this": "off",
|
"consistent-this": "off",
|
||||||
"curly": ["error", "multi-line"],
|
"curly": ["error", "multi-line"],
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
// * add an entry here in the proper ordering (based on spans)
|
// * add an entry here in the proper ordering (based on spans)
|
||||||
// The <a/> part of the snippet will be linked to the corresponding url.
|
// The <a/> part of the snippet will be linked to the corresponding url.
|
||||||
const DEFAULT_SNIPPETS_URLS = [
|
const DEFAULT_SNIPPETS_URLS = [
|
||||||
"https://www.mozilla.org/firefox/features/?utm_source=snippet&utm_medium=snippet&utm_campaign=default+feature+snippet"
|
"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://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons"
|
||||||
];
|
];
|
||||||
|
|
||||||
const SNIPPETS_UPDATE_INTERVAL_MS = 14400000; // 4 hours.
|
const SNIPPETS_UPDATE_INTERVAL_MS = 14400000; // 4 hours.
|
||||||
|
|
|
@ -310,11 +310,11 @@ var StarUI = {
|
||||||
fn();
|
fn();
|
||||||
}, {"capture": true, "once": true});
|
}, {"capture": true, "once": true});
|
||||||
};
|
};
|
||||||
gEditItemOverlay.initPanel({ node: aNode
|
gEditItemOverlay.initPanel({ node: aNode,
|
||||||
, onPanelReady
|
onPanelReady,
|
||||||
, hiddenRows: ["description", "location",
|
hiddenRows: ["description", "location",
|
||||||
"loadInSidebar", "keyword"]
|
"loadInSidebar", "keyword"],
|
||||||
, focusedElement: "preferred"});
|
focusedElement: "preferred"});
|
||||||
|
|
||||||
this.panel.openPopup(aAnchorElement, aPosition);
|
this.panel.openPopup(aAnchorElement, aPosition);
|
||||||
},
|
},
|
||||||
|
@ -499,8 +499,8 @@ var PlacesCommandHook = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (description) {
|
if (description) {
|
||||||
info.annotations = [{ name: PlacesUIUtils.DESCRIPTION_ANNO
|
info.annotations = [{ name: PlacesUIUtils.DESCRIPTION_ANNO,
|
||||||
, value: description }];
|
value: description }];
|
||||||
}
|
}
|
||||||
|
|
||||||
info.guid = await PlacesTransactions.NewBookmark(info).transact();
|
info.guid = await PlacesTransactions.NewBookmark(info).transact();
|
||||||
|
@ -572,8 +572,8 @@ var PlacesCommandHook = {
|
||||||
async bookmarkLink(aParentId, aURL, aTitle, aDescription = "") {
|
async bookmarkLink(aParentId, aURL, aTitle, aDescription = "") {
|
||||||
let node = await PlacesUIUtils.fetchNodeLike({ url: aURL });
|
let node = await PlacesUIUtils.fetchNodeLike({ url: aURL });
|
||||||
if (node) {
|
if (node) {
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "edit"
|
PlacesUIUtils.showBookmarkDialog({ action: "edit",
|
||||||
, node
|
node
|
||||||
}, window.top);
|
}, window.top);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -581,16 +581,16 @@ var PlacesCommandHook = {
|
||||||
let ip = new InsertionPoint(aParentId,
|
let ip = new InsertionPoint(aParentId,
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
Components.interfaces.nsITreeView.DROP_ON);
|
Components.interfaces.nsITreeView.DROP_ON);
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: "bookmark"
|
type: "bookmark",
|
||||||
, uri: makeURI(aURL)
|
uri: makeURI(aURL),
|
||||||
, title: aTitle
|
title: aTitle,
|
||||||
, description: aDescription
|
description: aDescription,
|
||||||
, defaultInsertionPoint: ip
|
defaultInsertionPoint: ip,
|
||||||
, hiddenRows: [ "description"
|
hiddenRows: [ "description",
|
||||||
, "location"
|
"location",
|
||||||
, "loadInSidebar"
|
"loadInSidebar",
|
||||||
, "keyword" ]
|
"keyword" ]
|
||||||
}, window.top);
|
}, window.top);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -623,10 +623,10 @@ var PlacesCommandHook = {
|
||||||
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
|
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
|
||||||
let pages = this.uniqueCurrentPages;
|
let pages = this.uniqueCurrentPages;
|
||||||
if (pages.length > 1) {
|
if (pages.length > 1) {
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: "folder"
|
type: "folder",
|
||||||
, URIList: pages
|
URIList: pages,
|
||||||
, hiddenRows: [ "description" ]
|
hiddenRows: [ "description" ]
|
||||||
}, window);
|
}, window);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -667,16 +667,16 @@ var PlacesCommandHook = {
|
||||||
description = (await this._getPageDetails(gBrowser.selectedBrowser)).description;
|
description = (await this._getPageDetails(gBrowser.selectedBrowser)).description;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: "livemark"
|
type: "livemark",
|
||||||
, feedURI
|
feedURI,
|
||||||
, siteURI: gBrowser.currentURI
|
siteURI: gBrowser.currentURI,
|
||||||
, title
|
title,
|
||||||
, description
|
description,
|
||||||
, defaultInsertionPoint: toolbarIP
|
defaultInsertionPoint: toolbarIP,
|
||||||
, hiddenRows: [ "feedLocation"
|
hiddenRows: [ "feedLocation",
|
||||||
, "siteLocation"
|
"siteLocation",
|
||||||
, "description" ]
|
"description" ]
|
||||||
}, window);
|
}, window);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -5749,14 +5749,14 @@ function contentAreaClick(event, isPanelClick) {
|
||||||
// This is the Opera convention for a special link that, when clicked,
|
// This is the Opera convention for a special link that, when clicked,
|
||||||
// allows to add a sidebar panel. The link's title attribute contains
|
// allows to add a sidebar panel. The link's title attribute contains
|
||||||
// the title that should be used for the sidebar panel.
|
// the title that should be used for the sidebar panel.
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: "bookmark"
|
type: "bookmark",
|
||||||
, uri: makeURI(href)
|
uri: makeURI(href),
|
||||||
, title: linkNode.getAttribute("title")
|
title: linkNode.getAttribute("title"),
|
||||||
, loadBookmarkInSidebar: true
|
loadBookmarkInSidebar: true,
|
||||||
, hiddenRows: [ "description"
|
hiddenRows: [ "description",
|
||||||
, "location"
|
"location",
|
||||||
, "keyword" ]
|
"keyword" ]
|
||||||
}, window);
|
}, window);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
@ -6646,18 +6646,18 @@ function AddKeywordForSearchField() {
|
||||||
let bookmarkData = message.data;
|
let bookmarkData = message.data;
|
||||||
let title = gNavigatorBundle.getFormattedString("addKeywordTitleAutoFill",
|
let title = gNavigatorBundle.getFormattedString("addKeywordTitleAutoFill",
|
||||||
[bookmarkData.title]);
|
[bookmarkData.title]);
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: "bookmark"
|
type: "bookmark",
|
||||||
, uri: makeURI(bookmarkData.spec)
|
uri: makeURI(bookmarkData.spec),
|
||||||
, title
|
title,
|
||||||
, description: bookmarkData.description
|
description: bookmarkData.description,
|
||||||
, keyword: ""
|
keyword: "",
|
||||||
, postData: bookmarkData.postData
|
postData: bookmarkData.postData,
|
||||||
, charSet: bookmarkData.charset
|
charSet: bookmarkData.charset,
|
||||||
, hiddenRows: [ "location"
|
hiddenRows: [ "location",
|
||||||
, "description"
|
"description",
|
||||||
, "tags"
|
"tags",
|
||||||
, "loadInSidebar" ]
|
"loadInSidebar" ]
|
||||||
}, window);
|
}, window);
|
||||||
}
|
}
|
||||||
mm.addMessageListener("ContextMenu:SearchFieldBookmarkData:Result", onMessage);
|
mm.addMessageListener("ContextMenu:SearchFieldBookmarkData:Result", onMessage);
|
||||||
|
|
|
@ -35,8 +35,7 @@ var panelProgressListener = {
|
||||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
|
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||||
window.parent.document.getElementById("sidebar-throbber").removeAttribute("loading");
|
window.parent.document.getElementById("sidebar-throbber").removeAttribute("loading");
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
,
|
|
||||||
|
|
||||||
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
|
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
|
||||||
UpdateBackForwardCommands(getPanelBrowser().webNavigation);
|
UpdateBackForwardCommands(getPanelBrowser().webNavigation);
|
||||||
|
|
|
@ -4,7 +4,6 @@ module.exports = {
|
||||||
"rules": {
|
"rules": {
|
||||||
"block-scoped-var": "error",
|
"block-scoped-var": "error",
|
||||||
"comma-dangle": "off",
|
"comma-dangle": "off",
|
||||||
"comma-style": ["error", "last"],
|
|
||||||
"complexity": ["error", {"max": 21}],
|
"complexity": ["error", {"max": 21}],
|
||||||
"dot-notation": "error",
|
"dot-notation": "error",
|
||||||
"indent": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
|
"indent": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
|
||||||
|
|
|
@ -579,9 +579,9 @@ this.PlacesUIUtils = {
|
||||||
if (!this.PLACES_FLAVORS.includes(aData.type))
|
if (!this.PLACES_FLAVORS.includes(aData.type))
|
||||||
throw new Error(`itemGuid unexpectedly set on ${aData.type} data`);
|
throw new Error(`itemGuid unexpectedly set on ${aData.type} data`);
|
||||||
|
|
||||||
let info = { guid: aData.itemGuid
|
let info = { guid: aData.itemGuid,
|
||||||
, newParentGuid: aNewParentGuid
|
newParentGuid: aNewParentGuid,
|
||||||
, newIndex: aIndex };
|
newIndex: aIndex };
|
||||||
if (aCopy) {
|
if (aCopy) {
|
||||||
info.excludingAnnotation = "Places/SmartBookmark";
|
info.excludingAnnotation = "Places/SmartBookmark";
|
||||||
return PlacesTransactions.Copy(info);
|
return PlacesTransactions.Copy(info);
|
||||||
|
@ -597,16 +597,16 @@ this.PlacesUIUtils = {
|
||||||
throw new Error("Can't copy a container from a legacy-transactions build");
|
throw new Error("Can't copy a container from a legacy-transactions build");
|
||||||
|
|
||||||
if (aData.type == PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR) {
|
if (aData.type == PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR) {
|
||||||
return PlacesTransactions.NewSeparator({ parentGuid: aNewParentGuid
|
return PlacesTransactions.NewSeparator({ parentGuid: aNewParentGuid,
|
||||||
, index: aIndex });
|
index: aIndex });
|
||||||
}
|
}
|
||||||
|
|
||||||
let title = aData.type != PlacesUtils.TYPE_UNICODE ? aData.title
|
let title = aData.type != PlacesUtils.TYPE_UNICODE ? aData.title
|
||||||
: aData.uri;
|
: aData.uri;
|
||||||
return PlacesTransactions.NewBookmark({ uri: NetUtil.newURI(aData.uri)
|
return PlacesTransactions.NewBookmark({ uri: NetUtil.newURI(aData.uri),
|
||||||
, title
|
title,
|
||||||
, parentGuid: aNewParentGuid
|
parentGuid: aNewParentGuid,
|
||||||
, index: aIndex });
|
index: aIndex });
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -309,18 +309,18 @@ var BookmarkPropertiesPanel = {
|
||||||
|
|
||||||
switch (this._action) {
|
switch (this._action) {
|
||||||
case ACTION_EDIT:
|
case ACTION_EDIT:
|
||||||
gEditItemOverlay.initPanel({ node: this._node
|
gEditItemOverlay.initPanel({ node: this._node,
|
||||||
, hiddenRows: this._hiddenRows
|
hiddenRows: this._hiddenRows,
|
||||||
, focusedElement: "first" });
|
focusedElement: "first" });
|
||||||
acceptButton.disabled = gEditItemOverlay.readOnly;
|
acceptButton.disabled = gEditItemOverlay.readOnly;
|
||||||
break;
|
break;
|
||||||
case ACTION_ADD:
|
case ACTION_ADD:
|
||||||
this._node = await this._promiseNewItem();
|
this._node = await this._promiseNewItem();
|
||||||
// Edit the new item
|
// Edit the new item
|
||||||
gEditItemOverlay.initPanel({ node: this._node
|
gEditItemOverlay.initPanel({ node: this._node,
|
||||||
, hiddenRows: this._hiddenRows
|
hiddenRows: this._hiddenRows,
|
||||||
, postData: this._postData
|
postData: this._postData,
|
||||||
, focusedElement: "first" });
|
focusedElement: "first" });
|
||||||
|
|
||||||
// Empty location field if the uri is about:blank, this way inserting a new
|
// 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
|
// 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 parentGuid = await PlacesUtils.promiseItemGuid(containerId);
|
||||||
let annotations = [];
|
let annotations = [];
|
||||||
if (this._description) {
|
if (this._description) {
|
||||||
annotations.push({ name: PlacesUIUtils.DESCRIPTION_ANNO
|
annotations.push({ name: PlacesUIUtils.DESCRIPTION_ANNO,
|
||||||
, value: this._description });
|
value: this._description });
|
||||||
}
|
}
|
||||||
if (this._loadInSidebar) {
|
if (this._loadInSidebar) {
|
||||||
annotations.push({ name: PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO
|
annotations.push({ name: PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO,
|
||||||
, value: true });
|
value: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
let itemGuid;
|
let itemGuid;
|
||||||
|
|
|
@ -290,14 +290,14 @@ PlacesController.prototype = {
|
||||||
break;
|
break;
|
||||||
case "placesCmd_createBookmark":
|
case "placesCmd_createBookmark":
|
||||||
let node = this._view.selectedNode;
|
let node = this._view.selectedNode;
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: "bookmark"
|
type: "bookmark",
|
||||||
, hiddenRows: [ "description"
|
hiddenRows: [ "description",
|
||||||
, "keyword"
|
"keyword",
|
||||||
, "location"
|
"location",
|
||||||
, "loadInSidebar" ]
|
"loadInSidebar" ],
|
||||||
, uri: NetUtil.newURI(node.uri)
|
uri: NetUtil.newURI(node.uri),
|
||||||
, title: node.title
|
title: node.title
|
||||||
}, window.top);
|
}, window.top);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -677,9 +677,9 @@ PlacesController.prototype = {
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "edit"
|
PlacesUIUtils.showBookmarkDialog({ action: "edit",
|
||||||
, node
|
node,
|
||||||
, hiddenRows: [ "folderPicker" ]
|
hiddenRows: [ "folderPicker" ]
|
||||||
}, window.top);
|
}, window.top);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -734,10 +734,10 @@ PlacesController.prototype = {
|
||||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
let performed =
|
let performed =
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: aType
|
type: aType,
|
||||||
, defaultInsertionPoint: ip
|
defaultInsertionPoint: ip,
|
||||||
, hiddenRows: [ "folderPicker" ]
|
hiddenRows: [ "folderPicker" ]
|
||||||
}, window.top);
|
}, window.top);
|
||||||
if (performed) {
|
if (performed) {
|
||||||
// Select the new item.
|
// Select the new item.
|
||||||
|
@ -765,8 +765,8 @@ PlacesController.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let txn = PlacesTransactions.NewSeparator({ parentGuid: await ip.promiseGuid()
|
let txn = PlacesTransactions.NewSeparator({ parentGuid: await ip.promiseGuid(),
|
||||||
, index: ip.index });
|
index: ip.index });
|
||||||
let guid = await txn.transact();
|
let guid = await txn.transact();
|
||||||
let itemId = await PlacesUtils.promiseItemId(guid);
|
let itemId = await PlacesUtils.promiseItemId(guid);
|
||||||
// Select the new item.
|
// Select the new item.
|
||||||
|
|
|
@ -51,8 +51,8 @@ var gMoveBookmarksDialog = {
|
||||||
// Nothing to do if the node is already under the selected folder.
|
// Nothing to do if the node is already under the selected folder.
|
||||||
if (node.parent.itemId == selectedFolderId)
|
if (node.parent.itemId == selectedFolderId)
|
||||||
continue;
|
continue;
|
||||||
await PlacesTransactions.Move({ guid: node.bookmarkGuid
|
await PlacesTransactions.Move({ guid: node.bookmarkGuid,
|
||||||
, newParentGuid }).transact();
|
newParentGuid }).transact();
|
||||||
}
|
}
|
||||||
}).then(null, Components.utils.reportError);
|
}).then(null, Components.utils.reportError);
|
||||||
},
|
},
|
||||||
|
|
|
@ -642,16 +642,16 @@ var PlacesOrganizer = {
|
||||||
if (selectedNode && !PlacesUtils.nodeIsSeparator(selectedNode)) {
|
if (selectedNode && !PlacesUtils.nodeIsSeparator(selectedNode)) {
|
||||||
detailsDeck.selectedIndex = 1;
|
detailsDeck.selectedIndex = 1;
|
||||||
|
|
||||||
gEditItemOverlay.initPanel({ node: selectedNode
|
gEditItemOverlay.initPanel({ node: selectedNode,
|
||||||
, hiddenRows: ["folderPicker"] });
|
hiddenRows: ["folderPicker"] });
|
||||||
|
|
||||||
this._detectAndSetDetailsPaneMinimalState(selectedNode);
|
this._detectAndSetDetailsPaneMinimalState(selectedNode);
|
||||||
} else if (!selectedNode && aNodeList[0]) {
|
} else if (!selectedNode && aNodeList[0]) {
|
||||||
if (aNodeList.every(PlacesUtils.nodeIsURI)) {
|
if (aNodeList.every(PlacesUtils.nodeIsURI)) {
|
||||||
let uris = aNodeList.map(node => PlacesUtils._uri(node.uri));
|
let uris = aNodeList.map(node => PlacesUtils._uri(node.uri));
|
||||||
detailsDeck.selectedIndex = 1;
|
detailsDeck.selectedIndex = 1;
|
||||||
gEditItemOverlay.initPanel({ uris
|
gEditItemOverlay.initPanel({ uris,
|
||||||
, hiddenRows: ["folderPicker",
|
hiddenRows: ["folderPicker",
|
||||||
"loadInSidebar",
|
"loadInSidebar",
|
||||||
"location",
|
"location",
|
||||||
"keyword",
|
"keyword",
|
||||||
|
|
|
@ -149,8 +149,8 @@ function finishTest() {
|
||||||
*/
|
*/
|
||||||
var bookmarksObserver = {
|
var bookmarksObserver = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsINavBookmarkObserver
|
Ci.nsINavBookmarkObserver,
|
||||||
, Ci.nsIAnnotationObserver
|
Ci.nsIAnnotationObserver
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// nsIAnnotationObserver
|
// nsIAnnotationObserver
|
||||||
|
|
|
@ -186,8 +186,8 @@ function finishTest() {
|
||||||
*/
|
*/
|
||||||
var bookmarksObserver = {
|
var bookmarksObserver = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsINavBookmarkObserver
|
Ci.nsINavBookmarkObserver,
|
||||||
, Ci.nsIAnnotationObserver
|
Ci.nsIAnnotationObserver
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// nsIAnnotationObserver
|
// nsIAnnotationObserver
|
||||||
|
|
|
@ -9,19 +9,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const URIS = [
|
const URIS = [
|
||||||
"http://a.example1.com/"
|
"http://a.example1.com/",
|
||||||
, "http://b.example1.com/"
|
"http://b.example1.com/",
|
||||||
, "http://b.example2.com/"
|
"http://b.example2.com/",
|
||||||
, "http://c.example3.com/"
|
"http://c.example3.com/"
|
||||||
];
|
];
|
||||||
|
|
||||||
const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
|
const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
|
||||||
|
|
||||||
var EXPECTED_NOTIFICATIONS = [
|
var EXPECTED_NOTIFICATIONS = [
|
||||||
"places-shutdown"
|
"places-shutdown",
|
||||||
, "places-will-close-connection"
|
"places-will-close-connection",
|
||||||
, "places-expiration-finished"
|
"places-expiration-finished",
|
||||||
, "places-connection-closed"
|
"places-connection-closed"
|
||||||
];
|
];
|
||||||
|
|
||||||
const UNEXPECTED_NOTIFICATIONS = [
|
const UNEXPECTED_NOTIFICATIONS = [
|
||||||
|
|
|
@ -32,9 +32,6 @@ module.exports = {
|
||||||
// No space padding in parentheses
|
// No space padding in parentheses
|
||||||
"space-in-parens": ["error", "never"],
|
"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
|
// Require braces around blocks that start a new line
|
||||||
"curly": ["error", "all"],
|
"curly": ["error", "all"],
|
||||||
|
|
||||||
|
|
|
@ -47,14 +47,14 @@ var ContentClick = {
|
||||||
// This is the Opera convention for a special link that, when clicked,
|
// This is the Opera convention for a special link that, when clicked,
|
||||||
// allows to add a sidebar panel. The link's title attribute contains
|
// allows to add a sidebar panel. The link's title attribute contains
|
||||||
// the title that should be used for the sidebar panel.
|
// the title that should be used for the sidebar panel.
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add",
|
||||||
, type: "bookmark"
|
type: "bookmark",
|
||||||
, uri: Services.io.newURI(json.href)
|
uri: Services.io.newURI(json.href),
|
||||||
, title: json.title
|
title: json.title,
|
||||||
, loadBookmarkInSidebar: true
|
loadBookmarkInSidebar: true,
|
||||||
, hiddenRows: [ "description"
|
hiddenRows: [ "description",
|
||||||
, "location"
|
"location",
|
||||||
, "keyword" ]
|
"keyword" ]
|
||||||
}, window);
|
}, window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ const PREF_TASKBAR_REFRESH = "refreshInSeconds";
|
||||||
|
|
||||||
// Hash keys for pendingStatements.
|
// Hash keys for pendingStatements.
|
||||||
const LIST_TYPE = {
|
const LIST_TYPE = {
|
||||||
FREQUENT: 0
|
FREQUENT: 0,
|
||||||
, RECENT: 1
|
RECENT: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -405,8 +405,8 @@ this.WinTaskbarJumpList =
|
||||||
for (let row; (row = aResultSet.getNextRow());) {
|
for (let row; (row = aResultSet.getNextRow());) {
|
||||||
try {
|
try {
|
||||||
aCallback.call(aScope,
|
aCallback.call(aScope,
|
||||||
{ uri: row.getResultByIndex(1)
|
{ uri: row.getResultByIndex(1),
|
||||||
, title: row.getResultByIndex(2)
|
title: row.getResultByIndex(2)
|
||||||
});
|
});
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@ module.exports = {
|
||||||
// Braces only needed for multi-line arrow function blocks
|
// Braces only needed for multi-line arrow function blocks
|
||||||
"arrow-body-style": ["error", "as-needed"],
|
"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.
|
// Verify calls of super() in constructors.
|
||||||
"constructor-super": "error",
|
"constructor-super": "error",
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,8 @@ AutoCompleteSearch.prototype = {
|
||||||
this.stopSearchInvoked = true;
|
this.stopSearchInvoked = true;
|
||||||
},
|
},
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsIFactory
|
Ci.nsIFactory,
|
||||||
, Ci.nsIAutoCompleteSearch
|
Ci.nsIAutoCompleteSearch
|
||||||
]),
|
]),
|
||||||
createInstance(outer, iid) {
|
createInstance(outer, iid) {
|
||||||
return this.QueryInterface(iid);
|
return this.QueryInterface(iid);
|
||||||
|
|
|
@ -50,9 +50,6 @@ module.exports = {
|
||||||
// No space padding in parentheses
|
// No space padding in parentheses
|
||||||
"space-in-parens": ["error", "never"],
|
"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
|
// Functions are not required to consistently return something or nothing
|
||||||
"consistent-return": "off",
|
"consistent-return": "off",
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ module.exports = {
|
||||||
"block-scoped-var": "error",
|
"block-scoped-var": "error",
|
||||||
"camelcase": "warn",
|
"camelcase": "warn",
|
||||||
"comma-dangle": "off",
|
"comma-dangle": "off",
|
||||||
"comma-style": ["warn", "last"],
|
|
||||||
"complexity": ["error", {"max": 20}],
|
"complexity": ["error", {"max": 20}],
|
||||||
"curly": "error",
|
"curly": "error",
|
||||||
"dot-location": ["warn", "property"],
|
"dot-location": ["warn", "property"],
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"comma-style": "error",
|
|
||||||
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
|
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
|
||||||
// be removed & synced with the mozilla/recommended value.
|
// be removed & synced with the mozilla/recommended value.
|
||||||
"complexity": ["error", 43],
|
"complexity": ["error", 43],
|
||||||
|
|
|
@ -182,17 +182,17 @@ var Bookmarks = Object.freeze({
|
||||||
modTime = now;
|
modTime = now;
|
||||||
}
|
}
|
||||||
let insertInfo = validateBookmarkObject(info,
|
let insertInfo = validateBookmarkObject(info,
|
||||||
{ type: { defaultValue: this.TYPE_BOOKMARK }
|
{ type: { defaultValue: this.TYPE_BOOKMARK },
|
||||||
, index: { defaultValue: this.DEFAULT_INDEX }
|
index: { defaultValue: this.DEFAULT_INDEX },
|
||||||
, url: { requiredIf: b => b.type == this.TYPE_BOOKMARK
|
url: { requiredIf: b => b.type == this.TYPE_BOOKMARK,
|
||||||
, validIf: b => b.type == this.TYPE_BOOKMARK }
|
validIf: b => b.type == this.TYPE_BOOKMARK },
|
||||||
, parentGuid: { required: true }
|
parentGuid: { required: true },
|
||||||
, title: { validIf: b => [ this.TYPE_BOOKMARK
|
title: { validIf: b => [ this.TYPE_BOOKMARK,
|
||||||
, this.TYPE_FOLDER ].includes(b.type) }
|
this.TYPE_FOLDER ].includes(b.type) },
|
||||||
, dateAdded: { defaultValue: addedTime }
|
dateAdded: { defaultValue: addedTime },
|
||||||
, lastModified: { defaultValue: modTime,
|
lastModified: { defaultValue: modTime,
|
||||||
validIf: b => b.lastModified >= now || (b.dateAdded && b.lastModified >= b.dateAdded) }
|
validIf: b => b.lastModified >= now || (b.dateAdded && b.lastModified >= b.dateAdded) },
|
||||||
, source: { defaultValue: this.SOURCES.DEFAULT }
|
source: { defaultValue: this.SOURCES.DEFAULT }
|
||||||
});
|
});
|
||||||
|
|
||||||
return (async () => {
|
return (async () => {
|
||||||
|
@ -342,21 +342,21 @@ var Bookmarks = Object.freeze({
|
||||||
// dateAdded may be imposed by the caller.
|
// dateAdded may be imposed by the caller.
|
||||||
let time = (info && info.dateAdded) || fallbackLastAdded;
|
let time = (info && info.dateAdded) || fallbackLastAdded;
|
||||||
let insertInfo = validateBookmarkObject(info, {
|
let insertInfo = validateBookmarkObject(info, {
|
||||||
type: { defaultValue: TYPE_BOOKMARK }
|
type: { defaultValue: TYPE_BOOKMARK },
|
||||||
, url: { requiredIf: b => b.type == TYPE_BOOKMARK
|
url: { requiredIf: b => b.type == TYPE_BOOKMARK,
|
||||||
, validIf: b => b.type == TYPE_BOOKMARK }
|
validIf: b => b.type == TYPE_BOOKMARK },
|
||||||
, parentGuid: { required: true }
|
parentGuid: { required: true },
|
||||||
, title: { validIf: b => [ TYPE_BOOKMARK
|
title: { validIf: b => [ TYPE_BOOKMARK,
|
||||||
, TYPE_FOLDER ].includes(b.type) }
|
TYPE_FOLDER ].includes(b.type) },
|
||||||
, dateAdded: { defaultValue: time
|
dateAdded: { defaultValue: time,
|
||||||
, validIf: b => !b.lastModified ||
|
validIf: b => !b.lastModified ||
|
||||||
b.dateAdded <= b.lastModified }
|
b.dateAdded <= b.lastModified },
|
||||||
, lastModified: { defaultValue: time,
|
lastModified: { defaultValue: time,
|
||||||
validIf: b => (!b.dateAdded && b.lastModified >= time) ||
|
validIf: b => (!b.dateAdded && b.lastModified >= time) ||
|
||||||
(b.dateAdded && b.lastModified >= b.dateAdded) }
|
(b.dateAdded && b.lastModified >= b.dateAdded) },
|
||||||
, index: { replaceWith: indexToUse++ }
|
index: { replaceWith: indexToUse++ },
|
||||||
, source: { replaceWith: source }
|
source: { replaceWith: source },
|
||||||
, children: { validIf: b => b.type == TYPE_FOLDER && Array.isArray(b.children) }
|
children: { validIf: b => b.type == TYPE_FOLDER && Array.isArray(b.children) }
|
||||||
});
|
});
|
||||||
if (shouldUseNullIndices) {
|
if (shouldUseNullIndices) {
|
||||||
insertInfo.index = null;
|
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
|
// it's compared to the existing item to remove any properties that don't
|
||||||
// need to be updated.
|
// need to be updated.
|
||||||
let updateInfo = validateBookmarkObject(info,
|
let updateInfo = validateBookmarkObject(info,
|
||||||
{ guid: { required: true }
|
{ guid: { required: true },
|
||||||
, index: { requiredIf: b => b.hasOwnProperty("parentGuid")
|
index: { requiredIf: b => b.hasOwnProperty("parentGuid"),
|
||||||
, validIf: b => b.index >= 0 || b.index == this.DEFAULT_INDEX }
|
validIf: b => b.index >= 0 || b.index == this.DEFAULT_INDEX },
|
||||||
, source: { defaultValue: this.SOURCES.DEFAULT }
|
source: { defaultValue: this.SOURCES.DEFAULT }
|
||||||
});
|
});
|
||||||
|
|
||||||
// There should be at last one more property in addition to guid and source.
|
// 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();
|
const now = new Date();
|
||||||
updateInfo = validateBookmarkObject(updateInfo,
|
updateInfo = validateBookmarkObject(updateInfo,
|
||||||
{ url: { validIf: () => item.type == this.TYPE_BOOKMARK }
|
{ url: { validIf: () => item.type == this.TYPE_BOOKMARK },
|
||||||
, title: { validIf: () => [ this.TYPE_BOOKMARK
|
title: { validIf: () => [ this.TYPE_BOOKMARK,
|
||||||
, this.TYPE_FOLDER ].includes(item.type) }
|
this.TYPE_FOLDER ].includes(item.type) },
|
||||||
, lastModified: { defaultValue: now
|
lastModified: { defaultValue: now,
|
||||||
, validIf: b => b.lastModified >= now ||
|
validIf: b => b.lastModified >= now ||
|
||||||
b.lastModified >= (b.dateAdded || item.dateAdded) }
|
b.lastModified >= (b.dateAdded || item.dateAdded) },
|
||||||
, dateAdded: { defaultValue: item.dateAdded }
|
dateAdded: { defaultValue: item.dateAdded }
|
||||||
});
|
});
|
||||||
|
|
||||||
return PlacesUtils.withConnectionWrapper("Bookmarks.jsm: update",
|
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.
|
// Ensure a page exists in moz_places for this URL.
|
||||||
await maybeInsertPlace(db, info.url);
|
await maybeInsertPlace(db, info.url);
|
||||||
// Update tuples for the update query.
|
// Update tuples for the update query.
|
||||||
tuples.set("url", { value: info.url.href
|
tuples.set("url", { value: info.url.href,
|
||||||
, fragment: "fk = (SELECT id FROM moz_places WHERE url_hash = hash(:url) AND url = :url)" });
|
fragment: "fk = (SELECT id FROM moz_places WHERE url_hash = hash(:url) AND url = :url)" });
|
||||||
}
|
}
|
||||||
|
|
||||||
let newIndex = info.hasOwnProperty("index") ? info.index : item.index;
|
let newIndex = info.hasOwnProperty("index") ? info.index : item.index;
|
||||||
|
@ -1159,8 +1159,8 @@ function updateBookmark(info, item, newParent) {
|
||||||
}
|
}
|
||||||
let needsSyncChange = tuples.size > sizeThreshold;
|
let needsSyncChange = tuples.size > sizeThreshold;
|
||||||
if (needsSyncChange) {
|
if (needsSyncChange) {
|
||||||
tuples.set("syncChangeDelta", { value: syncChangeDelta
|
tuples.set("syncChangeDelta", { value: syncChangeDelta,
|
||||||
, fragment: "syncChangeCounter = syncChangeCounter + :syncChangeDelta" });
|
fragment: "syncChangeCounter = syncChangeCounter + :syncChangeDelta" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,8 @@ PlacesCategoriesStarter.prototype = {
|
||||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(PlacesCategoriesStarter),
|
_xpcom_factory: XPCOMUtils.generateSingletonFactory(PlacesCategoriesStarter),
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsIObserver
|
Ci.nsIObserver,
|
||||||
, Ci.nsINavBookmarkObserver
|
Ci.nsINavBookmarkObserver
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1351,32 +1351,32 @@ var updateBookmarkMetadata = async function(oldBookmarkItem,
|
||||||
|
|
||||||
function validateNewBookmark(info) {
|
function validateNewBookmark(info) {
|
||||||
let insertInfo = validateSyncBookmarkObject(info,
|
let insertInfo = validateSyncBookmarkObject(info,
|
||||||
{ kind: { required: true }
|
{ kind: { required: true },
|
||||||
, syncId: { required: true }
|
syncId: { required: true },
|
||||||
, url: { requiredIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
|
url: { requiredIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
|
||||||
, BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind)
|
BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind),
|
||||||
, validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
|
validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
|
||||||
, BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
|
BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
|
||||||
, parentSyncId: { required: true }
|
parentSyncId: { required: true },
|
||||||
, title: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
|
title: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
|
||||||
, BookmarkSyncUtils.KINDS.QUERY
|
BookmarkSyncUtils.KINDS.QUERY,
|
||||||
, BookmarkSyncUtils.KINDS.FOLDER
|
BookmarkSyncUtils.KINDS.FOLDER,
|
||||||
, BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) }
|
BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) },
|
||||||
, query: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY }
|
query: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY },
|
||||||
, folder: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY }
|
folder: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.QUERY },
|
||||||
, tags: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
|
tags: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
|
||||||
, BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
|
BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
|
||||||
, keyword: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
|
keyword: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
|
||||||
, BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
|
BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
|
||||||
, description: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
|
description: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
|
||||||
, BookmarkSyncUtils.KINDS.QUERY
|
BookmarkSyncUtils.KINDS.QUERY,
|
||||||
, BookmarkSyncUtils.KINDS.FOLDER
|
BookmarkSyncUtils.KINDS.FOLDER,
|
||||||
, BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) }
|
BookmarkSyncUtils.KINDS.LIVEMARK ].includes(b.kind) },
|
||||||
, loadInSidebar: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK
|
loadInSidebar: { validIf: b => [ BookmarkSyncUtils.KINDS.BOOKMARK,
|
||||||
, BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) }
|
BookmarkSyncUtils.KINDS.QUERY ].includes(b.kind) },
|
||||||
, feed: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK }
|
feed: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK },
|
||||||
, site: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK }
|
site: { validIf: b => b.kind == BookmarkSyncUtils.KINDS.LIVEMARK },
|
||||||
, dateAdded: { required: false }
|
dateAdded: { required: false }
|
||||||
});
|
});
|
||||||
|
|
||||||
return insertInfo;
|
return insertInfo;
|
||||||
|
|
|
@ -1014,12 +1014,12 @@ async function createItemsFromBookmarksTree(aBookmarksTree, aRestoring = false,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let livemark =
|
let livemark =
|
||||||
await PlacesUtils.livemarks.addLivemark({ title: aItem.title
|
await PlacesUtils.livemarks.addLivemark({ title: aItem.title,
|
||||||
, feedURI
|
feedURI,
|
||||||
, siteURI
|
siteURI,
|
||||||
, parentId
|
parentId,
|
||||||
, index: aIndex
|
index: aIndex,
|
||||||
, guid});
|
guid});
|
||||||
itemId = livemark.id;
|
itemId = livemark.id;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1163,10 +1163,10 @@ PT.NewLivemark = DefineTransaction(["feedUrl", "title", "parentGuid"],
|
||||||
["siteUrl", "index", "annotations"]);
|
["siteUrl", "index", "annotations"]);
|
||||||
PT.NewLivemark.prototype = Object.seal({
|
PT.NewLivemark.prototype = Object.seal({
|
||||||
async execute(aFeedURI, aTitle, aParentGuid, aSiteURI, aIndex, aAnnos) {
|
async execute(aFeedURI, aTitle, aParentGuid, aSiteURI, aIndex, aAnnos) {
|
||||||
let livemarkInfo = { title: aTitle
|
let livemarkInfo = { title: aTitle,
|
||||||
, feedURI: aFeedURI
|
feedURI: aFeedURI,
|
||||||
, siteURI: aSiteURI
|
siteURI: aSiteURI,
|
||||||
, index: aIndex };
|
index: aIndex };
|
||||||
let createItem = async function() {
|
let createItem = async function() {
|
||||||
livemarkInfo.parentId = await PlacesUtils.promiseItemId(aParentGuid);
|
livemarkInfo.parentId = await PlacesUtils.promiseItemId(aParentGuid);
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(livemarkInfo);
|
let livemark = await PlacesUtils.livemarks.addLivemark(livemarkInfo);
|
||||||
|
@ -1505,9 +1505,9 @@ PT.Tag.prototype = {
|
||||||
if (!(await PlacesUtils.bookmarks.fetch({ url: uri }))) {
|
if (!(await PlacesUtils.bookmarks.fetch({ url: uri }))) {
|
||||||
// Tagging is only allowed for bookmarked URIs (but see 424160).
|
// Tagging is only allowed for bookmarked URIs (but see 424160).
|
||||||
let createTxn = TransactionsHistory.getRawTransaction(
|
let createTxn = TransactionsHistory.getRawTransaction(
|
||||||
PT.NewBookmark({ url: uri
|
PT.NewBookmark({ url: uri,
|
||||||
, tags: aTags
|
tags: aTags,
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid }));
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid }));
|
||||||
await createTxn.execute();
|
await createTxn.execute();
|
||||||
onUndo.unshift(createTxn.undo.bind(createTxn));
|
onUndo.unshift(createTxn.undo.bind(createTxn));
|
||||||
onRedo.push(createTxn.redo.bind(createTxn));
|
onRedo.push(createTxn.redo.bind(createTxn));
|
||||||
|
|
|
@ -4,25 +4,25 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
this.EXPORTED_SYMBOLS = [
|
this.EXPORTED_SYMBOLS = [
|
||||||
"PlacesUtils"
|
"PlacesUtils",
|
||||||
, "PlacesAggregatedTransaction"
|
"PlacesAggregatedTransaction",
|
||||||
, "PlacesCreateFolderTransaction"
|
"PlacesCreateFolderTransaction",
|
||||||
, "PlacesCreateBookmarkTransaction"
|
"PlacesCreateBookmarkTransaction",
|
||||||
, "PlacesCreateSeparatorTransaction"
|
"PlacesCreateSeparatorTransaction",
|
||||||
, "PlacesCreateLivemarkTransaction"
|
"PlacesCreateLivemarkTransaction",
|
||||||
, "PlacesMoveItemTransaction"
|
"PlacesMoveItemTransaction",
|
||||||
, "PlacesRemoveItemTransaction"
|
"PlacesRemoveItemTransaction",
|
||||||
, "PlacesEditItemTitleTransaction"
|
"PlacesEditItemTitleTransaction",
|
||||||
, "PlacesEditBookmarkURITransaction"
|
"PlacesEditBookmarkURITransaction",
|
||||||
, "PlacesSetItemAnnotationTransaction"
|
"PlacesSetItemAnnotationTransaction",
|
||||||
, "PlacesSetPageAnnotationTransaction"
|
"PlacesSetPageAnnotationTransaction",
|
||||||
, "PlacesEditBookmarkKeywordTransaction"
|
"PlacesEditBookmarkKeywordTransaction",
|
||||||
, "PlacesEditBookmarkPostDataTransaction"
|
"PlacesEditBookmarkPostDataTransaction",
|
||||||
, "PlacesEditItemDateAddedTransaction"
|
"PlacesEditItemDateAddedTransaction",
|
||||||
, "PlacesEditItemLastModifiedTransaction"
|
"PlacesEditItemLastModifiedTransaction",
|
||||||
, "PlacesSortFolderByNameTransaction"
|
"PlacesSortFolderByNameTransaction",
|
||||||
, "PlacesTagURITransaction"
|
"PlacesTagURITransaction",
|
||||||
, "PlacesUntagURITransaction"
|
"PlacesUntagURITransaction"
|
||||||
];
|
];
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
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"),
|
dateAdded: simpleValidateFunc(v => v.constructor.name == "Date"),
|
||||||
lastModified: simpleValidateFunc(v => v.constructor.name == "Date"),
|
lastModified: simpleValidateFunc(v => v.constructor.name == "Date"),
|
||||||
type: simpleValidateFunc(v => Number.isInteger(v) &&
|
type: simpleValidateFunc(v => Number.isInteger(v) &&
|
||||||
[ PlacesUtils.bookmarks.TYPE_BOOKMARK
|
[ PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
||||||
, PlacesUtils.bookmarks.TYPE_FOLDER
|
PlacesUtils.bookmarks.TYPE_FOLDER,
|
||||||
, PlacesUtils.bookmarks.TYPE_SEPARATOR ].includes(v)),
|
PlacesUtils.bookmarks.TYPE_SEPARATOR ].includes(v)),
|
||||||
title: v => {
|
title: v => {
|
||||||
simpleValidateFunc(val => val === null || typeof(val) == "string").call(this, v);
|
simpleValidateFunc(val => val === null || typeof(val) == "string").call(this, v);
|
||||||
if (!v)
|
if (!v)
|
||||||
|
@ -584,8 +584,8 @@ this.PlacesUtils = {
|
||||||
SYNC_CHANGE_RECORD_VALIDATORS,
|
SYNC_CHANGE_RECORD_VALIDATORS,
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsIObserver
|
Ci.nsIObserver,
|
||||||
, Ci.nsITransactionListener
|
Ci.nsITransactionListener
|
||||||
]),
|
]),
|
||||||
|
|
||||||
_shutdownFunctions: [],
|
_shutdownFunctions: [],
|
||||||
|
@ -1952,10 +1952,10 @@ this.PlacesUtils = {
|
||||||
try {
|
try {
|
||||||
// This is the first row.
|
// This is the first row.
|
||||||
rootItem = item = await createItemInfoObject(row, true);
|
rootItem = item = await createItemInfoObject(row, true);
|
||||||
Object.defineProperty(rootItem, "itemsCount", { value: 1
|
Object.defineProperty(rootItem, "itemsCount", { value: 1,
|
||||||
, writable: true
|
writable: true,
|
||||||
, enumerable: false
|
enumerable: false,
|
||||||
, configurable: false });
|
configurable: false });
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
throw new Error("Failed to fetch the data for the root item " + ex);
|
throw new Error("Failed to fetch the data for the root item " + ex);
|
||||||
}
|
}
|
||||||
|
@ -3051,11 +3051,11 @@ PlacesCreateLivemarkTransaction.prototype = {
|
||||||
|
|
||||||
doTransaction: function CLTXN_doTransaction() {
|
doTransaction: function CLTXN_doTransaction() {
|
||||||
this._promise = PlacesUtils.livemarks.addLivemark(
|
this._promise = PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: this.item.title
|
{ title: this.item.title,
|
||||||
, feedURI: this.item.feedURI
|
feedURI: this.item.feedURI,
|
||||||
, parentId: this.item.parentId
|
parentId: this.item.parentId,
|
||||||
, index: this.item.index
|
index: this.item.index,
|
||||||
, siteURI: this.item.siteURI
|
siteURI: this.item.siteURI
|
||||||
}).then(aLivemark => {
|
}).then(aLivemark => {
|
||||||
this.item.id = aLivemark.id;
|
this.item.id = aLivemark.id;
|
||||||
if (this.item.annotations && this.item.annotations.length > 0) {
|
if (this.item.annotations && this.item.annotations.length > 0) {
|
||||||
|
@ -3122,12 +3122,12 @@ PlacesRemoveLivemarkTransaction.prototype = {
|
||||||
// is used just to serialize, so doesn't matter.
|
// is used just to serialize, so doesn't matter.
|
||||||
PlacesUtils.livemarks.getLivemark({ id: this.item.id })
|
PlacesUtils.livemarks.getLivemark({ id: this.item.id })
|
||||||
.then(null, () => {
|
.then(null, () => {
|
||||||
PlacesUtils.livemarks.addLivemark({ parentId: this.item.parentId
|
PlacesUtils.livemarks.addLivemark({ parentId: this.item.parentId,
|
||||||
, title: this.item.title
|
title: this.item.title,
|
||||||
, siteURI: this.item.siteURI
|
siteURI: this.item.siteURI,
|
||||||
, feedURI: this.item.feedURI
|
feedURI: this.item.feedURI,
|
||||||
, index: this.item.index
|
index: this.item.index,
|
||||||
, lastModified: this.item.lastModified
|
lastModified: this.item.lastModified
|
||||||
}).then(
|
}).then(
|
||||||
aLivemark => {
|
aLivemark => {
|
||||||
let itemId = aLivemark.id;
|
let itemId = aLivemark.id;
|
||||||
|
|
|
@ -207,16 +207,16 @@ LivemarkService.prototype = {
|
||||||
let id = await PlacesUtils.promiseItemId(folder.guid);
|
let id = await PlacesUtils.promiseItemId(folder.guid);
|
||||||
|
|
||||||
// Create the internal Livemark object.
|
// Create the internal Livemark object.
|
||||||
let livemark = new Livemark({ id
|
let livemark = new Livemark({ id,
|
||||||
, title: folder.title
|
title: folder.title,
|
||||||
, parentGuid: folder.parentGuid
|
parentGuid: folder.parentGuid,
|
||||||
, parentId: await PlacesUtils.promiseItemId(folder.parentGuid)
|
parentId: await PlacesUtils.promiseItemId(folder.parentGuid),
|
||||||
, index: folder.index
|
index: folder.index,
|
||||||
, feedURI: aLivemarkInfo.feedURI
|
feedURI: aLivemarkInfo.feedURI,
|
||||||
, siteURI: aLivemarkInfo.siteURI
|
siteURI: aLivemarkInfo.siteURI,
|
||||||
, guid: folder.guid
|
guid: folder.guid,
|
||||||
, dateAdded: toPRTime(folder.dateAdded)
|
dateAdded: toPRTime(folder.dateAdded),
|
||||||
, lastModified: toPRTime(folder.lastModified)
|
lastModified: toPRTime(folder.lastModified)
|
||||||
});
|
});
|
||||||
|
|
||||||
livemark.writeFeedURI(aLivemarkInfo.feedURI, aLivemarkInfo.source);
|
livemark.writeFeedURI(aLivemarkInfo.feedURI, aLivemarkInfo.source);
|
||||||
|
@ -393,11 +393,11 @@ LivemarkService.prototype = {
|
||||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(LivemarkService),
|
_xpcom_factory: XPCOMUtils.generateSingletonFactory(LivemarkService),
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.mozIAsyncLivemarks
|
Ci.mozIAsyncLivemarks,
|
||||||
, Ci.nsINavBookmarkObserver
|
Ci.nsINavBookmarkObserver,
|
||||||
, Ci.nsINavHistoryObserver
|
Ci.nsINavHistoryObserver,
|
||||||
, Ci.nsIObserver
|
Ci.nsIObserver,
|
||||||
, Ci.nsISupportsWeakReference
|
Ci.nsISupportsWeakReference
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -866,10 +866,10 @@ LivemarkLoadListener.prototype = {
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsIFeedResultListener
|
Ci.nsIFeedResultListener,
|
||||||
, Ci.nsIStreamListener
|
Ci.nsIStreamListener,
|
||||||
, Ci.nsIRequestObserver
|
Ci.nsIRequestObserver,
|
||||||
, Ci.nsIInterfaceRequestor
|
Ci.nsIInterfaceRequestor
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1086,11 +1086,11 @@ nsPlacesExpiration.prototype = {
|
||||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesExpiration),
|
_xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesExpiration),
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsIObserver
|
Ci.nsIObserver,
|
||||||
, Ci.nsINavHistoryObserver
|
Ci.nsINavHistoryObserver,
|
||||||
, Ci.nsITimerCallback
|
Ci.nsITimerCallback,
|
||||||
, Ci.mozIStorageStatementCallback
|
Ci.mozIStorageStatementCallback,
|
||||||
, Ci.nsISupportsWeakReference
|
Ci.nsISupportsWeakReference
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -478,9 +478,9 @@ TaggingService.prototype = {
|
||||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(TaggingService),
|
_xpcom_factory: XPCOMUtils.generateSingletonFactory(TaggingService),
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Ci.nsITaggingService
|
Ci.nsITaggingService,
|
||||||
, Ci.nsINavBookmarkObserver
|
Ci.nsINavBookmarkObserver,
|
||||||
, Ci.nsIObserver
|
Ci.nsIObserver
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -136,11 +136,11 @@ async function task_populateDB(aArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qdata.isLivemark) {
|
if (qdata.isLivemark) {
|
||||||
await PlacesUtils.livemarks.addLivemark({ title: qdata.title
|
await PlacesUtils.livemarks.addLivemark({ title: qdata.title,
|
||||||
, parentId: (await PlacesUtils.promiseItemId(qdata.parentGuid))
|
parentId: (await PlacesUtils.promiseItemId(qdata.parentGuid)),
|
||||||
, index: qdata.index
|
index: qdata.index,
|
||||||
, feedURI: uri(qdata.feedURI)
|
feedURI: uri(qdata.feedURI),
|
||||||
, siteURI: uri(qdata.uri)
|
siteURI: uri(qdata.uri)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
// Check that bookmarklets are returned by searches with searchTerms.
|
// Check that bookmarklets are returned by searches with searchTerms.
|
||||||
|
|
||||||
var testData = [
|
var testData = [
|
||||||
{ isInQuery: true
|
{ isInQuery: true,
|
||||||
, isBookmark: true
|
isBookmark: true,
|
||||||
, title: "bookmark 1"
|
title: "bookmark 1",
|
||||||
, uri: "http://mozilla.org/script/"
|
uri: "http://mozilla.org/script/"
|
||||||
},
|
},
|
||||||
|
|
||||||
{ isInQuery: true
|
{ isInQuery: true,
|
||||||
, isBookmark: true
|
isBookmark: true,
|
||||||
, title: "bookmark 2"
|
title: "bookmark 2",
|
||||||
, uri: "javascript:alert('moz');"
|
uri: "javascript:alert('moz');"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -14,25 +14,25 @@ add_task(async function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normal bookmark.
|
// Normal bookmark.
|
||||||
await insertAndTest({ parentGuid: root.bookmarkGuid
|
await insertAndTest({ parentGuid: root.bookmarkGuid,
|
||||||
, type: PlacesUtils.bookmarks.TYPE_BOOKMARK
|
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
||||||
, title: "Test Bookmark"
|
title: "Test Bookmark",
|
||||||
, url: "http://test.url.tld" });
|
url: "http://test.url.tld" });
|
||||||
|
|
||||||
// place: query
|
// place: query
|
||||||
await insertAndTest({ parentGuid: root.bookmarkGuid
|
await insertAndTest({ parentGuid: root.bookmarkGuid,
|
||||||
, type: PlacesUtils.bookmarks.TYPE_BOOKMARK
|
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
|
||||||
, title: "Test Query"
|
title: "Test Query",
|
||||||
, url: "place:folder=BOOKMARKS_MENU" });
|
url: "place:folder=BOOKMARKS_MENU" });
|
||||||
|
|
||||||
// folder
|
// folder
|
||||||
await insertAndTest({ parentGuid: root.bookmarkGuid
|
await insertAndTest({ parentGuid: root.bookmarkGuid,
|
||||||
, type: PlacesUtils.bookmarks.TYPE_FOLDER
|
type: PlacesUtils.bookmarks.TYPE_FOLDER,
|
||||||
, title: "Test Folder" });
|
title: "Test Folder" });
|
||||||
|
|
||||||
// separator
|
// separator
|
||||||
await insertAndTest({ parentGuid: root.bookmarkGuid
|
await insertAndTest({ parentGuid: root.bookmarkGuid,
|
||||||
, type: PlacesUtils.bookmarks.TYPE_SEPARATOR });
|
type: PlacesUtils.bookmarks.TYPE_SEPARATOR });
|
||||||
|
|
||||||
root.containerOpen = false;
|
root.containerOpen = false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,18 +26,18 @@ function run_test() {
|
||||||
getService(Ci.nsINavBookmarksService);
|
getService(Ci.nsINavBookmarksService);
|
||||||
|
|
||||||
const QUERIES = [
|
const QUERIES = [
|
||||||
"folder=PLACES_ROOT"
|
"folder=PLACES_ROOT",
|
||||||
, "folder=BOOKMARKS_MENU"
|
"folder=BOOKMARKS_MENU",
|
||||||
, "folder=TAGS"
|
"folder=TAGS",
|
||||||
, "folder=UNFILED_BOOKMARKS"
|
"folder=UNFILED_BOOKMARKS",
|
||||||
, "folder=TOOLBAR"
|
"folder=TOOLBAR"
|
||||||
];
|
];
|
||||||
const FOLDER_IDS = [
|
const FOLDER_IDS = [
|
||||||
bs.placesRoot
|
bs.placesRoot,
|
||||||
, bs.bookmarksMenuFolder
|
bs.bookmarksMenuFolder,
|
||||||
, bs.tagsFolder
|
bs.tagsFolder,
|
||||||
, bs.unfiledBookmarksFolder
|
bs.unfiledBookmarksFolder,
|
||||||
, bs.toolbarFolder
|
bs.toolbarFolder
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,18 +34,18 @@ function run_test() {
|
||||||
getService(Ci.nsINavBookmarksService);
|
getService(Ci.nsINavBookmarksService);
|
||||||
|
|
||||||
const QUERIES = [
|
const QUERIES = [
|
||||||
"place:folder=PLACES_ROOT"
|
"place:folder=PLACES_ROOT",
|
||||||
, "place:folder=BOOKMARKS_MENU"
|
"place:folder=BOOKMARKS_MENU",
|
||||||
, "place:folder=TAGS"
|
"place:folder=TAGS",
|
||||||
, "place:folder=UNFILED_BOOKMARKS"
|
"place:folder=UNFILED_BOOKMARKS",
|
||||||
, "place:folder=TOOLBAR"
|
"place:folder=TOOLBAR"
|
||||||
];
|
];
|
||||||
const FOLDER_IDS = [
|
const FOLDER_IDS = [
|
||||||
bs.placesRoot
|
bs.placesRoot,
|
||||||
, bs.bookmarksMenuFolder
|
bs.bookmarksMenuFolder,
|
||||||
, bs.tagsFolder
|
bs.tagsFolder,
|
||||||
, bs.unfiledBookmarksFolder
|
bs.unfiledBookmarksFolder,
|
||||||
, bs.toolbarFolder
|
bs.toolbarFolder
|
||||||
];
|
];
|
||||||
|
|
||||||
// add something in the bookmarks menu folder so a query to it returns results
|
// add something in the bookmarks menu folder so a query to it returns results
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var transitions = [
|
var transitions = [
|
||||||
TRANSITION_LINK
|
TRANSITION_LINK,
|
||||||
, TRANSITION_TYPED
|
TRANSITION_TYPED,
|
||||||
, TRANSITION_BOOKMARK
|
TRANSITION_BOOKMARK,
|
||||||
, TRANSITION_EMBED
|
TRANSITION_EMBED,
|
||||||
, TRANSITION_FRAMED_LINK
|
TRANSITION_FRAMED_LINK,
|
||||||
, TRANSITION_REDIRECT_PERMANENT
|
TRANSITION_REDIRECT_PERMANENT,
|
||||||
, TRANSITION_REDIRECT_TEMPORARY
|
TRANSITION_REDIRECT_TEMPORARY,
|
||||||
, TRANSITION_DOWNLOAD
|
TRANSITION_DOWNLOAD
|
||||||
];
|
];
|
||||||
|
|
||||||
function runQuery(aResultType) {
|
function runQuery(aResultType) {
|
||||||
|
|
|
@ -45,21 +45,21 @@ var observer = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.itemsAdded.set(aGuid, { itemId: aItemId
|
this.itemsAdded.set(aGuid, { itemId: aItemId,
|
||||||
, parentGuid: aParentGuid
|
parentGuid: aParentGuid,
|
||||||
, index: aIndex
|
index: aIndex,
|
||||||
, itemType: aItemType
|
itemType: aItemType,
|
||||||
, title: aTitle
|
title: aTitle,
|
||||||
, url: aURI });
|
url: aURI });
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemRemoved(aItemId, aParentId, aIndex, aItemType, aURI, aGuid, aParentGuid) {
|
onItemRemoved(aItemId, aParentId, aIndex, aItemType, aURI, aGuid, aParentGuid) {
|
||||||
if (this.tagRelatedGuids.has(aGuid))
|
if (this.tagRelatedGuids.has(aGuid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.itemsRemoved.set(aGuid, { parentGuid: aParentGuid
|
this.itemsRemoved.set(aGuid, { parentGuid: aParentGuid,
|
||||||
, index: aIndex
|
index: aIndex,
|
||||||
, itemType: aItemType });
|
itemType: aItemType });
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemChanged(aItemId, aProperty, aIsAnnoProperty, aNewValue, aLastModified,
|
onItemChanged(aItemId, aProperty, aIsAnnoProperty, aNewValue, aLastModified,
|
||||||
|
@ -80,10 +80,10 @@ var observer = {
|
||||||
else
|
else
|
||||||
newValue = null;
|
newValue = null;
|
||||||
}
|
}
|
||||||
let change = { isAnnoProperty: aIsAnnoProperty
|
let change = { isAnnoProperty: aIsAnnoProperty,
|
||||||
, newValue
|
newValue,
|
||||||
, lastModified: aLastModified
|
lastModified: aLastModified,
|
||||||
, itemType: aItemType };
|
itemType: aItemType };
|
||||||
changesForGuid.set(aProperty, change);
|
changesForGuid.set(aProperty, change);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@ var observer = {
|
||||||
|
|
||||||
onItemMoved(aItemId, aOldParent, aOldIndex, aNewParent, aNewIndex, aItemType,
|
onItemMoved(aItemId, aOldParent, aOldIndex, aNewParent, aNewIndex, aItemType,
|
||||||
aGuid, aOldParentGuid, aNewParentGuid) {
|
aGuid, aOldParentGuid, aNewParentGuid) {
|
||||||
this.itemsMoved.set(aGuid, { oldParentGuid: aOldParentGuid
|
this.itemsMoved.set(aGuid, { oldParentGuid: aOldParentGuid,
|
||||||
, oldIndex: aOldIndex
|
oldIndex: aOldIndex,
|
||||||
, newParentGuid: aNewParentGuid
|
newParentGuid: aNewParentGuid,
|
||||||
, newIndex: aNewIndex
|
newIndex: aNewIndex,
|
||||||
, itemType: aItemType });
|
itemType: aItemType });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
@ -384,9 +384,9 @@ add_task(async function test_new_folder_with_annotation() {
|
||||||
|
|
||||||
let ensureUndo = () => {
|
let ensureUndo = () => {
|
||||||
ensureUndoState([[txn]], 1);
|
ensureUndoState([[txn]], 1);
|
||||||
ensureItemsRemoved({ guid: folder_info.guid
|
ensureItemsRemoved({ guid: folder_info.guid,
|
||||||
, parentGuid: folder_info.parentGuid
|
parentGuid: folder_info.parentGuid,
|
||||||
, index: bmStartIndex });
|
index: bmStartIndex });
|
||||||
observer.reset();
|
observer.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -402,10 +402,10 @@ add_task(async function test_new_folder_with_annotation() {
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_new_bookmark() {
|
add_task(async function test_new_bookmark() {
|
||||||
let bm_info = { parentGuid: rootGuid
|
let bm_info = { parentGuid: rootGuid,
|
||||||
, url: NetUtil.newURI("http://test_create_item.com")
|
url: NetUtil.newURI("http://test_create_item.com"),
|
||||||
, index: bmStartIndex
|
index: bmStartIndex,
|
||||||
, title: "Test creating an item" };
|
title: "Test creating an item" };
|
||||||
|
|
||||||
ensureUndoState();
|
ensureUndoState();
|
||||||
let txn = PT.NewBookmark(bm_info);
|
let txn = PT.NewBookmark(bm_info);
|
||||||
|
@ -420,9 +420,9 @@ add_task(async function test_new_bookmark() {
|
||||||
};
|
};
|
||||||
let ensureUndo = () => {
|
let ensureUndo = () => {
|
||||||
ensureUndoState([[txn]], 1);
|
ensureUndoState([[txn]], 1);
|
||||||
ensureItemsRemoved({ guid: bm_info.guid
|
ensureItemsRemoved({ guid: bm_info.guid,
|
||||||
, parentGuid: bm_info.parentGuid
|
parentGuid: bm_info.parentGuid,
|
||||||
, index: bmStartIndex });
|
index: bmStartIndex });
|
||||||
observer.reset();
|
observer.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -440,9 +440,9 @@ add_task(async function test_new_bookmark() {
|
||||||
|
|
||||||
add_task(async function test_merge_create_folder_and_item() {
|
add_task(async function test_merge_create_folder_and_item() {
|
||||||
let folder_info = createTestFolderInfo();
|
let folder_info = createTestFolderInfo();
|
||||||
let bm_info = { url: NetUtil.newURI("http://test_create_item_to_folder.com")
|
let bm_info = { url: NetUtil.newURI("http://test_create_item_to_folder.com"),
|
||||||
, title: "Test Bookmark"
|
title: "Test Bookmark",
|
||||||
, index: bmStartIndex };
|
index: bmStartIndex };
|
||||||
|
|
||||||
let [folderTxnResult, bkmTxnResult] = await PT.batch(async function() {
|
let [folderTxnResult, bkmTxnResult] = await PT.batch(async function() {
|
||||||
let folderTxn = PT.NewFolder(folder_info);
|
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() {
|
add_task(async function test_move_items_to_folder() {
|
||||||
let folder_a_info = createTestFolderInfo("Folder A");
|
let folder_a_info = createTestFolderInfo("Folder A");
|
||||||
let bkm_a_info = { url: new URL("http://test_move_items.com")
|
let bkm_a_info = { url: new URL("http://test_move_items.com"),
|
||||||
, title: "Bookmark A" };
|
title: "Bookmark A" };
|
||||||
let bkm_b_info = { url: NetUtil.newURI("http://test_move_items.com")
|
let bkm_b_info = { url: NetUtil.newURI("http://test_move_items.com"),
|
||||||
, title: "Bookmark B" };
|
title: "Bookmark B" };
|
||||||
|
|
||||||
// Test moving items within the same folder.
|
// 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_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);
|
ensureUndoState([[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
|
||||||
|
|
||||||
let moveTxn = PT.Move({ guid: bkm_a_info.guid
|
let moveTxn = PT.Move({ guid: bkm_a_info.guid,
|
||||||
, newParentGuid: folder_a_info.guid });
|
newParentGuid: folder_a_info.guid });
|
||||||
await moveTxn.transact();
|
await moveTxn.transact();
|
||||||
|
|
||||||
let ensureDo = () => {
|
let ensureDo = () => {
|
||||||
ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
|
ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 0);
|
||||||
ensureItemsMoved({ guid: bkm_a_info.guid
|
ensureItemsMoved({ guid: bkm_a_info.guid,
|
||||||
, oldParentGuid: folder_a_info.guid
|
oldParentGuid: folder_a_info.guid,
|
||||||
, newParentGuid: folder_a_info.guid
|
newParentGuid: folder_a_info.guid,
|
||||||
, oldIndex: 0
|
oldIndex: 0,
|
||||||
, newIndex: 1 });
|
newIndex: 1 });
|
||||||
observer.reset();
|
observer.reset();
|
||||||
};
|
};
|
||||||
let ensureUndo = () => {
|
let ensureUndo = () => {
|
||||||
ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 1);
|
ensureUndoState([[moveTxn], [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result]], 1);
|
||||||
ensureItemsMoved({ guid: bkm_a_info.guid
|
ensureItemsMoved({ guid: bkm_a_info.guid,
|
||||||
, oldParentGuid: folder_a_info.guid
|
oldParentGuid: folder_a_info.guid,
|
||||||
, newParentGuid: folder_a_info.guid
|
newParentGuid: folder_a_info.guid,
|
||||||
, oldIndex: 1
|
oldIndex: 1,
|
||||||
, newIndex: 0 });
|
newIndex: 0 });
|
||||||
observer.reset();
|
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_info = createTestFolderInfo("Folder B");
|
||||||
let folder_b_txn = PT.NewFolder(folder_b_info);
|
let folder_b_txn = PT.NewFolder(folder_b_info);
|
||||||
folder_b_info.guid = await folder_b_txn.transact();
|
folder_b_info.guid = await folder_b_txn.transact();
|
||||||
ensureUndoState([ [folder_b_txn]
|
ensureUndoState([ [folder_b_txn],
|
||||||
, [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
|
[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
|
||||||
|
|
||||||
moveTxn = PT.Move({ guid: bkm_a_info.guid
|
moveTxn = PT.Move({ guid: bkm_a_info.guid,
|
||||||
, newParentGuid: folder_b_info.guid
|
newParentGuid: folder_b_info.guid,
|
||||||
, newIndex: bmsvc.DEFAULT_INDEX });
|
newIndex: bmsvc.DEFAULT_INDEX });
|
||||||
await moveTxn.transact();
|
await moveTxn.transact();
|
||||||
|
|
||||||
ensureDo = () => {
|
ensureDo = () => {
|
||||||
ensureUndoState([ [moveTxn]
|
ensureUndoState([ [moveTxn],
|
||||||
, [folder_b_txn]
|
[folder_b_txn],
|
||||||
, [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
|
[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 0);
|
||||||
ensureItemsMoved({ guid: bkm_a_info.guid
|
ensureItemsMoved({ guid: bkm_a_info.guid,
|
||||||
, oldParentGuid: folder_a_info.guid
|
oldParentGuid: folder_a_info.guid,
|
||||||
, newParentGuid: folder_b_info.guid
|
newParentGuid: folder_b_info.guid,
|
||||||
, oldIndex: 0
|
oldIndex: 0,
|
||||||
, newIndex: 0 });
|
newIndex: 0 });
|
||||||
observer.reset();
|
observer.reset();
|
||||||
};
|
};
|
||||||
ensureUndo = () => {
|
ensureUndo = () => {
|
||||||
ensureUndoState([ [moveTxn]
|
ensureUndoState([ [moveTxn],
|
||||||
, [folder_b_txn]
|
[folder_b_txn],
|
||||||
, [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 1);
|
[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 1);
|
||||||
ensureItemsMoved({ guid: bkm_a_info.guid
|
ensureItemsMoved({ guid: bkm_a_info.guid,
|
||||||
, oldParentGuid: folder_b_info.guid
|
oldParentGuid: folder_b_info.guid,
|
||||||
, newParentGuid: folder_a_info.guid
|
newParentGuid: folder_a_info.guid,
|
||||||
, oldIndex: 0
|
oldIndex: 0,
|
||||||
, newIndex: 0 });
|
newIndex: 0 });
|
||||||
observer.reset();
|
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_b_txn
|
||||||
await PT.undo(); // folder_a_txn + the bookmarks;
|
await PT.undo(); // folder_a_txn + the bookmarks;
|
||||||
do_check_eq(observer.itemsRemoved.size, 4);
|
do_check_eq(observer.itemsRemoved.size, 4);
|
||||||
ensureUndoState([ [moveTxn]
|
ensureUndoState([ [moveTxn],
|
||||||
, [folder_b_txn]
|
[folder_b_txn],
|
||||||
, [bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 3);
|
[bkm_b_txn_result, bkm_a_txn_result, folder_a_txn_result] ], 3);
|
||||||
await PT.clearTransactionsHistory();
|
await PT.clearTransactionsHistory();
|
||||||
ensureUndoState();
|
ensureUndoState();
|
||||||
});
|
});
|
||||||
|
@ -606,44 +606,44 @@ add_task(async function test_remove_folder() {
|
||||||
let remove_folder_2_txn = PT.Remove(folder_level_2_info);
|
let remove_folder_2_txn = PT.Remove(folder_level_2_info);
|
||||||
await remove_folder_2_txn.transact();
|
await remove_folder_2_txn.transact();
|
||||||
|
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ]);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ]);
|
||||||
await ensureItemsRemoved(folder_level_2_info);
|
await ensureItemsRemoved(folder_level_2_info);
|
||||||
|
|
||||||
// Undo Remove "Folder Level 2"
|
// Undo Remove "Folder Level 2"
|
||||||
await PT.undo();
|
await PT.undo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
||||||
await ensureItemsAdded(folder_level_2_info);
|
await ensureItemsAdded(folder_level_2_info);
|
||||||
ensureTimestampsUpdated(folder_level_2_info.guid, true);
|
ensureTimestampsUpdated(folder_level_2_info.guid, true);
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
// Redo Remove "Folder Level 2"
|
// Redo Remove "Folder Level 2"
|
||||||
await PT.redo();
|
await PT.redo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ]);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ]);
|
||||||
await ensureItemsRemoved(folder_level_2_info);
|
await ensureItemsRemoved(folder_level_2_info);
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
// Undo it again
|
// Undo it again
|
||||||
await PT.undo();
|
await PT.undo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
||||||
await ensureItemsAdded(folder_level_2_info);
|
await ensureItemsAdded(folder_level_2_info);
|
||||||
ensureTimestampsUpdated(folder_level_2_info.guid, true);
|
ensureTimestampsUpdated(folder_level_2_info.guid, true);
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
// Undo the creation of both folders
|
// Undo the creation of both folders
|
||||||
await PT.undo();
|
await PT.undo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
|
||||||
await ensureItemsRemoved(folder_level_2_info, folder_level_1_info);
|
await ensureItemsRemoved(folder_level_2_info, folder_level_1_info);
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
// Redo the creation of both folders
|
// Redo the creation of both folders
|
||||||
await PT.redo();
|
await PT.redo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
||||||
await ensureItemsAdded(folder_level_1_info, folder_level_2_info);
|
await ensureItemsAdded(folder_level_1_info, folder_level_2_info);
|
||||||
ensureTimestampsUpdated(folder_level_1_info.guid, true);
|
ensureTimestampsUpdated(folder_level_1_info.guid, true);
|
||||||
ensureTimestampsUpdated(folder_level_2_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"
|
// Redo Remove "Folder Level 2"
|
||||||
await PT.redo();
|
await PT.redo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ]);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ]);
|
||||||
await ensureItemsRemoved(folder_level_2_info);
|
await ensureItemsRemoved(folder_level_2_info);
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
// Undo everything one last time
|
// Undo everything one last time
|
||||||
await PT.undo();
|
await PT.undo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ], 1);
|
||||||
await ensureItemsAdded(folder_level_2_info);
|
await ensureItemsAdded(folder_level_2_info);
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
await PT.undo();
|
await PT.undo();
|
||||||
ensureUndoState([ [remove_folder_2_txn]
|
ensureUndoState([ [remove_folder_2_txn],
|
||||||
, [folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
|
[folder_level_2_txn_result, folder_level_1_txn_result] ], 2);
|
||||||
await ensureItemsRemoved(folder_level_2_info, folder_level_2_info);
|
await ensureItemsRemoved(folder_level_2_info, folder_level_2_info);
|
||||||
observer.reset();
|
observer.reset();
|
||||||
|
|
||||||
|
@ -720,20 +720,20 @@ add_task(async function test_add_and_remove_bookmarks_with_additional_info() {
|
||||||
// also a no-op on undo.
|
// also a no-op on undo.
|
||||||
// * Test the "keyword" property of the NewBookmark transaction.
|
// * Test the "keyword" property of the NewBookmark transaction.
|
||||||
observer.reset();
|
observer.reset();
|
||||||
let b2_info = { parentGuid: folder_info.guid
|
let b2_info = { parentGuid: folder_info.guid,
|
||||||
, url: testURI, tags: [TAG_1, TAG_2]
|
url: testURI, tags: [TAG_1, TAG_2],
|
||||||
, keyword: KEYWORD
|
keyword: KEYWORD,
|
||||||
, postData: POST_DATA
|
postData: POST_DATA,
|
||||||
, annotations: [ANNO] };
|
annotations: [ANNO] };
|
||||||
b2_info.guid = await PT.NewBookmark(b2_info).transact();
|
b2_info.guid = await PT.NewBookmark(b2_info).transact();
|
||||||
let b2_post_creation_changes = [
|
let b2_post_creation_changes = [
|
||||||
{ guid: b2_info.guid
|
{ guid: b2_info.guid,
|
||||||
, isAnnoProperty: true
|
isAnnoProperty: true,
|
||||||
, property: ANNO.name
|
property: ANNO.name,
|
||||||
, newValue: ANNO.value },
|
newValue: ANNO.value },
|
||||||
{ guid: b2_info.guid
|
{ guid: b2_info.guid,
|
||||||
, property: "keyword"
|
property: "keyword",
|
||||||
, newValue: KEYWORD } ];
|
newValue: KEYWORD } ];
|
||||||
ensureItemsChanged(...b2_post_creation_changes);
|
ensureItemsChanged(...b2_post_creation_changes);
|
||||||
ensureTags([TAG_1, TAG_2]);
|
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.
|
// is not removed along with one of the bookmarks.
|
||||||
observer.reset();
|
observer.reset();
|
||||||
await PT.redo();
|
await PT.redo();
|
||||||
ensureItemsChanged({ guid: b2_info.guid
|
ensureItemsChanged({ guid: b2_info.guid,
|
||||||
, isAnnoProperty: true
|
isAnnoProperty: true,
|
||||||
, property: ANNO.name
|
property: ANNO.name,
|
||||||
, newValue: ANNO.value });
|
newValue: ANNO.value });
|
||||||
ensureTags([TAG_1, TAG_2]);
|
ensureTags([TAG_1, TAG_2]);
|
||||||
|
|
||||||
// Test Remove for multiple items.
|
// 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() {
|
add_task(async function test_add_and_remove_livemark() {
|
||||||
let createLivemarkTxn = PT.NewLivemark(
|
let createLivemarkTxn = PT.NewLivemark(
|
||||||
{ feedUrl: NetUtil.newURI("http://test.remove.livemark")
|
{ feedUrl: NetUtil.newURI("http://test.remove.livemark"),
|
||||||
, parentGuid: rootGuid
|
parentGuid: rootGuid,
|
||||||
, title: "Test Remove Livemark" });
|
title: "Test Remove Livemark" });
|
||||||
let guid = await createLivemarkTxn.transact();
|
let guid = await createLivemarkTxn.transact();
|
||||||
let originalInfo = await PlacesUtils.promiseBookmarksTree(guid);
|
let originalInfo = await PlacesUtils.promiseBookmarksTree(guid);
|
||||||
Assert.ok(originalInfo);
|
Assert.ok(originalInfo);
|
||||||
|
@ -911,14 +911,14 @@ add_task(async function test_add_and_remove_livemark() {
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_edit_title() {
|
add_task(async function test_edit_title() {
|
||||||
let bm_info = { parentGuid: rootGuid
|
let bm_info = { parentGuid: rootGuid,
|
||||||
, url: NetUtil.newURI("http://test_create_item.com")
|
url: NetUtil.newURI("http://test_create_item.com"),
|
||||||
, title: "Original Title" };
|
title: "Original Title" };
|
||||||
|
|
||||||
function ensureTitleChange(aCurrentTitle) {
|
function ensureTitleChange(aCurrentTitle) {
|
||||||
ensureItemsChanged({ guid: bm_info.guid
|
ensureItemsChanged({ guid: bm_info.guid,
|
||||||
, property: "title"
|
property: "title",
|
||||||
, newValue: aCurrentTitle});
|
newValue: aCurrentTitle});
|
||||||
}
|
}
|
||||||
|
|
||||||
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
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 newURI = NetUtil.newURI("http://new.test_editing_item_uri.com/");
|
||||||
let bm_info = { parentGuid: rootGuid, url: oldURI, tags: ["TestTag"] };
|
let bm_info = { parentGuid: rootGuid, url: oldURI, tags: ["TestTag"] };
|
||||||
function ensureURIAndTags(aPreChangeURI, aPostChangeURI, aOLdURITagsPreserved) {
|
function ensureURIAndTags(aPreChangeURI, aPostChangeURI, aOLdURITagsPreserved) {
|
||||||
ensureItemsChanged({ guid: bm_info.guid
|
ensureItemsChanged({ guid: bm_info.guid,
|
||||||
, property: "uri"
|
property: "uri",
|
||||||
, newValue: aPostChangeURI.spec });
|
newValue: aPostChangeURI.spec });
|
||||||
ensureTagsForURI(aPostChangeURI, bm_info.tags);
|
ensureTagsForURI(aPostChangeURI, bm_info.tags);
|
||||||
ensureTagsForURI(aPreChangeURI, aOLdURITagsPreserved ? 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() {
|
add_task(async function test_edit_keyword() {
|
||||||
let bm_info = { parentGuid: rootGuid
|
let bm_info = { parentGuid: rootGuid,
|
||||||
, url: NetUtil.newURI("http://test.edit.keyword") };
|
url: NetUtil.newURI("http://test.edit.keyword") };
|
||||||
const KEYWORD = "test_keyword";
|
const KEYWORD = "test_keyword";
|
||||||
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
||||||
function ensureKeywordChange(aCurrentKeyword = "") {
|
function ensureKeywordChange(aCurrentKeyword = "") {
|
||||||
ensureItemsChanged({ guid: bm_info.guid
|
ensureItemsChanged({ guid: bm_info.guid,
|
||||||
, property: "keyword"
|
property: "keyword",
|
||||||
, newValue: aCurrentKeyword });
|
newValue: aCurrentKeyword });
|
||||||
}
|
}
|
||||||
|
|
||||||
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
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() {
|
add_task(async function test_edit_specific_keyword() {
|
||||||
let bm_info = { parentGuid: rootGuid
|
let bm_info = { parentGuid: rootGuid,
|
||||||
, url: NetUtil.newURI("http://test.edit.keyword") };
|
url: NetUtil.newURI("http://test.edit.keyword") };
|
||||||
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
||||||
function ensureKeywordChange(aCurrentKeyword = "", aPreviousKeyword = "") {
|
function ensureKeywordChange(aCurrentKeyword = "", aPreviousKeyword = "") {
|
||||||
ensureItemsChanged({ guid: bm_info.guid
|
ensureItemsChanged({ guid: bm_info.guid,
|
||||||
, property: "keyword"
|
property: "keyword",
|
||||||
, newValue: aCurrentKeyword
|
newValue: aCurrentKeyword
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1118,10 +1118,10 @@ add_task(async function test_edit_specific_keyword() {
|
||||||
|
|
||||||
add_task(async function test_tag_uri() {
|
add_task(async function test_tag_uri() {
|
||||||
// This also tests passing uri specs.
|
// This also tests passing uri specs.
|
||||||
let bm_info_a = { url: "http://bookmarked.uri"
|
let bm_info_a = { url: "http://bookmarked.uri",
|
||||||
, parentGuid: rootGuid };
|
parentGuid: rootGuid };
|
||||||
let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri")
|
let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"),
|
||||||
, parentGuid: rootGuid };
|
parentGuid: rootGuid };
|
||||||
let unbookmarked_uri = NetUtil.newURI("http://un.bookmarked.uri");
|
let unbookmarked_uri = NetUtil.newURI("http://un.bookmarked.uri");
|
||||||
|
|
||||||
await PT.batch(async function() {
|
await PT.batch(async function() {
|
||||||
|
@ -1184,12 +1184,12 @@ add_task(async function test_tag_uri() {
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_untag_uri() {
|
add_task(async function test_untag_uri() {
|
||||||
let bm_info_a = { url: NetUtil.newURI("http://bookmarked.uri")
|
let bm_info_a = { url: NetUtil.newURI("http://bookmarked.uri"),
|
||||||
, parentGuid: rootGuid
|
parentGuid: rootGuid,
|
||||||
, tags: ["A", "B"] };
|
tags: ["A", "B"] };
|
||||||
let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri")
|
let bm_info_b = { url: NetUtil.newURI("http://bookmarked2.uri"),
|
||||||
, parentGuid: rootGuid
|
parentGuid: rootGuid,
|
||||||
, tag: "B" };
|
tag: "B" };
|
||||||
|
|
||||||
await PT.batch(async function() {
|
await PT.batch(async function() {
|
||||||
bm_info_a.guid = await PT.NewBookmark(bm_info_a).transact();
|
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() {
|
add_task(async function test_annotate() {
|
||||||
let bm_info = { url: NetUtil.newURI("http://test.item.annotation")
|
let bm_info = { url: NetUtil.newURI("http://test.item.annotation"),
|
||||||
, parentGuid: rootGuid };
|
parentGuid: rootGuid };
|
||||||
let anno_info = { name: "TestAnno", value: "TestValue" };
|
let anno_info = { name: "TestAnno", value: "TestValue" };
|
||||||
function ensureAnnoState(aSet) {
|
function ensureAnnoState(aSet) {
|
||||||
ensureAnnotationsSet(bm_info.guid,
|
ensureAnnotationsSet(bm_info.guid,
|
||||||
[{ name: anno_info.name
|
[{ name: anno_info.name,
|
||||||
, value: aSet ? anno_info.value : null }]);
|
value: aSet ? anno_info.value : null }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
bm_info.guid = await PT.NewBookmark(bm_info).transact();
|
||||||
|
@ -1334,12 +1334,12 @@ add_task(async function test_annotate_multiple() {
|
||||||
await PT.redo();
|
await PT.redo();
|
||||||
verifyAnnoValues(1, 2);
|
verifyAnnoValues(1, 2);
|
||||||
|
|
||||||
await PT.Annotate({ guid
|
await PT.Annotate({ guid,
|
||||||
, annotation: { name: "A" } }).transact();
|
annotation: { name: "A" } }).transact();
|
||||||
verifyAnnoValues(null, 2);
|
verifyAnnoValues(null, 2);
|
||||||
|
|
||||||
await PT.Annotate({ guid
|
await PT.Annotate({ guid,
|
||||||
, annotation: { name: "B", value: 0 } }).transact();
|
annotation: { name: "B", value: 0 } }).transact();
|
||||||
verifyAnnoValues(null, 0);
|
verifyAnnoValues(null, 0);
|
||||||
await PT.undo();
|
await PT.undo();
|
||||||
verifyAnnoValues(null, 2);
|
verifyAnnoValues(null, 2);
|
||||||
|
@ -1404,25 +1404,25 @@ add_task(async function test_sort_folder_by_name() {
|
||||||
|
|
||||||
add_task(async function test_livemark_txns() {
|
add_task(async function test_livemark_txns() {
|
||||||
let livemark_info =
|
let livemark_info =
|
||||||
{ feedUrl: NetUtil.newURI("http://test.feed.uri")
|
{ feedUrl: NetUtil.newURI("http://test.feed.uri"),
|
||||||
, parentGuid: rootGuid
|
parentGuid: rootGuid,
|
||||||
, title: "Test Livemark" };
|
title: "Test Livemark" };
|
||||||
function ensureLivemarkAdded() {
|
function ensureLivemarkAdded() {
|
||||||
ensureItemsAdded({ guid: livemark_info.guid
|
ensureItemsAdded({ guid: livemark_info.guid,
|
||||||
, title: livemark_info.title
|
title: livemark_info.title,
|
||||||
, parentGuid: livemark_info.parentGuid
|
parentGuid: livemark_info.parentGuid,
|
||||||
, itemType: bmsvc.TYPE_FOLDER });
|
itemType: bmsvc.TYPE_FOLDER });
|
||||||
let annos = [{ name: PlacesUtils.LMANNO_FEEDURI
|
let annos = [{ name: PlacesUtils.LMANNO_FEEDURI,
|
||||||
, value: livemark_info.feedUrl.spec }];
|
value: livemark_info.feedUrl.spec }];
|
||||||
if ("siteUrl" in livemark_info) {
|
if ("siteUrl" in livemark_info) {
|
||||||
annos.push({ name: PlacesUtils.LMANNO_SITEURI
|
annos.push({ name: PlacesUtils.LMANNO_SITEURI,
|
||||||
, value: livemark_info.siteUrl.spec });
|
value: livemark_info.siteUrl.spec });
|
||||||
}
|
}
|
||||||
ensureAnnotationsSet(livemark_info.guid, annos);
|
ensureAnnotationsSet(livemark_info.guid, annos);
|
||||||
}
|
}
|
||||||
function ensureLivemarkRemoved() {
|
function ensureLivemarkRemoved() {
|
||||||
ensureItemsRemoved({ guid: livemark_info.guid
|
ensureItemsRemoved({ guid: livemark_info.guid,
|
||||||
, parentGuid: livemark_info.parentGuid });
|
parentGuid: livemark_info.parentGuid });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _testDoUndoRedoUndo() {
|
async function _testDoUndoRedoUndo() {
|
||||||
|
@ -1484,14 +1484,14 @@ add_task(async function test_copy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test duplicating leafs (bookmark, separator, empty folder)
|
// Test duplicating leafs (bookmark, separator, empty folder)
|
||||||
PT.NewBookmark({ url: new URL("http://test.item.duplicate")
|
PT.NewBookmark({ url: new URL("http://test.item.duplicate"),
|
||||||
, parentGuid: rootGuid
|
parentGuid: rootGuid,
|
||||||
, annos: [{ name: "Anno", value: "AnnoValue"}] });
|
annos: [{ name: "Anno", value: "AnnoValue"}] });
|
||||||
let sepTxn = PT.NewSeparator({ parentGuid: rootGuid, index: 1 });
|
let sepTxn = PT.NewSeparator({ parentGuid: rootGuid, index: 1 });
|
||||||
let livemarkTxn = PT.NewLivemark(
|
let livemarkTxn = PT.NewLivemark(
|
||||||
{ feedUrl: new URL("http://test.feed.uri")
|
{ feedUrl: new URL("http://test.feed.uri"),
|
||||||
, parentGuid: rootGuid
|
parentGuid: rootGuid,
|
||||||
, title: "Test Livemark", index: 1 });
|
title: "Test Livemark", index: 1 });
|
||||||
let emptyFolderTxn = PT.NewFolder(createTestFolderInfo());
|
let emptyFolderTxn = PT.NewFolder(createTestFolderInfo());
|
||||||
for (let txn of [livemarkTxn, sepTxn, emptyFolderTxn]) {
|
for (let txn of [livemarkTxn, sepTxn, emptyFolderTxn]) {
|
||||||
let guid = await txn.transact();
|
let guid = await txn.transact();
|
||||||
|
@ -1502,16 +1502,16 @@ add_task(async function test_copy() {
|
||||||
let filledFolderGuid = await PT.batch(async function() {
|
let filledFolderGuid = await PT.batch(async function() {
|
||||||
let folderGuid = await PT.NewFolder(createTestFolderInfo()).transact();
|
let folderGuid = await PT.NewFolder(createTestFolderInfo()).transact();
|
||||||
let nestedFolderGuid =
|
let nestedFolderGuid =
|
||||||
await PT.NewFolder({ parentGuid: folderGuid
|
await PT.NewFolder({ parentGuid: folderGuid,
|
||||||
, title: "Nested Folder" }).transact();
|
title: "Nested Folder" }).transact();
|
||||||
// Insert a bookmark under the nested folder.
|
// Insert a bookmark under the nested folder.
|
||||||
await PT.NewBookmark({ url: new URL("http://nested.nested.bookmark")
|
await PT.NewBookmark({ url: new URL("http://nested.nested.bookmark"),
|
||||||
, parentGuid: nestedFolderGuid }).transact();
|
parentGuid: nestedFolderGuid }).transact();
|
||||||
// Insert a separator below the nested folder
|
// Insert a separator below the nested folder
|
||||||
await PT.NewSeparator({ parentGuid: folderGuid }).transact();
|
await PT.NewSeparator({ parentGuid: folderGuid }).transact();
|
||||||
// And another bookmark.
|
// And another bookmark.
|
||||||
await PT.NewBookmark({ url: new URL("http://nested.bookmark")
|
await PT.NewBookmark({ url: new URL("http://nested.bookmark"),
|
||||||
, parentGuid: folderGuid }).transact();
|
parentGuid: folderGuid }).transact();
|
||||||
return folderGuid;
|
return folderGuid;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1569,15 +1569,15 @@ add_task(async function test_copy_excluding_annotations() {
|
||||||
await ensureAnnosSet(folderGuid, "a", "b", "c");
|
await ensureAnnosSet(folderGuid, "a", "b", "c");
|
||||||
|
|
||||||
let excluding_a_dupeGuid =
|
let excluding_a_dupeGuid =
|
||||||
await PT.Copy({ guid: folderGuid
|
await PT.Copy({ guid: folderGuid,
|
||||||
, newParentGuid: rootGuid
|
newParentGuid: rootGuid,
|
||||||
, excludingAnnotation: "a" }).transact();
|
excludingAnnotation: "a" }).transact();
|
||||||
await ensureAnnosSet(excluding_a_dupeGuid, "b", "c");
|
await ensureAnnosSet(excluding_a_dupeGuid, "b", "c");
|
||||||
|
|
||||||
let excluding_ac_dupeGuid =
|
let excluding_ac_dupeGuid =
|
||||||
await PT.Copy({ guid: folderGuid
|
await PT.Copy({ guid: folderGuid,
|
||||||
, newParentGuid: rootGuid
|
newParentGuid: rootGuid,
|
||||||
, excludingAnnotations: ["a", "c"] }).transact();
|
excludingAnnotations: ["a", "c"] }).transact();
|
||||||
await ensureAnnosSet(excluding_ac_dupeGuid, "b");
|
await ensureAnnosSet(excluding_ac_dupeGuid, "b");
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
@ -1589,15 +1589,15 @@ add_task(async function test_copy_excluding_annotations() {
|
||||||
|
|
||||||
add_task(async function test_invalid_uri_spec_throws() {
|
add_task(async function test_invalid_uri_spec_throws() {
|
||||||
Assert.throws(() =>
|
Assert.throws(() =>
|
||||||
PT.NewBookmark({ parentGuid: rootGuid
|
PT.NewBookmark({ parentGuid: rootGuid,
|
||||||
, url: "invalid uri spec"
|
url: "invalid uri spec",
|
||||||
, title: "test bookmark" }));
|
title: "test bookmark" }));
|
||||||
Assert.throws(() =>
|
Assert.throws(() =>
|
||||||
PT.Tag({ tag: "TheTag"
|
PT.Tag({ tag: "TheTag",
|
||||||
, urls: ["invalid uri spec"] }));
|
urls: ["invalid uri spec"] }));
|
||||||
Assert.throws(() =>
|
Assert.throws(() =>
|
||||||
PT.Tag({ tag: "TheTag"
|
PT.Tag({ tag: "TheTag",
|
||||||
, urls: ["about:blank", "invalid uri spec"] }));
|
urls: ["about:blank", "invalid uri spec"] }));
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_annotate_multiple_items() {
|
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() {
|
add_task(async function test_remove_multiple() {
|
||||||
let guids = [];
|
let guids = [];
|
||||||
await PT.batch(async function() {
|
await PT.batch(async function() {
|
||||||
let folderGuid = await PT.NewFolder({ title: "Test Folder"
|
let folderGuid = await PT.NewFolder({ title: "Test Folder",
|
||||||
, parentGuid: rootGuid }).transact();
|
parentGuid: rootGuid }).transact();
|
||||||
let nestedFolderGuid =
|
let nestedFolderGuid =
|
||||||
await PT.NewFolder({ title: "Nested Test Folder"
|
await PT.NewFolder({ title: "Nested Test Folder",
|
||||||
, parentGuid: folderGuid }).transact();
|
parentGuid: folderGuid }).transact();
|
||||||
await PT.NewSeparator(nestedFolderGuid).transact();
|
await PT.NewSeparator(nestedFolderGuid).transact();
|
||||||
|
|
||||||
guids.push(folderGuid);
|
guids.push(folderGuid);
|
||||||
|
|
||||||
let bmGuid =
|
let bmGuid =
|
||||||
await PT.NewBookmark({ url: new URL("http://test.bookmark.removed")
|
await PT.NewBookmark({ url: new URL("http://test.bookmark.removed"),
|
||||||
, parentGuid: rootGuid }).transact();
|
parentGuid: rootGuid }).transact();
|
||||||
guids.push(bmGuid);
|
guids.push(bmGuid);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,11 @@ add_task(async function() {
|
||||||
|
|
||||||
|
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "livemark title"
|
{ title: "livemark title",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, index: PlacesUtils.bookmarks.DEFAULT_INDEX
|
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
, siteURI: uri("http://example.com/")
|
siteURI: uri("http://example.com/"),
|
||||||
, feedURI: uri("http://example.com/rdf")
|
feedURI: uri("http://example.com/rdf")
|
||||||
});
|
});
|
||||||
|
|
||||||
await annoPromise;
|
await annoPromise;
|
||||||
|
|
|
@ -137,12 +137,12 @@ add_task(async function test_bookmark_removal() {
|
||||||
|
|
||||||
add_task(async function test_moz_hosts_typed_update() {
|
add_task(async function test_moz_hosts_typed_update() {
|
||||||
const TEST_URI = NetUtil.newURI("http://typed.mozilla.com");
|
const TEST_URI = NetUtil.newURI("http://typed.mozilla.com");
|
||||||
let places = [{ uri: TEST_URI
|
let places = [{ uri: TEST_URI,
|
||||||
, title: "test for " + TEST_URI.spec
|
title: "test for " + TEST_URI.spec
|
||||||
},
|
},
|
||||||
{ uri: TEST_URI
|
{ uri: TEST_URI,
|
||||||
, title: "test for " + TEST_URI.spec
|
title: "test for " + TEST_URI.spec,
|
||||||
, transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
}];
|
}];
|
||||||
|
|
||||||
await PlacesTestUtils.addVisits(places);
|
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() {
|
add_task(async function test_moz_hosts_www_remove() {
|
||||||
async function test_removal(aURIToRemove, aURIToKeep, aCallback) {
|
async function test_removal(aURIToRemove, aURIToKeep, aCallback) {
|
||||||
let places = [{ uri: aURIToRemove
|
let places = [{ uri: aURIToRemove,
|
||||||
, title: "test for " + aURIToRemove.spec
|
title: "test for " + aURIToRemove.spec,
|
||||||
, transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
},
|
},
|
||||||
{ uri: aURIToKeep
|
{ uri: aURIToKeep,
|
||||||
, title: "test for " + aURIToKeep.spec
|
title: "test for " + aURIToKeep.spec,
|
||||||
, transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
}];
|
}];
|
||||||
|
|
||||||
await PlacesTestUtils.addVisits(places);
|
await PlacesTestUtils.addVisits(places);
|
||||||
|
@ -209,8 +209,8 @@ add_task(async function test_moz_hosts_update_2() {
|
||||||
// rev_hosts.
|
// rev_hosts.
|
||||||
const TEST_URI_1 = NetUtil.newURI("https://www.google.it/");
|
const TEST_URI_1 = NetUtil.newURI("https://www.google.it/");
|
||||||
const TEST_URI_2 = NetUtil.newURI("https://google.it/");
|
const TEST_URI_2 = NetUtil.newURI("https://google.it/");
|
||||||
let places = [{ uri: TEST_URI_1
|
let places = [{ uri: TEST_URI_1,
|
||||||
, transition: TRANSITION_TYPED
|
transition: TRANSITION_TYPED
|
||||||
},
|
},
|
||||||
{ uri: TEST_URI_2
|
{ uri: TEST_URI_2
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -68,9 +68,9 @@ function* step() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
history.updatePlaces({ uri
|
history.updatePlaces({ uri,
|
||||||
, visits: [ { transitionType: transition
|
visits: [ { transitionType: transition,
|
||||||
, visitDate: Date.now() * 1000
|
visitDate: Date.now() * 1000
|
||||||
} ]
|
} ]
|
||||||
}, callback);
|
}, callback);
|
||||||
});
|
});
|
||||||
|
|
|
@ -87,8 +87,8 @@ add_task(async function test_addLivemark_noIndex_throws() {
|
||||||
add_task(async function test_addLivemark_badIndex_throws() {
|
add_task(async function test_addLivemark_badIndex_throws() {
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ parentId: PlacesUtils.unfiledBookmarksFolderId
|
{ parentId: PlacesUtils.unfiledBookmarksFolderId,
|
||||||
, index: "test" });
|
index: "test" });
|
||||||
do_throw("Invoking addLivemark with a bad index should throw");
|
do_throw("Invoking addLivemark with a bad index should throw");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
|
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() {
|
add_task(async function test_addLivemark_invalidIndex_throws() {
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ parentId: PlacesUtils.unfiledBookmarksFolderId
|
{ parentId: PlacesUtils.unfiledBookmarksFolderId,
|
||||||
, index: -2
|
index: -2
|
||||||
});
|
});
|
||||||
do_throw("Invoking addLivemark with an invalid index should throw");
|
do_throw("Invoking addLivemark with an invalid index should throw");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
@ -120,8 +120,8 @@ add_task(async function test_addLivemark_noFeedURI_throws() {
|
||||||
add_task(async function test_addLivemark_badFeedURI_throws() {
|
add_task(async function test_addLivemark_badFeedURI_throws() {
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
{ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: "test" });
|
feedURI: "test" });
|
||||||
do_throw("Invoking addLivemark with a bad feedURI should throw");
|
do_throw("Invoking addLivemark with a bad feedURI should throw");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
|
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() {
|
add_task(async function test_addLivemark_badSiteURI_throws() {
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
{ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, siteURI: "test" });
|
siteURI: "test" });
|
||||||
do_throw("Invoking addLivemark with a bad siteURI should throw");
|
do_throw("Invoking addLivemark with a bad siteURI should throw");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
|
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() {
|
add_task(async function test_addLivemark_badGuid_throws() {
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
{ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, guid: "123456" });
|
guid: "123456" });
|
||||||
do_throw("Invoking addLivemark with a bad guid should throw");
|
do_throw("Invoking addLivemark with a bad guid should throw");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
do_check_eq(ex.result, Cr.NS_ERROR_INVALID_ARG);
|
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(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentId: PlacesUtils.unfiledBookmarksFolderId
|
parentId: PlacesUtils.unfiledBookmarksFolderId,
|
||||||
, feedURI: FEED_URI });
|
feedURI: FEED_URI });
|
||||||
do_check_true(onItemAddedCalled);
|
do_check_true(onItemAddedCalled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
add_task(async function test_addLivemark_noSiteURI_succeeds() {
|
add_task(async function test_addLivemark_noSiteURI_succeeds() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
do_check_true(livemark.id > 0);
|
do_check_true(livemark.id > 0);
|
||||||
do_check_valid_places_guid(livemark.guid);
|
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() {
|
add_task(async function test_addLivemark_succeeds() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, siteURI: SITE_URI
|
siteURI: SITE_URI
|
||||||
});
|
});
|
||||||
|
|
||||||
do_check_true(livemark.id > 0);
|
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() {
|
add_task(async function test_addLivemark_bogusid_succeeds() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ id: 100 // Should be ignored.
|
{ id: 100, // Should be ignored.
|
||||||
, title: "test"
|
title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, siteURI: SITE_URI
|
siteURI: SITE_URI
|
||||||
});
|
});
|
||||||
do_check_true(livemark.id > 0);
|
do_check_true(livemark.id > 0);
|
||||||
do_check_neq(livemark.id, 100);
|
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() {
|
add_task(async function test_addLivemark_bogusParentId_fails() {
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentId: 187
|
parentId: 187,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
do_throw("Adding a livemark with a bogus parent should fail");
|
do_throw("Adding a livemark with a bogus parent should fail");
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
|
@ -245,9 +245,9 @@ add_task(async function test_addLivemark_bogusParentId_fails() {
|
||||||
add_task(async function test_addLivemark_bogusParentGuid_fails() {
|
add_task(async function test_addLivemark_bogusParentGuid_fails() {
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: "123456789012"
|
parentGuid: "123456789012",
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
do_throw("Adding a livemark with a bogus parent should fail");
|
do_throw("Adding a livemark with a bogus parent should fail");
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
|
@ -255,16 +255,16 @@ add_task(async function test_addLivemark_bogusParentGuid_fails() {
|
||||||
|
|
||||||
add_task(async function test_addLivemark_intoLivemark_fails() {
|
add_task(async function test_addLivemark_intoLivemark_fails() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: livemark.guid
|
parentGuid: livemark.guid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
do_throw("Adding a livemark into a livemark should fail");
|
do_throw("Adding a livemark into a livemark should fail");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
@ -274,10 +274,10 @@ add_task(async function test_addLivemark_intoLivemark_fails() {
|
||||||
|
|
||||||
add_task(async function test_addLivemark_forceGuid_succeeds() {
|
add_task(async function test_addLivemark_forceGuid_succeeds() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, guid: "1234567890AB"
|
guid: "1234567890AB"
|
||||||
});
|
});
|
||||||
do_check_eq(livemark.guid, "1234567890AB");
|
do_check_eq(livemark.guid, "1234567890AB");
|
||||||
do_check_guid_for_bookmark(livemark.id, "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() {
|
add_task(async function test_addLivemark_dateAdded_succeeds() {
|
||||||
let dateAdded = new Date("2013-03-01T01:10:00") * 1000;
|
let dateAdded = new Date("2013-03-01T01:10:00") * 1000;
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, dateAdded
|
dateAdded
|
||||||
});
|
});
|
||||||
do_check_eq(livemark.dateAdded, 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() {
|
add_task(async function test_addLivemark_lastModified_succeeds() {
|
||||||
let now = Date.now() * 1000;
|
let now = Date.now() * 1000;
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, lastModified: now
|
lastModified: now
|
||||||
});
|
});
|
||||||
do_check_eq(livemark.dateAdded, now);
|
do_check_eq(livemark.dateAdded, now);
|
||||||
do_check_eq(livemark.lastModified, 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() {
|
add_task(async function test_removeLivemark_guid_succeeds() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, guid: "234567890ABC"
|
guid: "234567890ABC"
|
||||||
});
|
});
|
||||||
|
|
||||||
do_check_eq(livemark.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() {
|
add_task(async function test_removeLivemark_id_succeeds() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
|
|
||||||
await PlacesUtils.livemarks.removeLivemark({ id: livemark.id });
|
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() {
|
add_task(async function test_getLivemark_guid_succeeds() {
|
||||||
await PlacesUtils.livemarks.addLivemark(
|
await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI,
|
||||||
, guid: "34567890ABCD" });
|
guid: "34567890ABCD" });
|
||||||
|
|
||||||
// invalid id to check the guid wins.
|
// invalid id to check the guid wins.
|
||||||
let livemark =
|
let livemark =
|
||||||
|
@ -417,9 +417,9 @@ add_task(async function test_getLivemark_guid_succeeds() {
|
||||||
|
|
||||||
add_task(async function test_getLivemark_id_succeeds() {
|
add_task(async function test_getLivemark_id_succeeds() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
|
|
||||||
livemark = await PlacesUtils.livemarks.getLivemark({ id: livemark.id });
|
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() {
|
add_task(async function test_getLivemark_removeItem_contention() {
|
||||||
// do not yield.
|
// do not yield.
|
||||||
PlacesUtils.livemarks.addLivemark({ title: "test"
|
PlacesUtils.livemarks.addLivemark({ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
}).catch(() => { /* swallow errors*/ });
|
}).catch(() => { /* swallow errors*/ });
|
||||||
await PlacesUtils.bookmarks.eraseEverything();
|
await PlacesUtils.bookmarks.eraseEverything();
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
|
|
||||||
livemark = await PlacesUtils.livemarks.getLivemark({ guid: livemark.guid });
|
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() {
|
add_task(async function test_title_change() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI
|
feedURI: FEED_URI
|
||||||
});
|
});
|
||||||
|
|
||||||
await PlacesUtils.bookmarks.update({ guid: livemark.guid,
|
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() {
|
add_task(async function test_livemark_move() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI } );
|
feedURI: FEED_URI } );
|
||||||
|
|
||||||
await PlacesUtils.bookmarks.update({ guid: livemark.guid,
|
await PlacesUtils.bookmarks.update({ guid: livemark.guid,
|
||||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||||
|
@ -495,9 +495,9 @@ add_task(async function test_livemark_move() {
|
||||||
|
|
||||||
add_task(async function test_livemark_removed() {
|
add_task(async function test_livemark_removed() {
|
||||||
let livemark = await PlacesUtils.livemarks.addLivemark(
|
let livemark = await PlacesUtils.livemarks.addLivemark(
|
||||||
{ title: "test"
|
{ title: "test",
|
||||||
, parentGuid: PlacesUtils.bookmarks.unfiledGuid
|
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
|
||||||
, feedURI: FEED_URI } );
|
feedURI: FEED_URI } );
|
||||||
|
|
||||||
await PlacesUtils.bookmarks.remove(livemark.guid);
|
await PlacesUtils.bookmarks.remove(livemark.guid);
|
||||||
// Poll for the livemark removal.
|
// Poll for the livemark removal.
|
||||||
|
|
|
@ -17,7 +17,6 @@ module.exports = {
|
||||||
"rules": {
|
"rules": {
|
||||||
"camelcase": "error",
|
"camelcase": "error",
|
||||||
"comma-dangle": ["error", "never"],
|
"comma-dangle": ["error", "never"],
|
||||||
"comma-style": ["error", "last"],
|
|
||||||
"curly": ["error", "multi-line"],
|
"curly": ["error", "multi-line"],
|
||||||
"handle-callback-err": ["error", "er"],
|
"handle-callback-err": ["error", "er"],
|
||||||
"indent": ["error", 2, {"SwitchCase": 1}],
|
"indent": ["error", 2, {"SwitchCase": 1}],
|
||||||
|
|
|
@ -85,7 +85,7 @@ module.exports = {
|
||||||
"comma-spacing": ["error", {"after": true, "before": false}],
|
"comma-spacing": ["error", {"after": true, "before": false}],
|
||||||
|
|
||||||
// Commas at the end of the line not the start
|
// Commas at the end of the line not the start
|
||||||
// "comma-style": "error",
|
"comma-style": "error",
|
||||||
|
|
||||||
// Warn about cyclomatic complexity in functions.
|
// Warn about cyclomatic complexity in functions.
|
||||||
// XXX Get this down to 20?
|
// XXX Get this down to 20?
|
||||||
|
|
Загрузка…
Ссылка в новой задаче