Merge mozilla-central to inbound. a=merge CLOSED TREE

This commit is contained in:
Brindusan Cristian 2018-08-23 01:03:34 +03:00
Родитель fff6fb1ff1 d21b936680
Коммит d44d2ad21c
359 изменённых файлов: 2522 добавлений и 2181 удалений

Просмотреть файл

@ -83,11 +83,6 @@ var gEMEHandler = {
notificationMessage = this.getEMEDisabledFragment();
break;
case "cdm-insufficient-version":
notificationId = "drmContentCDMInsufficientVersion";
notificationMessage = this.getMessageWithBrandName(notificationId);
break;
case "cdm-not-installed":
notificationId = "drmContentCDMInstalling";
notificationMessage = this.getMessageWithBrandName(notificationId);

Просмотреть файл

@ -85,6 +85,7 @@ add_task(async function checkReturnToAboutHome() {
});
add_task(async function checkExceptionDialogButton() {
Services.prefs.setBoolPref("browser.security.newcerterrorpage.enabled", true);
info("Loading a bad cert page and making sure the exceptionDialogButton directly adds an exception");
let tab = await openErrorPage(BAD_CERT);
let browser = tab.linkedBrowser;
@ -108,6 +109,7 @@ add_task(async function checkExceptionDialogButton() {
.getService(Ci.nsICertOverrideService);
certOverrideService.clearValidityOverride("expired.example.com", -1);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
Services.prefs.clearUserPref("browser.security.newcerterrorpage.enabled");
});
add_task(async function checkReturnToPreviousPage() {
@ -165,14 +167,12 @@ add_task(async function checkBadStsCert() {
let tab = await openErrorPage(BAD_STS_CERT, useFrame);
let browser = tab.linkedBrowser;
let exceptionButtonHidden = await ContentTask.spawn(browser, {frame: useFrame}, async function({frame}) {
await ContentTask.spawn(browser, {frame: useFrame}, async function({frame}) {
let doc = frame ? content.document.querySelector("iframe").contentDocument : content.document;
let exceptionButton = doc.getElementById("exceptionDialogButton");
return exceptionButton.hidden;
ok(ContentTaskUtils.is_hidden(exceptionButton), "Exception button is hidden.");
});
ok(exceptionButtonHidden, "Exception button is hidden");
let message = await ContentTask.spawn(browser, {frame: useFrame}, async function({frame}) {
let doc = frame ? content.document.querySelector("iframe").contentDocument : content.document;
let advancedButton = doc.getElementById("advancedButton");
@ -372,7 +372,7 @@ add_task(async function checkAdvancedDetails() {
}
});
add_task(async function checkhideAddExceptionButton() {
add_task(async function checkhideAddExceptionButtonViaPref() {
info("Loading a bad cert page and verifying the pref security.certerror.hideAddException");
Services.prefs.setBoolPref("security.certerror.hideAddException", true);
@ -384,7 +384,7 @@ add_task(async function checkhideAddExceptionButton() {
let doc = frame ? content.document.querySelector("iframe").contentDocument : content.document;
let exceptionButton = doc.querySelector(".exceptionDialogButtonContainer");
ok(exceptionButton.hidden, "Exception button is hidden.");
ok(ContentTaskUtils.is_hidden(exceptionButton), "Exception button is hidden.");
});
BrowserTestUtils.removeTab(gBrowser.selectedTab);
@ -393,6 +393,20 @@ add_task(async function checkhideAddExceptionButton() {
Services.prefs.clearUserPref("security.certerror.hideAddException");
});
add_task(async function checkhideAddExceptionButtonInFrames() {
info("Loading a bad cert page in a frame and verifying it's hidden.");
let tab = await openErrorPage(BAD_CERT, true);
let browser = tab.linkedBrowser;
await ContentTask.spawn(browser, null, async function() {
let doc = content.document.querySelector("iframe").contentDocument;
let exceptionButton = doc.getElementById("exceptionDialogButton");
ok(ContentTaskUtils.is_hidden(exceptionButton), "Exception button is hidden.");
});
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
add_task(async function checkAdvancedDetailsForHSTS() {
info("Loading a bad STS cert page and verifying the advanced details section");
for (let useFrame of [false, true]) {

Просмотреть файл

@ -367,18 +367,18 @@ var PanelMultiView = class extends AssociatedToNode {
PanelMultiView.ensureUnloadHandlerRegistered(this.window);
let viewContainer = this._viewContainer =
this.document.createElement("box");
this.document.createXULElement("box");
viewContainer.classList.add("panel-viewcontainer");
let viewStack = this._viewStack = this.document.createElement("box");
let viewStack = this._viewStack = this.document.createXULElement("box");
viewStack.classList.add("panel-viewstack");
viewContainer.append(viewStack);
let offscreenViewContainer = this.document.createElement("box");
let offscreenViewContainer = this.document.createXULElement("box");
offscreenViewContainer.classList.add("panel-viewcontainer", "offscreen");
let offscreenViewStack = this._offscreenViewStack =
this.document.createElement("box");
this.document.createXULElement("box");
offscreenViewStack.classList.add("panel-viewstack");
offscreenViewContainer.append(offscreenViewStack);
@ -1212,10 +1212,10 @@ var PanelView = class extends AssociatedToNode {
return;
}
header = this.document.createElement("box");
header = this.document.createXULElement("box");
header.classList.add("panel-header");
let backButton = this.document.createElement("toolbarbutton");
let backButton = this.document.createXULElement("toolbarbutton");
backButton.className =
"subviewbutton subviewbutton-iconic subviewbutton-back";
backButton.setAttribute("closemenu", "none");
@ -1228,7 +1228,7 @@ var PanelView = class extends AssociatedToNode {
backButton.blur();
});
let label = this.document.createElement("label");
let label = this.document.createXULElement("label");
label.setAttribute("value", value);
header.append(backButton, label);

Просмотреть файл

@ -0,0 +1,7 @@
"use strict";
module.exports = {
"rules": {
"comma-dangle": ["error", "always-multiline"],
}
};

Просмотреть файл

@ -481,7 +481,7 @@ var PlacesUIUtils = {
await PlacesUtils.history.update({
url,
annotations: new Map([[PlacesUtils.CHARSET_ANNO, charset]])
annotations: new Map([[PlacesUtils.CHARSET_ANNO, charset]]),
});
},
@ -844,7 +844,7 @@ var PlacesUIUtils = {
let parent = {
itemId: await PlacesUtils.promiseItemId(aFetchInfo.parentGuid),
bookmarkGuid: aFetchInfo.parentGuid,
type: Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER
type: Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER,
};
return Object.freeze({
@ -872,7 +872,7 @@ var PlacesUIUtils = {
get parent() {
return parent;
}
},
});
},

Просмотреть файл

@ -169,7 +169,7 @@ var BookmarkPropertiesPanel = {
this._defaultInsertionPoint =
new PlacesInsertionPoint({
parentId: PlacesUtils.bookmarksMenuFolderId,
parentGuid: PlacesUtils.bookmarks.menuGuid
parentGuid: PlacesUtils.bookmarks.menuGuid,
});
}
@ -500,8 +500,8 @@ var BookmarkPropertiesPanel = {
parent: {
itemId: containerId,
bookmarkGuid: parentGuid,
type: Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER
}
type: Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER,
},
});
}
},
};

Просмотреть файл

@ -218,7 +218,7 @@ PlacesViewBase.prototype = {
return new PlacesInsertionPoint({
parentId: PlacesUtils.getConcreteItemId(container),
parentGuid: PlacesUtils.getConcreteItemGuid(container),
index, orientation, tagName
index, orientation, tagName,
});
},
@ -968,7 +968,7 @@ function PlacesToolbar(aPlace) {
["_rootElt", "PlacesToolbarItems"],
["_dropIndicator", "PlacesToolbarDropIndicator"],
["_chevron", "PlacesChevron"],
["_chevronPopup", "PlacesChevronPopup"]
["_chevronPopup", "PlacesChevronPopup"],
].forEach(function(elementGlobal) {
let [name, id] = elementGlobal;
thisView.__defineGetter__(name, function() {
@ -1564,7 +1564,7 @@ PlacesToolbar.prototype = {
parentId: PlacesUtils.getConcreteItemId(this._resultNode),
parentGuid: PlacesUtils.getConcreteItemGuid(this._resultNode),
index: eltIndex,
orientation: Ci.nsITreeView.DROP_BEFORE
orientation: Ci.nsITreeView.DROP_BEFORE,
});
dropPoint.beforeIndex = eltIndex;
} else if (this.isRTL ? (aEvent.clientX > eltRect.left + threshold)
@ -1576,7 +1576,7 @@ PlacesToolbar.prototype = {
new PlacesInsertionPoint({
parentId: PlacesUtils.getConcreteItemId(elt._placesNode),
parentGuid: PlacesUtils.getConcreteItemGuid(elt._placesNode),
tagName
tagName,
});
dropPoint.beforeIndex = eltIndex;
dropPoint.folderElt = elt;
@ -1591,7 +1591,7 @@ PlacesToolbar.prototype = {
parentId: PlacesUtils.getConcreteItemId(this._resultNode),
parentGuid: PlacesUtils.getConcreteItemGuid(this._resultNode),
index: beforeIndex,
orientation: Ci.nsITreeView.DROP_BEFORE
orientation: Ci.nsITreeView.DROP_BEFORE,
});
dropPoint.beforeIndex = beforeIndex;
}
@ -1607,7 +1607,7 @@ PlacesToolbar.prototype = {
parentId: PlacesUtils.getConcreteItemId(this._resultNode),
parentGuid: PlacesUtils.getConcreteItemGuid(this._resultNode),
index: eltIndex,
orientation: Ci.nsITreeView.DROP_BEFORE
orientation: Ci.nsITreeView.DROP_BEFORE,
});
dropPoint.beforeIndex = eltIndex;
} else {
@ -1620,7 +1620,7 @@ PlacesToolbar.prototype = {
parentId: PlacesUtils.getConcreteItemId(this._resultNode),
parentGuid: PlacesUtils.getConcreteItemGuid(this._resultNode),
index: beforeIndex,
orientation: Ci.nsITreeView.DROP_BEFORE
orientation: Ci.nsITreeView.DROP_BEFORE,
});
dropPoint.beforeIndex = beforeIndex;
}
@ -1632,7 +1632,7 @@ PlacesToolbar.prototype = {
new PlacesInsertionPoint({
parentId: PlacesUtils.getConcreteItemId(this._resultNode),
parentGuid: PlacesUtils.getConcreteItemGuid(this._resultNode),
orientation: Ci.nsITreeView.DROP_BEFORE
orientation: Ci.nsITreeView.DROP_BEFORE,
});
dropPoint.beforeIndex = -1;
}
@ -1904,7 +1904,7 @@ PlacesToolbar.prototype = {
this._openedMenuButton.open = false;
target.open = true;
}
}
},
};
/**
@ -1981,7 +1981,7 @@ PlacesMenu.prototype = {
// when the folder closes because it is no longer applicable.
popup.removeAttribute("autoopened");
popup.removeAttribute("dragstart");
}
},
};
function PlacesPanelMenuView(aPlace, aViewId, aRootId, aOptions) {
@ -2128,7 +2128,7 @@ PlacesPanelMenuView.prototype = {
this._insertNewItem(this._resultNode.getChild(i), fragment);
}
this._rootElt.appendChild(fragment);
}
},
};
this.PlacesPanelview = class extends PlacesViewBase {

Просмотреть файл

@ -58,7 +58,7 @@ PlacesInsertionPoint.prototype = {
get isTag() {
return typeof(this.tagName) == "string";
}
},
};
/**
@ -89,7 +89,7 @@ PlacesController.prototype = {
disableUserActions: false,
QueryInterface: ChromeUtils.generateQI([
Ci.nsIClipboardOwner
Ci.nsIClipboardOwner,
]),
// nsIClipboardOwner
@ -275,7 +275,7 @@ PlacesController.prototype = {
type: "bookmark",
hiddenRows: [ "keyword", "location" ],
uri: Services.io.newURI(node.uri),
title: node.title
title: node.title,
}, window.top);
break;
}
@ -649,7 +649,7 @@ PlacesController.prototype = {
PlacesUIUtils.showBookmarkDialog({ action: "edit",
node,
hiddenRows: [ "folderPicker" ]
hiddenRows: [ "folderPicker" ],
}, window.top);
},
@ -698,7 +698,7 @@ PlacesController.prototype = {
PlacesUIUtils.showBookmarkDialog({ action: "add",
type: aType,
defaultInsertionPoint: ip,
hiddenRows: [ "folderPicker" ]
hiddenRows: [ "folderPicker" ],
}, window.top);
if (bookmarkGuid) {
this._view.selectItems([bookmarkGuid], false);
@ -914,7 +914,7 @@ PlacesController.prototype = {
// end up removing more history than requested.
await PlacesUtils.history.removeByFilter({
beginDate: PlacesUtils.toDate(beginTime + 1000),
endDate: PlacesUtils.toDate(endTime)
endDate: PlacesUtils.toDate(endTime),
});
}
},
@ -1431,7 +1431,7 @@ var PlacesControllerDragHelper = {
nodes.push({
uri: spec,
title: data.label,
type: PlacesUtils.TYPE_X_MOZ_URL
type: PlacesUtils.TYPE_X_MOZ_URL,
});
} else {
throw new Error("bogus data was passed as a tab");

Просмотреть файл

@ -703,7 +703,7 @@ var gEditItemOverlay = {
this._paneInfo.itemGuid != containerGuid) {
await PlacesTransactions.Move({
guid: this._paneInfo.itemGuid,
newParentGuid: containerGuid
newParentGuid: containerGuid,
}).transact();
// Auto-show the bookmarks toolbar when adding / moving an item there.
@ -827,7 +827,7 @@ var gEditItemOverlay = {
if (!ip) {
ip = new PlacesInsertionPoint({
parentId: PlacesUtils.bookmarksMenuFolderId,
parentGuid: PlacesUtils.bookmarks.menuGuid
parentGuid: PlacesUtils.bookmarks.menuGuid,
});
}
@ -836,7 +836,7 @@ var gEditItemOverlay = {
let guid = await PlacesTransactions.NewFolder({
parentGuid: ip.guid,
title,
index: await ip.getIndex()
index: await ip.getIndex(),
}).transact().catch(Cu.reportError);
this._folderTree.focus();

Просмотреть файл

@ -93,7 +93,7 @@
// If we are dragging over a non places node drop at the end.
dropPoint.ip = new PlacesInsertionPoint({
parentId: PlacesUtils.getConcreteItemId(resultNode),
parentGuid: PlacesUtils.getConcreteItemGuid(resultNode)
parentGuid: PlacesUtils.getConcreteItemGuid(resultNode),
});
// We can set folderElt if we are dropping over a static menu that
// has an internal placespopup.
@ -119,7 +119,7 @@
parentGuid: PlacesUtils.getConcreteItemGuid(resultNode),
orientation: Ci.nsITreeView.DROP_BEFORE,
tagName,
dropNearNode: elt._placesNode
dropNearNode: elt._placesNode,
});
return dropPoint;
} else if (eventY - eltY < eltHeight * 0.80) {
@ -127,7 +127,7 @@
dropPoint.ip = new PlacesInsertionPoint({
parentId: PlacesUtils.getConcreteItemId(elt._placesNode),
parentGuid: PlacesUtils.getConcreteItemGuid(elt._placesNode),
tagName
tagName,
});
dropPoint.folderElt = elt;
return dropPoint;
@ -140,7 +140,7 @@
parentGuid: PlacesUtils.getConcreteItemGuid(resultNode),
orientation: Ci.nsITreeView.DROP_BEFORE,
tagName,
dropNearNode: elt._placesNode
dropNearNode: elt._placesNode,
});
return dropPoint;
}
@ -284,7 +284,7 @@
this._folder.closeTimer.cancel();
this._folder.closeTimer = null;
}
}
},
})]]></field>
<method name="_cleanupDragDetails">

Просмотреть файл

@ -70,19 +70,19 @@ var PlacesOrganizer = {
case "BookmarksMenu":
this.selectLeftPaneContainerByHierarchy([
PlacesUtils.virtualAllBookmarksGuid,
PlacesUtils.bookmarks.virtualMenuGuid
PlacesUtils.bookmarks.virtualMenuGuid,
]);
break;
case "BookmarksToolbar":
this.selectLeftPaneContainerByHierarchy([
PlacesUtils.virtualAllBookmarksGuid,
PlacesUtils.bookmarks.virtualToolbarGuid
PlacesUtils.bookmarks.virtualToolbarGuid,
]);
break;
case "UnfiledBookmarks":
this.selectLeftPaneContainerByHierarchy([
PlacesUtils.virtualAllBookmarksGuid,
PlacesUtils.bookmarks.virtualUnfiledGuid
PlacesUtils.bookmarks.virtualUnfiledGuid,
]);
break;
default:
@ -446,7 +446,7 @@ var PlacesOrganizer = {
let restorePopup = document.getElementById("fileRestorePopup");
const dtOptions = {
dateStyle: "long"
dateStyle: "long",
};
let dateFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions);
@ -880,7 +880,7 @@ var PlacesQueryBuilder = {
var searchStr = PlacesSearchBox.searchFilter.value;
if (searchStr)
PlacesSearchBox.search(searchStr);
}
},
};
/**
@ -1125,7 +1125,7 @@ var ViewMenu = {
var sortConst = "SORT_BY_" + colLookupTable[columnId].key + "_" + aDirection;
result.sortingMode = Ci.nsINavHistoryQueryOptions[sortConst];
}
},
};
var ContentArea = {
@ -1260,7 +1260,7 @@ var ContentArea = {
focus() {
this._deck.selectedPanel.focus();
}
},
};
var ContentTree = {
@ -1275,7 +1275,7 @@ var ContentTree = {
get viewOptions() {
return Object.seal({
showDetailsPane: true,
toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter"
toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter",
});
},
@ -1304,5 +1304,5 @@ var ContentTree = {
onKeyPress: function CT_onKeyPress(aEvent) {
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
this.openSelectedNode(aEvent);
}
},
};

Просмотреть файл

@ -534,7 +534,7 @@
return new PlacesInsertionPoint({
parentId: PlacesUtils.getConcreteItemId(container),
parentGuid: PlacesUtils.getConcreteItemGuid(container),
index, orientation, tagName, dropNearNode
index, orientation, tagName, dropNearNode,
});
]]></body>
</method>

Просмотреть файл

@ -51,7 +51,7 @@ PlacesTreeView.prototype = {
QueryInterface: ChromeUtils.generateQI([
Ci.nsITreeView,
Ci.nsINavHistoryResultObserver,
Ci.nsISupportsWeakReference
Ci.nsISupportsWeakReference,
]),
/**
@ -415,7 +415,7 @@ PlacesTreeView.prototype = {
nodesInfo.push({
node: this._rows[i],
oldRow: i,
wasVisible: i >= firstVisibleRow && i <= lastVisibleRow
wasVisible: i >= firstVisibleRow && i <= lastVisibleRow,
});
}
}
@ -551,7 +551,7 @@ PlacesTreeView.prototype = {
if (!this.__dateFormatter) {
const dtOptions = {
dateStyle: "short",
timeStyle: "short"
timeStyle: "short",
};
this.__dateFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions);
}
@ -1442,7 +1442,7 @@ PlacesTreeView.prototype = {
return new PlacesInsertionPoint({
parentId: PlacesUtils.getConcreteItemId(container),
parentGuid: PlacesUtils.getConcreteItemGuid(container),
index, orientation, tagName, dropNearNode
index, orientation, tagName, dropNearNode,
});
},
@ -1764,5 +1764,5 @@ PlacesTreeView.prototype = {
isSelectable(aRow, aColumn) { return false; },
performAction(aAction) { },
performActionOnRow(aAction, aRow) { },
performActionOnCell(aAction, aRow, aColumn) { }
performActionOnCell(aAction, aRow, aColumn) { },
};

Просмотреть файл

@ -57,7 +57,7 @@ add_task(async function reopen_same_field() {
await PlacesUtils.keywords.insert({
url: TEST_URL,
keyword: "kw",
postData: "accenti%3D%E0%E8%EC%F2%F9&search%3D%25s"
postData: "accenti%3D%E0%E8%EC%F2%F9&search%3D%25s",
});
registerCleanupFunction(async function() {
await PlacesUtils.keywords.remove("kw");
@ -84,7 +84,7 @@ add_task(async function open_other_field() {
await PlacesUtils.keywords.insert({
url: TEST_URL,
keyword: "kw2",
postData: "search%3D%25s"
postData: "search%3D%25s",
});
registerCleanupFunction(async function() {
await PlacesUtils.keywords.remove("kw2");

Просмотреть файл

@ -22,13 +22,13 @@ add_task(async function() {
let bookmark = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
});
Assert.equal(bookmark.title, "modified", "folder name has been edited");
let livemark = await PlacesUtils.livemarks.getLivemark({
guid: bookmark.guid
guid: bookmark.guid,
});
Assert.equal(livemark.feedURI.spec, "http://livemark.com/", "livemark has the correct url");
Assert.equal(livemark.title, "modified", "livemark has the correct title");

Просмотреть файл

@ -23,7 +23,7 @@ add_task(async function setup() {
}, {
title: "bm2",
url: "http://example.com/2",
}]
}],
});
// Undo is called asynchronously - and not waited for. Since we're not

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function() {
let bm = await PlacesUtils.bookmarks.insert({
title: "folder",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
parentGuid: PlacesUtils.bookmarks.unfiledGuid
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
});
registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.remove(bm);

Просмотреть файл

@ -5,7 +5,7 @@ add_task(async function() {
let uri = Services.io.newURI("http://example.com/");
let bm = await PlacesUtils.bookmarks.insert({
url: uri.spec,
parentGuid: PlacesUtils.bookmarks.unfiledGuid
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
});
registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.remove(bm);

Просмотреть файл

@ -18,7 +18,7 @@ add_task(async function setup() {
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
registerCleanupFunction(async () => {

Просмотреть файл

@ -10,13 +10,13 @@ add_task(async function test_change_title_from_BookmarkStar() {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: TEST_URL,
title: "Before Edit"
title: "Before Edit",
});
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
registerCleanupFunction(async () => {
@ -52,7 +52,7 @@ add_task(async function test_change_title_from_BookmarkStar() {
},
mozGetDataAt(i) {
return bookmarkWithId;
}
},
};
Assert.ok(!folderTree.view.canDrop(1, Ci.nsITreeView.DROP_BEFORE, dt),
@ -68,7 +68,7 @@ add_task(async function test_change_title_from_BookmarkStar() {
"cmd_delete",
"cmd_selectAll",
// Anything starting with placesCmd_ should also be disabled.
"placesCmd_"
"placesCmd_",
];
for (let action of userActions) {
Assert.ok(!folderTree.view._controller.supportsCommand(action),

Просмотреть файл

@ -85,7 +85,7 @@ add_task(async function setup() {
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: "about:robots",
waitForStateStop: true
waitForStateStop: true,
});
folders = await PlacesUtils.bookmarks.insertTree({
@ -108,7 +108,7 @@ add_task(async function setup() {
}, {
title: "Principal",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
}]
}],
});
registerCleanupFunction(async () => {

Просмотреть файл

@ -29,7 +29,7 @@ add_task(async function test_add_bookmark_tags_from_bookmarkProperties() {
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
// Cleanup.
@ -88,7 +88,7 @@ add_task(async function test_add_bookmark_tags_from_library() {
// Add a bookmark.
await PlacesUtils.bookmarks.insert({
url: uri,
parentGuid: PlacesUtils.bookmarks.unfiledGuid
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
});
// Open the Library on "UnfiledBookmarks".
@ -127,7 +127,7 @@ add_task(async function test_add_bookmark_tags_from_sidebar() {
let bookmarks = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: TEST_URL,
title: "Bookmark Title"
title: "Bookmark Title",
});
await withSidebarTree("bookmarks", async function(tree) {

Просмотреть файл

@ -9,7 +9,7 @@ add_task(async function() {
const TEST_PAGES = [
BASE_URL + "bookmark_dummy_1.html",
BASE_URL + "bookmark_dummy_2.html",
BASE_URL + "bookmark_dummy_1.html"
BASE_URL + "bookmark_dummy_1.html",
];
function promiseAddTab(url) {
@ -24,11 +24,11 @@ add_task(async function() {
Assert.deepEqual(URIs.map(URI => URI.uri.spec), [
"about:blank",
BASE_URL + "bookmark_dummy_1.html",
BASE_URL + "bookmark_dummy_2.html"
BASE_URL + "bookmark_dummy_2.html",
], "Correct URIs are returned");
Assert.deepEqual(URIs.map(URI => URI.title), [
"New Tab", "Bookmark Dummy 1", "Bookmark Dummy 2"
"New Tab", "Bookmark Dummy 1", "Bookmark Dummy 2",
], "Correct titles are returned");
registerCleanupFunction(async function() {

Просмотреть файл

@ -13,18 +13,18 @@ const PLACES = [
{
guid: PlacesUtils.bookmarks.menuGuid,
prefix: "In Menu",
total: 5
total: 5,
},
{
guid: PlacesUtils.bookmarks.toolbarGuid,
prefix: "In Toolbar",
total: 7
total: 7,
},
{
guid: PlacesUtils.bookmarks.unfiledGuid,
prefix: "In Other",
total: 8
}
total: 8,
},
];
var importExportPicker, saveDir, actualBookmarks;
@ -36,12 +36,12 @@ async function generateTestBookmarks() {
for (let i = 1; i <= place.total; i++) {
currentPlaceChildren.push({
url: `${BASE_URL}${i}`,
title: `${place.prefix} Bookmark: ${i}`
title: `${place.prefix} Bookmark: ${i}`,
});
}
await PlacesUtils.bookmarks.insertTree({
guid: place.guid,
children: currentPlaceChildren
children: currentPlaceChildren,
});
actualBookmarks = actualBookmarks.concat(currentPlaceChildren);
}

Просмотреть файл

@ -35,7 +35,7 @@ add_task(async function test_change_location_from_Toolbar() {
let toolbarBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "",
url: TEST_URL
url: TEST_URL,
});
let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid);
@ -47,7 +47,7 @@ add_task(async function test_change_location_from_Toolbar() {
let promisePopup = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await promisePopup;

Просмотреть файл

@ -9,7 +9,7 @@ add_task(async function() {
let root = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "",
type: PlacesUtils.bookmarks.TYPE_FOLDER
type: PlacesUtils.bookmarks.TYPE_FOLDER,
});
registerCleanupFunction(async () => {
@ -34,7 +34,7 @@ add_task(async function() {
let shortcut = await PlacesUtils.bookmarks.insert({
parentGuid: root.guid,
title: "bar",
url: `place:parent=${folder.guid}`
url: `place:parent=${folder.guid}`,
});
tree.selectItems([shortcut.guid]);
Assert.equal(tree.selectedNode.bookmarkGuid, shortcut.guid,
@ -57,7 +57,7 @@ add_task(async function() {
let query = await PlacesUtils.bookmarks.insert({
parentGuid: root.guid,
title: "bar",
url: `place:terms=foo`
url: `place:terms=foo`,
});
tree.selectItems([query.guid]);
Assert.equal(tree.selectedNode.bookmarkGuid, query.guid,

Просмотреть файл

@ -37,7 +37,7 @@ add_task(async function test_remove_tags_from_BookmarkStar() {
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
registerCleanupFunction(async () => {
@ -73,7 +73,7 @@ add_task(async function test_remove_tags_from_Toolbar() {
let toolbarBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: TEST_URL,
url: TEST_URL
url: TEST_URL,
});
let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid);
@ -85,7 +85,7 @@ add_task(async function test_remove_tags_from_Toolbar() {
let promisePopup = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await promisePopup;

Просмотреть файл

@ -11,7 +11,7 @@ function makeBookmarkFor(url, keyword) {
title: "bookmarklet",
url }),
PlacesUtils.keywords.insert({url,
keyword})
keyword}),
]);
}
@ -20,7 +20,7 @@ add_task(async function openKeywordBookmarkWithWindowOpen() {
// This is the current default, but let's not assume that...
await SpecialPowers.pushPrefEnv({"set": [
[ "browser.link.open_newwindow", 3 ],
[ "dom.disable_open_during_load", true ]
[ "dom.disable_open_during_load", true ],
]});
let moztab;
@ -39,7 +39,7 @@ add_task(async function openKeywordBookmarkWithWindowOpen() {
registerCleanupFunction(function() {
return Promise.all([
PlacesUtils.bookmarks.remove(bookmarkInfo),
PlacesUtils.keywords.remove(keywordForBM)
PlacesUtils.keywords.remove(keywordForBM),
]);
});
gURLBar.value = keywordForBM;

Просмотреть файл

@ -41,7 +41,7 @@ function add_bookmark(url) {
return PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url,
title: `bookmark/${url}`
title: `bookmark/${url}`,
});
}
@ -120,7 +120,7 @@ gTests.push({
default:
Assert.ok(false, "unknown event: " + aEvent.type);
}
}
},
};
tagsField.popup.addEventListener("popupshown", popupListener, true);
tagsField.popup.addEventListener("popuphidden", popupListener, true);
@ -149,7 +149,7 @@ gTests.push({
await PlacesUtils.bookmarks.remove(this._bookmark);
let bm = await PlacesUtils.bookmarks.fetch(this._bookmark.guid);
Assert.ok(!bm, "should have been removed");
}
},
});
// ------------------------------------------------------------------------------
@ -224,7 +224,7 @@ gTests.push({
default:
Assert.ok(false, "unknown event: " + aEvent.type);
}
}
},
};
tagsField.popup.addEventListener("popupshown", popupListener, true);
tagsField.popup.addEventListener("popuphidden", popupListener, true);
@ -252,7 +252,7 @@ gTests.push({
await PlacesUtils.bookmarks.remove(this._bookmark);
let bm = await PlacesUtils.bookmarks.fetch(this._bookmark.guid);
Assert.ok(!bm, "should have been removed");
}
},
});
// ------------------------------------------------------------------------------
@ -337,7 +337,7 @@ gTests.push({
await PlacesTestUtils.promiseAsyncUpdates();
await PlacesUtils.history.clear();
}
},
});
// ------------------------------------------------------------------------------

Просмотреть файл

@ -39,13 +39,13 @@ add_task(async function test_change_title_from_BookmarkStar() {
let originalBm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: TEST_URL,
title: "Before Edit"
title: "Before Edit",
});
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
registerCleanupFunction(async () => {
@ -81,7 +81,7 @@ add_task(async function test_change_title_from_Toolbar() {
let toolbarBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: titleAfterFirstUpdate,
url: TEST_URL
url: TEST_URL,
});
let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid);
@ -93,7 +93,7 @@ add_task(async function test_change_title_from_Toolbar() {
let promisePopup = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await promisePopup;

Просмотреть файл

@ -43,7 +43,7 @@ add_task(async function test() {
await PlacesUtils.bookmarks.insert({
url,
title: "example page " + i,
parentGuid: PlacesUtils.bookmarks.toolbarGuid
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
});
PlacesUtils.tagging.tagURI(url, ["test"]);
}

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function() {
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
registerCleanupFunction(async () => {

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function() {
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
title: "mozilla",
url: testURI
url: testURI,
});
// Init panel

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function() {
let bm1 = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "mozilla",
url: uri1.spec
url: uri1.spec,
});
PlacesUtils.tagging.tagURI(uri1, tags);
@ -33,14 +33,14 @@ add_task(async function() {
let bm2 = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "mozilla",
url: uri2.spec
url: uri2.spec,
});
PlacesUtils.tagging.tagURI(uri2, tags);
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
registerCleanupFunction(async () => {

Просмотреть файл

@ -8,7 +8,7 @@ add_task(async function test() {
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Plain Bob",
url: "http://example.com"
url: "http://example.com",
});
registerCleanupFunction(async () => {

Просмотреть файл

@ -43,7 +43,7 @@ add_task(async function setup() {
return PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: `Title ${index}`,
url
url,
});
}));
@ -76,13 +76,13 @@ add_task(async function setup() {
add_task(async function click() {
let promise = waitForLoad(gBrowser.selectedBrowser, TEST_PAGES[0]);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[0], {
button: 0
button: 0,
});
await promise;
promise = waitForNewTab(TEST_PAGES[1], false);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[1], {
button: 0, accelKey: true
button: 0, accelKey: true,
});
await promise;
@ -94,25 +94,25 @@ add_task(async function click() {
add_task(async function middleclick() {
let promise = waitForNewTab(TEST_PAGES[0], true);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[0], {
button: 1, shiftKey: true
button: 1, shiftKey: true,
});
await promise;
promise = waitForNewTab(TEST_PAGES[1], false);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[1], {
button: 1
button: 1,
});
await promise;
});
add_task(async function clickWithPrefSet() {
await SpecialPowers.pushPrefEnv({set: [
[PREF_LOAD_BOOKMARKS_IN_TABS, true]
[PREF_LOAD_BOOKMARKS_IN_TABS, true],
]});
let promise = waitForNewTab(TEST_PAGES[0], false);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[0], {
button: 0
button: 0,
});
await promise;
@ -120,14 +120,14 @@ add_task(async function clickWithPrefSet() {
promise = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[1], {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await promise;
promise = waitForLoad(gBrowser.selectedBrowser, TEST_PAGES[1]);
let open = document.getElementById("placesContext_open");
EventUtils.synthesizeMouseAtCenter(open, {
button: 0
button: 0,
});
await promise;
@ -136,7 +136,7 @@ add_task(async function clickWithPrefSet() {
await BrowserTestUtils.withNewTab({gBrowser}, async (tab) => {
promise = waitForLoad(gBrowser.selectedBrowser, TEST_PAGES[1]);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[1], {
button
button,
});
await promise;
});
@ -149,13 +149,13 @@ add_task(async function clickWithPrefSet() {
// enabled state of the menuitems is updated properly.
add_task(async function quickContextMenu() {
await SpecialPowers.pushPrefEnv({set: [
[PREF_LOAD_BOOKMARKS_IN_TABS, true]
[PREF_LOAD_BOOKMARKS_IN_TABS, true],
]});
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, TEST_PAGES[0]);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[0], {
button: 0
button: 0,
});
let newTab = await tabPromise;
@ -163,7 +163,7 @@ add_task(async function quickContextMenu() {
let promise = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[1], {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await promise;

Просмотреть файл

@ -19,14 +19,14 @@ add_task(async function setup() {
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
title: "bm1",
url: "http://example1.com"
url: "http://example1.com",
}, {
title: "bm2",
url: "http://example2.com"
url: "http://example2.com",
}, {
title: "bm3",
url: "http://example3.com"
}]
url: "http://example3.com",
}],
});
bookmarkIds = await PlacesUtils.promiseManyItemIds([
@ -59,7 +59,7 @@ async function run_drag_test(startBookmarkIndex, insertionIndex) {
this._data.push({
type,
data,
index
index,
});
},
};
@ -87,7 +87,7 @@ async function run_drag_test(startBookmarkIndex, insertionIndex) {
let ip = new PlacesInsertionPoint({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
index: insertionIndex,
orientation: Ci.nsITreeView.DROP_ON
orientation: Ci.nsITreeView.DROP_ON,
});
await PlacesControllerDragHelper.onDrop(ip, dataTransfer);

Просмотреть файл

@ -42,7 +42,7 @@ async function simulateDrop(selectTargets, sourceBm, dropEffect, targetGuid,
this._data.push({
type,
data,
index
index,
});
},
};
@ -73,7 +73,7 @@ async function simulateDrop(selectTargets, sourceBm, dropEffect, targetGuid,
parentId: await PlacesUtils.promiseItemId(targetGuid),
parentGuid: targetGuid,
index: 0,
orientation: Ci.nsITreeView.DROP_ON
orientation: Ci.nsITreeView.DROP_ON,
});
await PlacesControllerDragHelper.onDrop(ip, dataTransfer);
@ -84,7 +84,7 @@ add_task(async function test_move_normal_bm_in_sidebar() {
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Fake",
url: TEST_URL
url: TEST_URL,
});
await simulateDrop([bm.guid], bm, "move", PlacesUtils.bookmarks.unfiledGuid);
@ -96,7 +96,7 @@ add_task(async function test_move_normal_bm_in_sidebar() {
let oldLocationBm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
});
Assert.ok(!oldLocationBm,
@ -134,7 +134,7 @@ add_task(async function test_try_move_bm_within_two_root_folder_queries() {
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "Fake",
url: TEST_URL
url: TEST_URL,
});
let queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
@ -143,8 +143,8 @@ add_task(async function test_try_move_bm_within_two_root_folder_queries() {
guid: PlacesUtils.bookmarks.toolbarGuid,
children: [{
title: "Query",
url: `place:queryType=${queryType}&terms=Fake`
}]
url: `place:queryType=${queryType}&terms=Fake`,
}],
});
await simulateDrop([queries[0].guid, bookmark.guid],

Просмотреть файл

@ -28,12 +28,12 @@ add_task(async function setup() {
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
title: "bm1",
url: "http://example1.com"
url: "http://example1.com",
}, {
title: "bm2",
url: "http://example2.com",
tags: [TAG_NAME]
}]
tags: [TAG_NAME],
}],
});
bookmarkId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
});
@ -59,14 +59,14 @@ async function run_drag_test(startBookmarkIndex, newParentGuid) {
let ip = new PlacesInsertionPoint({
isTag: true,
tagName: TAG_NAME,
orientation: Ci.nsITreeView.DROP_ON
orientation: Ci.nsITreeView.DROP_ON,
});
let bookmarkWithId = JSON.stringify(Object.assign({
id: bookmarkId,
itemGuid: dragBookmark.guid,
parent: PlacesUtils.unfiledBookmarksFolderId,
uri: dragBookmark.url
uri: dragBookmark.url,
}, dragBookmark));
let dt = {
@ -79,7 +79,7 @@ async function run_drag_test(startBookmarkIndex, newParentGuid) {
},
mozGetDataAt(i) {
return bookmarkWithId;
}
},
};
await PlacesControllerDragHelper.onDrop(ip, dt);

Просмотреть файл

@ -23,19 +23,19 @@ add_task(async function() {
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: TEST_URL,
title: "0"
title: "0",
}));
bookmarks.push(await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: TEST_URL,
title: "1"
title: "1",
}));
bookmarks.push(await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: TEST_URL,
title: "2"
title: "2",
}));
await selectBookmarksIn(organizer, bookmarks, "BookmarksToolbar");

Просмотреть файл

@ -33,18 +33,18 @@ add_task(async function test_change_location_from_Toolbar() {
let children = [
{
title: "first",
url: "http://www.mochi.test/first"
url: "http://www.mochi.test/first",
},
{
title: "second",
url: "http://www.mochi.test/second"
url: "http://www.mochi.test/second",
},
{
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
},
{
title: "third",
url: "http://www.mochi.test/third"
url: "http://www.mochi.test/third",
},
];
let guid = PlacesUtils.history.makeGuid();

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function() {
PlacesUtils.bookmarks.removeObserver(this);
resolve({ property, value });
},
QueryInterface: ChromeUtils.generateQI([Ci.nsINavBookmarkObserver])
QueryInterface: ChromeUtils.generateQI([Ci.nsINavBookmarkObserver]),
});
});
}
@ -24,7 +24,7 @@ add_task(async function() {
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
opening: TEST_URL,
waitForStateStop: true
waitForStateStop: true,
});
let library = await promiseLibrary("UnfiledBookmarks");

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function() {
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: TEST_URI.spec,
title: "test.me"
title: "test.me",
});
// Init panel.
@ -66,7 +66,7 @@ add_task(async function() {
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
title: "test.again.me",
url: TEST_URI2.spec
url: TEST_URI2.spec,
});
// Init panel with multiple uris.

Просмотреть файл

@ -6,7 +6,7 @@
const TEST_URIs = [
"http://www.mozilla.org/test1",
"http://www.mozilla.org/test2"
"http://www.mozilla.org/test2",
];
// This test makes sure that the Forget This Site command is hidden for multiple

Просмотреть файл

@ -33,7 +33,7 @@ add_task(async function test_create_and_remove_bookmarks() {
children: [{
title: "deleteme",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
children: bmChildren
children: bmChildren,
}, {
title: "keepme",
type: PlacesUtils.bookmarks.TYPE_FOLDER,

Просмотреть файл

@ -14,16 +14,16 @@ add_task(async function test() {
// Add visits.
await PlacesTestUtils.addVisits([{
uri: "http://mozilla.org",
transition: PlacesUtils.history.TRANSITION_TYPED
transition: PlacesUtils.history.TRANSITION_TYPED,
}, {
uri: "http://google.com",
transition: PlacesUtils.history.TRANSITION_DOWNLOAD
transition: PlacesUtils.history.TRANSITION_DOWNLOAD,
}, {
uri: "http://en.wikipedia.org",
transition: PlacesUtils.history.TRANSITION_TYPED
transition: PlacesUtils.history.TRANSITION_TYPED,
}, {
uri: "http://ubuntu.org",
transition: PlacesUtils.history.TRANSITION_DOWNLOAD
transition: PlacesUtils.history.TRANSITION_DOWNLOAD,
}]);
let library = await promiseLibrary("Downloads");

Просмотреть файл

@ -14,7 +14,7 @@ var gLibrary = null;
add_task(async function test_setup() {
// Temporary disable history, so we won't record pages navigation.
await SpecialPowers.pushPrefEnv({set: [
["places.history.enabled", false]
["places.history.enabled", false],
]});
// Open Library window.
@ -36,7 +36,7 @@ add_task(async function test_open_folder_in_tabs() {
let children = URIs.map(url => {
return {
title: "Title",
url
url,
};
});

Просмотреть файл

@ -18,7 +18,7 @@ add_task(async function test_setup() {
// Temporary disable history, so we won't record pages navigation.
await SpecialPowers.pushPrefEnv({set: [
["places.history.enabled", false]
["places.history.enabled", false],
]});
// Ensure the database is empty.
@ -64,7 +64,7 @@ gTests.push({
async cleanup() {
await PlacesUtils.bookmarks.remove(this._bookmark);
}
},
});
// ------------------------------------------------------------------------------
@ -104,7 +104,7 @@ gTests.push({
async cleanup() {
await PlacesUtils.bookmarks.remove(this._bookmarks[0]);
}
},
});
// ------------------------------------------------------------------------------
@ -161,7 +161,7 @@ gTests.push({
async cleanup() {
await PlacesUtils.bookmarks.remove(this._bookmarks[0]);
await PlacesUtils.bookmarks.remove(this._query);
}
},
});
async function runTest(test) {

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function test_open_bookmark_from_library() {
}, {
url: "https://example3.com",
title: "bm3",
}]
}],
});
let library = await promiseLibrary("UnfiledBookmarks");
@ -43,7 +43,7 @@ add_task(async function test_open_bookmark_from_library() {
let promisePopup = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
synthesizeClickOnSelectedTreeCell(library.ContentTree.view, {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await promisePopup;

Просмотреть файл

@ -77,7 +77,7 @@ add_task(async function test_open_history_query() {
const todayTitle = PlacesUtils.getString("finduri-AgeInDays-is-0");
await PlacesTestUtils.addVisits([{
"uri": "http://example.com",
"title": "Whittingtons"
"title": "Whittingtons",
}]);
library.PlacesOrganizer.selectLeftPaneBuiltIn("History");

Просмотреть файл

@ -158,7 +158,7 @@ async function updateAndCheckItem(newItemData, expectedIndex) {
async function removeAndCheckItem(itemData) {
await PlacesUtils.bookmarks.remove(itemData);
let [node, ] = getNodeForTreeItem(itemData.guid, gLibrary.PlacesOrganizer._places);
let [node ] = getNodeForTreeItem(itemData.guid, gLibrary.PlacesOrganizer._places);
Assert.ok(!node, "Should not be able to find the removed node");
}

Просмотреть файл

@ -37,7 +37,7 @@ add_task(async function test_panelview_bookmarks_delete() {
promise = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
EventUtils.synthesizeMouseAtCenter(listItem, {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await promise;

Просмотреть файл

@ -29,7 +29,7 @@ add_task(async function paste() {
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: TEST_URL,
title: "0"
title: "0",
});
ContentTree.view.selectItems([bookmark.guid]);
@ -67,22 +67,22 @@ add_task(async function paste_check_indexes() {
for (let i = 0; i < 10; i++) {
copyChildren.push({
url: `${TEST_URL}${i}`,
title: `Copy ${i}`
title: `Copy ${i}`,
});
targetChildren.push({
url: `${TEST_URL1}${i}`,
title: `Target ${i}`
title: `Target ${i}`,
});
}
let copyBookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.toolbarGuid,
children: copyChildren
children: copyChildren,
});
let targetBookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: targetChildren
children: targetChildren,
});
ContentTree.view.selectItems([
@ -143,13 +143,13 @@ add_task(async function paste_check_indexes_same_folder() {
for (let i = 0; i < 10; i++) {
copyChildren.push({
url: `${TEST_URL}${i}`,
title: `Copy ${i}`
title: `Copy ${i}`,
});
}
let copyBookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.toolbarGuid,
children: copyChildren
children: copyChildren,
});
ContentTree.view.selectItems([
@ -213,7 +213,7 @@ add_task(async function paste_from_different_instance() {
"dateAdded": 1464866275853000,
"lastModified": 1507638113352000,
"type": "text/x-moz-place",
"uri": TEST_URL1
"uri": TEST_URL1,
};
data = JSON.stringify(data);
@ -257,7 +257,7 @@ add_task(async function paste_separator_from_different_instance() {
"parent": 452,
"dateAdded": 1464866275853000,
"lastModified": 1507638113352000,
"type": PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR
"type": PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR,
};
data = JSON.stringify(data);
@ -293,22 +293,22 @@ add_task(async function paste_copy_check_indexes() {
for (let i = 0; i < 10; i++) {
copyChildren.push({
url: `${TEST_URL}${i}`,
title: `Copy ${i}`
title: `Copy ${i}`,
});
targetChildren.push({
url: `${TEST_URL1}${i}`,
title: `Target ${i}`
title: `Target ${i}`,
});
}
let copyBookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.toolbarGuid,
children: copyChildren
children: copyChildren,
});
let targetBookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: targetChildren
children: targetChildren,
});
ContentTree.view.selectItems([

Просмотреть файл

@ -28,7 +28,7 @@ add_task(async function() {
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
title: "bookmark/" + TEST_URL.spec,
url: TEST_URL
url: TEST_URL,
});
ok(newBookmark, "A bookmark was added");

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function paste() {
}, {
url: TEST_URL1,
title: "1",
}]
}],
});
Assert.equal(ContentTree.view.view.rowCount, 2,

Просмотреть файл

@ -34,7 +34,7 @@ add_task(async function test_remove_bookmark_from_toolbar() {
let toolbarBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Bookmark Title",
url: TEST_URL
url: TEST_URL,
});
let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid);
@ -44,7 +44,7 @@ add_task(async function test_remove_bookmark_from_toolbar() {
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await popupShownPromise;
@ -76,7 +76,7 @@ add_task(async function test_remove_bookmark_from_library() {
// Insert bookmarks.
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children
children,
});
// Open the Library and select the "UnfiledBookmarks".

Просмотреть файл

@ -12,11 +12,11 @@ add_task(async function setup() {
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
title: "bm1",
url: "about:buildconfig"
url: "about:buildconfig",
}, {
title: "bm2",
url: "about:mozilla",
}]
}],
});
registerCleanupFunction(async () => {
@ -69,7 +69,7 @@ add_task(async function test_open_bookmark_from_sidebar_keypress() {
add_task(async function test_open_bookmark_in_tab_from_sidebar() {
await SpecialPowers.pushPrefEnv({set: [
[PREF_LOAD_BOOKMARKS_IN_TABS, true]
[PREF_LOAD_BOOKMARKS_IN_TABS, true],
]});
await BrowserTestUtils.withNewTab({gBrowser}, async (initialTab) => {

Просмотреть файл

@ -49,7 +49,7 @@ add_task(async function test_sidebarpanels_click() {
},
sidebarName: BOOKMARKS_SIDEBAR_ID,
treeName: BOOKMARKS_SIDEBAR_TREE_ID,
desc: "Bookmarks sidebar test"
desc: "Bookmarks sidebar test",
});
tests.push({
@ -58,7 +58,7 @@ add_task(async function test_sidebarpanels_click() {
let uri = Services.io.newURI(TEST_URL);
await PlacesTestUtils.addVisits({
uri, visitDate: Date.now() * 1000,
transition: PlacesUtils.history.TRANSITION_TYPED
transition: PlacesUtils.history.TRANSITION_TYPED,
});
},
prepare() {
@ -74,7 +74,7 @@ add_task(async function test_sidebarpanels_click() {
},
sidebarName: HISTORY_SIDEBAR_ID,
treeName: HISTORY_SIDEBAR_TREE_ID,
desc: "History sidebar test"
desc: "History sidebar test",
});
for (let test of tests) {

Просмотреть файл

@ -58,18 +58,18 @@ add_task(async function test_setup() {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
url: "http://example.com/",
title: "Test1"
title: "Test1",
});
let folder = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: "TEST_TITLE",
index: 0
index: 0,
});
await PlacesUtils.bookmarks.insert({
parentGuid: folder.guid,
url: "http://example.com/",
title: "Test1"
title: "Test1",
});
registerCleanupFunction(async function() {

Просмотреть файл

@ -71,7 +71,7 @@ add_task(async function test() {
const urls = [
"http://www.mozilla.org/C54263C6-A484-46CF-8E2B-FE131586348A",
"http://www.mozilla.org/71381257-61E6-4376-AF7C-BF3C5FD8870D",
"http://www.mozilla.org/091A88BD-5743-4C16-A005-3D2EA3A3B71E"
"http://www.mozilla.org/091A88BD-5743-4C16-A005-3D2EA3A3B71E",
];
let data;
if (aMimeType == "text/x-moz-url")

Просмотреть файл

@ -10,7 +10,7 @@
const BASE_URL = "http://example.org/browser/browser/components/places/tests/browser/";
const bookmarkItems = [{
url: `${BASE_URL}bookmark_dummy_1.html`,
title: "Custom Title 1"
title: "Custom Title 1",
}, {
url: `${BASE_URL}bookmark_dummy_2.html`,
title: "Custom Title 2",
@ -41,7 +41,7 @@ async function openBookmarkedItemInNewTab(itemFromMenu) {
let openContextMenuPromise = BrowserTestUtils.waitForEvent(placesContext, "popupshown");
EventUtils.synthesizeMouseAtCenter(itemFromMenu, {
button: 2,
type: "contextmenu"
type: "contextmenu",
});
await openContextMenuPromise;
info("Opened context menu");
@ -50,7 +50,7 @@ async function openBookmarkedItemInNewTab(itemFromMenu) {
let openInNewTabOption = document.getElementById("placesContext_open:newtab");
EventUtils.synthesizeMouseAtCenter(openInNewTabOption, {
button: 0
button: 0,
});
info("Click open in new tab");

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async function setup() {
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.toolbarGuid,
children: Array(BOOKMARKS_COUNT).fill("")
.map((_, i) => ({ url: `http://test.places.${i}/`}))
.map((_, i) => ({ url: `http://test.places.${i}/`})),
});
// Uncollapse the personal toolbar if needed.
@ -74,7 +74,7 @@ add_task(async function test_separator_first() {
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
index: 0
index: 0,
});
// Hide and show the toolbar to cause a rebuild.
let promiseReady = BrowserTestUtils.waitForEvent(gToolbar, "BookmarksToolbarVisibilityUpdated");
@ -99,7 +99,7 @@ add_task(async function test_newWindow_noOverflow() {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: "http://toolbar.overflow/",
title: "Example"
title: "Example",
});
// Add a favicon for the bookmark.
let favicon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAA" +
@ -135,7 +135,7 @@ async function test_index(desc, index, expected) {
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: "http://test.places.added/",
index
index,
});
Assert.equal(bm.index, index, "Sanity check the bookmark index");
await promiseUpdateVisibility;
@ -186,7 +186,7 @@ async function test_move_index(desc, fromIndex, toIndex, original, expected) {
: Promise.resolve();
await PlacesUtils.bookmarks.update({
guid: movedGuid,
index: toIndex
index: toIndex,
});
await promiseUpdateVisibility;
@ -216,7 +216,7 @@ async function test_move_index(desc, fromIndex, toIndex, original, expected) {
: Promise.resolve();
await PlacesUtils.bookmarks.update({
guid: movedGuid,
index: fromIndex
index: fromIndex,
});
await promiseUpdateVisibility;
@ -243,12 +243,12 @@ add_task(async function test_separator_first() {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
index: 0
index: 0,
});
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
index: 0
index: 0,
});
// Hide and show the toolbar to cause a rebuild.
let promiseReady = BrowserTestUtils.waitForEvent(gToolbar, "BookmarksToolbarVisibilityUpdated");

Просмотреть файл

@ -36,7 +36,7 @@ add_task(async function() {
let bm = await PlacesUtils.bookmarks.insert({
url: PAGE_URI,
title: "test icon",
parentGuid: PlacesUtils.bookmarks.toolbarGuid
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
});
registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.remove(bm);
@ -117,6 +117,6 @@ async function getRectForSidebarItem(guid) {
left: treerect.left + cellrect.left + sidebar.getBoundingClientRect().left,
top: treerect.top + cellrect.top + sidebar.getBoundingClientRect().top,
width: cellrect.width,
height: cellrect.height
height: cellrect.height,
};
}

Просмотреть файл

@ -193,7 +193,7 @@ var bookmarksObserver = {
async assertItemRemoved(views, guid) {
for (let i = 0; i < views.length; i++) {
let [node, ] = searchItemInView(guid, views[i]);
let [node ] = searchItemInView(guid, views[i]);
Assert.equal(node, null, "Should not have found the node");
}
},
@ -230,7 +230,7 @@ var bookmarksObserver = {
Assert.equal(node.title, newValue, "Node should have the correct new title");
Assert.ok(valid, "Node element should have the correct label");
}
}
},
};
/**

Просмотреть файл

@ -45,7 +45,7 @@ add_task(async function test_main() {
// Check that JSON backup has been restored.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
});
Assert.equal(bm.title, "examplejson");
});

Просмотреть файл

@ -39,7 +39,7 @@ add_task(async function() {
// Check that bookmarks html has been restored.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
});
Assert.equal(bm.title, "example");
});

Просмотреть файл

@ -39,7 +39,7 @@ add_task(async function() {
// Check that default bookmarks have been restored.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
});
// Bug 1283076: Nightly bookmark points to Get Involved page, not Getting Started one

Просмотреть файл

@ -61,13 +61,13 @@ add_task(async function() {
// Check the custom bookmarks exist on menu.
let menuItem = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0
index: 0,
});
Assert.equal(menuItem.title, "Menu Link Before");
menuItem = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 1 + DEFAULT_BOOKMARKS_ON_MENU
index: 1 + DEFAULT_BOOKMARKS_ON_MENU,
});
Assert.equal(menuItem.title, "Menu Link After");
@ -77,14 +77,14 @@ add_task(async function() {
}, "Favicon not found", 10), /Favicon\snot\sfound/, "Favicon not found");
let keywordItem = await PlacesUtils.keywords.fetch({
url: menuItem.url.href
url: menuItem.url.href,
});
Assert.strictEqual(keywordItem, null);
// Check the custom bookmarks exist on toolbar.
let toolbarItem = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
});
Assert.equal(toolbarItem.title, "Toolbar Link Before");
@ -101,14 +101,14 @@ add_task(async function() {
Assert.equal(base64Icon, SMALLPNG_DATA_URI.spec);
keywordItem = await PlacesUtils.keywords.fetch({
url: toolbarItem.url.href
url: toolbarItem.url.href,
});
Assert.notStrictEqual(keywordItem, null);
Assert.equal(keywordItem.keyword, "e:t:b");
toolbarItem = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 1 + DEFAULT_BOOKMARKS_ON_TOOLBAR
index: 1 + DEFAULT_BOOKMARKS_ON_TOOLBAR,
});
Assert.equal(toolbarItem.title, "Toolbar Link After");

Просмотреть файл

@ -35,7 +35,7 @@ add_task(async function test_migrate_bookmarks() {
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: "http://mozilla.org/",
title: "migrated"
title: "migrated",
});
let promise = promiseTopicObserved("places-browser-init-complete");
@ -45,18 +45,18 @@ add_task(async function test_migrate_bookmarks() {
// Check the created bookmark still exists.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0
index: 0,
});
Assert.equal(bm.title, "migrated");
// Check that we have not imported any new bookmark.
Assert.ok(!(await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 1
index: 1,
})));
Assert.ok(!(await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
})));
});

Просмотреть файл

@ -65,7 +65,7 @@ add_task(async function test_import() {
// Sanity check: we should not have any bookmark on the toolbar.
Assert.ok(!(await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
})));
// Set preferences.
@ -76,7 +76,7 @@ add_task(async function test_import() {
// Check bookmarks.html has been imported.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
});
Assert.equal(bm.title, "example");
@ -93,7 +93,7 @@ add_task(async function test_restore() {
// Sanity check: we should not have any bookmark on the toolbar.
Assert.ok(!(await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
})));
// Set preferences.
@ -104,7 +104,7 @@ add_task(async function test_restore() {
// Check bookmarks.html has been restored.
Assert.ok(await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
}));
// Check preferences have been reverted.
@ -120,7 +120,7 @@ add_task(async function test_restore_import() {
// Sanity check: we should not have any bookmark on the toolbar.
Assert.ok(!(await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
})));
// Set preferences.
@ -132,7 +132,7 @@ add_task(async function test_restore_import() {
// Check bookmarks.html has been restored.
Assert.ok(await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
}));
// Check preferences have been reverted.

Просмотреть файл

@ -48,7 +48,7 @@ add_task(async function test_main() {
// Check that JSON backup has been restored.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
index: 0,
});
Assert.equal(bm.title, "examplejson");
});

Просмотреть файл

@ -12,7 +12,7 @@ const URIS = [
"http://a.example1.com/",
"http://b.example1.com/",
"http://b.example2.com/",
"http://c.example3.com/"
"http://c.example3.com/",
];
const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
@ -20,11 +20,11 @@ const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
var EXPECTED_NOTIFICATIONS = [
"places-shutdown",
"places-expiration-finished",
"places-connection-closed"
"places-connection-closed",
];
const UNEXPECTED_NOTIFICATIONS = [
"xpcom-shutdown"
"xpcom-shutdown",
];
const FTP_URL = "ftp://localhost/clearHistoryOnShutdown/";
@ -66,7 +66,7 @@ add_task(async function test_execute() {
for (let aUrl of URIS) {
await PlacesTestUtils.addVisits({
uri: uri(aUrl), visitDate: timeInMicroseconds++,
transition: PlacesUtils.history.TRANSITION_TYPED
transition: PlacesUtils.history.TRANSITION_TYPED,
});
}
info("Add cache.");
@ -107,7 +107,7 @@ function addFormHistory() {
value: "test",
timesUsed: 1,
firstUsed: now,
lastUsed: now
lastUsed: now,
},
{ handleCompletion(reason) { resolve(); } });
});
@ -118,7 +118,7 @@ function getFormHistoryCount() {
let count = -1;
FormHistory.count({ fieldname: "testfield" },
{ handleResult(result) { count = result; },
handleCompletion(reason) { resolve(count); }
handleCompletion(reason) { resolve(count); },
});
});
}
@ -148,7 +148,7 @@ function storeCache(aURL, aContent) {
os.close();
entry.close();
resolve();
}
},
};
storage.asyncOpenURI(Services.io.newURI(aURL), "",
@ -167,7 +167,7 @@ function checkCache(aURL) {
onCacheEntryAvailable(entry, isnew, appcache, status) {
Assert.equal(status, Cr.NS_ERROR_CACHE_KEY_NOT_FOUND);
resolve();
}
},
};
storage.asyncOpenURI(Services.io.newURI(aURL), "",

Просмотреть файл

@ -50,8 +50,6 @@ body {
@media only screen and (max-width: 480px) {
.button-container button {
/* Force buttons to display: block here to try and enforce collapsing margins */
display: block;
width: 100%;
margin: 0.66em 0 0;
}

Просмотреть файл

@ -905,7 +905,7 @@ ifdef MOZ_USING_SCCACHE
sccache_wrap := RUSTC_WRAPPER='$(CCACHE)'
endif
ifneq (WINNT,$(OS_ARCH))
ifneq (WINNT,$(HOST_OS_ARCH))
ifndef MOZ_ASAN
ifndef MOZ_TSAN
ifndef MOZ_CODE_COVERAGE

Просмотреть файл

@ -447,11 +447,13 @@ DevTools.prototype = {
* @param {Number} startTime
* Optional, indicates the time at which the user event related to this toolbox
* opening started. This is a `Cu.now()` timing.
* @param {string} reason
* Reason the tool was opened
*
* @return {Toolbox} toolbox
* The toolbox that was opened
*/
async showToolbox(target, toolId, hostType, hostOptions, startTime) {
async showToolbox(target, toolId, hostType, hostOptions, startTime, reason = "toolbox_show") {
let toolbox = this._toolboxes.get(target);
if (toolbox) {
@ -460,7 +462,7 @@ DevTools.prototype = {
}
if (toolId != null && toolbox.currentToolId != toolId) {
await toolbox.selectTool(toolId, "toolbox_show");
await toolbox.selectTool(toolId, reason);
}
toolbox.raise();
@ -692,7 +694,8 @@ DevTools.prototype = {
async inspectNode(tab, nodeSelectors, startTime) {
const target = TargetFactory.forTab(tab);
const toolbox = await gDevTools.showToolbox(target, "inspector", null, null, startTime);
const toolbox = await gDevTools.showToolbox(target, "inspector", null, null,
startTime, "inspect_dom");
const inspector = toolbox.getCurrentPanel();
// If the toolbox has been switched into a nested frame, we should first remove

Просмотреть файл

@ -112,7 +112,7 @@ exports.getHighlighterUtils = function(toolbox) {
isPicking = true;
toolbox.pickerButton.isChecked = true;
await toolbox.selectTool("inspector");
await toolbox.selectTool("inspector", "inspect_dom");
toolbox.on("select", cancelPicker);
if (isRemoteHighlightable()) {

Просмотреть файл

@ -2763,7 +2763,7 @@ Toolbox.prototype = {
const nodeFound = await inspector.inspectNodeActor(objectActor.actor,
inspectFromAnnotation);
if (nodeFound) {
await this.selectTool("inspector", "inspect_dom");
await this.selectTool("inspector");
}
} else if (objectActor.type !== "null" &&
objectActor.type !== "undefined") {
@ -3385,6 +3385,15 @@ Toolbox.prototype = {
return extInfo && Services.prefs.getBoolPref(extInfo.pref, false);
},
/**
* Returns a panel id in the case of built in panels or "other" in the case of
* third party panels. This is necessary due to limitations in addon id strings,
* the permitted length of event telemetry property values and what we actually
* want to see in our telemetry.
*
* @param {String} id
* The panel id we would like to process.
*/
getTelemetryPanelNameOrOther: function(id) {
if (!this._toolNames) {
const definitions = gDevTools.getToolDefinitionArray();
@ -3392,9 +3401,11 @@ Toolbox.prototype = {
this._toolNames = new Set(definitionIds);
}
if (!this._toolNames.has(id)) {
return "other";
}
return id;
},
};

Просмотреть файл

@ -8,8 +8,59 @@
const TEST_URI = "data:text/html;charset=UTF-8," +
"<p>Switch to inspector on pick</p>";
const OPTOUT = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
const DATA = [
{
timestamp: 3562,
category: "devtools.main",
method: "enter",
object: "webconsole",
extra: {
host: "bottom",
start_state: "initial_panel",
panel_name: "webconsole",
cold: "true",
message_count: "0",
width: "1300"
}
},
{
timestamp: 3671,
category: "devtools.main",
method: "exit",
object: "webconsole",
extra: {
host: "bottom",
width: "1300",
panel_name: "webconsole",
next_panel: "inspector",
reason: "inspect_dom"
}
},
{
timestamp: 3671,
category: "devtools.main",
method: "enter",
object: "inspector",
extra: {
host: "bottom",
start_state: "inspect_dom",
panel_name: "inspector",
cold: "true",
width: "1300"
}
}
];
add_task(async function() {
// Let's reset the counts.
Services.telemetry.clearEvents();
// Ensure no events have been logged
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
ok(!snapshot.parent, "No events have been logged for the main process");
const tab = await addTab(TEST_URI);
const toolbox = await openToolbox(tab);
@ -17,6 +68,8 @@ add_task(async function() {
info("Stoppping element picker.");
await toolbox.highlighterUtils.stopPicker();
checkResults();
});
function openToolbox(tab) {
@ -34,3 +87,38 @@ async function startPickerAndAssertSwitchToInspector(toolbox) {
await toolbox.once("inspector-selected");
is(toolbox.currentToolId, "inspector", "Switched to the inspector");
}
function checkResults() {
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
const events = snapshot.parent.filter(event => event[1] === "devtools.main" &&
event[2] === "enter" ||
event[2] === "exit"
);
for (const i in DATA) {
const [ timestamp, category, method, object, value, extra ] = events[i];
const expected = DATA[i];
// ignore timestamp
ok(timestamp > 0, "timestamp is greater than 0");
is(category, expected.category, "category is correct");
is(method, expected.method, "method is correct");
is(object, expected.object, "object is correct");
is(value, null, "value is correct");
ok(extra.width > 0, "width is greater than 0");
checkExtra("host", extra, expected);
checkExtra("start_state", extra, expected);
checkExtra("reason", extra, expected);
checkExtra("panel_name", extra, expected);
checkExtra("next_panel", extra, expected);
checkExtra("message_count", extra, expected);
checkExtra("cold", extra, expected);
}
}
function checkExtra(propName, extra, expected) {
if (extra[propName]) {
is(extra[propName], expected.extra[propName], `${propName} is correct`);
}
}

Просмотреть файл

@ -332,7 +332,11 @@ ToolSidebar.prototype = {
return;
}
currentToolId = this.getTelemetryPanelNameOrOther(currentToolId);
if (previousToolId) {
previousToolId = this.getTelemetryPanelNameOrOther(previousToolId);
this._telemetry.toolClosed(previousToolId);
this._telemetry.recordEvent("devtools.main", "sidepanel_changed", "inspector", null,
@ -346,6 +350,33 @@ ToolSidebar.prototype = {
this._telemetry.toolOpened(currentToolId);
},
/**
* Returns a panel id in the case of built in panels or "other" in the case of
* third party panels. This is necessary due to limitations in addon id strings,
* the permitted length of event telemetry property values and what we actually
* want to see in our telemetry.
*
* @param {String} id
* The panel id we would like to process.
*/
getTelemetryPanelNameOrOther: function(id) {
if (!this._toolNames) {
// Get all built in tool ids. We identify third party tool ids by checking
// for a "-", which shows it originates from an addon.
const ids = this._tabbar.state.tabs.map(({ id: toolId }) => {
return toolId.includes("-") ? "other" : toolId;
});
this._toolNames = new Set(ids);
}
if (!this._toolNames.has(id)) {
return "other";
}
return id;
},
/**
* Show the sidebar.
*

Просмотреть файл

@ -65,13 +65,8 @@ pref("devtools.inspector.shapesHighlighter.enabled", true);
pref("devtools.flexboxinspector.enabled", false);
// Enable the new Animation Inspector
pref("devtools.new-animationinspector.enabled", true);
// Enable the Variable Fonts editor only in Nightly
#if defined(NIGHTLY_BUILD)
// Enable the Font Editor
pref("devtools.inspector.fonteditor.enabled", true);
#else
pref("devtools.inspector.fonteditor.enabled", false);
#endif
// Enable the font highlight-on-hover feature
pref("devtools.inspector.fonthighlighter.enabled", false);

Просмотреть файл

@ -230,7 +230,7 @@ WebConsoleOutputWrapper.prototype = {
: null;
},
openNodeInInspector: async (grip) => {
const onSelectInspector = this.toolbox.selectTool("inspector");
const onSelectInspector = this.toolbox.selectTool("inspector", "inspect_dom");
const onGripNodeToFront = this.toolbox.highlighterUtils.gripToNodeFront(grip);
const [
front,

Просмотреть файл

@ -27,6 +27,7 @@
#include "nsError.h"
#include "nsNetUtil.h"
#include "xpcpublic.h"
#include "nsReadableUtils.h"
namespace mozilla {
namespace dom {
@ -265,13 +266,8 @@ void
PopulateBufferForBinaryString(char16_t* aDest, const char* aSource,
uint32_t aCount)
{
const unsigned char* source = (const unsigned char*)aSource;
char16_t* end = aDest + aCount;
while (aDest != end) {
*aDest = *source;
++aDest;
++source;
}
// Zero-extend each char to char16_t.
ConvertLatin1toUTF16(MakeSpan(aSource, aCount), MakeSpan(aDest, aCount));
}
nsresult

Просмотреть файл

@ -46,23 +46,56 @@ NS_IMPL_RELEASE_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper,
mControllerWorker, mReadyPromise)
namespace {
bool
IsInPrivateBrowsing(JSContext* const aCx)
{
if (const nsCOMPtr<nsIGlobalObject> global = xpc::CurrentNativeGlobal(aCx)) {
if (const nsCOMPtr<nsIPrincipal> principal = global->PrincipalOrNull()) {
return principal->GetPrivateBrowsingId() > 0;
}
}
return false;
}
bool
IsServiceWorkersTestingEnabledInWindow(JSObject* const aGlobal)
{
if (const nsCOMPtr<nsPIDOMWindowInner> innerWindow = Navigator::GetWindowFromGlobal(aGlobal)) {
if (const nsCOMPtr<nsPIDOMWindowOuter> outerWindow = innerWindow->GetOuterWindow()) {
return outerWindow->GetServiceWorkersTestingEnabled();
}
}
return false;
}
}
/* static */ bool
ServiceWorkerContainer::IsEnabled(JSContext* aCx, JSObject* aGlobal)
{
MOZ_ASSERT(NS_IsMainThread());
JS::Rooted<JSObject*> global(aCx, aGlobal);
nsCOMPtr<nsPIDOMWindowInner> window = Navigator::GetWindowFromGlobal(global);
if (!window) {
if (!DOMPrefs::ServiceWorkersEnabled()) {
return false;
}
nsIDocument* doc = window->GetExtantDoc();
if (!doc || nsContentUtils::IsInPrivateBrowsing(doc)) {
if (IsInPrivateBrowsing(aCx)) {
return false;
}
return DOMPrefs::ServiceWorkersEnabled();
if (IsSecureContextOrObjectIsFromSecureContext(aCx, aGlobal)) {
return true;
}
const bool isTestingEnabledInWindow = IsServiceWorkersTestingEnabledInWindow(aGlobal);
const bool isTestingEnabledByPref = DOMPrefs::ServiceWorkersTestingEnabled();
const bool isTestingEnabled = isTestingEnabledByPref || isTestingEnabledInWindow;
return isTestingEnabled;
}
// static
@ -154,39 +187,6 @@ GetBaseURIFromGlobal(nsIGlobalObject* aGlobal, ErrorResult& aRv)
return baseURI.forget();
}
// This function implements parts of the step 3 of the following algorithm:
// https://w3c.github.io/webappsec/specs/powerfulfeatures/#settings-secure
static bool
IsFromAuthenticatedOrigin(nsIDocument* aDoc)
{
MOZ_ASSERT(aDoc);
nsCOMPtr<nsIDocument> doc(aDoc);
nsCOMPtr<nsIContentSecurityManager> csm = do_GetService(NS_CONTENTSECURITYMANAGER_CONTRACTID);
if (NS_WARN_IF(!csm)) {
return false;
}
while (doc && !nsContentUtils::IsChromeDoc(doc)) {
bool trustworthyOrigin = false;
// The origin of the document may be different from the document URI
// itself. Check the principal, not the document URI itself.
nsCOMPtr<nsIPrincipal> documentPrincipal = doc->NodePrincipal();
// The check for IsChromeDoc() above should mean we never see a system
// principal inside the loop.
MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(documentPrincipal));
csm->IsOriginPotentiallyTrustworthy(documentPrincipal, &trustworthyOrigin);
if (!trustworthyOrigin) {
return false;
}
doc = doc->GetParentDocument();
}
return true;
}
} // anonymous namespace
already_AddRefed<Promise>
@ -285,27 +285,6 @@ ServiceWorkerContainer::Register(const nsAString& aScriptURL,
return nullptr;
}
// Next, implement a lame version of [SecureContext] with an
// exception based on a pref or devtools option.
// TODO: This logic should be moved to a webidl [Func]. See bug 1455078.
nsCOMPtr<nsPIDOMWindowOuter> outerWindow = window->GetOuterWindow();
bool serviceWorkersTestingEnabled =
outerWindow->GetServiceWorkersTestingEnabled();
bool authenticatedOrigin;
if (DOMPrefs::ServiceWorkersTestingEnabled() ||
serviceWorkersTestingEnabled) {
authenticatedOrigin = true;
} else {
authenticatedOrigin = IsFromAuthenticatedOrigin(doc);
}
if (!authenticatedOrigin) {
NS_WARNING("ServiceWorker registration from insecure websites is not allowed.");
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
// The next section of code executes an NS_CheckContentLoadPolicy()
// check. This is necessary to enforce the CSP of the calling client.
// Currently this requires an nsIDocument. Once bug 965637 lands we

Просмотреть файл

@ -9,13 +9,6 @@ function done() {
}
ok(location.protocol == "https:", "We should be loaded from HTTPS");
navigator.serviceWorker.register("empty.js", {scope: "register-https"})
.then(reg => {
ok(false, "Registration should fail");
done();
}).catch(err => {
ok(err.name === "SecurityError", "Registration should fail with SecurityError");
done();
});
ok(!("serviceWorker" in navigator), "ServiceWorkerContainer not availalble in insecure context");
done();
</script>

Просмотреть файл

@ -46,7 +46,7 @@
}).then(function(w) {
ok(false, "non-HTTPS pages cannot register ServiceWorkers");
}, function(e) {
ok(e.name === "SecurityError", "Should fail with a SecurityError");
ok(e.name === "TypeError", "navigator.serviceWorker should be undefined");
}).then(function() {
return SpecialPowers.popPrefEnv();
});
@ -176,10 +176,10 @@
function runTest() {
simpleRegister()
.then(readyPromise)
.then(sameOriginWorker)
.then(sameOriginScope)
.then(httpsOnly)
.then(readyPromise)
.then(realWorker)
.then(networkError404)
.then(redirectError)

Просмотреть файл

@ -28,7 +28,8 @@
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true]
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]
]}, function() {
checkEnabled();
SimpleTest.finish();

Просмотреть файл

@ -45,7 +45,7 @@ var wP;
function testPrivateWindow() {
testOnWindow(true, function(aWin) {
wP = aWin;
ok(!("serviceWorker" in wP.content.navigator), "ServiceWorkers are not available for private windows");
ok(!wP.content.eval('"serviceWorker" in navigator'), "ServiceWorkers are not available for private windows");
runTest();
});
}

Просмотреть файл

@ -18,14 +18,8 @@
<script class="testbody" type="text/javascript">
function runTest() {
navigator.serviceWorker.register("http://mochi.test:8888/tests/dom/serviceworkers/test/empty.js")
.then(reg => {
ok(false, "Register should fail");
SimpleTest.finish();
}, err => {
is(err.name, "SecurityError", "Registration should fail with SecurityError");
SimpleTest.finish();
});
ok(!("serviceWorker" in navigator), "ServiceWorkerContainer shouldn't be defined");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();

Просмотреть файл

@ -864,7 +864,7 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "ServiceWorker", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "ServiceWorkerContainer", insecureContext: true},
{name: "ServiceWorkerContainer", insecureContext: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "ServiceWorkerRegistration", insecureContext: true},
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -1,3 +1,21 @@
Overview of changes leading to 1.8.8
Tuesday, August 14, 2018
====================================
- Fix hb-icu crash on architectures where compare_exchange_weak() can
fail falsely. This bug was introduced in 1.8.4.
https://bugs.chromium.org/p/chromium/issues/detail?id=873568
- More internal refactoring of atomic operations and singletons.
- API changes:
The following functions do NOT reference their return value before
returning:
* hb_unicode_funcs_get_default()
* hb_glib_get_unicode_funcs()
* hb_icu_get_unicode_funcs()
This is consistent with their naming ("get", instead of "reference")
as well as how they are used in the wild (ie. no one calls destroy()
on their return value.)
Overview of changes leading to 1.8.7
Wednesday, August 8, 2018
====================================

Просмотреть файл

@ -1,7 +1,7 @@
This directory contains the HarfBuzz source from the upstream repo:
https://github.com/harfbuzz/harfbuzz
Current version: 1.8.7 [commit b6fdcf4f8bd09e065c767939125861c9dc8ff18f]
Current version: 1.8.8 [commit 63be5dcdde61275822d931b2924425478bc1dac1]
UPDATING:

Просмотреть файл

@ -1,6 +1,6 @@
AC_PREREQ([2.64])
AC_INIT([HarfBuzz],
[1.8.7],
[1.8.8],
[https://github.com/harfbuzz/harfbuzz/issues/new],
[harfbuzz],
[http://harfbuzz.org/])

Просмотреть файл

@ -35,7 +35,10 @@
#include "hb-private.hh"
/* atomic_int */
/*
* Atomic integers and pointers.
*/
/* We need external help for these */
@ -43,18 +46,19 @@
&& defined(hb_atomic_ptr_impl_get) \
&& defined(hb_atomic_ptr_impl_cmpexch)
/* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */
/* Defined externally, i.e. in config.h. */
#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME)
/* C++11-style GCC primitives. */
typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add ((AI), (V), __ATOMIC_ACQ_REL)
#define hb_atomic_int_impl_set_relaxed(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELAXED)
#define hb_atomic_int_impl_get_relaxed(AI) __atomic_load_n ((AI), __ATOMIC_RELAXED)
#define hb_atomic_ptr_impl_set_relaxed(P, V) __atomic_store_n ((P), (V), __ATOMIC_RELAXED)
#define hb_atomic_ptr_impl_get_relaxed(P) __atomic_load_n ((P), __ATOMIC_RELAXED)
#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_CONSUME)
static inline bool
_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
@ -70,11 +74,12 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
#include <atomic>
typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (AI)->fetch_add ((V), std::memory_order_acq_rel))
#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast<std::atomic<int> *> (AI)->store ((V), std::memory_order_relaxed))
#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast<std::atomic<int> *> (AI)->load (std::memory_order_relaxed))
#define hb_atomic_ptr_impl_set_relaxed(P, V) (reinterpret_cast<std::atomic<void*> *> (P)->store ((V), std::memory_order_relaxed))
#define hb_atomic_ptr_impl_get_relaxed(P) (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_relaxed))
#define hb_atomic_ptr_impl_get(P) (reinterpret_cast<std::atomic<void*> *> (P)->load (std::memory_order_consume))
static inline bool
_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
@ -101,8 +106,7 @@ static inline void _hb_memory_barrier (void)
}
#define _hb_memory_barrier() _hb_memory_barrier ()
typedef LONG hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((AI), (V))
#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((unsigned *) (AI), (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
@ -111,7 +115,6 @@ typedef LONG hb_atomic_int_impl_t;
#define _hb_memory_barrier() __sync_synchronize ()
typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) __sync_fetch_and_add ((AI), (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
@ -126,12 +129,10 @@ typedef int hb_atomic_int_impl_t;
#define _hb_memory_w_barrier() __machine_w_barrier ()
#define _hb_memory_barrier() __machine_rw_barrier ()
typedef unsigned int hb_atomic_int_impl_t;
static inline int _hb_fetch_and_add (hb_atomic_int_impl_t *AI, int V)
static inline int _hb_fetch_and_add (int *AI, int V)
{
_hb_memory_w_barrier ();
int result = atomic_add_int_nv (AI, V);
int result = atomic_add_int_nv ((uint_t *) AI, V);
_hb_memory_r_barrier ();
return result;
}
@ -159,7 +160,6 @@ static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, cons
#define _hb_memory_barrier() OSMemoryBarrier ()
typedef int32_t hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) (OSAtomicAdd32Barrier ((V), (AI)) - (V))
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100)
@ -179,9 +179,7 @@ typedef int32_t hb_atomic_int_impl_t;
#define _hb_memory_barrier() __lwsync ()
typedef int hb_atomic_int_impl_t;
static inline int _hb_fetch_and_add (hb_atomic_int_impl_t *AI, int V)
static inline int _hb_fetch_and_add (int *AI, int V)
{
_hb_memory_barrier ();
int result = __fetch_and_add (AI, V);
@ -208,15 +206,13 @@ static_assert ((sizeof (long) == sizeof (void *)), "");
#define _hb_memory_barrier()
typedef volatile int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), true) : false)
#else /* HB_NO_MT */
typedef int hb_atomic_int_impl_t;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
#define _hb_memory_barrier()
@ -233,33 +229,53 @@ typedef int hb_atomic_int_impl_t;
#ifndef _hb_memory_w_barrier
#define _hb_memory_w_barrier() _hb_memory_barrier ()
#endif
#ifndef HB_ATOMIC_INT_INIT
#define HB_ATOMIC_INT_INIT(V) {V}
#endif
#ifndef hb_atomic_int_impl_set_relaxed
#define hb_atomic_int_impl_set_relaxed(AI, V) (*(AI) = (V))
#endif
#ifndef hb_atomic_int_impl_get_relaxed
#define hb_atomic_int_impl_get_relaxed(AI) (*(AI))
#endif
#ifndef hb_atomic_ptr_impl_set_relaxed
#define hb_atomic_ptr_impl_set_relaxed(P, V) (*(P) = (V))
#endif
#ifndef hb_atomic_ptr_impl_get_relaxed
#define hb_atomic_ptr_impl_get_relaxed(P) (*(P))
#endif
#ifndef hb_atomic_ptr_impl_get
inline void *hb_atomic_ptr_impl_get (void **P) { void *v = *P; _hb_memory_r_barrier (); return v; }
#endif
#define HB_ATOMIC_INT_INIT(V) {V}
struct hb_atomic_int_t
{
mutable hb_atomic_int_impl_t v;
inline void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); }
inline void set_relaxed (int v_) const { hb_atomic_int_impl_set_relaxed (&v, v_); }
inline int get_relaxed (void) const { return hb_atomic_int_impl_get_relaxed (&v); }
inline int inc (void) { return hb_atomic_int_impl_add (&v, 1); }
inline int dec (void) { return hb_atomic_int_impl_add (&v, -1); }
mutable int v;
};
#define hb_atomic_ptr_get(P) hb_atomic_ptr_impl_get((void **) P)
#define hb_atomic_ptr_cmpexch(P,O,N) hb_atomic_ptr_impl_cmpexch((P),(O),(N))
template <typename T> struct hb_remove_ptr_t { typedef T value; };
template <typename T> struct hb_remove_ptr_t<T *> { typedef T value; };
#define HB_ATOMIC_PTR_INIT(V) {V}
template <typename P>
struct hb_atomic_ptr_t
{
typedef typename hb_remove_ptr_t<P>::value T;
inline void init (T* v_ = nullptr) { set_relaxed (v_); }
inline void set_relaxed (T* v_) const { hb_atomic_ptr_impl_set_relaxed (&v, v_); }
inline T *get_relaxed (void) const { return hb_atomic_ptr_impl_get_relaxed (&v); }
inline T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
inline bool cmpexch (const T *old, T *new_) const{ return hb_atomic_ptr_impl_cmpexch (&v, old, new_); }
mutable T *v;
};
#endif /* HB_ATOMIC_PRIVATE_HH */

Просмотреть файл

@ -216,7 +216,7 @@ hb_buffer_t::reset (void)
return;
hb_unicode_funcs_destroy (unicode);
unicode = hb_unicode_funcs_get_default ();
unicode = hb_unicode_funcs_reference (hb_unicode_funcs_get_default ());
flags = HB_BUFFER_FLAG_DEFAULT;
replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
@ -908,7 +908,6 @@ hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
if (!unicode_funcs)
unicode_funcs = hb_unicode_funcs_get_default ();
hb_unicode_funcs_reference (unicode_funcs);
hb_unicode_funcs_destroy (buffer->unicode);
buffer->unicode = unicode_funcs;

Просмотреть файл

@ -28,6 +28,7 @@
#include "hb-private.hh"
#include "hb-machinery-private.hh"
#include <locale.h>
#ifdef HAVE_XLOCALE_H
@ -244,15 +245,15 @@ struct hb_language_item_t {
/* Thread-safe lock-free language list */
static hb_language_item_t *langs;
static hb_atomic_ptr_t <hb_language_item_t> langs;
#ifdef HB_USE_ATEXIT
static void
free_langs (void)
{
retry:
hb_language_item_t *first_lang = (hb_language_item_t *) hb_atomic_ptr_get (&langs);
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, nullptr))
hb_language_item_t *first_lang = langs.get ();
if (unlikely (!langs.cmpexch (first_lang, nullptr)))
goto retry;
while (first_lang) {
@ -268,7 +269,7 @@ static hb_language_item_t *
lang_find_or_insert (const char *key)
{
retry:
hb_language_item_t *first_lang = (hb_language_item_t *) hb_atomic_ptr_get (&langs);
hb_language_item_t *first_lang = langs.get ();
for (hb_language_item_t *lang = first_lang; lang; lang = lang->next)
if (*lang == key)
@ -286,7 +287,8 @@ retry:
return nullptr;
}
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
if (unlikely (!langs.cmpexch (first_lang, lang)))
{
lang->fini ();
free (lang);
goto retry;
@ -368,15 +370,16 @@ hb_language_to_string (hb_language_t language)
hb_language_t
hb_language_get_default (void)
{
static hb_language_t default_language = HB_LANGUAGE_INVALID;
static hb_atomic_ptr_t <hb_language_t> default_language;
hb_language_t language = (hb_language_t) hb_atomic_ptr_get (&default_language);
if (unlikely (language == HB_LANGUAGE_INVALID)) {
hb_language_t language = default_language.get ();
if (unlikely (language == HB_LANGUAGE_INVALID))
{
language = hb_language_from_string (setlocale (LC_CTYPE, nullptr), -1);
(void) hb_atomic_ptr_cmpexch (&default_language, HB_LANGUAGE_INVALID, language);
(void) default_language.cmpexch (HB_LANGUAGE_INVALID, language);
}
return default_language;
return language;
}
@ -728,47 +731,46 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv)
#ifdef USE_XLOCALE
static HB_LOCALE_T C_locale;
static void free_static_C_locale (void);
static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<HB_LOCALE_T>::value,
hb_C_locale_lazy_loader_t>
{
static inline HB_LOCALE_T create (void)
{
HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C");
#ifdef HB_USE_ATEXIT
static void
free_C_locale (void)
atexit (free_static_C_locale);
#endif
return C_locale;
}
static inline void destroy (HB_LOCALE_T p)
{
HB_FREE_LOCALE (p);
}
static inline HB_LOCALE_T get_null (void)
{
return nullptr;
}
} static_C_locale;
#ifdef HB_USE_ATEXIT
static
void free_static_C_locale (void)
{
retry:
HB_LOCALE_T locale = (HB_LOCALE_T) hb_atomic_ptr_get (&C_locale);
if (!hb_atomic_ptr_cmpexch (&C_locale, locale, nullptr))
goto retry;
if (locale)
HB_FREE_LOCALE (locale);
static_C_locale.free_instance ();
}
#endif
static HB_LOCALE_T
get_C_locale (void)
{
retry:
HB_LOCALE_T C = (HB_LOCALE_T) hb_atomic_ptr_get (&C_locale);
if (unlikely (!C))
{
C = HB_CREATE_LOCALE ("C");
if (!hb_atomic_ptr_cmpexch (&C_locale, nullptr, C))
{
HB_FREE_LOCALE (C_locale);
goto retry;
}
#ifdef HB_USE_ATEXIT
atexit (free_C_locale); /* First person registers atexit() callback. */
#endif
}
return C;
return static_C_locale.get_unconst ();
}
#endif
#endif /* USE_XLOCALE */
static bool
parse_float (const char **pp, const char *end, float *pv)
@ -845,7 +847,7 @@ parse_tag (const char **pp, const char *end, hb_tag_t *tag)
}
const char *p = *pp;
while (*pp < end && ISALNUM(**pp))
while (*pp < end && (ISALNUM(**pp) || **pp == '_'))
(*pp)++;
if (p == *pp || *pp - p > 4)

Просмотреть файл

@ -348,7 +348,7 @@ hb_coretext_font_create (CTFontRef ct_font)
hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font)));
/* Let there be dragons here... */
HB_SHAPER_DATA_GET (font) = (hb_coretext_font_data_t *) CFRetain (ct_font);
HB_SHAPER_DATA (HB_SHAPER, font).set_relaxed ((hb_coretext_font_data_t *) CFRetain (ct_font));
return font;
}

Просмотреть файл

@ -61,7 +61,8 @@ struct hb_face_t
{
hb_shape_plan_t *shape_plan;
plan_node_t *next;
} *shape_plans;
};
hb_atomic_ptr_t<plan_node_t> shape_plans;
inline hb_blob_t *reference_table (hb_tag_t tag) const
{

Просмотреть файл

@ -78,12 +78,12 @@ DEFINE_NULL_INSTANCE (hb_face_t) =
0, /* num_glyphs */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#define HB_SHAPER_IMPLEMENT(shaper) HB_ATOMIC_PTR_INIT (HB_SHAPER_DATA_INVALID),
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
},
nullptr, /* shape_plans */
HB_ATOMIC_PTR_INIT (nullptr), /* shape_plans */
};
@ -249,7 +249,7 @@ hb_face_destroy (hb_face_t *face)
{
if (!hb_object_destroy (face)) return;
for (hb_face_t::plan_node_t *node = face->shape_plans; node; )
for (hb_face_t::plan_node_t *node = face->shape_plans.get (); node; )
{
hb_face_t::plan_node_t *next = node->next;
hb_shape_plan_destroy (node->shape_plan);

Просмотреть файл

@ -1247,7 +1247,7 @@ DEFINE_NULL_INSTANCE (hb_font_t) =
nullptr, /* destroy */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#define HB_SHAPER_IMPLEMENT(shaper) HB_ATOMIC_PTR_INIT (HB_SHAPER_DATA_INVALID),
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
}

Просмотреть файл

@ -32,6 +32,7 @@
#include "hb-ft.h"
#include "hb-font-private.hh"
#include "hb-machinery-private.hh"
#include FT_ADVANCES_H
#include FT_MULTIPLE_MASTERS_H
@ -416,30 +417,13 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
return true;
}
static hb_font_funcs_t *static_ft_funcs = nullptr;
static void free_static_ft_funcs (void);
#ifdef HB_USE_ATEXIT
static
void free_static_ft_funcs (void)
static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft_font_funcs_lazy_loader_t>
{
retry:
hb_font_funcs_t *ft_funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_funcs);
if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, ft_funcs, nullptr))
goto retry;
hb_font_funcs_destroy (ft_funcs);
}
#endif
static void
_hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
{
retry:
hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_funcs);
if (unlikely (!funcs))
static inline hb_font_funcs_t *create (void)
{
funcs = hb_font_funcs_create ();
hb_font_funcs_t *funcs = hb_font_funcs_create ();
hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, nullptr, nullptr);
//hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, nullptr, nullptr);
@ -458,20 +442,35 @@ retry:
hb_font_funcs_make_immutable (funcs);
if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, nullptr, funcs)) {
hb_font_funcs_destroy (funcs);
goto retry;
}
#ifdef HB_USE_ATEXIT
atexit (free_static_ft_funcs);
#endif
return funcs;
}
} static_ft_funcs;
#ifdef HB_USE_ATEXIT
atexit (free_static_ft_funcs); /* First person registers atexit() callback. */
static
void free_static_ft_funcs (void)
{
static_ft_funcs.free_instance ();
}
#endif
};
static hb_font_funcs_t *
_hb_ft_get_font_funcs (void)
{
return static_ft_funcs.get_unconst ();
}
static void
_hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
{
bool symbol = ft_face->charmap && ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL;
hb_font_set_funcs (font,
funcs,
_hb_ft_get_font_funcs (),
_hb_ft_font_create (ft_face, symbol, unref),
_hb_ft_font_destroy);
}
@ -684,46 +683,45 @@ hb_ft_font_create_referenced (FT_Face ft_face)
}
/* Thread-safe, lock-free, FT_Library */
static void free_static_ft_library (void);
static FT_Library ft_library;
static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<FT_Library>::value,
hb_ft_library_lazy_loader_t>
{
static inline FT_Library create (void)
{
FT_Library l;
if (FT_Init_FreeType (&l))
return nullptr;
#ifdef HB_USE_ATEXIT
atexit (free_static_ft_library);
#endif
return l;
}
static inline void destroy (FT_Library l)
{
FT_Done_FreeType (l);
}
static inline FT_Library get_null (void)
{
return nullptr;
}
} static_ft_library;
#ifdef HB_USE_ATEXIT
static
void free_ft_library (void)
void free_static_ft_library (void)
{
retry:
FT_Library library = (FT_Library) hb_atomic_ptr_get (&ft_library);
if (!hb_atomic_ptr_cmpexch (&ft_library, library, nullptr))
goto retry;
FT_Done_FreeType (library);
static_ft_library.free_instance ();
}
#endif
static FT_Library
get_ft_library (void)
{
retry:
FT_Library library = (FT_Library) hb_atomic_ptr_get (&ft_library);
if (unlikely (!library))
{
/* Not found; allocate one. */
if (FT_Init_FreeType (&library))
return nullptr;
if (!hb_atomic_ptr_cmpexch (&ft_library, nullptr, library)) {
FT_Done_FreeType (library);
goto retry;
}
#ifdef HB_USE_ATEXIT
atexit (free_ft_library); /* First person registers atexit() callback. */
#endif
}
return library;
return static_ft_library.get_unconst ();
}
static void

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше