Merge autoland to mozilla-central. a=merge

This commit is contained in:
shindli 2019-01-30 06:05:41 +02:00
Родитель 6ce645e654 8bb6f4af0f
Коммит f65c00428b
61 изменённых файлов: 741 добавлений и 562 удалений

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

@ -1623,6 +1623,11 @@ pref("dom.ipc.cpows.forbid-unsafe-from-browser", true);
// detection).
pref("dom.ipc.processHangMonitor", true);
#if defined(NIGHTLY_BUILD) && defined(XP_WIN)
// Allows us to deprioritize the processes of background tabs at an OS level
pref("dom.ipc.processPriorityManager.enabled", true);
#endif
#ifdef DEBUG
// Don't report hangs in DEBUG builds. They're too slow and often a
// debugger is attached.

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

@ -697,6 +697,7 @@ html|input.urlbar-input {
list-style-image: none;
}
#urlbar[noactions] > #urlbar-display-box,
#urlbar:not([actiontype="switchtab"]):not([actiontype="extension"]) > #urlbar-display-box,
#urlbar:not([actiontype="switchtab"]) > #urlbar-display-box > #switchtab,
#urlbar:not([actiontype="extension"]) > #urlbar-display-box > #extension {

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

@ -18,6 +18,8 @@ const getRecentlyClosed = (maxResults, extension) => {
let recentlyClosed = [];
// Get closed windows
// Closed private windows are not stored in sessionstore, we do
// not need to check access for that.
let closedWindowData = SessionStore.getClosedWindowData(false);
for (let window of closedWindowData) {
recentlyClosed.push({
@ -26,7 +28,11 @@ const getRecentlyClosed = (maxResults, extension) => {
}
// Get closed tabs
// Private closed tabs are in sessionstore if the owning window is still open .
for (let window of windowTracker.browserWindows()) {
if (!extension.canAccessWindow(window)) {
continue;
}
let closedTabData = SessionStore.getClosedTabData(window, false);
for (let tab of closedTabData) {
recentlyClosed.push({
@ -66,23 +72,25 @@ const getEncodedKey = function getEncodedKey(extensionId, key) {
return `extension:${extensionId}:${key}`;
};
const getTabParams = function getTabParams(extensionId, key, id) {
let encodedKey = getEncodedKey(extensionId, key);
let tab = tabTracker.getTab(id);
return {encodedKey, tab};
};
const getWindowParams = function getWindowParams(extensionId, key, id, context) {
let encodedKey = getEncodedKey(extensionId, key);
let win = windowTracker.getWindow(id, context);
return {encodedKey, win};
};
this.sessions = class extends ExtensionAPI {
getAPI(context) {
let {extension} = context;
function getTabParams(key, id) {
let encodedKey = getEncodedKey(extension.id, key);
let tab = tabTracker.getTab(id);
if (!context.canAccessWindow(tab.ownerGlobal)) {
throw new ExtensionError(`Invalid tab ID: ${id}`);
}
return {encodedKey, tab};
}
function getWindowParams(key, id) {
let encodedKey = getEncodedKey(extension.id, key);
let win = windowTracker.getWindow(id, context);
return {encodedKey, win};
}
return {
sessions: {
async getRecentlyClosed(filter) {
@ -93,7 +101,7 @@ this.sessions = class extends ExtensionAPI {
async forgetClosedTab(windowId, sessionId) {
await SessionStore.promiseInitialized;
let window = context.extension.windowManager.get(windowId).window;
let window = windowTracker.getWindow(windowId, context);
let closedTabData = SessionStore.getClosedTabData(window, false);
let closedTabIndex = closedTabData.findIndex((closedTab) => {
@ -127,7 +135,7 @@ this.sessions = class extends ExtensionAPI {
let session, closedId;
if (sessionId) {
closedId = sessionId;
session = SessionStore.undoCloseById(closedId);
session = SessionStore.undoCloseById(closedId, extension.privateBrowsingAllowed);
} else if (SessionStore.lastClosedObjectType == "window") {
// If the most recently closed object is a window, just undo closing the most recent window.
session = SessionStore.undoCloseWindow(0);
@ -142,26 +150,28 @@ this.sessions = class extends ExtensionAPI {
}
}
// Sort the tabs.
recentlyClosedTabs.sort((a, b) => b.closedAt - a.closedAt);
if (recentlyClosedTabs.length > 0) {
// Sort the tabs.
recentlyClosedTabs.sort((a, b) => b.closedAt - a.closedAt);
// Use the closedId of the most recently closed tab to restore it.
closedId = recentlyClosedTabs[0].closedId;
session = SessionStore.undoCloseById(closedId);
// Use the closedId of the most recently closed tab to restore it.
closedId = recentlyClosedTabs[0].closedId;
session = SessionStore.undoCloseById(closedId, extension.privateBrowsingAllowed);
}
}
return createSession(session, extension, closedId);
},
setTabValue(tabId, key, value) {
let {tab, encodedKey} =
getTabParams(extension.id, key, tabId);
getTabParams(key, tabId);
SessionStore.setCustomTabValue(tab, encodedKey, JSON.stringify(value));
},
async getTabValue(tabId, key) {
let {tab, encodedKey} =
getTabParams(extension.id, key, tabId);
getTabParams(key, tabId);
let value = SessionStore.getCustomTabValue(tab, encodedKey);
if (value) {
@ -173,21 +183,21 @@ this.sessions = class extends ExtensionAPI {
removeTabValue(tabId, key) {
let {tab, encodedKey} =
getTabParams(extension.id, key, tabId);
getTabParams(key, tabId);
SessionStore.deleteCustomTabValue(tab, encodedKey);
},
setWindowValue(windowId, key, value) {
let {win, encodedKey} =
getWindowParams(extension.id, key, windowId, context);
getWindowParams(key, windowId);
SessionStore.setCustomWindowValue(win, encodedKey, JSON.stringify(value));
},
async getWindowValue(windowId, key) {
let {win, encodedKey} =
getWindowParams(extension.id, key, windowId, context);
getWindowParams(key, windowId);
let value = SessionStore.getCustomWindowValue(win, encodedKey);
if (value) {
@ -199,7 +209,7 @@ this.sessions = class extends ExtensionAPI {
removeWindowValue(windowId, key) {
let {win, encodedKey} =
getWindowParams(extension.id, key, windowId, context);
getWindowParams(key, windowId);
SessionStore.deleteCustomWindowValue(win, encodedKey);
},

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

@ -161,6 +161,7 @@ skip-if = !e10s || !crashreporter # the tab's process is killed during the test.
[browser_ext_runtime_setUninstallURL.js]
[browser_ext_sessions_forgetClosedTab.js]
[browser_ext_sessions_forgetClosedWindow.js]
[browser_ext_sessions_incognito.js]
[browser_ext_sessions_getRecentlyClosed.js]
[browser_ext_sessions_getRecentlyClosed_private.js]
[browser_ext_sessions_getRecentlyClosed_tabs.js]

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

@ -2,7 +2,7 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(async function test_sessions_forget_closed_tab() {
function getExtension(incognitoOverride) {
function background() {
browser.test.onMessage.addListener((msg, windowId, sessionId) => {
if (msg === "check-sessions") {
@ -15,22 +15,24 @@ add_task(async function test_sessions_forget_closed_tab() {
browser.test.sendMessage("forgot-tab");
},
error => {
browser.test.assertEq(error.message,
`Could not find closed tab using sessionId ${sessionId}.`);
browser.test.sendMessage("forget-reject");
browser.test.sendMessage("forget-reject", error.message);
}
);
}
});
}
let extension = ExtensionTestUtils.loadExtension({
return ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["sessions", "tabs"],
},
background,
incognitoOverride,
});
}
add_task(async function test_sessions_forget_closed_tab() {
let extension = getExtension();
await extension.startup();
let tabUrl = "http://example.com";
@ -62,7 +64,9 @@ add_task(async function test_sessions_forget_closed_tab() {
extension.sendMessage("forget-tab",
recentlyClosedTab.windowId,
recentlyClosedTab.sessionId);
await extension.awaitMessage("forget-reject");
let errormsg = await extension.awaitMessage("forget-reject");
is(errormsg, `Could not find closed tab using sessionId ${recentlyClosedTab.sessionId}.`);
extension.sendMessage("check-sessions");
remainingClosed = await extension.awaitMessage("recentlyClosed");
is(remainingClosed.length, recentlyClosedLength - 1,
@ -72,3 +76,40 @@ add_task(async function test_sessions_forget_closed_tab() {
await extension.unload();
});
add_task(async function test_sessions_forget_closed_tab_private() {
SpecialPowers.pushPrefEnv({set: [
["extensions.allowPrivateBrowsingByDefault", false],
]});
let pb_extension = getExtension("spanning");
await pb_extension.startup();
let extension = getExtension();
await extension.startup();
// Open a private browsing window.
let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
let tabUrl = "http://example.com";
let tab = await BrowserTestUtils.openNewForegroundTab(privateWin.gBrowser, tabUrl);
BrowserTestUtils.removeTab(tab);
tab = await BrowserTestUtils.openNewForegroundTab(privateWin.gBrowser, tabUrl);
let sessionUpdatePromise = BrowserTestUtils.waitForSessionStoreUpdate(tab);
BrowserTestUtils.removeTab(tab);
await sessionUpdatePromise;
pb_extension.sendMessage("check-sessions");
let recentlyClosed = await pb_extension.awaitMessage("recentlyClosed");
let recentlyClosedTab = recentlyClosed[0].tab;
// Check that forgetting a tab works properly
extension.sendMessage("forget-tab",
recentlyClosedTab.windowId,
recentlyClosedTab.sessionId);
let errormsg = await extension.awaitMessage("forget-reject");
ok(/Invalid window ID/.test(errormsg), "could not access window");
await BrowserTestUtils.closeWindow(privateWin);
await extension.unload();
await pb_extension.unload();
});

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

@ -2,14 +2,7 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(async function test_sessions_forget_closed_window() {
async function openAndCloseWindow(url = "http://example.com") {
let win = await BrowserTestUtils.openNewBrowserWindow();
await BrowserTestUtils.loadURI(win.gBrowser.selectedBrowser, url);
await BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
await BrowserTestUtils.closeWindow(win);
}
function getExtension(incognitoOverride) {
function background() {
browser.test.onMessage.addListener((msg, sessionId) => {
if (msg === "check-sessions") {
@ -22,23 +15,32 @@ add_task(async function test_sessions_forget_closed_window() {
browser.test.sendMessage("forgot-window");
},
error => {
browser.test.assertEq(
error.message,
`Could not find closed window using sessionId ${sessionId}.`);
browser.test.sendMessage("forget-reject");
browser.test.sendMessage("forget-reject", error.message);
}
);
}
});
}
let extension = ExtensionTestUtils.loadExtension({
return ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["sessions", "tabs"],
},
background,
incognitoOverride,
});
}
async function openAndCloseWindow(url = "http://example.com", privateWin) {
let win = await BrowserTestUtils.openNewBrowserWindow({private: privateWin});
let tab = await BrowserTestUtils.openNewForegroundTab(win.gBrowser, url);
let sessionUpdatePromise = BrowserTestUtils.waitForSessionStoreUpdate(tab);
await BrowserTestUtils.closeWindow(win);
await sessionUpdatePromise;
}
add_task(async function test_sessions_forget_closed_window() {
let extension = getExtension();
await extension.startup();
await openAndCloseWindow("about:config");
@ -46,7 +48,6 @@ add_task(async function test_sessions_forget_closed_window() {
extension.sendMessage("check-sessions");
let recentlyClosed = await extension.awaitMessage("recentlyClosed");
let recentlyClosedLength = recentlyClosed.length;
let recentlyClosedWindow = recentlyClosed[0].window;
// Check that forgetting a window works properly
@ -54,20 +55,51 @@ add_task(async function test_sessions_forget_closed_window() {
await extension.awaitMessage("forgot-window");
extension.sendMessage("check-sessions");
let remainingClosed = await extension.awaitMessage("recentlyClosed");
is(remainingClosed.length, recentlyClosedLength - 1,
is(remainingClosed.length, recentlyClosed.length - 1,
"One window was forgotten.");
is(remainingClosed[0].window.sessionId, recentlyClosed[1].window.sessionId,
"The correct window was forgotten.");
// Check that re-forgetting the same window fails properly
extension.sendMessage("forget-window", recentlyClosedWindow.sessionId);
await extension.awaitMessage("forget-reject");
let errMsg = await extension.awaitMessage("forget-reject");
is(errMsg, `Could not find closed window using sessionId ${recentlyClosedWindow.sessionId}.`);
extension.sendMessage("check-sessions");
remainingClosed = await extension.awaitMessage("recentlyClosed");
is(remainingClosed.length, recentlyClosedLength - 1,
is(remainingClosed.length, recentlyClosed.length - 1,
"No extra window was forgotten.");
is(remainingClosed[0].window.sessionId, recentlyClosed[1].window.sessionId,
"The correct window remains.");
await extension.unload();
});
add_task(async function test_sessions_forget_closed_window_private() {
SpecialPowers.pushPrefEnv({set: [
["extensions.allowPrivateBrowsingByDefault", false],
]});
let pb_extension = getExtension("spanning");
await pb_extension.startup();
let extension = getExtension("not_allowed");
await extension.startup();
await openAndCloseWindow("about:config", true);
await openAndCloseWindow("about:robots", true);
pb_extension.sendMessage("check-sessions");
let recentlyClosed = await pb_extension.awaitMessage("recentlyClosed");
let recentlyClosedWindow = recentlyClosed[0].window;
extension.sendMessage("forget-window", recentlyClosedWindow.sessionId);
await extension.awaitMessage("forgot-window");
extension.sendMessage("check-sessions");
let remainingClosed = await extension.awaitMessage("recentlyClosed");
is(remainingClosed.length, recentlyClosed.length - 1,
"One window was forgotten.");
ok(!recentlyClosedWindow.incognito, "not an incognito window");
await extension.unload();
await pb_extension.unload();
});

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

@ -7,7 +7,7 @@ SimpleTest.requestCompleteLog();
Services.scriptloader.loadSubScript(new URL("head_sessions.js", gTestPath).href,
this);
add_task(async function test_sessions_get_recently_closed_private() {
async function run_test_extension(incognitoOverride) {
function background() {
browser.test.onMessage.addListener((msg, filter) => {
if (msg == "check-sessions") {
@ -23,6 +23,7 @@ add_task(async function test_sessions_get_recently_closed_private() {
permissions: ["sessions", "tabs"],
},
background,
incognitoOverride,
});
// Open a private browsing window.
@ -48,7 +49,8 @@ add_task(async function test_sessions_get_recently_closed_private() {
extension.sendMessage("check-sessions");
recentlyClosed = await extension.awaitMessage("recentlyClosed");
checkRecentlyClosed(recentlyClosed.filter(onlyNewItemsFilter), 2, privateWinId, true);
let expectedCount = incognitoOverride == "not_allowed" ? 0 : 2;
checkRecentlyClosed(recentlyClosed.filter(onlyNewItemsFilter), expectedCount, privateWinId, true);
// Close the private window.
await BrowserTestUtils.closeWindow(privateWin);
@ -58,4 +60,21 @@ add_task(async function test_sessions_get_recently_closed_private() {
is(recentlyClosed.filter(onlyNewItemsFilter).length, 0, "the closed private window info was not found in recently closed data");
await extension.unload();
}
add_task(async function test_sessions_get_recently_closed_default() {
SpecialPowers.pushPrefEnv({set: [
["extensions.allowPrivateBrowsingByDefault", true],
]});
await run_test_extension();
});
add_task(async function test_sessions_get_recently_closed_private_incognito() {
SpecialPowers.pushPrefEnv({set: [
["extensions.allowPrivateBrowsingByDefault", false],
]});
await run_test_extension("spanning");
await run_test_extension("not_allowed");
});

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

@ -0,0 +1,88 @@
"use strict";
add_task(async function test_sessions_tab_value_private() {
Services.obs.notifyObservers(null, "browser:purge-session-history");
is(SessionStore.getClosedWindowCount(), 0,
"No closed window sessions at start of test");
SpecialPowers.pushPrefEnv({set: [
["extensions.allowPrivateBrowsingByDefault", false],
]});
let extension = ExtensionTestUtils.loadExtension({
manifest: {
applications: {
gecko: {
id: "exampleextension@mozilla.org",
},
},
permissions: ["sessions"],
},
background() {
browser.test.onMessage.addListener(async (msg, pbw) => {
if (msg == "value") {
await browser.test.assertRejects(browser.sessions.setWindowValue(pbw.windowId, "foo", "bar"),
/Invalid window ID/,
"should not be able to set incognito window session data");
await browser.test.assertRejects(browser.sessions.getWindowValue(pbw.windowId, "foo"),
/Invalid window ID/,
"should not be able to get incognito window session data");
await browser.test.assertRejects(browser.sessions.removeWindowValue(pbw.windowId, "foo"),
/Invalid window ID/,
"should not be able to remove incognito window session data");
await browser.test.assertRejects(browser.sessions.setTabValue(pbw.tabId, "foo", "bar"),
/Invalid tab ID/,
"should not be able to set incognito tab session data");
await browser.test.assertRejects(browser.sessions.getTabValue(pbw.tabId, "foo"),
/Invalid tab ID/,
"should not be able to get incognito tab session data");
await browser.test.assertRejects(browser.sessions.removeTabValue(pbw.tabId, "foo"),
/Invalid tab ID/,
"should not be able to remove incognito tab session data");
}
if (msg == "restore") {
await browser.test.assertRejects(browser.sessions.restore(),
/Could not restore object/,
"should not be able to restore incognito last window session data");
if (pbw) {
await browser.test.assertRejects(browser.sessions.restore(pbw.sessionId),
/Could not restore object/,
`should not be able to restore incognito session ID ${pbw.sessionId} session data`);
}
}
browser.test.sendMessage("done");
});
},
});
let winData = await getIncognitoWindow("http://mochi.test:8888/");
await extension.startup();
// Test value set/get APIs on a private window and tab.
extension.sendMessage("value", winData.details);
await extension.awaitMessage("done");
// Test restoring a private tab.
let tab = await BrowserTestUtils.openNewForegroundTab(winData.win.gBrowser, "http://example.com");
let sessionUpdatePromise = BrowserTestUtils.waitForSessionStoreUpdate(tab);
await BrowserTestUtils.removeTab(tab);
await sessionUpdatePromise;
let closedTabData = SessionStore.getClosedTabData(winData.win, false);
extension.sendMessage("restore", {sesionId: closedTabData[0].closedId});
await extension.awaitMessage("done");
// Test restoring a private window.
sessionUpdatePromise = BrowserTestUtils.waitForSessionStoreUpdate(winData.win.gBrowser.selectedTab);
await BrowserTestUtils.closeWindow(winData.win);
await sessionUpdatePromise;
is(SessionStore.getClosedWindowCount(), 0,
"The closed window was added to Recently Closed Windows");
// If the window gets restored, test will fail with an unclosed window.
extension.sendMessage("restore");
await extension.awaitMessage("done");
await extension.unload();
});

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

@ -375,8 +375,8 @@ var SessionStore = {
return SessionStoreInternal.getSessionHistory(tab, updatedCallback);
},
undoCloseById(aClosedId) {
return SessionStoreInternal.undoCloseById(aClosedId);
undoCloseById(aClosedId, aIncludePrivate) {
return SessionStoreInternal.undoCloseById(aClosedId, aIncludePrivate);
},
resetBrowserToLazyState(tab) {
@ -2689,7 +2689,6 @@ var SessionStoreInternal = {
if (!(aIndex in this._closedWindows)) {
throw Components.Exception("Invalid index: not in the closed windows", Cr.NS_ERROR_INVALID_ARG);
}
// reopen the window
let state = { windows: this._removeClosedWindow(aIndex) };
delete state.windows[0].closedAt; // Window is now open.
@ -2828,10 +2827,12 @@ var SessionStoreInternal = {
*
* @param aClosedId
* The closedId of the tab or window
* @param aIncludePrivate
* Whether to restore private tabs or windows
*
* @returns a tab or window object
*/
undoCloseById(aClosedId) {
undoCloseById(aClosedId, aIncludePrivate = true) {
// Check for a window first.
for (let i = 0, l = this._closedWindows.length; i < l; i++) {
if (this._closedWindows[i].closedId == aClosedId) {
@ -2841,6 +2842,9 @@ var SessionStoreInternal = {
// Check for a tab.
for (let window of Services.wm.getEnumerator("navigator:browser")) {
if (!aIncludePrivate && PrivateBrowsingUtils.isWindowPrivate(window)) {
continue;
}
let windowState = this._windows[window.__SSi];
if (windowState) {
for (let j = 0, l = windowState._closedTabs.length; j < l; j++) {

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

@ -135,12 +135,12 @@ class UrlbarController {
TelemetryStopwatch.finish(TELEMETRY_6_FIRST_RESULTS, queryContext);
}
if (queryContext.lastResultCount == 0 && queryContext.autofillValue) {
this.input.autofill(queryContext.autofillValue);
}
// The first time we receive results try to connect to the heuristic result.
if (queryContext.lastResultCount == 0) {
if (queryContext.autofillValue) {
this.input.autofill(queryContext.autofillValue);
}
// The first time we receive results try to connect to the heuristic
// result.
this.speculativeConnect(queryContext, 0, "resultsadded");
}

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

@ -110,6 +110,7 @@ class UrlbarInput {
this.inputField.addEventListener("scrollend", this);
this.inputField.addEventListener("select", this);
this.inputField.addEventListener("keydown", this);
this.inputField.addEventListener("keyup", this);
this.view.panel.addEventListener("popupshowing", this);
this.view.panel.addEventListener("popuphidden", this);
@ -311,7 +312,7 @@ class UrlbarInput {
switch (result.type) {
case UrlbarUtils.RESULT_TYPE.TAB_SWITCH: {
if (this._overrideDefaultAction(event)) {
if (this.hasAttribute("noactions")) {
where = "current";
break;
}
@ -385,6 +386,15 @@ class UrlbarInput {
}
}
this.value = val;
switch (result.type) {
case UrlbarUtils.RESULT_TYPE.TAB_SWITCH:
this.setAttribute("actiontype", "switchtab");
break;
case UrlbarUtils.RESULT_TYPE.OMNIBOX:
this.setAttribute("actiontype", "extension");
break;
}
}
/**
@ -505,6 +515,7 @@ class UrlbarInput {
this.valueIsTyped = false;
this.inputField.value = val;
this.formatValue();
this.removeAttribute("actiontype");
// Dispatch ValueChange event for accessibility.
let event = this.document.createEvent("Events");
@ -616,14 +627,20 @@ class UrlbarInput {
return selectedVal;
}
_overrideDefaultAction(event) {
return event.shiftKey ||
event.altKey ||
(AppConstants.platform == "macosx" ?
event.metaKey : event.ctrlKey);
_toggleNoActions(event) {
if (event.keyCode == KeyEvent.DOM_VK_SHIFT ||
event.keyCode == KeyEvent.DOM_VK_ALT ||
event.keyCode == (AppConstants.platform == "macosx" ?
KeyEvent.DOM_VK_META :
KeyEvent.DOM_VK_CONTROL)) {
if (event.type == "keydown") {
this.setAttribute("noactions", "true");
} else {
this.removeAttribute("noactions");
}
}
}
/**
* Get the url to load for the search query and records in telemetry that it
* is being loaded.
@ -902,6 +919,7 @@ class UrlbarInput {
} else {
this.removeAttribute("usertyping");
}
this.removeAttribute("actiontype");
// XXX Fill in lastKey, and add anything else we need.
this.startQuery({
@ -963,6 +981,11 @@ class UrlbarInput {
_on_keydown(event) {
this.controller.handleKeyNavigation(event);
this._toggleNoActions(event);
}
_on_keyup(event) {
this._toggleNoActions(event);
}
_on_popupshowing() {

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

@ -206,15 +206,44 @@ add_task(function test_receiveResults() {
sandbox.resetHistory();
});
add_task(function test_autocomplete_enabled() {
add_task(async function test_autofillValue() {
// Ensure the controller doesn't have any previous queries.
delete controller._lastQueryContext;
// Stub the controller's input so we can tell whether input.autofill() is
// called.
let input = {
autofill: sandbox.stub(),
};
controller.input = input;
const context = createContext();
context.results = [];
controller.startQuery(context);
// Set autofillValue and call receiveResults().
context.autofillValue = "test";
context.results = [
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
UrlbarUtils.RESULT_SOURCE.TABS,
{ url: "http://example.com/1" }),
];
controller.receiveResults(context);
Assert.equal(generalListener.onQueryResults.callCount, 1,
"Should have called onQueryResults for the listener");
Assert.deepEqual(generalListener.onQueryResults.args[0], [context],
"Should have called onQueryResults with the context");
Assert.equal(input.autofill.callCount, 1,
"Should have called input.autofill() one time");
Assert.deepEqual(input.autofill.args[0], ["test"],
"Should have called input.autofill() with context.autofillValue");
// Call receiveResults() again with more results.
context.results.push(
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
UrlbarUtils.RESULT_SOURCE.TABS,
{ url: "http://example.com/2" }),
);
controller.receiveResults(context);
Assert.equal(input.autofill.callCount, 1,
"Should not have called input.autofill() again");
sandbox.resetHistory();
});

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

@ -116,5 +116,9 @@ policy-SearchEngines = Configure search engine settings. This policy is only ava
# For more information, see https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/PKCS11/Module_Installation
policy-SecurityDevices = Install PKCS #11 modules.
policy-SSLVersionMax = Set the maximum SSL version.
policy-SSLVersionMin = Set the minimum SSL version.
# “format” refers to the format used for the value of this policy.
policy-WebsiteFilter = Block websites from being visited. See documentation for more details on the format.

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

@ -1187,6 +1187,20 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
add_old_configure_assignment(var, depends_if(valid_compiler)(
lambda x: list(x.wrapper) + [x.compiler] + list(x.flags)))
if host_or_target is target:
add_old_configure_assignment('ac_cv_prog_%s' % var, depends_if(valid_compiler)(
lambda x: list(x.wrapper) + [x.compiler] + list(x.flags)))
# We check that it works in python configure already.
add_old_configure_assignment('ac_cv_prog_%s_works' % var.lower(), 'yes')
gcc_like = depends(valid_compiler.type)(lambda x: 'yes' if x in ('gcc', 'clang') else 'no')
add_old_configure_assignment('ac_cv_prog_%s_g' % var.lower(), gcc_like)
if language == 'C':
add_old_configure_assignment('ac_cv_prog_gcc', gcc_like)
add_old_configure_assignment('ac_cv_prog_gcc_traditional', 'no')
if language == 'C++':
add_old_configure_assignment('ac_cv_prog_gxx', gcc_like)
# Set CC_TYPE/CC_VERSION/HOST_CC_TYPE/HOST_CC_VERSION to allow
# old-configure to do some of its still existing checks.
if language == 'C':
@ -2092,6 +2106,7 @@ def as_with_flags(as_info, assembler, provided_assembler, c_compiler):
add_old_configure_assignment('AS', as_with_flags)
add_old_configure_assignment('ac_cv_prog_AS', as_with_flags)
@depends(assembler, c_compiler, extra_toolchain_flags)

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

@ -358,21 +358,7 @@ def dia_sdk_subdir(host_or_target, subdir):
return dia_sdk_subdir
# XXX: remove after bug 1523201
js_option(env='WIN_DIA_SDK_BIN_DIR', nargs=1, help='Path to the DIA DLLs')
@depends('WIN_DIA_SDK_BIN_DIR', dia_sdk_subdir(host, 'bin'))
@imports('os')
def dia_sdk_bin_dir(from_env, guessed):
if from_env:
if not os.path.isdir(from_env[0]):
die('Invalid Windows DIA SDK directory: {}'.format(from_env))
return from_env[0]
return guessed
set_config('WIN_DIA_SDK_BIN_DIR', dia_sdk_bin_dir)
set_config('WIN_DIA_SDK_BIN_DIR', dia_sdk_subdir(host, 'bin'))
@template

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

@ -9,7 +9,6 @@ if [ -d "${VSPATH}" ]; then
export WINDOWSSDKDIR="${VSWINPATH}/SDK"
export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT"
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x86"
export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin/amd64"
export DIA_SDK_PATH="${VSPATH}/DIA SDK"
export VC_PATH="${VSPATH}/VC"

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

@ -8,7 +8,6 @@ if [ -d "${VSPATH}" ]; then
export WINDOWSSDKDIR="${VSWINPATH}/SDK"
export WIN32_REDIST_DIR=${VSPATH}/VC/redist/arm64/Microsoft.VC141.CRT
export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin/amd64"
export DIA_SDK_PATH="${VSPATH}/DIA SDK"
export VC_PATH="${VSPATH}/VC"

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

@ -9,7 +9,6 @@ if [ -d "${VSPATH}" ]; then
export WINDOWSSDKDIR="${VSWINPATH}/SDK"
export WIN32_REDIST_DIR=${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x64"
export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin/amd64"
export DIA_SDK_PATH="${VSPATH}/DIA SDK"
export VC_PATH="${VSPATH}/VC"
fi

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

@ -6,7 +6,7 @@
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/ChromeBrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/BrowsingContextBinding.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
@ -120,8 +120,8 @@ BrowsingContext* BrowsingContext::TopLevelBrowsingContext() {
RefPtr<BrowsingContext> context;
if (XRE_IsParentProcess()) {
context = new ChromeBrowsingContext(aParent, aOpener, aName, id,
/* aProcessId */ 0, aType);
context = new CanonicalBrowsingContext(aParent, aOpener, aName, id,
/* aProcessId */ 0, aType);
} else {
context = new BrowsingContext(aParent, aOpener, aName, id, aType);
}
@ -147,7 +147,7 @@ BrowsingContext* BrowsingContext::TopLevelBrowsingContext() {
RefPtr<BrowsingContext> context;
if (XRE_IsParentProcess()) {
context = new ChromeBrowsingContext(
context = new CanonicalBrowsingContext(
aParent, aOpener, aName, aId, aOriginProcess->ChildID(), Type::Content);
} else {
context = new BrowsingContext(aParent, aOpener, aName, aId, Type::Content);
@ -380,7 +380,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(BrowsingContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(BrowsingContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocShell, mChildren, mParent)
if (XRE_IsParentProcess()) {
ChromeBrowsingContext::Cast(tmp)->Unlink();
CanonicalBrowsingContext::Cast(tmp)->Unlink();
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -388,7 +388,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(BrowsingContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocShell, mChildren, mParent)
if (XRE_IsParentProcess()) {
ChromeBrowsingContext::Cast(tmp)->Traverse(cb);
CanonicalBrowsingContext::Cast(tmp)->Traverse(cb);
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

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

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/ChromeBrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/WindowGlobalParent.h"
namespace mozilla {
@ -15,25 +15,26 @@ extern mozilla::LazyLogModule gUserInteractionPRLog;
#define USER_ACTIVATION_LOG(msg, ...) \
MOZ_LOG(gUserInteractionPRLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
ChromeBrowsingContext::ChromeBrowsingContext(BrowsingContext* aParent,
BrowsingContext* aOpener,
const nsAString& aName,
uint64_t aBrowsingContextId,
uint64_t aProcessId,
BrowsingContext::Type aType)
CanonicalBrowsingContext::CanonicalBrowsingContext(BrowsingContext* aParent,
BrowsingContext* aOpener,
const nsAString& aName,
uint64_t aBrowsingContextId,
uint64_t aProcessId,
BrowsingContext::Type aType)
: BrowsingContext(aParent, aOpener, aName, aBrowsingContextId, aType),
mProcessId(aProcessId) {
// You are only ever allowed to create ChromeBrowsingContexts in the
// You are only ever allowed to create CanonicalBrowsingContexts in the
// parent process.
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
}
// TODO(farre): ChromeBrowsingContext::CleanupContexts starts from the
// TODO(farre): CanonicalBrowsingContext::CleanupContexts starts from the
// list of root BrowsingContexts. This isn't enough when separate
// BrowsingContext nodes of a BrowsingContext tree, not in a crashing
// child process, are from that process and thus needs to be
// cleaned. [Bug 1472108]
/* static */ void ChromeBrowsingContext::CleanupContexts(uint64_t aProcessId) {
/* static */ void CanonicalBrowsingContext::CleanupContexts(
uint64_t aProcessId) {
nsTArray<RefPtr<BrowsingContext>> roots;
BrowsingContext::GetRootBrowsingContexts(roots);
@ -44,25 +45,25 @@ ChromeBrowsingContext::ChromeBrowsingContext(BrowsingContext* aParent,
}
}
/* static */ already_AddRefed<ChromeBrowsingContext> ChromeBrowsingContext::Get(
uint64_t aId) {
/* static */ already_AddRefed<CanonicalBrowsingContext>
CanonicalBrowsingContext::Get(uint64_t aId) {
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
return BrowsingContext::Get(aId).downcast<ChromeBrowsingContext>();
return BrowsingContext::Get(aId).downcast<CanonicalBrowsingContext>();
}
/* static */ ChromeBrowsingContext* ChromeBrowsingContext::Cast(
/* static */ CanonicalBrowsingContext* CanonicalBrowsingContext::Cast(
BrowsingContext* aContext) {
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
return static_cast<ChromeBrowsingContext*>(aContext);
return static_cast<CanonicalBrowsingContext*>(aContext);
}
/* static */ const ChromeBrowsingContext* ChromeBrowsingContext::Cast(
/* static */ const CanonicalBrowsingContext* CanonicalBrowsingContext::Cast(
const BrowsingContext* aContext) {
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
return static_cast<const ChromeBrowsingContext*>(aContext);
return static_cast<const CanonicalBrowsingContext*>(aContext);
}
void ChromeBrowsingContext::GetWindowGlobals(
void CanonicalBrowsingContext::GetWindowGlobals(
nsTArray<RefPtr<WindowGlobalParent>>& aWindows) {
aWindows.SetCapacity(mWindowGlobals.Count());
for (auto iter = mWindowGlobals.Iter(); !iter.Done(); iter.Next()) {
@ -70,12 +71,13 @@ void ChromeBrowsingContext::GetWindowGlobals(
}
}
void ChromeBrowsingContext::RegisterWindowGlobal(WindowGlobalParent* aGlobal) {
void CanonicalBrowsingContext::RegisterWindowGlobal(
WindowGlobalParent* aGlobal) {
MOZ_ASSERT(!mWindowGlobals.Contains(aGlobal), "Global already registered!");
mWindowGlobals.PutEntry(aGlobal);
}
void ChromeBrowsingContext::UnregisterWindowGlobal(
void CanonicalBrowsingContext::UnregisterWindowGlobal(
WindowGlobalParent* aGlobal) {
MOZ_ASSERT(mWindowGlobals.Contains(aGlobal), "Global not registered!");
mWindowGlobals.RemoveEntry(aGlobal);
@ -87,7 +89,7 @@ void ChromeBrowsingContext::UnregisterWindowGlobal(
}
}
void ChromeBrowsingContext::SetCurrentWindowGlobal(
void CanonicalBrowsingContext::SetCurrentWindowGlobal(
WindowGlobalParent* aGlobal) {
MOZ_ASSERT(mWindowGlobals.Contains(aGlobal), "Global not registered!");
@ -95,12 +97,12 @@ void ChromeBrowsingContext::SetCurrentWindowGlobal(
mCurrentWindowGlobal = aGlobal;
}
JSObject* ChromeBrowsingContext::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return ChromeBrowsingContext_Binding::Wrap(aCx, this, aGivenProto);
JSObject* CanonicalBrowsingContext::WrapObject(
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
return CanonicalBrowsingContext_Binding::Wrap(aCx, this, aGivenProto);
}
void ChromeBrowsingContext::NotifySetUserGestureActivationFromIPC(
void CanonicalBrowsingContext::NotifySetUserGestureActivationFromIPC(
bool aIsUserGestureActivation) {
if (!mCurrentWindowGlobal) {
return;
@ -121,13 +123,13 @@ void ChromeBrowsingContext::NotifySetUserGestureActivationFromIPC(
// in bug1519229.
}
void ChromeBrowsingContext::Traverse(nsCycleCollectionTraversalCallback& cb) {
ChromeBrowsingContext* tmp = this;
void CanonicalBrowsingContext::Traverse(nsCycleCollectionTraversalCallback& cb) {
CanonicalBrowsingContext* tmp = this;
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindowGlobals);
}
void ChromeBrowsingContext::Unlink() {
ChromeBrowsingContext* tmp = this;
void CanonicalBrowsingContext::Unlink() {
CanonicalBrowsingContext* tmp = this;
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowGlobals);
}

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

@ -4,8 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_ChromeBrowsingContext_h
#define mozilla_dom_ChromeBrowsingContext_h
#ifndef mozilla_dom_CanonicalBrowsingContext_h
#define mozilla_dom_CanonicalBrowsingContext_h
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/RefPtr.h"
@ -21,15 +21,15 @@ namespace dom {
class WindowGlobalParent;
// ChromeBrowsingContext is a BrowsingContext living in the parent
// CanonicalBrowsingContext is a BrowsingContext living in the parent
// process, with whatever extra data that a BrowsingContext in the
// parent needs.
class ChromeBrowsingContext final : public BrowsingContext {
class CanonicalBrowsingContext final : public BrowsingContext {
public:
static void CleanupContexts(uint64_t aProcessId);
static already_AddRefed<ChromeBrowsingContext> Get(uint64_t aId);
static ChromeBrowsingContext* Cast(BrowsingContext* aContext);
static const ChromeBrowsingContext* Cast(const BrowsingContext* aContext);
static already_AddRefed<CanonicalBrowsingContext> Get(uint64_t aId);
static CanonicalBrowsingContext* Cast(BrowsingContext* aContext);
static const CanonicalBrowsingContext* Cast(const BrowsingContext* aContext);
bool IsOwnedByProcess(uint64_t aProcessId) const {
return mProcessId == aProcessId;
@ -63,9 +63,9 @@ class ChromeBrowsingContext final : public BrowsingContext {
void Unlink();
using Type = BrowsingContext::Type;
ChromeBrowsingContext(BrowsingContext* aParent, BrowsingContext* aOpener,
const nsAString& aName, uint64_t aBrowsingContextId,
uint64_t aProcessId, Type aType = Type::Chrome);
CanonicalBrowsingContext(BrowsingContext* aParent, BrowsingContext* aOpener,
const nsAString& aName, uint64_t aBrowsingContextId,
uint64_t aProcessId, Type aType = Type::Chrome);
private:
friend class BrowsingContext;
@ -82,4 +82,4 @@ class ChromeBrowsingContext final : public BrowsingContext {
} // namespace dom
} // namespace mozilla
#endif // !defined(mozilla_dom_ChromeBrowsingContext_h)
#endif // !defined(mozilla_dom_CanonicalBrowsingContext_h)

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

@ -77,14 +77,14 @@ EXPORTS.mozilla += [
EXPORTS.mozilla.dom += [
'BrowsingContext.h',
'CanonicalBrowsingContext.h',
'ChildProcessChannelListener.h',
'ChromeBrowsingContext.h'
]
UNIFIED_SOURCES += [
'BrowsingContext.cpp',
'CanonicalBrowsingContext.cpp',
'ChildProcessChannelListener.cpp',
'ChromeBrowsingContext.cpp',
'LoadContext.cpp',
'nsAboutRedirector.cpp',
'nsDefaultURIFixup.cpp',

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

@ -100,7 +100,7 @@
#include "mozilla/dom/PromiseNativeHandler.h"
#include "mozilla/dom/ParentSHistory.h"
#include "mozilla/dom/ChildSHistory.h"
#include "mozilla/dom/ChromeBrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/HTMLBodyElement.h"

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

@ -19,7 +19,7 @@ interface BrowsingContext {
};
[Exposed=Window, ChromeOnly]
interface ChromeBrowsingContext : BrowsingContext {
interface CanonicalBrowsingContext : BrowsingContext {
sequence<WindowGlobalParent> getWindowGlobals();
readonly attribute WindowGlobalParent? currentWindowGlobal;

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

@ -11,7 +11,7 @@ interface nsIDocShell;
interface WindowGlobalParent {
readonly attribute boolean isClosed;
readonly attribute boolean isInProcess;
readonly attribute ChromeBrowsingContext browsingContext;
readonly attribute CanonicalBrowsingContext browsingContext;
readonly attribute boolean isCurrentGlobal;

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

@ -38,7 +38,7 @@
#include "mozilla/devtools/HeapSnapshotTempFileHelperParent.h"
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/ChromeBrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ClientManager.h"
#include "mozilla/dom/ClientOpenWindowOpActors.h"
#include "mozilla/dom/DataTransfer.h"
@ -1751,7 +1751,7 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) {
a11y::AccessibleWrap::ReleaseContentProcessIdFor(ChildID());
#endif
ChromeBrowsingContext::CleanupContexts(ChildID());
CanonicalBrowsingContext::CleanupContexts(ChildID());
}
bool ContentParent::TryToRecycle() {
@ -5587,7 +5587,8 @@ mozilla::ipc::IPCResult ContentParent::RecvStoreUserInteractionAsPermission(
mozilla::ipc::IPCResult ContentParent::RecvAttachBrowsingContext(
const BrowsingContextId& aParentId, const BrowsingContextId& aOpenerId,
const BrowsingContextId& aChildId, const nsString& aName) {
RefPtr<ChromeBrowsingContext> parent = ChromeBrowsingContext::Get(aParentId);
RefPtr<CanonicalBrowsingContext> parent =
CanonicalBrowsingContext::Get(aParentId);
if (aParentId && !parent) {
// Unless 'aParentId' is 0 (which it is when the child is a root
// BrowsingContext) there should always be a corresponding
@ -5653,8 +5654,8 @@ mozilla::ipc::IPCResult ContentParent::RecvAttachBrowsingContext(
mozilla::ipc::IPCResult ContentParent::RecvDetachBrowsingContext(
const BrowsingContextId& aContextId, const bool& aMoveToBFCache) {
RefPtr<ChromeBrowsingContext> context =
ChromeBrowsingContext::Get(aContextId);
RefPtr<CanonicalBrowsingContext> context =
CanonicalBrowsingContext::Get(aContextId);
if (!context) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
@ -5689,8 +5690,8 @@ mozilla::ipc::IPCResult ContentParent::RecvDetachBrowsingContext(
mozilla::ipc::IPCResult ContentParent::RecvSetOpenerBrowsingContext(
const BrowsingContextId& aContextId,
const BrowsingContextId& aOpenerContextId) {
RefPtr<ChromeBrowsingContext> context =
ChromeBrowsingContext::Get(aContextId);
RefPtr<CanonicalBrowsingContext> context =
CanonicalBrowsingContext::Get(aContextId);
if (!context) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
@ -5722,8 +5723,8 @@ mozilla::ipc::IPCResult ContentParent::RecvSetOpenerBrowsingContext(
mozilla::ipc::IPCResult ContentParent::RecvSetUserGestureActivation(
const BrowsingContextId& aContextId, const bool& aNewValue) {
RefPtr<ChromeBrowsingContext> context =
ChromeBrowsingContext::Get(aContextId);
RefPtr<CanonicalBrowsingContext> context =
CanonicalBrowsingContext::Get(aContextId);
if (!context) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
@ -5758,7 +5759,7 @@ void ContentParent::UnregisterRemoveWorkerActor() {
mozilla::ipc::IPCResult ContentParent::RecvWindowClose(
const BrowsingContextId& aContextId, const bool& aTrustedCaller) {
RefPtr<ChromeBrowsingContext> bc = ChromeBrowsingContext::Get(aContextId);
RefPtr<CanonicalBrowsingContext> bc = CanonicalBrowsingContext::Get(aContextId);
if (!bc) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context "
@ -5780,7 +5781,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowClose(
mozilla::ipc::IPCResult ContentParent::RecvWindowFocus(
const BrowsingContextId& aContextId) {
RefPtr<ChromeBrowsingContext> bc = ChromeBrowsingContext::Get(aContextId);
RefPtr<CanonicalBrowsingContext> bc = CanonicalBrowsingContext::Get(aContextId);
if (!bc) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context "
@ -5798,7 +5799,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowFocus(
mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
const BrowsingContextId& aContextId) {
RefPtr<ChromeBrowsingContext> bc = ChromeBrowsingContext::Get(aContextId);
RefPtr<CanonicalBrowsingContext> bc = CanonicalBrowsingContext::Get(aContextId);
if (!bc) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context "
@ -5817,7 +5818,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
mozilla::ipc::IPCResult ContentParent::RecvWindowPostMessage(
const BrowsingContextId& aContextId, const ClonedMessageData& aMessage,
const PostMessageData& aData) {
RefPtr<ChromeBrowsingContext> bc = ChromeBrowsingContext::Get(aContextId);
RefPtr<CanonicalBrowsingContext> bc = CanonicalBrowsingContext::Get(aContextId);
if (!bc) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context "

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

@ -102,7 +102,7 @@
#include "nsString.h"
#include "IHistory.h"
#include "mozilla/dom/WindowGlobalParent.h"
#include "mozilla/dom/ChromeBrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#ifdef XP_WIN
# include "mozilla/plugins/PluginWidgetParent.h"
@ -1631,8 +1631,7 @@ mozilla::ipc::IPCResult TabParent::RecvAsyncMessage(
}
mozilla::ipc::IPCResult TabParent::RecvSetCursor(
const nsCursor& aCursor,
const bool& aHasCustomCursor,
const nsCursor& aCursor, const bool& aHasCustomCursor,
const nsCString& aCursorData, const uint32_t& aWidth,
const uint32_t& aHeight, const uint32_t& aStride,
const gfx::SurfaceFormat& aFormat, const uint32_t& aHotspotX,
@ -3433,7 +3432,7 @@ mozilla::ipc::IPCResult TabParent::RecvGetSystemFont(nsCString* aFontName) {
mozilla::ipc::IPCResult TabParent::RecvRootBrowsingContext(
const BrowsingContextId& aId) {
MOZ_ASSERT(!mBrowsingContext, "May only set browsing context once!");
mBrowsingContext = ChromeBrowsingContext::Get(aId);
mBrowsingContext = CanonicalBrowsingContext::Get(aId);
MOZ_ASSERT(mBrowsingContext, "Invalid ID!");
return IPC_OK();
}

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

@ -67,7 +67,7 @@ class DataSourceSurface;
namespace dom {
class ChromeBrowsingContext;
class CanonicalBrowsingContext;
class ClonedMessageData;
class nsIContentParent;
class Element;
@ -126,7 +126,7 @@ class TabParent final : public PBrowserParent,
nsIXULBrowserWindow* GetXULBrowserWindow();
ChromeBrowsingContext* GetBrowsingContext() { return mBrowsingContext; }
CanonicalBrowsingContext* GetBrowsingContext() { return mBrowsingContext; }
void Destroy();
@ -677,7 +677,7 @@ class TabParent final : public PBrowserParent,
RefPtr<nsFrameLoader> mFrameLoader;
// The root browsing context loaded in this TabParent.
RefPtr<ChromeBrowsingContext> mBrowsingContext;
RefPtr<CanonicalBrowsingContext> mBrowsingContext;
TabId mTabId;

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

@ -6,7 +6,7 @@
#include "mozilla/dom/WindowGlobalParent.h"
#include "mozilla/ipc/InProcessParent.h"
#include "mozilla/dom/ChromeBrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/WindowGlobalActorsBinding.h"
#include "mozilla/dom/ChromeUtils.h"
#include "mozJSComponentLoader.h"
@ -63,7 +63,7 @@ void WindowGlobalParent::Init(const WindowGlobalInit& aInit) {
processId = static_cast<ContentParent*>(Manager()->Manager())->ChildID();
}
mBrowsingContext = ChromeBrowsingContext::Get(aInit.browsingContextId());
mBrowsingContext = CanonicalBrowsingContext::Get(aInit.browsingContextId());
MOZ_ASSERT(mBrowsingContext);
// XXX(nika): This won't be the case soon, but for now this is a good

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

@ -19,7 +19,7 @@ class nsFrameLoader;
namespace mozilla {
namespace dom {
class ChromeBrowsingContext;
class CanonicalBrowsingContext;
class WindowGlobalChild;
class JSWindowActorParent;
@ -66,7 +66,7 @@ class WindowGlobalParent final : public nsISupports,
nsIPrincipal* DocumentPrincipal() { return mDocumentPrincipal; }
// The BrowsingContext which this WindowGlobal has been loaded into.
ChromeBrowsingContext* BrowsingContext() { return mBrowsingContext; }
CanonicalBrowsingContext* BrowsingContext() { return mBrowsingContext; }
// Get the root nsFrameLoader object for the tree of BrowsingContext nodes
// which this WindowGlobal is a part of. This will be the nsFrameLoader
@ -111,7 +111,7 @@ class WindowGlobalParent final : public nsISupports,
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
nsCOMPtr<nsIURI> mDocumentURI;
RefPtr<nsFrameLoader> mFrameLoader;
RefPtr<ChromeBrowsingContext> mBrowsingContext;
RefPtr<CanonicalBrowsingContext> mBrowsingContext;
nsRefPtrHashtable<nsStringHashKey, JSWindowActorParent> mWindowActors;
uint64_t mInnerWindowId;
uint64_t mOuterWindowId;

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

@ -93,6 +93,11 @@ TEST(GfxWidgets, Versioning) {
ASSERT_TRUE(mozilla::Version("42.0a1") < mozilla::Version("42.0.5"));
ASSERT_TRUE(mozilla::Version("42.0b7") < mozilla::Version("42.0.5"));
ASSERT_TRUE(mozilla::Version("") == mozilla::Version("0"));
ASSERT_TRUE(mozilla::Version("1b1b") == mozilla::Version("1b1b"));
ASSERT_TRUE(mozilla::Version("1b1b") < mozilla::Version("1b1c"));
ASSERT_TRUE(mozilla::Version("1b1b") < mozilla::Version("1b1d"));
ASSERT_TRUE(mozilla::Version("1b1c") > mozilla::Version("1b1b"));
ASSERT_TRUE(mozilla::Version("1b1d") > mozilla::Version("1b1b"));
// Note these two; one would expect for 42.0b1 and 42b1 to compare the
// same, but they do not. If this ever changes, we want to know, so

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

@ -6,8 +6,11 @@
#include shared,prim_shared,brush
varying vec3 vUv;
// Interpolated UV coordinates to sample.
varying vec2 vUv;
// X = layer index to sample, Y = flag to allow perspective interpolation of UV.
flat varying vec2 vLayerAndPerspective;
flat varying float vAmount;
flat varying int vOp;
flat varying mat3 vColorMat;
@ -39,8 +42,10 @@ void brush_vs(
vec2 y = mix(extra_data.st_bl, extra_data.st_br, f.x);
f = mix(x, y, f.y);
vec2 uv = mix(uv0, uv1, f);
vUv = vec3(uv / texture_size, res.layer);
float perspective_interpolate = (brush_flags & BRUSH_FLAG_PERSPECTIVE_INTERPOLATION) != 0 ? 1.0 : 0.0;
vUv = uv / texture_size * mix(vi.world_pos.w, 1.0, perspective_interpolate);
vLayerAndPerspective = vec2(res.layer, perspective_interpolate);
vUvClipBounds = vec4(uv0, uv1) / texture_size.xyxy;
float lumR = 0.2126;
@ -146,7 +151,9 @@ vec3 LinearToSrgb(vec3 color) {
}
Fragment brush_fs() {
vec4 Cs = texture(sColor0, vUv);
float perspective_divisor = mix(gl_FragCoord.w, 1.0, vLayerAndPerspective.y);
vec2 uv = vUv * perspective_divisor;
vec4 Cs = texture(sColor0, vec3(uv, vLayerAndPerspective.x));
// Un-premultiply the input.
float alpha = Cs.a;
@ -179,7 +186,7 @@ Fragment brush_fs() {
// Fail-safe to ensure that we don't sample outside the rendered
// portion of a blend source.
alpha *= point_inside_rect(vUv.xy, vUvClipBounds.xy, vUvClipBounds.zw);
alpha *= point_inside_rect(uv, vUvClipBounds.xy, vUvClipBounds.zw);
// Pre-multiply the alpha into the output value.
return Fragment(alpha * vec4(color, 1.0));

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

@ -10,8 +10,10 @@
varying vec2 vLocalPos;
#endif
// Interpolated uv coordinates in xy, and layer in z.
varying vec3 vUv;
// Interpolated UV coordinates to sample.
varying vec2 vUv;
// X = layer index to sample, Y = flag to allow perspective interpolation of UV.
flat varying vec2 vLayerAndPerspective;
// Normalized bounds of the source image in the texture.
flat varying vec4 vUvBounds;
// Normalized bounds of the source image in the texture, adjusted to avoid
@ -97,7 +99,8 @@ void brush_vs(
}
}
vUv.z = res.layer;
float perspective_interpolate = (brush_flags & BRUSH_FLAG_PERSPECTIVE_INTERPOLATION) != 0 ? 1.0 : 0.0;
vLayerAndPerspective = vec2(res.layer, perspective_interpolate);
// Handle case where the UV coords are inverted (e.g. from an
// external image).
@ -141,9 +144,12 @@ void brush_vs(
// Offset and scale vUv here to avoid doing it in the fragment shader.
vec2 repeat = local_rect.size / stretch_size;
vUv.xy = mix(uv0, uv1, f) - min_uv;
vUv.xy /= texture_size;
vUv.xy *= repeat.xy;
vUv = mix(uv0, uv1, f) - min_uv;
vUv /= texture_size;
vUv *= repeat.xy;
if (perspective_interpolate == 0.0) {
vUv *= vi.world_pos.w;
}
#ifdef WR_FEATURE_TEXTURE_RECT
vUvBounds = vec4(0.0, 0.0, vec2(textureSize(sColor0)));
@ -201,12 +207,13 @@ void brush_vs(
Fragment brush_fs() {
vec2 uv_size = vUvBounds.zw - vUvBounds.xy;
float perspective_divisor = mix(gl_FragCoord.w, 1.0, vLayerAndPerspective.y);
#ifdef WR_FEATURE_ALPHA_PASS
// This prevents the uv on the top and left parts of the primitive that was inflated
// for anti-aliasing purposes from going beyound the range covered by the regular
// (non-inflated) primitive.
vec2 local_uv = max(vUv.xy, vec2(0.0));
vec2 local_uv = max(vUv * perspective_divisor, vec2(0.0));
// Handle horizontal and vertical repetitions.
vec2 repeated_uv = mod(local_uv, uv_size) + vUvBounds.xy;
@ -222,13 +229,13 @@ Fragment brush_fs() {
}
#else
// Handle horizontal and vertical repetitions.
vec2 repeated_uv = mod(vUv.xy, uv_size) + vUvBounds.xy;
vec2 repeated_uv = mod(vUv * perspective_divisor, uv_size) + vUvBounds.xy;
#endif
// Clamp the uvs to avoid sampling artifacts.
vec2 uv = clamp(repeated_uv, vUvSampleBounds.xy, vUvSampleBounds.zw);
vec4 texel = TEX_SAMPLE(sColor0, vec3(uv, vUv.z));
vec4 texel = TEX_SAMPLE(sColor0, vec3(uv, vLayerAndPerspective.x));
Fragment frag;

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

@ -4,7 +4,10 @@
#include shared,prim_shared
varying vec3 vUv;
// interpolated UV coordinates to sample.
varying vec2 vUv;
// X = layer index to sample, Y = flag to allow perspective interpolation of UV.
flat varying vec2 vLayerAndPerspective;
flat varying vec4 vUvSampleBounds;
#ifdef WR_VERTEX_SHADER
@ -103,15 +106,18 @@ void main(void) {
f.y, f.x
);
vec2 uv = mix(uv0, uv1, f);
float perspective_interpolate = float(ph.user_data.y);
vUv = vec3(uv / texture_size, res.layer);
vUv = uv / texture_size * mix(gl_Position.w, 1.0, perspective_interpolate);
vLayerAndPerspective = vec2(res.layer, perspective_interpolate);
}
#endif
#ifdef WR_FRAGMENT_SHADER
void main(void) {
float alpha = do_clip();
vec2 uv = clamp(vUv.xy, vUvSampleBounds.xy, vUvSampleBounds.zw);
oFragColor = alpha * textureLod(sPrevPassColor, vec3(uv, vUv.z), 0.0);
float perspective_divisor = mix(gl_FragCoord.w, 1.0, vLayerAndPerspective.y);
vec2 uv = clamp(vUv * perspective_divisor, vUvSampleBounds.xy, vUvSampleBounds.zw);
oFragColor = alpha * textureLod(sPrevPassColor, vec3(uv, vLayerAndPerspective.x), 0.0);
}
#endif

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

@ -597,6 +597,8 @@ impl AlphaBatchBuilder {
#[cfg(debug_assertions)] //TODO: why is this needed?
debug_assert_eq!(prim_instance.prepared_frame_id, render_tasks.frame_id());
let is_chased = prim_instance.is_chased();
let transform_id = transforms
.get_id(
prim_instance.spatial_node_index,
@ -627,6 +629,12 @@ impl AlphaBatchBuilder {
prim_common_data.prim_size,
);
if is_chased {
println!("\tbatch {:?} with clip {:?} and bound {:?}",
prim_rect, clip_task_address, bounding_rect);
}
match prim_instance.kind {
PrimitiveInstanceKind::Clear { data_handle } => {
let prim_data = &ctx.data_stores.prim[data_handle];
@ -972,7 +980,7 @@ impl AlphaBatchBuilder {
let prim_instance = &picture.prim_list.prim_instances[child.anchor];
let prim_info = &ctx.scratch.prim_info[prim_instance.visibility_info.0 as usize];
let pic_index = match prim_instance.kind {
let child_pic_index = match prim_instance.kind {
PrimitiveInstanceKind::Picture { pic_index, .. } => pic_index,
PrimitiveInstanceKind::LineDecoration { .. } |
PrimitiveInstanceKind::TextRun { .. } |
@ -987,7 +995,7 @@ impl AlphaBatchBuilder {
unreachable!();
}
};
let pic = &ctx.prim_store.pictures[pic_index.0];
let pic = &ctx.prim_store.pictures[child_pic_index.0];
// Get clip task, if set, for the picture primitive.
@ -1007,13 +1015,12 @@ impl AlphaBatchBuilder {
transform_id: child.transform_id,
};
let surface_index = pic
let raster_config = pic
.raster_config
.as_ref()
.expect("BUG: 3d primitive was not assigned a surface")
.surface_index;
.expect("BUG: 3d primitive was not assigned a surface");
let (uv_rect_address, _) = ctx
.surfaces[surface_index.0]
.surfaces[raster_config.surface_index.0]
.surface
.as_ref()
.expect("BUG: no surface")
@ -1025,7 +1032,7 @@ impl AlphaBatchBuilder {
let prim_header_index = prim_headers.push(&prim_header, z_id, [
uv_rect_address.as_int(),
0,
if raster_config.establishes_raster_root { 1 } else { 0 },
0,
]);
@ -1058,6 +1065,14 @@ impl AlphaBatchBuilder {
match picture.raster_config {
Some(ref raster_config) => {
// If the child picture was rendered in local space, we can safely
// interpolate the UV coordinates with perspective correction.
let brush_flags = if raster_config.establishes_raster_root {
BrushFlags::PERSPECTIVE_INTERPOLATION
} else {
BrushFlags::empty()
};
match raster_config.composite_mode {
PictureCompositeMode::TileCache { .. } => {
// Construct a local clip rect that ensures we only draw pixels where
@ -1119,7 +1134,7 @@ impl AlphaBatchBuilder {
clip_task_address,
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::empty(),
brush_flags: BrushFlags::empty(),
brush_flags,
user_data: uv_rect_address,
};
@ -1223,7 +1238,7 @@ impl AlphaBatchBuilder {
prim_header_index,
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::empty(),
brush_flags: BrushFlags::empty(),
brush_flags,
clip_task_address,
user_data: uv_rect_address.as_int(),
};
@ -1303,7 +1318,7 @@ impl AlphaBatchBuilder {
clip_task_address,
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::empty(),
brush_flags: BrushFlags::empty(),
brush_flags,
user_data: shadow_uv_rect_address,
};
@ -1312,7 +1327,7 @@ impl AlphaBatchBuilder {
clip_task_address,
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::empty(),
brush_flags: BrushFlags::empty(),
brush_flags,
user_data: content_uv_rect_address,
};
@ -1397,7 +1412,7 @@ impl AlphaBatchBuilder {
clip_task_address,
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::empty(),
brush_flags: BrushFlags::empty(),
brush_flags,
user_data: 0,
};
@ -1442,7 +1457,7 @@ impl AlphaBatchBuilder {
clip_task_address,
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::empty(),
brush_flags: BrushFlags::empty(),
brush_flags,
user_data: 0,
};
@ -1482,7 +1497,7 @@ impl AlphaBatchBuilder {
clip_task_address,
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::empty(),
brush_flags: BrushFlags::empty(),
brush_flags,
user_data: uv_rect_address,
};

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

@ -2442,7 +2442,7 @@ impl PicturePrimitive {
self.raster_config = Some(RasterConfig {
composite_mode,
establishes_raster_root: surface_spatial_node_index == surface.raster_spatial_node_index,
establishes_raster_root: surface.raster_spatial_node_index != parent_raster_spatial_node_index,
surface_index: state.push_surface(surface),
});
}

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

@ -3169,7 +3169,7 @@ impl PrimitiveInstance {
segment.has_mask,
segment.edge_flags,
[0.0; 4],
BrushFlags::empty(),
BrushFlags::PERSPECTIVE_INTERPOLATION,
),
);
});

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

@ -79,9 +79,7 @@ fn compute_offset_from(
let ancestor = &previous_spatial_nodes[parent_index.0 as usize];
match ancestor.node_type {
SpatialNodeType::ReferenceFrame(..) => {
// FIXME(emilio, bug 1523436): Breaking here is technically
// wrong and can happen if the perspective frame is transformed
// as well.
// We don't want to scroll across reference frames.
break;
},
SpatialNodeType::ScrollFrame(ref info) => {

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

@ -16,4 +16,4 @@ platform(linux,mac) fuzzy(1,20) == same-plane.yaml same-plane.png
#== cross.yaml cross-ref.yaml
== mixed-order.yaml mixed-order-ref.yaml
fuzzy(1,40000) == filter.yaml filter-ref.yaml
#fuzzy(1,10000) == gradient.yaml gradient-ref.yaml
fuzzy(1,10000) == gradient.yaml gradient-ref.yaml

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

@ -293,11 +293,13 @@ bool PropertyEmitter::emitInitProp(
}
bool PropertyEmitter::emitInitGetter(JS::Handle<JSAtom*> key) {
obj_ = nullptr;
return emitInit(isClass_ ? JSOP_INITHIDDENPROP_GETTER : JSOP_INITPROP_GETTER,
key, false, nullptr);
}
bool PropertyEmitter::emitInitSetter(JS::Handle<JSAtom*> key) {
obj_ = nullptr;
return emitInit(isClass_ ? JSOP_INITHIDDENPROP_SETTER : JSOP_INITPROP_SETTER,
key, false, nullptr);
}
@ -310,12 +312,14 @@ bool PropertyEmitter::emitInitIndexProp(
}
bool PropertyEmitter::emitInitIndexGetter() {
obj_ = nullptr;
return emitInitIndexOrComputed(
isClass_ ? JSOP_INITHIDDENELEM_GETTER : JSOP_INITELEM_GETTER,
FunctionPrefixKind::Get, false);
}
bool PropertyEmitter::emitInitIndexSetter() {
obj_ = nullptr;
return emitInitIndexOrComputed(
isClass_ ? JSOP_INITHIDDENELEM_SETTER : JSOP_INITELEM_SETTER,
FunctionPrefixKind::Set, false);
@ -329,12 +333,14 @@ bool PropertyEmitter::emitInitComputedProp(
}
bool PropertyEmitter::emitInitComputedGetter() {
obj_ = nullptr;
return emitInitIndexOrComputed(
isClass_ ? JSOP_INITHIDDENELEM_GETTER : JSOP_INITELEM_GETTER,
FunctionPrefixKind::Get, true);
}
bool PropertyEmitter::emitInitComputedSetter() {
obj_ = nullptr;
return emitInitIndexOrComputed(
isClass_ ? JSOP_INITHIDDENELEM_SETTER : JSOP_INITELEM_SETTER,
FunctionPrefixKind::Set, true);

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

@ -1067,6 +1067,19 @@ static bool TrackUnhandledRejections(JSContext* cx, JS::HandleObject promise,
return true;
}
#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
if (cx->runningOOMTest) {
// When OOM happens, we cannot reliably track the set of unhandled
// promise rejections. Throw error only when simulated OOM is used
// *and* promises are used in the test.
JS_ReportErrorASCII(
cx,
"Can't track unhandled rejections while running simulated OOM "
"test. Call ignoreUnhandledRejections before using oomTest etc.");
return false;
}
#endif
if (!sc->unhandledRejectedPromises) {
sc->unhandledRejectedPromises = SetObject::create(cx);
if (!sc->unhandledRejectedPromises) {
@ -1093,7 +1106,8 @@ static bool TrackUnhandledRejections(JSContext* cx, JS::HandleObject promise,
&deleted)) {
return false;
}
MOZ_ASSERT(deleted);
// We can't MOZ_ASSERT(deleted) here, because it's possible we failed to
// add the promise in the first place, due to OOM.
break;
}

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

@ -6712,7 +6712,7 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
#ifdef DEBUG
if (gNoisyContentUpdates && IsFramePartOfIBSplit(parentFrame)) {
printf("nsCSSFrameConstructor::ContentAppended: parentFrame=");
nsFrame::ListTag(stdout, parentFrame);
parentFrame->ListTag(stdout);
printf(" is ib-split\n");
}
#endif
@ -7572,11 +7572,11 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
// frame tree when first-letter style is present.
#ifdef NOISY_FIRST_LETTER
printf("ContentRemoved: containingBlock=");
nsFrame::ListTag(stdout, containingBlock);
containingBlock->ListTag(stdout);
printf(" parentFrame=");
nsFrame::ListTag(stdout, parentFrame);
parentFrame->ListTag(stdout);
printf(" childFrame=");
nsFrame::ListTag(stdout, childFrame);
childFrame->ListTag(stdout);
printf("\n");
#endif
@ -7597,9 +7597,9 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
#ifdef NOISY_FIRST_LETTER
printf(" ==> revised parentFrame=");
nsFrame::ListTag(stdout, parentFrame);
parentFrame->ListTag(stdout);
printf(" childFrame=");
nsFrame::ListTag(stdout, childFrame);
childFrame->ListTag(stdout);
printf("\n");
#endif
}
@ -7607,7 +7607,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
#ifdef DEBUG
if (gReallyNoisyContentUpdates) {
printf("nsCSSFrameConstructor::ContentRemoved: childFrame=");
nsFrame::ListTag(stdout, childFrame);
childFrame->ListTag(stdout);
putchar('\n');
parentFrame->List(stdout);
}

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

@ -471,7 +471,7 @@ void BlockReflowInput::RecoverFloats(nsLineList::iterator aLine,
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("RecoverFloats: tIB=%d,%d (%d,%d) ", tI, tB, mFloatManagerI,
mFloatManagerB);
nsFrame::ListTag(stdout, floatFrame);
floatFrame->ListTag(stdout);
LogicalRect region =
nsFloatManager::GetRegionFor(wm, floatFrame, ContainerSize());
printf(" aDeltaBCoord=%d region={%d,%d,%d,%d}\n", aDeltaBCoord,
@ -1023,7 +1023,7 @@ bool BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat) {
if (nsBlockFrame::gNoisyFloatManager) {
nscoord tI, tB;
FloatManager()->GetTranslation(tI, tB);
nsIFrame::ListTag(stdout, mBlock);
mBlock->ListTag(stdout);
printf(": FlowAndPlaceFloat: AddFloat: tIB=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
tI, tB, mFloatManagerI, mFloatManagerB, region.IStart(wm),
region.BStart(wm), region.ISize(wm), region.BSize(wm));
@ -1033,7 +1033,7 @@ bool BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat) {
nsRect r = aFloat->GetRect();
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placed float: ");
nsFrame::ListTag(stdout, aFloat);
aFloat->ListTag(stdout);
printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height);
}
#endif
@ -1074,7 +1074,7 @@ void BlockReflowInput::PlaceBelowCurrentLineFloats(nsLineBox* aLine) {
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placing bcl float: ");
nsFrame::ListTag(stdout, fc->mFloat);
fc->mFloat->ListTag(stdout);
printf("\n");
}
#endif

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

@ -3645,7 +3645,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
#ifdef NOISY_BLOCK_DIR_MARGINS
ListTag(stdout);
printf(": reflow incomplete, frame=");
nsFrame::ListTag(stdout, mFrame);
frame->ListTag(stdout);
printf(" prevBEndMargin=%d, setting to zero\n",
aState.mPrevBEndMargin.get());
#endif
@ -3671,7 +3671,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
#ifdef NOISY_BLOCK_DIR_MARGINS
ListTag(stdout);
printf(": reflow complete but overflow incomplete for ");
nsFrame::ListTag(stdout, mFrame);
frame->ListTag(stdout);
printf(" prevBEndMargin=%d collapsedBEndMargin=%d\n",
aState.mPrevBEndMargin.get(), collapsedBEndMargin.get());
#endif
@ -3681,7 +3681,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
#ifdef NOISY_BLOCK_DIR_MARGINS
ListTag(stdout);
printf(": reflow complete for ");
nsFrame::ListTag(stdout, mFrame);
frame->ListTag(stdout);
printf(" prevBEndMargin=%d collapsedBEndMargin=%d\n",
aState.mPrevBEndMargin.get(), collapsedBEndMargin.get());
#endif
@ -3690,7 +3690,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
#ifdef NOISY_BLOCK_DIR_MARGINS
ListTag(stdout);
printf(": frame=");
nsFrame::ListTag(stdout, mFrame);
frame->ListTag(stdout);
printf(" carriedOutBEndMargin=%d collapsedBEndMargin=%d => %d\n",
brc.GetCarriedOutBEndMargin().get(), collapsedBEndMargin.get(),
aState.mPrevBEndMargin.get());
@ -4068,7 +4068,7 @@ void nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
#ifdef NOISY_FIRST_LETTER
ListTag(stdout);
printf(": reflowing ");
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf(" reflowingFirstLetter=%s\n",
aLineLayout.GetFirstLetterStyleOK() ? "on" : "off");
#endif
@ -4088,7 +4088,7 @@ void nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
}
#ifdef REALLY_NOISY_REFLOW
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf(": status=%s\n", ToString(frameReflowStatus).c_str());
#endif
@ -4296,7 +4296,7 @@ void nsBlockFrame::SplitLine(BlockReflowInput& aState,
printf("split line: from line=%p pushCount=%d aFrame=",
static_cast<void*>(aLine.get()), pushCount);
if (aFrame) {
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
} else {
printf("(null)");
}
@ -5070,10 +5070,12 @@ void nsBlockFrame::AppendFrames(ChildListID aListID, nsFrameList& aFrameList) {
#ifdef NOISY_REFLOW_REASON
ListTag(stdout);
printf(": append ");
nsFrame::ListTag(stdout, aFrameList);
for (nsIFrame* frame : aFrameList) {
frame->ListTag(out);
}
if (lastKid) {
printf(" after ");
nsFrame::ListTag(stdout, lastKid);
lastKid->ListTag(stdout);
}
printf("\n");
#endif
@ -5111,10 +5113,12 @@ void nsBlockFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
#ifdef NOISY_REFLOW_REASON
ListTag(stdout);
printf(": insert ");
nsFrame::ListTag(stdout, aFrameList);
for (nsIFrame* frame : aFrameList) {
frame->ListTag(out);
}
if (aPrevFrame) {
printf(" after ");
nsFrame::ListTag(stdout, aPrevFrame);
aPrevFrame->ListTag(stdout);
}
printf("\n");
#endif
@ -5131,7 +5135,7 @@ void nsBlockFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) {
#ifdef NOISY_REFLOW_REASON
ListTag(stdout);
printf(": remove ");
nsFrame::ListTag(stdout, aOldFrame);
aOldFrame->ListTag(stdout);
printf("\n");
#endif
@ -5752,7 +5756,7 @@ void nsBlockFrame::DoRemoveFrameInternal(nsIFrame* aDeletedFrame,
#ifdef NOISY_REMOVE_FRAME
printf("DoRemoveFrame: %s line=%p frame=",
searchingOverflowList ? "overflow" : "normal", line.get());
nsFrame::ListTag(stdout, aDeletedFrame);
aDeletedFrame->ListTag(stdout);
printf(" prevSibling=%p deletedNextContinuation=%p\n",
aDeletedFrame->GetPrevSibling(), deletedNextContinuation);
#endif

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

@ -64,7 +64,7 @@ bool nsBlockReflowContext::ComputeCollapsedBStartMargin(
// caller.
#ifdef NOISY_BLOCKDIR_MARGINS
nsFrame::ListTag(stdout, aRI.mFrame);
aRI.mFrame->ListTag(stdout);
printf(": %d => %d\n", aRI.ComputedLogicalMargin().BStart(wm),
aMargin->get());
#endif
@ -211,7 +211,7 @@ done:
}
#ifdef NOISY_BLOCKDIR_MARGINS
nsFrame::ListTag(stdout, aRI.mFrame);
aRI.mFrame->ListTag(stdout);
printf(": => %d\n", aMargin->get());
#endif
@ -236,9 +236,9 @@ void nsBlockReflowContext::ReflowBlock(
mBStartMargin = aPrevMargin;
#ifdef NOISY_BLOCKDIR_MARGINS
nsFrame::ListTag(stdout, mOuterReflowInput.mFrame);
mOuterReflowInput.mFrame->ListTag(stdout);
printf(": reflowing ");
nsFrame::ListTag(stdout, mFrame);
mFrame->ListTag(stdout);
printf(" margin => %d, clearance => %d\n", mBStartMargin.get(), aClearance);
#endif
@ -303,14 +303,14 @@ void nsBlockReflowContext::ReflowBlock(
CRAZY_SIZE(mMetrics.BSize(mWritingMode))) &&
!mFrame->GetParent()->IsCrazySizeAssertSuppressed()) {
printf("nsBlockReflowContext: ");
nsFrame::ListTag(stdout, mFrame);
mFrame->ListTag(stdout);
printf(" metrics=%d,%d!\n", mMetrics.ISize(mWritingMode),
mMetrics.BSize(mWritingMode));
}
if ((mMetrics.ISize(mWritingMode) == nscoord(0xdeadbeef)) ||
(mMetrics.BSize(mWritingMode) == nscoord(0xdeadbeef))) {
printf("nsBlockReflowContext: ");
nsFrame::ListTag(stdout, mFrame);
mFrame->ListTag(stdout);
printf(" didn't set i/b %d,%d!\n", mMetrics.ISize(mWritingMode),
mMetrics.BSize(mWritingMode));
}
@ -382,9 +382,9 @@ bool nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowInput,
#ifdef NOISY_BLOCKDIR_MARGINS
printf(" ");
nsFrame::ListTag(stdout, mOuterReflowInput.mFrame);
mOuterReflowInput.mFrame->ListTag(stdout);
printf(": ");
nsFrame::ListTag(stdout, mFrame);
mFrame->ListTag(stdout);
printf(
" -- collapsing block start & end margin together; BStart=%d "
"spaceBStart=%d\n",

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

@ -7329,21 +7329,21 @@ int32_t nsFrame::ContentIndexInContainer(const nsIFrame* aFrame) {
*/
void DebugListFrameTree(nsIFrame* aFrame) { ((nsFrame*)aFrame)->List(stderr); }
void nsIFrame::ListTag(nsACString& aTo) const { ListTag(aTo, this); }
/* static */
void nsIFrame::ListTag(nsACString& aTo, const nsIFrame* aFrame) {
nsAutoCString nsIFrame::ListTag() const {
nsAutoString tmp;
aFrame->GetFrameName(tmp);
aTo += NS_ConvertUTF16toUTF8(tmp).get();
aTo += nsPrintfCString("@%p", static_cast<const void*>(aFrame));
GetFrameName(tmp);
nsAutoCString tag;
tag += NS_ConvertUTF16toUTF8(tmp);
tag += nsPrintfCString("@%p", static_cast<const void*>(this));
return tag;
}
// Debugging
void nsIFrame::ListGeneric(nsACString& aTo, const char* aPrefix,
uint32_t aFlags) const {
aTo += aPrefix;
ListTag(aTo);
aTo += ListTag();
if (HasView()) {
aTo += nsPrintfCString(" [view=%p]", static_cast<void*>(GetView()));
}
@ -9957,7 +9957,7 @@ void nsFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
#ifdef DEBUG_REFLOW
nsAdaptorAddIndents();
printf("Reflowing: ");
nsFrame::ListTag(stdout, mFrame);
mFrame->ListTag(stdout);
printf("\n");
gIndent2++;
#endif

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

@ -4528,24 +4528,8 @@ class nsIFrame : public nsQueryFrame {
static void IndentBy(FILE* out, int32_t aIndent) {
while (--aIndent >= 0) fputs(" ", out);
}
void ListTag(FILE* out) const { ListTag(out, this); }
static void ListTag(FILE* out, const nsIFrame* aFrame) {
nsAutoCString t;
ListTag(t, aFrame);
fputs(t.get(), out);
}
static void ListTag(FILE* out, const nsFrameList& aFrameList) {
for (nsIFrame* frame : aFrameList) {
ListTag(out, frame);
}
}
void ListTag(nsACString& aTo) const;
nsAutoCString ListTag() const {
nsAutoCString tag;
ListTag(tag);
return tag;
}
static void ListTag(nsACString& aTo, const nsIFrame* aFrame);
void ListTag(FILE* out) const { fputs(ListTag().get(), out); }
nsAutoCString ListTag() const;
void ListGeneric(nsACString& aTo, const char* aPrefix = "",
uint32_t aFlags = 0) const;
enum {TRAVERSE_SUBDOCUMENT_FRAMES = 0x01};

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

@ -156,17 +156,17 @@ void nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
#ifdef DEBUG
if ((aISize != NS_UNCONSTRAINEDSIZE) && CRAZY_SIZE(aISize) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": Init: bad caller: width WAS %d(0x%x)\n", aISize, aISize);
}
if ((aBSize != NS_UNCONSTRAINEDSIZE) && CRAZY_SIZE(aBSize) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": Init: bad caller: height WAS %d(0x%x)\n", aBSize, aBSize);
}
#endif
#ifdef NOISY_REFLOW
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n", aICoord, aBCoord,
aISize, aBSize, aImpactedByFloats ? "true" : "false",
aIsTopOfPage ? "top-of-page" : "");
@ -239,7 +239,7 @@ void nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
void nsLineLayout::EndLineReflow() {
#ifdef NOISY_REFLOW
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": EndLineReflow: width=%d\n",
mRootSpan->mICoord - mRootSpan->mIStart);
#endif
@ -296,14 +296,14 @@ void nsLineLayout::UpdateBand(WritingMode aWM,
if ((availSpace.ISize(lineWM) != NS_UNCONSTRAINEDSIZE) &&
CRAZY_SIZE(availSpace.ISize(lineWM)) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": UpdateBand: bad caller: ISize WAS %d(0x%x)\n",
availSpace.ISize(lineWM), availSpace.ISize(lineWM));
}
if ((availSpace.BSize(lineWM) != NS_UNCONSTRAINEDSIZE) &&
CRAZY_SIZE(availSpace.BSize(lineWM)) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": UpdateBand: bad caller: BSize WAS %d(0x%x)\n",
availSpace.BSize(lineWM), availSpace.BSize(lineWM));
}
@ -322,7 +322,7 @@ void nsLineLayout::UpdateBand(WritingMode aWM,
nscoord deltaISize =
availSpace.ISize(lineWM) - (mRootSpan->mIEnd - mRootSpan->mIStart);
#ifdef NOISY_REFLOW
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": UpdateBand: %d,%d,%d,%d deltaISize=%d deltaICoord=%d\n",
availSpace.IStart(lineWM), availSpace.BStart(lineWM),
availSpace.ISize(lineWM), availSpace.BSize(lineWM), deltaISize,
@ -396,7 +396,7 @@ void nsLineLayout::BeginSpan(nsIFrame* aFrame,
"should no longer be using unconstrained sizes");
#ifdef NOISY_REFLOW
nsFrame::IndentBy(stdout, mSpanDepth + 1);
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf(": BeginSpan leftEdge=%d rightEdge=%d\n", aIStart, aIEnd);
#endif
@ -429,7 +429,7 @@ nscoord nsLineLayout::EndSpan(nsIFrame* aFrame) {
NS_ASSERTION(mSpanDepth > 0, "end-span without begin-span");
#ifdef NOISY_REFLOW
nsFrame::IndentBy(stdout, mSpanDepth);
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf(": EndSpan width=%d\n", mCurrentSpan->mICoord - mCurrentSpan->mIStart);
#endif
PerSpanData* psd = mCurrentSpan;
@ -758,7 +758,7 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
#ifdef REALLY_NOISY_REFLOW
nsFrame::IndentBy(stdout, mSpanDepth);
printf("%p: Begin ReflowFrame pfd=%p ", psd, pfd);
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf("\n");
#endif
@ -976,13 +976,13 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
CRAZY_SIZE(reflowOutput.BSize(lineWM))) &&
!LineContainerFrame()->GetParent()->IsCrazySizeAssertSuppressed()) {
printf("nsLineLayout: ");
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf(" metrics=%d,%d!\n", reflowOutput.Width(), reflowOutput.Height());
}
if ((reflowOutput.Width() == nscoord(0xdeadbeef)) ||
(reflowOutput.Height() == nscoord(0xdeadbeef))) {
printf("nsLineLayout: ");
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf(" didn't set w/h %d,%d!\n", reflowOutput.Width(),
reflowOutput.Height());
}
@ -1099,7 +1099,7 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
#ifdef REALLY_NOISY_REFLOW
nsFrame::IndentBy(stdout, mSpanDepth);
printf("End ReflowFrame ");
nsFrame::ListTag(stdout, aFrame);
aFrame->ListTag(stdout);
printf(" status=%x\n", aReflowStatus);
#endif
}
@ -1250,10 +1250,10 @@ bool nsLineLayout::CanPlaceFrame(PerFrameData* pfd, bool aNotSafeToBreak,
#ifdef NOISY_CAN_PLACE_FRAME
if (nullptr != psd->mFrame) {
nsFrame::ListTag(stdout, psd->mFrame->mFrame);
psd->mFrame->mFrame->ListTag(stdout);
}
printf(": aNotSafeToBreak=%s frame=", aNotSafeToBreak ? "true" : "false");
nsFrame::ListTag(stdout, pfd->mFrame);
pfd->mFrame->ListTag(stdout);
printf(" frameWidth=%d, margins=%d,%d\n",
pfd->mBounds.IEnd(lineWM) + endMargin - psd->mICoord, startMargin,
endMargin);
@ -1443,7 +1443,7 @@ void nsLineLayout::DumpPerSpanData(PerSpanData* psd, int32_t aIndent) {
PerFrameData* pfd = psd->mFirstFrame;
while (nullptr != pfd) {
nsFrame::IndentBy(stdout, aIndent + 1);
nsFrame::ListTag(stdout, pfd->mFrame);
pfd->mFrame->ListTag(stdout);
nsRect rect =
pfd->mBounds.GetPhysicalRect(psd->mWritingMode, ContainerSize());
printf(" %d,%d,%d,%d\n", rect.x, rect.y, rect.width, rect.height);
@ -1623,7 +1623,7 @@ void nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
pfd->mFrame->SetRect(lineWM, pfd->mBounds, containerSize);
#ifdef NOISY_BLOCKDIR_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
pfd->mFrame->ListTag(stdout);
printf(": y=%d dTop=%d [bp.top=%d topLeading=%d]\n",
pfd->mBounds.BStart(lineWM), aDistanceFromStart,
span ? pfd->mBorderPadding.BStart(lineWM) : 0,
@ -1643,7 +1643,7 @@ void nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
pfd->mFrame->SetRect(lineWM, pfd->mBounds, containerSize);
#ifdef NOISY_BLOCKDIR_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
pfd->mFrame->ListTag(stdout);
printf(": y=%d\n", pfd->mBounds.BStart(lineWM));
#endif
break;
@ -1761,7 +1761,7 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
#ifdef NOISY_BLOCKDIR_ALIGN
printf("[%sSpan]", (psd == mRootSpan) ? "Root" : "");
nsFrame::ListTag(stdout, spanFrame);
spanFrame->ListTag(stdout);
printf(": preMode=%s strictMode=%s w/h=%d,%d emptyContinuation=%s",
preMode ? "yes" : "no",
mPresContext->CompatibilityMode() != eCompatibility_NavQuirks ? "yes"
@ -1860,7 +1860,7 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
maxBCoord = BLOCKDIR_ALIGN_FRAMES_NO_MAXIMUM;
#ifdef NOISY_BLOCKDIR_ALIGN
printf("[RootSpan]");
nsFrame::ListTag(stdout, spanFrame);
spanFrame->ListTag(stdout);
printf(
": pass1 valign frames: topEdge=%d minLineBSize=%d "
"zeroEffectiveSpanBox=%s\n",
@ -1920,7 +1920,7 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
#ifdef NOISY_BLOCKDIR_ALIGN
printf("[%sSpan]", (psd == mRootSpan) ? "Root" : "");
nsFrame::ListTag(stdout, spanFrame);
spanFrame->ListTag(stdout);
printf(
": baseLine=%d logicalBSize=%d topLeading=%d h=%d bp=%d,%d "
"zeroEffectiveSpanBox=%s\n",
@ -1970,7 +1970,7 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
uint8_t verticalAlignEnum = frame->VerticalAlignEnum();
#ifdef NOISY_BLOCKDIR_ALIGN
printf(" [frame]");
nsFrame::ListTag(stdout, frame);
frame->ListTag(stdout);
printf(": verticalAlignUnit=%d (enum == %d", verticalAlign.GetUnit(),
((eStyleUnit_Enumerated == verticalAlign.GetUnit())
? verticalAlign.GetIntValue()
@ -2491,9 +2491,9 @@ bool nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
pfd = pfd->Last();
while (nullptr != pfd) {
#ifdef REALLY_NOISY_TRIM
nsFrame::ListTag(stdout, psd->mFrame->mFrame);
psd->mFrame->mFrame->ListTag(stdout);
printf(": attempting trim of ");
nsFrame::ListTag(stdout, pfd->mFrame);
pfd->mFrame->ListTag(stdout);
printf("\n");
#endif
PerSpanData* childSpan = pfd->mSpan;
@ -2556,9 +2556,9 @@ bool nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
->TrimTrailingWhiteSpace(
mBlockReflowInput->mRenderingContext->GetDrawTarget());
#ifdef NOISY_TRIM
nsFrame::ListTag(stdout, psd->mFrame->mFrame);
psd->mFrame->mFrame->ListTag(stdout);
printf(": trim of ");
nsFrame::ListTag(stdout, pfd->mFrame);
pfd->mFrame->ListTag(stdout);
printf(" returned %d\n", trimOutput.mDeltaWidth);
#endif
@ -3067,7 +3067,7 @@ void nsLineLayout::TextAlignLine(nsLineBox* aLine, bool aIsLastLine) {
nscoord availISize = psd->mIEnd - psd->mIStart;
nscoord remainingISize = availISize - aLine->ISize();
#ifdef NOISY_INLINEDIR_ALIGN
nsFrame::ListTag(stdout, mBlockReflowInput->mFrame);
mBlockReflowInput->mFrame->ListTag(stdout);
printf(": availISize=%d lineBounds.IStart=%d lineISize=%d delta=%d\n",
availISize, aLine->IStart(), aLine->ISize(), remainingISize);
#endif

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

@ -267,7 +267,7 @@ void nsPlaceholderFrame::List(FILE* out, const char* aPrefix,
if (mOutOfFlowFrame) {
str += " outOfFlowFrame=";
nsFrame::ListTag(str, mOutOfFlowFrame);
str += mOutOfFlowFrame->ListTag();
}
fprintf_stderr(out, "%s\n", str.get());
}

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

@ -21,7 +21,6 @@ using namespace mozilla;
#ifdef XP_WIN
const wchar_t* kWindowsDefaultRootStoreName = L"ROOT";
NS_NAMED_LITERAL_CSTRING(kMicrosoftFamilySafetyCN, "Microsoft Family Safety");
// Helper function to determine if the OS considers the given certificate to be
// a trust anchor for TLS server auth certificates. This is to be used in the
@ -96,6 +95,24 @@ UniqueCERTCertificate PCCERT_CONTEXTToCERTCertificate(PCCERT_CONTEXT pccert) {
true)); // copy DER
}
// Because HCERTSTORE is just a typedef void*, we can't use any of the nice
// scoped or unique pointer templates. To elaborate, any attempt would
// instantiate those templates with T = void. When T gets used in the context
// of T&, this results in void&, which isn't legal.
class ScopedCertStore final {
public:
explicit ScopedCertStore(HCERTSTORE certstore) : certstore(certstore) {}
~ScopedCertStore() { CertCloseStore(certstore, 0); }
HCERTSTORE get() { return certstore; }
private:
ScopedCertStore(const ScopedCertStore&) = delete;
ScopedCertStore& operator=(const ScopedCertStore&) = delete;
HCERTSTORE certstore;
};
// Loads the enterprise roots at the registry location corresponding to the
// given location flag.
// Supported flags are:
@ -153,20 +170,13 @@ static void GatherEnterpriseRootsForLocation(DWORD locationFlag,
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("couldn't decode certificate"));
continue;
}
// Don't import the Microsoft Family Safety root (this prevents the
// Enterprise Roots feature from interacting poorly with the Family
// Safety support).
UniquePORTString subjectName(CERT_GetCommonName(&nssCertificate->subject));
if (kMicrosoftFamilySafetyCN.Equals(subjectName.get())) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("skipping Family Safety Root"));
continue;
}
if (CERT_AddCertToListTail(roots.get(), nssCertificate.get()) !=
SECSuccess) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("couldn't add cert to list"));
continue;
}
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Imported '%s'", subjectName.get()));
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("Imported '%s'", nssCertificate->subjectName));
numImported++;
// now owned by roots
Unused << nssCertificate.release();

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

@ -10,39 +10,6 @@
#include "ErrorList.h"
#include "ScopedNSSTypes.h"
#ifdef XP_WIN
# include "windows.h" // this needs to be before the following includes
# include "wincrypt.h"
#endif // XP_WIN
nsresult GatherEnterpriseRoots(mozilla::UniqueCERTCertList& result);
#ifdef XP_WIN
mozilla::UniqueCERTCertificate PCCERT_CONTEXTToCERTCertificate(
PCCERT_CONTEXT pccert);
extern const wchar_t* kWindowsDefaultRootStoreName;
extern const nsLiteralCString kMicrosoftFamilySafetyCN;
// Because HCERTSTORE is just a typedef void*, we can't use any of the nice
// scoped or unique pointer templates. To elaborate, any attempt would
// instantiate those templates with T = void. When T gets used in the context
// of T&, this results in void&, which isn't legal.
class ScopedCertStore final {
public:
explicit ScopedCertStore(HCERTSTORE certstore) : certstore(certstore) {}
~ScopedCertStore() { CertCloseStore(certstore, 0); }
HCERTSTORE get() { return certstore; }
private:
ScopedCertStore(const ScopedCertStore&) = delete;
ScopedCertStore& operator=(const ScopedCertStore&) = delete;
HCERTSTORE certstore;
};
#endif // XP_WIN
#endif // EnterpriseRoots_h

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

@ -444,140 +444,34 @@ static nsresult AccountHasFamilySafetyEnabled(bool& enabled) {
enabled = loggingRequired == 1 || webFilterOn == 1;
return NS_OK;
}
nsresult nsNSSComponent::MaybeImportFamilySafetyRoot(
PCCERT_CONTEXT certificate, bool& wasFamilySafetyRoot) {
MutexAutoLock lock(mMutex);
MOZ_ASSERT(NS_IsMainThread());
if (!NS_IsMainThread()) {
return NS_ERROR_NOT_SAME_THREAD;
}
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("MaybeImportFamilySafetyRoot"));
wasFamilySafetyRoot = false;
UniqueCERTCertificate nssCertificate(
PCCERT_CONTEXTToCERTCertificate(certificate));
if (!nssCertificate) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("couldn't decode certificate"));
return NS_ERROR_FAILURE;
}
// Looking for a certificate with the common name 'Microsoft Family Safety'
UniquePORTString subjectName(CERT_GetCommonName(&nssCertificate->subject));
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("subject name is '%s'", subjectName.get()));
if (kMicrosoftFamilySafetyCN.Equals(subjectName.get())) {
wasFamilySafetyRoot = true;
MOZ_ASSERT(!mFamilySafetyRoot);
mFamilySafetyRoot = std::move(nssCertificate);
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("added Family Safety root"));
}
return NS_OK;
}
nsresult nsNSSComponent::LoadFamilySafetyRoot() {
ScopedCertStore certstore(
CertOpenSystemStore(0, kWindowsDefaultRootStoreName));
if (!certstore.get()) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("couldn't get certstore '%S'", kWindowsDefaultRootStoreName));
return NS_ERROR_FAILURE;
}
// Any resources held by the certificate are released by the next call to
// CertFindCertificateInStore.
PCCERT_CONTEXT certificate = nullptr;
while ((certificate = CertFindCertificateInStore(
certstore.get(), X509_ASN_ENCODING, 0, CERT_FIND_ANY, nullptr,
certificate))) {
bool wasFamilySafetyRoot = false;
nsresult rv = MaybeImportFamilySafetyRoot(certificate, wasFamilySafetyRoot);
if (NS_SUCCEEDED(rv) && wasFamilySafetyRoot) {
return NS_OK; // We're done (we're only expecting one root).
}
}
return NS_ERROR_FAILURE;
}
#endif // XP_WIN
void nsNSSComponent::UnloadFamilySafetyRoot() {
MOZ_ASSERT(NS_IsMainThread());
if (!NS_IsMainThread()) {
return;
}
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("UnloadFamilySafetyRoot"));
// We can't call ChangeCertTrustWithPossibleAuthentication while holding
// mMutex (because it could potentially call back in to nsNSSComponent and
// attempt to acquire mMutex), so we move mFamilySafetyRoot out of
// nsNSSComponent into a local handle. This has the side-effect of clearing
// mFamilySafetyRoot, which is what we want anyway.
UniqueCERTCertificate familySafetyRoot;
{
MutexAutoLock lock(mMutex);
if (!mFamilySafetyRoot) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("Family Safety Root wasn't present"));
return;
}
familySafetyRoot = std::move(mFamilySafetyRoot);
MOZ_ASSERT(!mFamilySafetyRoot);
}
MOZ_ASSERT(familySafetyRoot);
// It would be intuitive to set the trust to { 0, 0, 0 } here. However, this
// doesn't work for temporary certificates because CERT_ChangeCertTrust first
// looks up the current trust settings in the permanent cert database, finds
// that such trust doesn't exist, considers the current trust to be
// { 0, 0, 0 }, and decides that it doesn't need to update the trust since
// they're the same. To work around this, we set a non-zero flag to ensure
// that the trust will get updated.
CERTCertTrust trust = {CERTDB_USER, 0, 0};
if (ChangeCertTrustWithPossibleAuthentication(familySafetyRoot, trust,
nullptr) != SECSuccess) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("couldn't untrust certificate for TLS server auth"));
}
}
// The supported values of this pref are:
// 0: disable detecting Family Safety mode and importing the root
// 1: only attempt to detect Family Safety mode (don't import the root)
// 2: detect Family Safety mode and import the root
// On Windows 8.1, if the following preference is 2, we will attempt to detect
// if the Family Safety TLS interception feature has been enabled. If so, we
// will behave as if the enterprise roots feature has been enabled (i.e. import
// and trust third party root certificates from the OS).
// With any other value of the pref or on any other platform, this does nothing.
// This preference takes precedence over "security.enterprise_roots.enabled".
const char* kFamilySafetyModePref = "security.family_safety.mode";
const uint32_t kFamilySafetyModeDefault = 0;
// The telemetry gathered by this function is as follows:
// 0-2: the value of the Family Safety mode pref
// 3: detecting Family Safety mode failed
// 4: Family Safety was not enabled
// 5: Family Safety was enabled
// 6: failed to import the Family Safety root
// 7: successfully imported the root
void nsNSSComponent::MaybeEnableFamilySafetyCompatibility(
bool nsNSSComponent::ShouldEnableEnterpriseRootsForFamilySafety(
uint32_t familySafetyMode) {
#ifdef XP_WIN
if (!(IsWin8Point1OrLater() && !IsWin10OrLater())) {
return;
return false;
}
if (familySafetyMode > 2) {
familySafetyMode = 0;
}
if (familySafetyMode == 0) {
return;
if (familySafetyMode != 2) {
return false;
}
bool familySafetyEnabled;
nsresult rv = AccountHasFamilySafetyEnabled(familySafetyEnabled);
if (NS_FAILED(rv)) {
return;
}
if (!familySafetyEnabled) {
return;
}
if (familySafetyMode == 2) {
rv = LoadFamilySafetyRoot();
if (NS_FAILED(rv)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("failed to load Family Safety root"));
}
return false;
}
return familySafetyEnabled;
#else
return false;
#endif // XP_WIN
}
@ -641,10 +535,16 @@ void nsNSSComponent::MaybeImportEnterpriseRoots() {
}
bool importEnterpriseRoots =
Preferences::GetBool(kEnterpriseRootModePref, false);
if (!importEnterpriseRoots) {
return;
uint32_t familySafetyMode =
Preferences::GetUint(kFamilySafetyModePref, kFamilySafetyModeDefault);
// If we've been configured to detect the Family Safety TLS interception
// feature, see if it's enabled. If so, we want to import enterprise roots.
if (ShouldEnableEnterpriseRootsForFamilySafety(familySafetyMode)) {
importEnterpriseRoots = true;
}
if (importEnterpriseRoots) {
ImportEnterpriseRoots();
}
ImportEnterpriseRoots();
}
void nsNSSComponent::ImportEnterpriseRoots() {
@ -695,25 +595,6 @@ nsresult nsNSSComponent::TrustLoaded3rdPartyRoots() {
}
}
}
#ifdef XP_WIN
// Again copy mFamilySafetyRoot so we don't hold mMutex while calling
// ChangeCertTrustWithPossibleAuthentication.
UniqueCERTCertificate familySafetyRoot;
{
MutexAutoLock lock(mMutex);
if (mFamilySafetyRoot) {
familySafetyRoot.reset(CERT_DupCertificate(mFamilySafetyRoot.get()));
if (!familySafetyRoot) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
}
if (familySafetyRoot && ChangeCertTrustWithPossibleAuthentication(
familySafetyRoot, trust, nullptr) != SECSuccess) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
("couldn't trust family safety certificate for TLS server auth"));
}
#endif
return NS_OK;
}
@ -822,10 +703,15 @@ LoadLoadableRootsTask::Run() {
}
}
// If we've been configured to detect the Family Safety TLS interception
// feature, see if it's enabled. If so, we want to import enterprise roots.
if (mNSSComponent->ShouldEnableEnterpriseRootsForFamilySafety(
mFamilySafetyMode)) {
mImportEnterpriseRoots = true;
}
if (mImportEnterpriseRoots) {
mNSSComponent->ImportEnterpriseRoots();
}
mNSSComponent->MaybeEnableFamilySafetyCompatibility(mFamilySafetyMode);
nsresult rv = mNSSComponent->TrustLoaded3rdPartyRoots();
if (NS_FAILED(rv)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Error,
@ -1986,10 +1872,7 @@ void nsNSSComponent::ShutdownNSS() {
::mozilla::psm::UnloadLoadableRoots();
MutexAutoLock lock(mMutex);
#ifdef XP_WIN
mFamilySafetyRoot = nullptr;
mEnterpriseRoots = nullptr;
#endif
PK11_SetPasswordFunc((PK11PasswordFunc) nullptr);
@ -2107,20 +1990,13 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic,
Preferences::GetString("security.test.built_in_root_hash",
mTestBuiltInRootHash);
#endif // DEBUG
} else if (prefName.Equals(kFamilySafetyModePref)) {
// When the pref changes, it is safe to change the trust of 3rd party
// roots in the same event tick that they're loaded.
UnloadFamilySafetyRoot();
uint32_t familySafetyMode =
Preferences::GetUint(kFamilySafetyModePref, kFamilySafetyModeDefault);
MaybeEnableFamilySafetyCompatibility(familySafetyMode);
TrustLoaded3rdPartyRoots();
} else if (prefName.EqualsLiteral("security.content.signature.root_hash")) {
MutexAutoLock lock(mMutex);
mContentSigningRootHash.Truncate();
Preferences::GetString("security.content.signature.root_hash",
mContentSigningRootHash);
} else if (prefName.Equals(kEnterpriseRootModePref)) {
} else if (prefName.Equals(kEnterpriseRootModePref) ||
prefName.Equals(kFamilySafetyModePref)) {
// When the pref changes, it is safe to change the trust of 3rd party
// roots in the same event tick that they're loaded.
UnloadEnterpriseRoots();

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

@ -86,17 +86,10 @@ class nsNSSComponent final : public nsINSSComponent, public nsIObserver {
void ImportEnterpriseRoots();
void UnloadEnterpriseRoots();
void MaybeEnableFamilySafetyCompatibility(uint32_t familySafetyMode);
void UnloadFamilySafetyRoot();
bool ShouldEnableEnterpriseRootsForFamilySafety(uint32_t familySafetyMode);
nsresult TrustLoaded3rdPartyRoots();
#ifdef XP_WIN
nsresult MaybeImportFamilySafetyRoot(PCCERT_CONTEXT certificate,
bool& wasFamilySafetyRoot);
nsresult LoadFamilySafetyRoot();
#endif // XP_WIN
// mLoadableRootsLoadedMonitor protects mLoadableRootsLoaded.
mozilla::Monitor mLoadableRootsLoadedMonitor;
bool mLoadableRootsLoaded;
@ -115,7 +108,6 @@ class nsNSSComponent final : public nsINSSComponent, public nsIObserver {
nsString mMitmCanaryIssuer;
bool mMitmDetecionEnabled;
mozilla::UniqueCERTCertList mEnterpriseRoots;
mozilla::UniqueCERTCertificate mFamilySafetyRoot;
// The following members are accessed only on the main thread:
static int mInstanceCount;

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

@ -43,11 +43,12 @@ pref("security.remember_cert_checkbox_default_setting", true);
pref("security.ask_for_password", 0);
pref("security.password_lifetime", 30);
// The supported values of this pref are:
// 0: disable detecting Family Safety mode and importing the root
// 1: only attempt to detect Family Safety mode (don't import the root)
// 2: detect Family Safety mode and import the root
// (This is only relevant to Windows 8.1)
// On Windows 8.1, if the following preference is 2, we will attempt to detect
// if the Family Safety TLS interception feature has been enabled. If so, we
// will behave as if the enterprise roots feature has been enabled (i.e. import
// and trust third party root certificates from the OS).
// With any other value of the pref or on any other platform, this does nothing.
// This preference takes precedence over "security.enterprise_roots.enabled".
pref("security.family_safety.mode", 2);
pref("security.enterprise_roots.enabled", false);

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

@ -521,7 +521,7 @@ linux64-rust-1.31:
treeherder:
kind: build
platform: toolchains/opt
symbol: TL(rust)
symbol: TL(rust-1.31)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
@ -537,6 +537,29 @@ linux64-rust-1.31:
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',
]
toolchain-artifact: public/build/rustc.tar.xz
linux64-rust-1.32:
description: "rust repack"
treeherder:
kind: build
platform: toolchains/opt
symbol: TL(rust)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
max-run-time: 7200
env:
UPLOAD_DIR: artifacts
run:
using: toolchain-script
script: repack_rust.py
arguments: [
'--channel', '1.32.0',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',
]
toolchain-alias: linux64-rust
toolchain-artifact: public/build/rustc.tar.xz
@ -568,7 +591,7 @@ linux64-rust-macos-1.31:
treeherder:
kind: build
platform: toolchains/opt
symbol: TL(rust-macos)
symbol: TL(rust-macos-1.31)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
@ -584,6 +607,29 @@ linux64-rust-macos-1.31:
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-apple-darwin',
]
toolchain-artifact: public/build/rustc.tar.xz
linux64-rust-macos-1.32:
description: "rust repack with macos-cross support"
treeherder:
kind: build
platform: toolchains/opt
symbol: TL(rust-macos)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
max-run-time: 7200
env:
UPLOAD_DIR: artifacts
run:
using: toolchain-script
script: repack_rust.py
arguments: [
'--channel', '1.32.0',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-apple-darwin',
]
toolchain-alias: linux64-rust-macos
toolchain-artifact: public/build/rustc.tar.xz
@ -610,7 +656,7 @@ linux64-rust-nightly-macos:
]
toolchain-artifact: public/build/rustc.tar.xz
linux64-rust-android-1.31:
linux64-rust-android-1.32:
description: "rust repack with android-cross support"
treeherder:
kind: build
@ -626,7 +672,7 @@ linux64-rust-android-1.31:
using: toolchain-script
script: repack_rust.py
arguments: [
'--channel', '1.31.0',
'--channel', '1.32.0',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'armv7-linux-androideabi',
@ -904,7 +950,7 @@ wrench-deps:
- 'taskcluster/scripts/misc/tooltool-download.sh'
toolchain-artifact: public/build/wrench-deps.tar.bz2
toolchains:
- linux64-rust-1.31 # whatever m-c is built with
- linux64-rust-1.32 # whatever m-c is built with
linux64-minidump-stackwalk:
description: "minidump_stackwalk toolchain build"

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

@ -110,7 +110,7 @@ win64-rust-1.28:
]
toolchain-artifact: public/build/rustc.tar.bz2
win64-rust-1.31:
win64-rust-1.32:
description: "rust repack"
treeherder:
kind: build
@ -127,7 +127,7 @@ win64-rust-1.31:
using: toolchain-script
script: repack_rust.py
arguments: [
'--channel', '1.31.0',
'--channel', '1.32.0',
'--host', 'x86_64-pc-windows-msvc',
'--target', 'x86_64-pc-windows-msvc',
'--target', 'i686-pc-windows-msvc',
@ -206,7 +206,7 @@ mingw32-rust-1.31:
treeherder:
kind: build
platform: toolchains/opt
symbol: TMW(rust)
symbol: TMW(rust-1.31)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
@ -225,6 +225,32 @@ mingw32-rust-1.31:
'--target', 'x86_64-pc-windows-gnu',
'--target', 'x86_64-unknown-linux-gnu',
]
toolchain-artifact: public/build/rustc.tar.xz
mingw32-rust-1.32:
description: "rust repack"
treeherder:
kind: build
platform: toolchains/opt
symbol: TMW(rust)
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
docker-image: {in-tree: toolchain-build}
max-run-time: 7200
env:
UPLOAD_DIR: artifacts
run:
using: toolchain-script
script: repack_rust.py
arguments: [
'--channel', '1.32.0',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',
'--target', 'i686-pc-windows-gnu',
'--target', 'x86_64-pc-windows-gnu',
'--target', 'x86_64-unknown-linux-gnu',
]
toolchain-alias: mingw32-rust
toolchain-artifact: public/build/rustc.tar.xz

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

@ -177,7 +177,7 @@
<td id="multiprocess-box">
<span id="multiprocess-box-process-count"/>
<span id="multiprocess-box-status" data-l10n-id="multi-process-status-unknown"/>
<span id="multiprocess-box-status"/>
</td>
</tr>

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

@ -127,8 +127,7 @@ detail-update-manual =
.tooltiptext = Dont automatically install updates
# Used as a description for the option to allow or block an add-on in private windows.
detail-private-browsing =
.value = Run in Private Windows
detail-private-browsing-label = Run in Private Windows
detail-private-browsing-description = Extension will work in Private Windows, and have access to your online activities. <label data-l10n-name="detail-private-browsing-learn-more">Learn more</label>

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

@ -547,7 +547,7 @@
</columns>
<rows id="detail-rows">
<row class="detail-row-complex" id="detail-privateBrowsing-row">
<label class="detail-row-label" data-l10n-id="detail-private-browsing"/>
<label class="detail-row-label" data-l10n-id="detail-private-browsing-label"/>
<hbox align="center">
<radiogroup id="detail-privateBrowsing" orient="horizontal">
<radio data-l10n-id="detail-private-browsing-on"

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

@ -24,7 +24,6 @@
overflow-x: hidden;
margin-right: 28px;
margin-left: 28px;
max-width: 664px;
}
.global-warning {
@ -101,7 +100,6 @@
-moz-box-align: center;
margin-right: 28px;
margin-left: 28px;
max-width: 664px;
margin-bottom: 10px;
}

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

@ -36,10 +36,6 @@
* bool IsVersionValid(const char* version) {
* return mozilla::Version("15.a2") <= version;
* }
*
* On Windows, if your version strings are wide characters, you should use the
* mozilla::VersionW variant instead. The semantics of that class is the same
* as Version.
*/
namespace mozilla {
@ -60,13 +56,13 @@ struct Version {
~Version() { free(versionContent); }
bool operator<(const Version& aRhs) const {
return CompareVersions(versionContent, aRhs.ReadContent()) == -1;
return CompareVersions(versionContent, aRhs.ReadContent()) < 0;
}
bool operator<=(const Version& aRhs) const {
return CompareVersions(versionContent, aRhs.ReadContent()) < 1;
}
bool operator>(const Version& aRhs) const {
return CompareVersions(versionContent, aRhs.ReadContent()) == 1;
return CompareVersions(versionContent, aRhs.ReadContent()) > 0;
}
bool operator>=(const Version& aRhs) const {
return CompareVersions(versionContent, aRhs.ReadContent()) > -1;
@ -78,13 +74,13 @@ struct Version {
return CompareVersions(versionContent, aRhs.ReadContent()) != 0;
}
bool operator<(const char* aRhs) const {
return CompareVersions(versionContent, aRhs) == -1;
return CompareVersions(versionContent, aRhs) < 0;
}
bool operator<=(const char* aRhs) const {
return CompareVersions(versionContent, aRhs) < 1;
}
bool operator>(const char* aRhs) const {
return CompareVersions(versionContent, aRhs) == 1;
return CompareVersions(versionContent, aRhs) > 0;
}
bool operator>=(const char* aRhs) const {
return CompareVersions(versionContent, aRhs) > -1;
@ -100,41 +96,6 @@ struct Version {
char* versionContent;
};
#ifdef XP_WIN
struct VersionW {
explicit VersionW(const char16_t* aVersionStringW) {
versionContentW =
reinterpret_cast<char16_t*>(wcsdup(char16ptr_t(aVersionStringW)));
}
const char16_t* ReadContentW() const { return versionContentW; }
~VersionW() { free(versionContentW); }
bool operator<(const VersionW& aRhs) const {
return CompareVersions(versionContentW, aRhs.ReadContentW()) == -1;
}
bool operator<=(const VersionW& aRhs) const {
return CompareVersions(versionContentW, aRhs.ReadContentW()) < 1;
}
bool operator>(const VersionW& aRhs) const {
return CompareVersions(versionContentW, aRhs.ReadContentW()) == 1;
}
bool operator>=(const VersionW& aRhs) const {
return CompareVersions(versionContentW, aRhs.ReadContentW()) > -1;
}
bool operator==(const VersionW& aRhs) const {
return CompareVersions(versionContentW, aRhs.ReadContentW()) == 0;
}
bool operator!=(const VersionW& aRhs) const {
return CompareVersions(versionContentW, aRhs.ReadContentW()) != 0;
}
private:
char16_t* versionContentW;
};
#endif
} // namespace mozilla
#endif // nsVersionComparator_h__