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

This commit is contained in:
Noemi Erli 2018-11-13 18:34:32 +02:00
Родитель 3a68003805 6e9e399066
Коммит 3b0f69841f
164 изменённых файлов: 1701 добавлений и 946 удалений

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

@ -26,7 +26,6 @@ gfx/tests/chrome/**
gfx/tests/mochitest/**
image/**
layout/**
memory/replace/dmd/test/**
modules/**
netwerk/cookie/test/browser/**
netwerk/test/browser/**

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

@ -231,9 +231,9 @@
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findPrevious" modifiers="shift"/>
<key id="addBookmarkAsKb" key="&bookmarkThisPageCmd.commandkey;" command="Browser:AddBookmarkAs" modifiers="accel"/>
<key id="bookmarkAllTabsKb" key="&bookmarkThisPageCmd.commandkey;" oncommand="PlacesCommandHook.bookmarkPages(PlacesCommandHook.uniqueCurrentPages);" modifiers="accel,shift"/>
# Accel+Shift+A-F are reserved on GTK
#ifndef MOZ_WIDGET_GTK
<key id="bookmarkAllTabsKb" key="&bookmarkThisPageCmd.commandkey;" oncommand="PlacesCommandHook.bookmarkPages(PlacesCommandHook.uniqueCurrentPages);" modifiers="accel,shift"/>
<key id="manBookmarkKb" key="&bookmarksCmd.commandkey;" command="Browser:ShowAllBookmarks" modifiers="accel,shift"/>
#else
<key id="manBookmarkKb" key="&bookmarksGtkCmd.commandkey;" command="Browser:ShowAllBookmarks" modifiers="accel,shift"/>

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

@ -23,10 +23,6 @@ window._gBrowser = {
ChromeUtils.defineModuleGetter(this, "UrlbarProviderOpenTabs",
"resource:///modules/UrlbarProviderOpenTabs.jsm");
XPCOMUtils.defineLazyServiceGetters(this, {
serializationHelper: ["@mozilla.org/network/serialization-helper;1", "nsISerializationHelper"],
});
Services.obs.addObserver(this, "contextual-identity-updated");
Services.els.addSystemEventListener(document, "keydown", this, false);

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

@ -9,10 +9,10 @@ add_task(async function() {
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:home" }, async function(browser) {
// Add a test engine that provides suggestions and switch to it.
let currEngine = Services.search.currentEngine;
let currEngine = Services.search.defaultEngine;
let engine = await promiseNewEngine("searchSuggestionEngine.xml");
let p = promiseContentSearchChange(browser, engine.name);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
await p;
await ContentTask.spawn(browser, null, async function() {
@ -68,7 +68,7 @@ add_task(async function() {
await mutationPromise;
// Click the second suggestion.
let expectedURL = Services.search.currentEngine
let expectedURL = Services.search.defaultEngine
.getSubmission("xbar", null, "homepage").uri.spec;
let loadPromise = waitForDocLoadAndStopIt(expectedURL);
await BrowserTestUtils.synthesizeMouseAtCenter("#TEMPID", {
@ -76,7 +76,7 @@ add_task(async function() {
}, browser);
await loadPromise;
Services.search.currentEngine = currEngine;
Services.search.defaultEngine = currEngine;
try {
Services.search.removeEngine(engine);
} catch (ex) { }

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

@ -10,10 +10,10 @@ add_task(async function() {
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:home" }, async function(browser) {
// Add a test engine that provides suggestions and switch to it.
let currEngine = Services.search.currentEngine;
let currEngine = Services.search.defaultEngine;
let engine = await promiseNewEngine("searchSuggestionEngine.xml");
let p = promiseContentSearchChange(browser, engine.name);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
await p;
await ContentTask.spawn(browser, null, async function() {
@ -54,7 +54,7 @@ add_task(async function() {
"Search suggestion table hidden");
});
Services.search.currentEngine = currEngine;
Services.search.defaultEngine = currEngine;
try {
Services.search.removeEngine(engine);
} catch (ex) { }

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

@ -8,14 +8,14 @@ add_task(async function() {
info("Check that performing a search fires a search event and records to Telemetry.");
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:home" }, async function(browser) {
let currEngine = Services.search.currentEngine;
let currEngine = Services.search.defaultEngine;
let engine = await promiseNewEngine("searchSuggestionEngine.xml");
// Make this actually work in healthreport by giving it an ID:
Object.defineProperty(engine.wrappedJSObject, "identifier",
{ value: "org.mozilla.testsearchsuggestions" });
let p = promiseContentSearchChange(browser, engine.name);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
await p;
await ContentTask.spawn(browser, { expectedName: engine.name }, async function(args) {
@ -37,7 +37,7 @@ add_task(async function() {
let searchStr = "a search";
let expectedURL = Services.search.currentEngine
let expectedURL = Services.search.defaultEngine
.getSubmission(searchStr, null, "homepage").uri.spec;
let promise = waitForDocLoadAndStopIt(expectedURL, browser);
@ -58,7 +58,7 @@ add_task(async function() {
Assert.equal(hs[histogramKey].sum, numSearchesBefore + 1,
"histogram sum should be incremented");
Services.search.currentEngine = currEngine;
Services.search.defaultEngine = currEngine;
try {
Services.search.removeEngine(engine);
} catch (ex) {}

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

@ -737,7 +737,7 @@ function promiseMsg(name, type, msgMan) {
function setUpEngines() {
return (async function() {
info("Removing default search engines");
let currentEngineName = Services.search.currentEngine.name;
let currentEngineName = Services.search.defaultEngine.name;
let currentEngines = Services.search.getVisibleEngines();
info("Adding test search engines");
let rootDir = getRootDirectory(gTestPath);
@ -745,13 +745,13 @@ function setUpEngines() {
rootDir + TEST_ENGINE_BASENAME);
await SearchTestUtils.promiseNewSearchEngine(
rootDir + TEST_ENGINE_2_BASENAME);
Services.search.currentEngine = engine1;
Services.search.defaultEngine = engine1;
for (let engine of currentEngines) {
Services.search.removeEngine(engine);
}
registerCleanupFunction(() => {
Services.search.restoreDefaultEngines();
Services.search.currentEngine = Services.search.getEngineByName(currentEngineName);
Services.search.defaultEngine = Services.search.getEngineByName(currentEngineName);
});
})();
}

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

@ -4,7 +4,7 @@ registerCleanupFunction(async function cleanup() {
while (gBrowser.tabs.length > 1) {
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
}
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
let engine = Services.search.getEngineByName("MozSearch");
Services.search.removeEngine(engine);
});
@ -18,8 +18,8 @@ add_task(async function test_setup() {
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
});
// New Tab Button opens any link.

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

@ -1,5 +1,5 @@
registerCleanupFunction(function cleanup() {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
let engine = Services.search.getEngineByName("MozSearch");
Services.search.removeEngine(engine);
});
@ -13,8 +13,8 @@ add_task(async function test_setup() {
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
// Move New Window button to nav bar, to make it possible to drag and drop.
let {CustomizableUI} = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});

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

@ -4,7 +4,7 @@ registerCleanupFunction(async function cleanup() {
while (gBrowser.tabs.length > 1) {
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
}
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
let engine = Services.search.getEngineByName("MozSearch");
Services.search.removeEngine(engine);
});
@ -15,8 +15,8 @@ add_task(async function test_setup() {
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
});
add_task(async function single_url() {

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

@ -18,7 +18,7 @@ addMessageListener(TEST_MSG, msg => {
var messageHandlers = {
init() {
Services.search.currentEngine = Services.search.getEngineByName(ENGINE_NAME);
Services.search.defaultEngine = Services.search.getEngineByName(ENGINE_NAME);
let input = content.document.querySelector("input");
gController =
new content.ContentSearchUIController(input, input.parentNode, "test", "test");

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

@ -5,13 +5,13 @@ add_task(async function() {
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla");
registerCleanupFunction(async function() {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
Services.search.removeEngine(engine);
try {
BrowserTestUtils.removeTab(tab);

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

@ -6,13 +6,13 @@ add_task(async function() {
Services.search.addEngineWithDetails("MozSearch", iconURI, "moz", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla");
registerCleanupFunction(async function() {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
Services.search.removeEngine(engine);
try {
BrowserTestUtils.removeTab(tab);

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

@ -21,13 +21,13 @@ add_task(async function switchToTab() {
add_task(async function searchSuggestions() {
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
Services.prefs.setBoolPref(SUGGEST_ALL_PREF, true);
let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
registerCleanupFunction(function() {
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
Services.prefs.clearUserPref(SUGGEST_ALL_PREF);
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
});

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

@ -66,15 +66,15 @@ add_task(taskWithNewTab(async function test_disabled_ac() {
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
function cleanup() {
Preferences.set("browser.urlbar.suggest.history", suggestHistory);
Preferences.set("browser.urlbar.suggest.bookmark", suggestBookmarks);
Preferences.set("browser.urlbar.suggest.openpage", suggestOpenPages);
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
let mozSearchEngine = Services.search.getEngineByName("MozSearch");
if (mozSearchEngine) {
Services.search.removeEngine(mozSearchEngine);

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

@ -44,9 +44,9 @@ add_task(async function checkPrefTurnsOffCanonize() {
// Add a dummy search engine to avoid hitting the network.
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
registerCleanupFunction(() => { Services.search.currentEngine = oldCurrentEngine; });
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
registerCleanupFunction(() => { Services.search.defaultEngine = oldCurrentEngine; });
let tabsToClose = [];
// Ensure we don't end up loading something in the current tab becuase it's empty:

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

@ -12,7 +12,7 @@ registerCleanupFunction(async function cleanup() {
while (gBrowser.tabs.length > 1) {
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
}
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
let engine = Services.search.getEngineByName("MozSearch");
Services.search.removeEngine(engine);
});
@ -23,8 +23,8 @@ add_task(async function test_setup() {
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
});
add_task(async function checkDragURL() {

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

@ -4,7 +4,7 @@ var gRestyleSearchesPref = "browser.urlbar.restyleSearches";
registerCleanupFunction(() => {
Services.prefs.clearUserPref(gRestyleSearchesPref);
Services.search.currentEngine = gOriginalEngine;
Services.search.defaultEngine = gOriginalEngine;
Services.search.removeEngine(gEngine);
return PlacesUtils.history.clear();
});
@ -23,8 +23,8 @@ add_task(async function() {
"GET", "http://s.example.com/search");
gEngine = Services.search.getEngineByName("SearchEngine");
gEngine.addParam("q", "{searchTerms}", null);
gOriginalEngine = Services.search.currentEngine;
Services.search.currentEngine = gEngine;
gOriginalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = gEngine;
let uri = NetUtil.newURI("http://s.example.com/search?q=foobar&client=1");
await PlacesTestUtils.addVisits({ uri, title: "Foo - SearchEngine Search" });

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

@ -8,11 +8,11 @@ add_task(async function init() {
});
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.moveEngine(engine, 0);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
registerCleanupFunction(async function() {
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
await PlacesUtils.history.clear();
// Make sure the popup is closed for the next test.

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

@ -10,7 +10,7 @@
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
const originalEngine = Services.search.currentEngine;
const originalEngine = Services.search.defaultEngine;
const expectedString = gBrowserBundle.formatStringFromName("urlbar.placeholder",
[originalEngine.name], 1);
var extraEngine;
@ -26,7 +26,7 @@ add_task(async function setup() {
BrowserTestUtils.removeTab(urlTab);
registerCleanupFunction(() => {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
for (let tab of tabs) {
BrowserTestUtils.removeTab(tab);
}
@ -36,13 +36,13 @@ add_task(async function setup() {
add_task(async function test_change_default_engine_updates_placeholder() {
tabs.push(await BrowserTestUtils.openNewForegroundTab(gBrowser));
Services.search.currentEngine = extraEngine;
Services.search.defaultEngine = extraEngine;
await TestUtils.waitForCondition(
() => gURLBar.getAttribute("placeholder") == gURLBar.getAttribute("defaultPlaceholder"),
"The placeholder should match the default placeholder for non-built-in engines.");
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
await TestUtils.waitForCondition(
() => gURLBar.getAttribute("placeholder") == expectedString,

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

@ -7,11 +7,11 @@ add_task(async function prepare() {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
registerCleanupFunction(async function() {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
// Clicking suggestions causes visits to search results pages, so clear that
// history now.
@ -33,7 +33,7 @@ add_task(async function clickSuggestion() {
"Expected suggestion engine");
let item = gURLBar.popup.richlistbox.getItemAtIndex(idx);
let uri = Services.search.currentEngine.getSubmission(suggestion).uri;
let uri = Services.search.defaultEngine.getSubmission(suggestion).uri;
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser,
false, uri.spec);
item.click();
@ -51,7 +51,7 @@ async function testPressEnterOnSuggestion(expectedUrl = null, keyModifiers = {})
"Expected suggestion engine");
if (!expectedUrl) {
expectedUrl = Services.search.currentEngine.getSubmission(suggestion).uri.spec;
expectedUrl = Services.search.defaultEngine.getSubmission(suggestion).uri.spec;
}
let promiseLoad = waitForDocLoadAndStopIt(expectedUrl);

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

@ -11,8 +11,8 @@ const ONEOFF_PREF = "browser.urlbar.oneOffSearches";
add_task(async function prepare() {
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
let defaults = Services.prefs.getDefaultBranch("browser.urlbar.");
let searchSuggestionsDefault = defaults.getBoolPref("suggest.searches");
@ -23,7 +23,7 @@ add_task(async function prepare() {
Services.prefs.setBoolPref(ONEOFF_PREF, true);
registerCleanupFunction(async function() {
defaults.setBoolPref("suggest.searches", searchSuggestionsDefault);
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
Services.prefs.clearUserPref(SUGGEST_ALL_PREF);
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.prefs.setBoolPref(CHOICE_PREF, suggestionsChoice);

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

@ -9,12 +9,12 @@ add_task(async function prepare() {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
registerCleanupFunction(async function() {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
// Clicking urlbar results causes visits to their associated pages, so clear
// that history now.
@ -108,7 +108,7 @@ async function compareCounts(clickCallback) {
// * Telemetry histogram named "SEARCH_COUNTS"
// * FHR
let engine = Services.search.currentEngine;
let engine = Services.search.defaultEngine;
let engineID = "org.mozilla.testsearchsuggestions";
// First, get the current counts.

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

@ -21,11 +21,11 @@ add_task(async function init() {
// Add a test search engine that returns suggestions on a delay.
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.moveEngine(engine, 0);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
registerCleanupFunction(async () => {
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
await PlacesUtils.history.clear();
// Make sure the popup is closed for the next test.
gURLBar.blur();

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

@ -31,12 +31,12 @@ add_task(async function setup() {
let engine = await SearchTestUtils.promiseNewSearchEngine(
getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
let oldCurrentEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let oldCurrentEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
registerCleanupFunction(async function() {
await PlacesUtils.history.clear();
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
gHttpServer.identity.remove(gScheme, gHost, gPort);
gHttpServer.stop(() => {
gHttpServer = null;

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

@ -9,11 +9,11 @@ ChromeUtils.defineModuleGetter(this, "AddonManager",
const EXTENSION1_ID = "extension1@mozilla.com";
const EXTENSION2_ID = "extension2@mozilla.com";
let defaultEngineName = Services.search.currentEngine.name;
let defaultEngineName = Services.search.defaultEngine.name;
function restoreDefaultEngine() {
let engine = Services.search.getEngineByName(defaultEngineName);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
}
registerCleanupFunction(restoreDefaultEngine);
@ -34,11 +34,11 @@ add_task(async function test_extension_setting_default_engine() {
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext1.unload();
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
is(Services.search.defaultEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
});
/* This tests that uninstalling add-ons maintains the proper
@ -72,19 +72,19 @@ add_task(async function test_extension_setting_multiple_default_engine() {
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext2.startup();
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
await ext2.unload();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext1.unload();
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
is(Services.search.defaultEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
});
/* This tests that uninstalling add-ons in reverse order maintains the proper
@ -118,19 +118,19 @@ add_task(async function test_extension_setting_multiple_default_engine_reversed(
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext2.startup();
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
await ext1.unload();
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
await ext2.unload();
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
is(Services.search.defaultEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
});
/* This tests that when the user changes the search engine and the add-on
@ -151,14 +151,14 @@ add_task(async function test_user_changing_default_engine() {
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
let engine = Services.search.getEngineByName("Twitter");
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
await ext1.unload();
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
restoreDefaultEngine();
});
@ -185,25 +185,25 @@ add_task(async function test_user_change_with_disabling() {
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
let engine = Services.search.getEngineByName("Twitter");
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
let disabledPromise = awaitEvent("shutdown", EXTENSION1_ID);
let addon = await AddonManager.getAddonByID(EXTENSION1_ID);
await addon.disable();
await disabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
let enabledPromise = awaitEvent("ready", EXTENSION1_ID);
await addon.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
await ext1.unload();
restoreDefaultEngine();
});
@ -250,30 +250,30 @@ add_task(async function test_two_addons_with_first_disabled_before_second() {
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
let disabledPromise = awaitEvent("shutdown", EXTENSION1_ID);
let addon1 = await AddonManager.getAddonByID(EXTENSION1_ID);
await addon1.disable();
await disabledPromise;
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
is(Services.search.defaultEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
await ext2.startup();
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
let enabledPromise = awaitEvent("ready", EXTENSION1_ID);
await addon1.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
await ext2.unload();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext1.unload();
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
is(Services.search.defaultEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
});
/* This tests that when two add-ons are installed that change default
@ -318,30 +318,30 @@ add_task(async function test_two_addons_with_first_disabled() {
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext2.startup();
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
let disabledPromise = awaitEvent("shutdown", EXTENSION1_ID);
let addon1 = await AddonManager.getAddonByID(EXTENSION1_ID);
await addon1.disable();
await disabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
let enabledPromise = awaitEvent("ready", EXTENSION1_ID);
await addon1.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
await ext2.unload();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext1.unload();
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
is(Services.search.defaultEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
});
/* This tests that when two add-ons are installed that change default
@ -386,28 +386,28 @@ add_task(async function test_two_addons_with_second_disabled() {
await ext1.startup();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext2.startup();
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
let disabledPromise = awaitEvent("shutdown", EXTENSION2_ID);
let addon2 = await AddonManager.getAddonByID(EXTENSION2_ID);
await addon2.disable();
await disabledPromise;
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
let enabledPromise = awaitEvent("ready", EXTENSION2_ID);
await addon2.enable();
await enabledPromise;
is(Services.search.currentEngine.name, "Twitter", "Default engine is Twitter");
is(Services.search.defaultEngine.name, "Twitter", "Default engine is Twitter");
await ext2.unload();
is(Services.search.currentEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
is(Services.search.defaultEngine.name, "DuckDuckGo", "Default engine is DuckDuckGo");
await ext1.unload();
is(Services.search.currentEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
is(Services.search.defaultEngine.name, defaultEngineName, `Default engine is ${defaultEngineName}`);
});

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

@ -57,15 +57,15 @@ function addSearchEngine(basename) {
}
async function prepareSearchEngine() {
let oldCurrentEngine = Services.search.currentEngine;
let oldCurrentEngine = Services.search.defaultEngine;
let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
let engine = await addSearchEngine(TEST_ENGINE_BASENAME);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
registerCleanupFunction(async function() {
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
// Make sure the popup is closed for the next test.
gURLBar.blur();

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

@ -118,7 +118,7 @@ add_task(async function test_upgrade_default_position_engine() {
await ext1.startup();
let engine = Services.search.getEngineByName("MozSearch");
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
Services.search.moveEngine(engine, 1);
await ext1.upgrade({
@ -141,7 +141,7 @@ add_task(async function test_upgrade_default_position_engine() {
});
engine = Services.search.getEngineByName("MozSearch");
equal(Services.search.currentEngine, engine, "Default engine should still be MozSearch");
equal(Services.search.defaultEngine, engine, "Default engine should still be MozSearch");
equal(Services.search.getEngines().indexOf(engine), 1, "Engine is in position 1");
await ext1.unload();

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

@ -19,11 +19,9 @@
<!DOCTYPE page [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % certManagerDTD SYSTEM "chrome://pippki/locale/certManager.dtd">
<!ENTITY % deviceManangerDTD SYSTEM "chrome://pippki/locale/deviceManager.dtd">
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
%brandDTD;
%certManagerDTD;
%deviceManangerDTD;
%sanitizeDTD;
]>
@ -50,6 +48,7 @@
<link rel="localization" href="browser/preferences/siteDataSettings.ftl"/>
<link rel="localization" href="browser/aboutDialog.ftl"/>
<link rel="localization" href="toolkit/updates/history.ftl"/>
<link rel="localization" href="security/certificates/deviceManager.ftl"/>
</linkset>
<html:link rel="shortcut icon"

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

@ -788,15 +788,17 @@
class="accessory-button"
data-l10n-id="certs-devices"
preference="security.disable_button.openDeviceManager"
searchkeywords="&devmgr.title;
&devmgr.devlist.label;
&devmgr.details.title;
&devmgr.details.title2;
&devmgr.button.login.label;
&devmgr.button.logout.label;
&devmgr.button.changepw.label;
&devmgr.button.load.label;
&devmgr.button.unload.label;"/>
search-l10n-ids="
devmgr.title,
devmgr-devlist.label,
devmgr-header-details.label,
devmgr-header-value.label,
devmgr-button-login.label,
devmgr-button-logout.label,
devmgr-button-changepw.label,
devmgr-button-load.label,
devmgr-button-unload.label
"/>
</hbox>
</vbox>
</hbox>

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

@ -65,10 +65,10 @@ function promiseSetEngine() {
case "engine-added":
var engine = ss.getEngineByName("Bug 426329");
ok(engine, "Engine was added.");
ss.currentEngine = engine;
ss.defaultEngine = engine;
break;
case "engine-current":
ok(ss.currentEngine.name == "Bug 426329", "currentEngine set");
ok(ss.defaultEngine.name == "Bug 426329", "currentEngine set");
searchBar = BrowserSearch.searchBar;
searchButton = searchBar.querySelector(".search-go-button");
ok(searchButton, "got search-go-button");

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

@ -68,7 +68,7 @@ var gTests = [
gBrowser.selectedBrowser);
await loadPromise;
is(engine, Services.search.currentEngine,
is(engine, Services.search.defaultEngine,
"the custom engine is still default");
is(rawEngine.getAttr("loadPathHash"), initialHash,
"the loadPathHash has been fixed");
@ -81,7 +81,7 @@ var gTests = [
{
desc: "Test the 'Restore Search Defaults' button.",
async run() {
let currentEngine = Services.search.currentEngine;
let currentEngine = Services.search.defaultEngine;
let originalEngine = Services.search.originalDefaultEngine;
let browser = gBrowser.selectedBrowser;
let defaultEngineSpanText =
@ -108,12 +108,12 @@ var gTests = [
{}, browser);
await loadPromise;
is(originalEngine, Services.search.currentEngine,
is(originalEngine, Services.search.defaultEngine,
"the default engine is back to the original one");
checkTelemetryRecords(TELEMETRY_RESULT_ENUM.RESTORED_DEFAULT);
is(Services.prefs.getCharPref(kStatusPref), "accepted");
Services.search.currentEngine = currentEngine;
Services.search.defaultEngine = currentEngine;
},
},

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

@ -64,10 +64,10 @@ var gTests = [
let aEngine = gSS.getEngineByAlias("fooalias");
ok(!aEngine, "Alias was not parsed from engine description");
gSS.currentEngine = engine;
gSS.defaultEngine = engine;
},
current(engine) {
let currentEngine = gSS.currentEngine;
let currentEngine = gSS.defaultEngine;
is(engine, currentEngine, "engine is current");
is(engine.name, this.engine.name, "current engine was changed successfully");
@ -80,7 +80,7 @@ var gTests = [
// engines.
Services.obs.removeObserver(observer, "browser-search-engine-modified");
let currentEngine = gSS.currentEngine;
let currentEngine = gSS.defaultEngine;
ok(currentEngine, "An engine is present.");
isnot(currentEngine.name, this.engine.name, "Current engine reset after removal");

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

@ -30,12 +30,12 @@ add_task(async function() {
case "engine-added":
var engine = ss.getEngineByName(ENGINE_NAME);
ok(engine, "Engine was added.");
ss.currentEngine = engine;
ss.defaultEngine = engine;
envService.set("XPCSHELL_TEST_PROFILE_DIR", originalValue);
resProt.setSubstitution("search-plugins", originalSubstitution);
break;
case "engine-current":
is(ss.currentEngine.name, ENGINE_NAME, "currentEngine set");
is(ss.defaultEngine.name, ENGINE_NAME, "currentEngine set");
resolve();
break;
case "engine-removed":
@ -93,7 +93,7 @@ add_task(async function() {
await new Promise(resolve => {
searchDonePromise = resolve;
ss.removeEngine(ss.currentEngine);
ss.removeEngine(ss.defaultEngine);
});
gBrowser.removeCurrentTab();

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

@ -61,10 +61,10 @@ function promiseContentSearchReady(browser) {
for (let engine of searchEngineDetails) {
add_task(async function() {
let previouslySelectedEngine = Services.search.currentEngine;
let previouslySelectedEngine = Services.search.defaultEngine;
registerCleanupFunction(function() {
Services.search.currentEngine = previouslySelectedEngine;
Services.search.defaultEngine = previouslySelectedEngine;
});
await testSearchEngine(engine);
@ -75,7 +75,7 @@ async function testSearchEngine(engineDetails) {
let engine = Services.search.getEngineByName(engineDetails.name);
Assert.ok(engine, `${engineDetails.name} is installed`);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
engine.alias = engineDetails.alias;
// Test search URLs (including purposes).

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

@ -56,13 +56,13 @@ function test() {
case "engine-added":
let engine = Services.search.getEngineByName("Foo");
ok(engine, "Engine was added.");
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
break;
case "engine-current":
// We may be called again when resetting the engine at the end.
if (!calledTestTelemetry) {
is(Services.search.currentEngine.name, "Foo", "Current engine is Foo");
is(Services.search.defaultEngine.name, "Foo", "Current engine is Foo");
testTelemetry();
}
break;

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

@ -19,10 +19,10 @@ add_task(async function init() {
});
searchIcon = searchbar.querySelector(".searchbar-search-button");
let currentEngine = Services.search.currentEngine;
let currentEngine = Services.search.defaultEngine;
await promiseNewEngine("testEngine_diacritics.xml", {setAsCurrent: false});
registerCleanupFunction(() => {
Services.search.currentEngine = currentEngine;
Services.search.defaultEngine = currentEngine;
Services.prefs.clearUserPref("browser.search.hiddenOneOffs");
});
});

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

@ -16,10 +16,10 @@ const urlBarOneOffElement = document.getAnonymousElementByAttribute(
urlbarPopup, "anonid", "one-off-search-buttons"
);
let originalEngine = Services.search.currentEngine;
let originalEngine = Services.search.defaultEngine;
function resetEngine() {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
}
registerCleanupFunction(resetEngine);
@ -88,7 +88,7 @@ add_task(async function test_urlBarChangeEngine() {
// This also checks the engine correctly changed.
await promise;
let currentEngine = Services.search.currentEngine;
let currentEngine = Services.search.defaultEngine;
// For the urlbar, we should keep the new engine's icon.
Assert.equal(oneOffButton.id, URLBAR_BASE_ID + currentEngine.name,
@ -111,7 +111,7 @@ function promiseCurrentEngineChanged() {
return new Promise(resolve => {
function observer(aSub, aTopic, aData) {
if (aData == "engine-current") {
Assert.equal(Services.search.currentEngine.name, TEST_ENGINE_NAME, "currentEngine set");
Assert.equal(Services.search.defaultEngine.name, TEST_ENGINE_NAME, "currentEngine set");
Services.obs.removeObserver(observer, "browser-search-engine-modified");
resolve();
}

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

@ -81,10 +81,10 @@ add_task(async function test_setup() {
for (let engine of SEARCH_ENGINE_DETAILS) {
add_task(async function() {
let previouslySelectedEngine = Services.search.currentEngine;
let previouslySelectedEngine = Services.search.defaultEngine;
registerCleanupFunction(function() {
Services.search.currentEngine = previouslySelectedEngine;
Services.search.defaultEngine = previouslySelectedEngine;
});
await testSearchEngine(engine);
@ -95,7 +95,7 @@ async function testSearchEngine(engineDetails) {
let engine = Services.search.getEngineByName(engineDetails.name);
Assert.ok(engine, `${engineDetails.name} is installed`);
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
engine.alias = engineDetails.alias;
let base = engineDetails.baseURL;

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

@ -60,16 +60,16 @@ function promiseNewEngine(basename, options = {}) {
Services.search.init({
onInitComplete() {
let url = getRootDirectory(options.testPath || gTestPath) + basename;
let current = Services.search.currentEngine;
let current = Services.search.defaultEngine;
Services.search.addEngine(url, options.iconURL || "", false, {
onSuccess(engine) {
info("Search engine added: " + basename);
if (setAsCurrent) {
Services.search.currentEngine = engine;
Services.search.defaultEngine = engine;
}
registerCleanupFunction(() => {
if (setAsCurrent) {
Services.search.currentEngine = current;
Services.search.defaultEngine = current;
}
Services.search.removeEngine(engine);
info("Search engine removed: " + basename);

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

@ -11,7 +11,7 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/browser/components/search/test/head.js",
this);
let originalEngine = Services.search.currentEngine;
let originalEngine = Services.search.defaultEngine;
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({
@ -24,7 +24,7 @@ add_task(async function setup() {
});
registerCleanupFunction(() => {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
});
});
@ -43,7 +43,7 @@ add_task(async function GetState() {
add_task(async function SetCurrentEngine() {
let { mm } = await addTab();
let newCurrentEngine = null;
let oldCurrentEngine = Services.search.currentEngine;
let oldCurrentEngine = Services.search.defaultEngine;
let engines = Services.search.getVisibleEngines();
for (let engine of engines) {
if (engine != oldCurrentEngine) {
@ -78,7 +78,7 @@ add_task(async function SetCurrentEngine() {
data: await currentEngineObj(newCurrentEngine),
});
Services.search.currentEngine = oldCurrentEngine;
Services.search.defaultEngine = oldCurrentEngine;
msg = await waitForTestMsg(mm, "CurrentEngine");
checkMsg(msg, {
type: "CurrentEngine",
@ -88,7 +88,7 @@ add_task(async function SetCurrentEngine() {
add_task(async function modifyEngine() {
let { mm } = await addTab();
let engine = Services.search.currentEngine;
let engine = Services.search.defaultEngine;
let oldAlias = engine.alias;
engine.alias = "ContentSearchTest";
let msg = await waitForTestMsg(mm, "CurrentState");
@ -106,7 +106,7 @@ add_task(async function modifyEngine() {
add_task(async function search() {
let { browser } = await addTab();
let engine = Services.search.currentEngine;
let engine = Services.search.defaultEngine;
let data = {
engineName: engine.name,
searchString: "ContentSearchTest",
@ -125,7 +125,7 @@ add_task(async function searchInBackgroundTab() {
// search page should be loaded in the same tab that performed the search, in
// the background tab.
let { browser } = await addTab();
let engine = Services.search.currentEngine;
let engine = Services.search.defaultEngine;
let data = {
engineName: engine.name,
searchString: "ContentSearchTest",
@ -377,7 +377,7 @@ var currentStateObj = async function() {
};
var currentEngineObj = async function() {
let engine = Services.search.currentEngine;
let engine = Services.search.defaultEngine;
let uriFavicon = engine.getIconURLBySize(16, 16);
let bundle = Services.strings.createBundle("chrome://global/locale/autocomplete.properties");
return {

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

@ -16,8 +16,8 @@ add_task(async function setup() {
// Make the first engine the default search engine.
let engineDefault = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engineDefault;
let originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engineDefault;
// Move the second engine at the beginning of the one-off list.
let engineOneOff = Services.search.getEngineByName("MozSearch2");
@ -36,7 +36,7 @@ add_task(async function setup() {
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
Services.search.removeEngine(engineDefault);
Services.search.removeEngine(engineOneOff);
await PlacesUtils.history.clear();

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

@ -20,8 +20,8 @@ add_task(async function setup() {
// Make the first engine the default search engine.
let engineDefault = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engineDefault;
let originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engineDefault;
// Move the second engine at the beginning of the one-off list.
let engineOneOff = Services.search.getEngineByName("MozSearch2");
@ -36,7 +36,7 @@ add_task(async function setup() {
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
Services.search.removeEngine(engineDefault);
Services.search.removeEngine(engineOneOff);
await PlacesUtils.history.clear();

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

@ -69,8 +69,8 @@ add_task(async function setup() {
// Make the first engine the default search engine.
let engineDefault = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engineDefault;
let originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engineDefault;
// Move the second engine at the beginning of the one-off list.
let engineOneOff = Services.search.getEngineByName("MozSearch2");
@ -86,7 +86,7 @@ add_task(async function setup() {
// Make sure to restore the engine once we're done.
registerCleanupFunction(function() {
Services.telemetry.canRecordExtended = oldCanRecord;
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
Services.search.removeEngine(engineDefault);
Services.search.removeEngine(engineOneOff);
Services.telemetry.setEventRecordingEnabled("navigation", false);
@ -192,8 +192,8 @@ add_task(async function test_oneOff_enterSelection() {
});
});
let previousEngine = Services.search.currentEngine;
Services.search.currentEngine = suggestionEngine;
let previousEngine = Services.search.defaultEngine;
Services.search.defaultEngine = suggestionEngine;
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
@ -212,7 +212,7 @@ add_task(async function test_oneOff_enterSelection() {
URLBAR_SELECTED_RESULT_METHODS.enterSelection,
"FX_SEARCHBAR_SELECTED_RESULT_METHOD");
Services.search.currentEngine = previousEngine;
Services.search.defaultEngine = previousEngine;
Services.search.removeEngine(suggestionEngine);
BrowserTestUtils.removeTab(tab);
});
@ -260,8 +260,8 @@ add_task(async function test_suggestion_click() {
});
});
let previousEngine = Services.search.currentEngine;
Services.search.currentEngine = suggestionEngine;
let previousEngine = Services.search.defaultEngine;
Services.search.defaultEngine = suggestionEngine;
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
@ -293,7 +293,7 @@ add_task(async function test_suggestion_click() {
URLBAR_SELECTED_RESULT_METHODS.click,
"FX_SEARCHBAR_SELECTED_RESULT_METHOD");
Services.search.currentEngine = previousEngine;
Services.search.defaultEngine = previousEngine;
Services.search.removeEngine(suggestionEngine);
BrowserTestUtils.removeTab(tab);
});
@ -317,8 +317,8 @@ add_task(async function test_suggestion_enterSelection() {
});
});
let previousEngine = Services.search.currentEngine;
Services.search.currentEngine = suggestionEngine;
let previousEngine = Services.search.defaultEngine;
Services.search.defaultEngine = suggestionEngine;
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
@ -335,7 +335,7 @@ add_task(async function test_suggestion_enterSelection() {
URLBAR_SELECTED_RESULT_METHODS.enterSelection,
"FX_SEARCHBAR_SELECTED_RESULT_METHOD");
Services.search.currentEngine = previousEngine;
Services.search.defaultEngine = previousEngine;
Services.search.removeEngine(suggestionEngine);
BrowserTestUtils.removeTab(tab);
});

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

@ -88,13 +88,13 @@ async function withNewSearchEngine(taskFn) {
});
});
let previousEngine = Services.search.currentEngine;
Services.search.currentEngine = suggestionEngine;
let previousEngine = Services.search.defaultEngine;
Services.search.defaultEngine = suggestionEngine;
try {
await taskFn(suggestionEngine);
} finally {
Services.search.currentEngine = previousEngine;
Services.search.defaultEngine = previousEngine;
Services.search.removeEngine(suggestionEngine);
}
}
@ -106,8 +106,8 @@ add_task(async function setup() {
// Make it the default search engine.
let engine = Services.search.getEngineByName("MozSearch");
let originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
let originalEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
// Give it some mock internal aliases.
engine.wrappedJSObject.__internalAliases = ["@mozaliasfoo", "@mozaliasbar"];
@ -143,7 +143,7 @@ add_task(async function setup() {
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
Services.telemetry.canRecordExtended = oldCanRecord;
Services.search.currentEngine = originalEngine;
Services.search.defaultEngine = originalEngine;
Services.search.removeEngine(engine);
Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);

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

@ -646,6 +646,15 @@ notification[value="translation"] menulist > .menulist-dropmarker {
visibility: visible;
}
/* When temporarily showing the menu bar, make it at least as tall as the tab
* bar such that the window controls don't appear to move up. */
:root[tabsintitlebar] #toolbar-menubar[autohide="true"] {
height: var(--tab-min-height);
}
:root[tabsintitlebar][sizemode="normal"] #toolbar-menubar[autohide="true"] {
height: calc(var(--tab-min-height) + var(--space-above-tabbar));
}
/* Add extra space to titlebar for dragging */
:root[sizemode="normal"][chromehidden~="menubar"] #TabsToolbar,
:root[sizemode="normal"] #toolbar-menubar[autohide="true"][inactive] + #TabsToolbar {

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

@ -6,18 +6,15 @@
%filter substitution
%define horizontalTabPadding 9px
#titlebar,
#tabbrowser-tabs {
:root {
--tab-min-height: 33px;
}
:root[uidensity=compact] #titlebar,
:root[uidensity=compact] #tabbrowser-tabs {
:root[uidensity=compact] {
--tab-min-height: 29px;
}
:root[uidensity=touch] #titlebar,
:root[uidensity=touch] #tabbrowser-tabs {
:root[uidensity=touch] {
--tab-min-height: 41px;
}

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

@ -356,10 +356,8 @@ inline bool inThirdPartyPath(SourceLocation Loc, const SourceManager &SM) {
return pair->second;
}
SmallString<1024> RawFileName = SM.getFilename(Loc);
llvm::sys::fs::make_absolute(RawFileName);
SmallString<1024> FileName;
llvm::sys::fs::real_path(RawFileName, FileName);
SmallString<1024> FileName = SM.getFilename(Loc);
llvm::sys::fs::make_absolute(FileName);
for (uint32_t i = 0; i < MOZ_THIRD_PARTY_PATHS_COUNT; ++i) {
auto PathB = sys::path::begin(FileName);

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

@ -82,7 +82,8 @@ enum class MatchForCompositor {
static MatchForCompositor
IsMatchForCompositor(const KeyframeEffect& aEffect,
nsCSSPropertyID aProperty,
const nsIFrame* aFrame)
const nsIFrame* aFrame,
const EffectSet& aEffects)
{
const Animation* animation = aEffect.GetAnimation();
MOZ_ASSERT(animation);
@ -103,7 +104,7 @@ IsMatchForCompositor(const KeyframeEffect& aEffect,
return MatchForCompositor::NoAndBlockThisProperty;
}
if (!aEffect.HasEffectiveAnimationOfProperty(aProperty)) {
if (!aEffect.HasEffectiveAnimationOfProperty(aProperty, aEffects)) {
return MatchForCompositor::No;
}
@ -205,7 +206,7 @@ FindAnimationsForCompositor(const nsIFrame* aFrame,
bool foundRunningAnimations = false;
for (KeyframeEffect* effect : *effects) {
MatchForCompositor matchResult =
IsMatchForCompositor(*effect, aProperty, aFrame);
IsMatchForCompositor(*effect, aProperty, aFrame, *effects);
if (matchResult == MatchForCompositor::NoAndBlockThisProperty) {
// For a given |aFrame|, we don't want some animations of |aProperty| to

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

@ -188,6 +188,10 @@ public:
static nsAtom** GetEffectSetPropertyAtoms();
const nsCSSPropertyIDSet& PropertiesWithImportantRules() const
{
return mPropertiesWithImportantRules;
}
nsCSSPropertyIDSet& PropertiesWithImportantRules()
{
return mPropertiesWithImportantRules;

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

@ -262,30 +262,65 @@ KeyframeEffect::SetKeyframes(
}
}
const AnimationProperty*
KeyframeEffect::GetEffectiveAnimationOfProperty(nsCSSPropertyID aProperty) const
static bool
IsEffectiveProperty(const EffectSet& aEffects, nsCSSPropertyID aProperty)
{
EffectSet* effectSet =
EffectSet::GetEffectSet(mTarget->mElement, mTarget->mPseudoType);
for (size_t propIdx = 0, propEnd = mProperties.Length();
propIdx != propEnd; ++propIdx) {
if (aProperty == mProperties[propIdx].mProperty) {
const AnimationProperty* result = &mProperties[propIdx];
// Skip if there is a property of animation level that is overridden
// by !important rules.
if (effectSet &&
effectSet->PropertiesWithImportantRules()
.HasProperty(result->mProperty) &&
effectSet->PropertiesForAnimationsLevel()
.HasProperty(result->mProperty)) {
result = nullptr;
}
return result;
return !aEffects.PropertiesWithImportantRules()
.HasProperty(aProperty) ||
!aEffects.PropertiesForAnimationsLevel()
.HasProperty(aProperty);
}
const AnimationProperty*
KeyframeEffect::GetEffectiveAnimationOfProperty(nsCSSPropertyID aProperty,
const EffectSet& aEffects) const
{
MOZ_ASSERT(
&aEffects ==
EffectSet::GetEffectSet(mTarget->mElement, mTarget->mPseudoType));
for (const AnimationProperty& property : mProperties) {
if (aProperty != property.mProperty) {
continue;
}
const AnimationProperty* result = nullptr;
// Only include the property if it is not overridden by !important rules in
// the transitions level.
if (IsEffectiveProperty(aEffects, property.mProperty)) {
result = &property;
}
return result;
}
return nullptr;
}
nsCSSPropertyIDSet
KeyframeEffect::GetPropertiesForCompositor(const EffectSet& aEffects) const
{
MOZ_ASSERT(
&aEffects ==
EffectSet::GetEffectSet(mTarget->mElement, mTarget->mPseudoType));
nsCSSPropertyIDSet properties;
if (!IsInEffect() && !IsCurrent()) {
return properties;
}
static constexpr nsCSSPropertyIDSet compositorAnimatables =
nsCSSPropertyIDSet::CompositorAnimatables();
for (const AnimationProperty& property : mProperties) {
if (!compositorAnimatables.HasProperty(property.mProperty)) {
continue;
}
if (IsEffectiveProperty(aEffects, property.mProperty)) {
properties.AddProperty(property.mProperty);
}
}
return properties;
}
bool
KeyframeEffect::HasAnimationOfProperty(nsCSSPropertyID aProperty) const
{
@ -1251,16 +1286,16 @@ KeyframeEffect::CanThrottle() const
MOZ_ASSERT(nsCSSPropertyIDSet::CompositorAnimatables()
.HasProperty(property.mProperty),
"The property should be able to run on the compositor");
MOZ_ASSERT(HasEffectiveAnimationOfProperty(property.mProperty),
"There should be an effective animation of the property while "
"it is marked as being run on the compositor");
if (!effectSet) {
effectSet = EffectSet::GetEffectSet(mTarget->mElement,
mTarget->mPseudoType);
MOZ_ASSERT(effectSet, "CanThrottle should be called on an effect "
"associated with a target element");
}
MOZ_ASSERT(HasEffectiveAnimationOfProperty(property.mProperty, *effectSet),
"There should be an effective animation of the property while "
"it is marked as being run on the compositor");
DisplayItemType displayItemType =
LayerAnimationInfo::GetDisplayItemTypeForProperty(property.mProperty);

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

@ -199,14 +199,27 @@ public:
// property is not overridden by !important rules.
// Also EffectiveAnimationOfProperty returns true under the same condition.
//
// |aEffect| should be the EffectSet containing this KeyframeEffect since
// this function is typically called for all KeyframeEffects on an element
// so that we can avoid multiple calls of EffectSet::GetEffect().
//
// NOTE: We don't currently check for !important rules for properties that
// can't run on the compositor.
bool HasEffectiveAnimationOfProperty(nsCSSPropertyID aProperty) const
bool HasEffectiveAnimationOfProperty(nsCSSPropertyID aProperty,
const EffectSet& aEffect) const
{
return GetEffectiveAnimationOfProperty(aProperty) != nullptr;
return GetEffectiveAnimationOfProperty(aProperty, aEffect) != nullptr;
}
const AnimationProperty* GetEffectiveAnimationOfProperty(
nsCSSPropertyID aProperty) const;
nsCSSPropertyID aProperty, const EffectSet& aEffect) const;
// Returns all the effective animated CSS properties that can be animated on
// the compositor and are not overridden by a higher cascade level.
//
// NOTE: This function is basically called for all KeyframeEffects on an
// element thus it takes |aEffects| to avoid multiple calls of
// EffectSet::GetEffect().
nsCSSPropertyIDSet GetPropertiesForCompositor(const EffectSet& aEffects) const;
const InfallibleTArray<AnimationProperty>& Properties() const
{

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

@ -1169,16 +1169,13 @@ nsAttrValue::Contains(nsAtom* aValue, nsCaseTreatment aCaseSensitive) const
case eAtomBase:
{
nsAtom* atom = GetAtomValue();
if (aCaseSensitive == eCaseMatters) {
return aValue == atom;
}
// For performance reasons, don't do a full on unicode case insensitive
// string comparison. This is only used for quirks mode anyway.
return
nsContentUtils::EqualsIgnoreASCIICase(nsDependentAtomString(aValue),
nsDependentAtomString(atom));
return nsContentUtils::EqualsIgnoreASCIICase(aValue, atom);
}
default:
{
@ -1188,16 +1185,11 @@ nsAttrValue::Contains(nsAtom* aValue, nsCaseTreatment aCaseSensitive) const
return array->Contains(aValue);
}
nsDependentAtomString val1(aValue);
for (RefPtr<nsAtom> *cur = array->Elements(),
*end = cur + array->Length();
cur != end; ++cur) {
for (RefPtr<nsAtom>& cur : *array) {
// For performance reasons, don't do a full on unicode case
// insensitive string comparison. This is only used for quirks mode
// anyway.
if (nsContentUtils::EqualsIgnoreASCIICase(val1,
nsDependentAtomString(*cur))) {
if (nsContentUtils::EqualsIgnoreASCIICase(aValue, cur)) {
return true;
}
}

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

@ -2064,6 +2064,25 @@ public:
static JSContext *GetCurrentJSContext();
/**
* Case insensitive comparison between two atoms.
*/
static bool EqualsIgnoreASCIICase(nsAtom* aAtom1, nsAtom* aAtom2)
{
if (aAtom1 == aAtom2) {
return true;
}
// If both are ascii lowercase already, we know that the slow comparison
// below is going to return false.
if (aAtom1->IsAsciiLowercase() && aAtom2->IsAsciiLowercase()) {
return false;
}
return EqualsIgnoreASCIICase(nsDependentAtomString(aAtom1),
nsDependentAtomString(aAtom2));
}
/**
* Case insensitive comparison between two strings. However it only ignores
* case for ASCII characters a-z.

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

@ -71,7 +71,7 @@ interface nsIImageLoadingContent : imgINotificationObserver
* the image was blocked. This status always refers to the
* CURRENT_REQUEST load.
*/
[noscript] readonly attribute short imageBlockingStatus;
[noscript, infallible] readonly attribute short imageBlockingStatus;
/**
* Used to register an image decoder observer. Typically, this will

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

@ -1375,6 +1375,18 @@ public:
virtual already_AddRefed<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const = 0;
/**
* Returns false if CreateSimilarDrawTarget would return null with the same
* parameters. May return true even in cases where CreateSimilarDrawTarget
* return null (i.e. this function returning false has meaning, but returning
* true doesn't guarantee anything).
*/
virtual bool
CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const
{
return true;
}
/**
* Create a draw target optimized for drawing a shadow.
*

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

@ -1004,6 +1004,13 @@ DrawTargetD2D1::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFor
return dt.forget();
}
bool
DrawTargetD2D1::CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const
{
return (mDC->GetMaximumBitmapSize() >= UINT32(aSize.width) &&
mDC->GetMaximumBitmapSize() >= UINT32(aSize.height));
}
already_AddRefed<PathBuilder>
DrawTargetD2D1::CreatePathBuilder(FillRule aFillRule) const
{

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

@ -117,6 +117,8 @@ public:
virtual already_AddRefed<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
virtual bool
CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const override;

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

@ -220,5 +220,11 @@ DrawTargetDual::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFor
return mA->CreateSimilarDrawTarget(aSize, aFormat);
}
bool
DrawTargetDual::CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const
{
return mA->CanCreateSimilarDrawTarget(aSize, aFormat);
}
} // namespace gfx
} // namespace mozilla

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

@ -143,7 +143,9 @@ public:
virtual already_AddRefed<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
virtual bool
CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const override
{
return mA->CreatePathBuilder(aFillRule);

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

@ -139,6 +139,12 @@ public:
return mDrawTarget->CreateSimilarDrawTarget(aSize, aFormat);
}
virtual bool
CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override
{
return mDrawTarget->CanCreateSimilarDrawTarget(aSize, aFormat);
}
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const override
{
return mDrawTarget->CreatePathBuilder(aFillRule);

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

@ -567,18 +567,39 @@ DrawTargetRecording::CreateSourceSurfaceFromNativeSurface(const NativeSurface &a
already_AddRefed<DrawTarget>
DrawTargetRecording::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const
{
RefPtr<DrawTarget> similarDT = new DrawTargetRecording(this, aSize, aFormat);
mRecorder->RecordEvent(RecordedCreateSimilarDrawTarget(similarDT.get(),
aSize,
aFormat));
RefPtr<DrawTarget> similarDT;
if (mFinalDT->CanCreateSimilarDrawTarget(aSize, aFormat)) {
similarDT = new DrawTargetRecording(this, aSize, aFormat);
mRecorder->RecordEvent(RecordedCreateSimilarDrawTarget(similarDT.get(),
aSize,
aFormat));
} else if (XRE_IsContentProcess()) {
// Crash any content process that calls this function with arguments that
// would fail to create a similar draw target. We do this to root out bad
// callers. We don't want to crash any important processes though so for
// for those we'll just gracefully return nullptr.
MOZ_CRASH("Content-process DrawTargetRecording can't create requested similar drawtarget");
}
return similarDT.forget();
}
bool
DrawTargetRecording::CanCreateSimilarDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) const
{
return mFinalDT->CanCreateSimilarDrawTarget(aSize, aFormat);
}
RefPtr<DrawTarget>
DrawTargetRecording::CreateClippedDrawTarget(const IntSize& aMaxSize, const Matrix& aTransform, SurfaceFormat aFormat) const
{
RefPtr<DrawTarget> similarDT = new DrawTargetRecording(this, aMaxSize, aFormat);
mRecorder->RecordEvent(RecordedCreateClippedDrawTarget(similarDT.get(), aMaxSize, aTransform, aFormat));
RefPtr<DrawTarget> similarDT;
if (mFinalDT->CanCreateSimilarDrawTarget(aMaxSize, aFormat)) {
similarDT = new DrawTargetRecording(this, aMaxSize, aFormat);
mRecorder->RecordEvent(RecordedCreateClippedDrawTarget(similarDT.get(), aMaxSize, aTransform, aFormat));
} else if (XRE_IsContentProcess()) {
// See CreateSimilarDrawTarget
MOZ_CRASH("Content-process DrawTargetRecording can't create requested clipped drawtarget");
}
return similarDT;
}

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

@ -303,7 +303,9 @@ public:
virtual already_AddRefed<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
/**
bool CanCreateSimilarDrawTarget(const IntSize& aSize,
SurfaceFormat aFormat) const override;
/**
* Create a similar DrawTarget whose requested size may be clipped based
* on this DrawTarget's rect transformed to the new target's space.
*/

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

@ -1705,6 +1705,12 @@ DrawTargetSkia::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFor
return target.forget();
}
bool
DrawTargetSkia::CanCreateSimilarDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) const
{
return size_t(std::max(aSize.width, aSize.height)) < GetMaxSurfaceSize();
}
bool
DrawTargetSkia::UsingSkiaGPU() const
{

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

@ -126,6 +126,7 @@ public:
CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const override;
virtual already_AddRefed<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
virtual bool CanCreateSimilarDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) const override;
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const override;
virtual already_AddRefed<GradientStops> CreateGradientStops(GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode = ExtendMode::CLAMP) const override;
virtual already_AddRefed<FilterNode> CreateFilter(FilterType aType) override;

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

@ -154,6 +154,10 @@ public:
return mTiles[0].mDrawTarget->CreateSimilarDrawTarget(aSize, aFormat);
}
virtual bool CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override {
return mTiles[0].mDrawTarget->CanCreateSimilarDrawTarget(aSize, aFormat);
}
virtual already_AddRefed<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const override
{
return mTiles[0].mDrawTarget->CreatePathBuilder(aFillRule);

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

@ -675,6 +675,12 @@ DrawTargetWrapAndRecord::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFo
return similarDT.forget();
}
bool
DrawTargetWrapAndRecord::CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const
{
return mFinalDT->CanCreateSimilarDrawTarget(aSize, aFormat);
}
already_AddRefed<PathBuilder>
DrawTargetWrapAndRecord::CreatePathBuilder(FillRule aFillRule) const
{

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

@ -270,6 +270,9 @@ public:
virtual already_AddRefed<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
virtual bool
CanCreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const override;
/*
* Create a path builder with the specified fillmode.
*

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

@ -56,18 +56,21 @@ InlineTranslator::TranslateRecording(char *aData, size_t aLen)
uint32_t magicInt;
ReadElement(reader, magicInt);
if (magicInt != mozilla::gfx::kMagicInt) {
mError = "Magic";
return false;
}
uint16_t majorRevision;
ReadElement(reader, majorRevision);
if (majorRevision != kMajorRevision) {
mError = "Major";
return false;
}
uint16_t minorRevision;
ReadElement(reader, minorRevision);
if (minorRevision > kMinorRevision) {
mError = "Minor";
return false;
}
@ -78,16 +81,19 @@ InlineTranslator::TranslateRecording(char *aData, size_t aLen)
[&] (RecordedEvent *recordedEvent) {
// Make sure that the whole event was read from the stream successfully.
if (!reader.good()) {
mError = " READ";
return false;
}
if (!recordedEvent->PlayEvent(this)) {
mError = " PLAY";
return false;
}
return true;
});
if (!success) {
mError = RecordedEvent::GetEventName(static_cast<RecordedEvent::EventType>(eventType)) + mError;
return false;
}

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

@ -8,6 +8,7 @@
#define mozilla_layout_InlineTranslator_h
#include <istream>
#include <string>
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Filters.h"
@ -184,10 +185,12 @@ public:
mozilla::gfx::DrawTarget* GetReferenceDrawTarget() final { return mBaseDT; }
void* GetFontContext() final { return mFontContext; }
std::string GetError() { return mError; }
private:
RefPtr<DrawTarget> mBaseDT;
void* mFontContext;
std::string mError;
nsRefPtrHashtable<nsPtrHashKey<void>, DrawTarget> mDrawTargets;
nsRefPtrHashtable<nsPtrHashKey<void>, Path> mPaths;

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

@ -100,7 +100,7 @@ DeleteWaylandGLSurface(EGLSurface surface)
{
// We're running on Wayland which means our EGLSurface may
// have attached Wayland backend data which must be released.
if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
auto entry = sWaylandGLSurface.Lookup(surface);
if (entry) {
delete entry.Data();
@ -970,7 +970,7 @@ FillContextAttribs(bool alpha, bool depth, bool stencil, bool bpp16,
{
out->AppendElement(LOCAL_EGL_SURFACE_TYPE);
#if defined(MOZ_WAYLAND)
if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
// Wayland on desktop does not support PBuffer or FBO.
// We create a dummy wl_egl_window instead.
out->AppendElement(LOCAL_EGL_WINDOW_BIT);
@ -1101,7 +1101,7 @@ GLContextEGL::CreateEGLPBufferOffscreenContext(CreateContextFlags flags,
mozilla::gfx::IntSize pbSize(size);
EGLSurface surface = nullptr;
#if defined(MOZ_WAYLAND)
if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
surface = GLContextEGL::CreateWaylandBufferSurface(config, pbSize);
} else
#endif

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

@ -774,7 +774,7 @@ GLLibraryEGL::CreateDisplay(bool forceAccel, const nsCOMPtr<nsIGfxInfo>& gfxInfo
#ifdef MOZ_WAYLAND
// Some drivers doesn't support EGL_DEFAULT_DISPLAY
GdkDisplay *gdkDisplay = gdk_display_get_default();
if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) {
if (!GDK_IS_X11_DISPLAY(gdkDisplay)) {
static auto sGdkWaylandDisplayGetWlDisplay =
(wl_display *(*)(GdkDisplay *))
dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");

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

@ -5,9 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AnimationInfo.h"
#include "mozilla/LayerAnimationInfo.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/layers/AnimationHelper.h"
#include "mozilla/dom/Animation.h"
#include "nsIContent.h"
#include "PuppetWidget.h"
namespace mozilla {
namespace layers {
@ -189,5 +192,64 @@ AnimationInfo::GetGenerationFromFrame(nsIFrame* aFrame,
return Nothing();
}
/* static */ void
AnimationInfo::EnumerateGenerationOnFrame(
const nsIFrame* aFrame,
const nsIContent* aContent,
const CompositorAnimatableDisplayItemTypes& aDisplayItemTypes,
const AnimationGenerationCallback& aCallback)
{
if (XRE_IsContentProcess()) {
if (nsIWidget* widget = nsContentUtils::WidgetForContent(aContent)) {
// In case of child processes, we might not have yet created the layer
// manager. That means there is no animation generation we have, thus
// we call the callback function with |Nothing()| for the generation.
//
// Note that we need to use nsContentUtils::WidgetForContent() instead of
// TabChild::GetFrom(aFrame->PresShell())->WebWidget() because in the case
// of child popup content PuppetWidget::mTabChild is the same as the
// parent's one, which means mTabChild->IsLayersConnected() check in
// PuppetWidget::GetLayerManager queries the parent state, it results the
// assertion in the function failure.
if (widget->GetOwningTabChild() &&
!static_cast<widget::PuppetWidget*>(widget)->HasLayerManager()) {
for (auto displayItem : LayerAnimationInfo::sDisplayItemTypes) {
aCallback(Nothing(), displayItem);
}
return;
}
}
}
RefPtr<LayerManager> layerManager =
nsContentUtils::LayerManagerForContent(aContent);
if (layerManager &&
layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) {
// In case of continuation, nsDisplayItem uses its last continuation, so we
// have to use the last continuation frame here.
if (nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(aFrame)) {
aFrame = nsLayoutUtils::LastContinuationOrIBSplitSibling(aFrame);
}
for (auto displayItem : LayerAnimationInfo::sDisplayItemTypes) {
RefPtr<WebRenderAnimationData> animationData =
GetWebRenderUserData<WebRenderAnimationData>(aFrame,
(uint32_t)displayItem);
Maybe<uint64_t> generation;
if (animationData) {
generation = animationData->GetAnimationInfo().GetAnimationGeneration();
}
aCallback(generation, displayItem);
}
return;
}
FrameLayerBuilder::EnumerateGenerationForDedicatedLayers(
aFrame,
LayerAnimationInfo::sDisplayItemTypes,
aCallback);
}
} // namespace layers
} // namespace mozilla

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

@ -8,9 +8,12 @@
#define GFX_ANIMATIONINFO_H
#include "nsAutoPtr.h"
#include "nsCSSPropertyIDSet.h"
#include "nsDisplayItemTypes.h"
#include "mozilla/Array.h"
struct RawServoAnimationValue;
class nsIContent;
class nsIFrame;
namespace mozilla {
@ -48,7 +51,10 @@ public:
{
mAnimationGeneration = Some(aCount);
}
Maybe<uint64_t> GetAnimationGeneration() { return mAnimationGeneration; }
Maybe<uint64_t> GetAnimationGeneration() const
{
return mAnimationGeneration;
}
// ClearAnimations clears animations on this layer.
void ClearAnimations();
@ -72,6 +78,21 @@ public:
static Maybe<uint64_t> GetGenerationFromFrame(nsIFrame* aFrame,
DisplayItemType aDisplayItemKey);
using CompositorAnimatableDisplayItemTypes =
Array<DisplayItemType, nsCSSPropertyIDSet::CompositorAnimatableCount()>;
using AnimationGenerationCallback =
std::function<bool(const Maybe<uint64_t>& aGeneration,
DisplayItemType aDisplayItemType)>;
// Enumerates animation generations on |aFrame| for the given display item
// types and calls |aCallback| with the animation generation.
//
// The enumeration stops if |aCallback| returns false.
static void EnumerateGenerationOnFrame(
const nsIFrame* aFrame,
const nsIContent* aContent,
const CompositorAnimatableDisplayItemTypes& aDisplayItemTypes,
const AnimationGenerationCallback& aCallback);
protected:
AnimationArray mAnimations;
uint64_t mCompositorAnimationsId;

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

@ -1379,7 +1379,7 @@ public:
uint64_t GetCompositorAnimationsId() { return mAnimationInfo.GetCompositorAnimationsId(); }
InfallibleTArray<AnimData>& GetAnimationData();
Maybe<uint64_t> GetAnimationGeneration()
Maybe<uint64_t> GetAnimationGeneration() const
{
return mAnimationInfo.GetAnimationGeneration();
}

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

@ -554,10 +554,10 @@ struct DIGroup
combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
// The invalid rect should contain the old rect and the new rect
// because the parent should have invalidated this area
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
// but may not because the parent may have been removed.
InvalidateRect(aData->mRect);
aData->mRect = transformedRect.Intersect(mImageBounds);
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
InvalidateRect(aData->mRect);
GP("ContainerLayer image rect bounds change\n");
} else {
// XXX: this code can eventually be deleted/made debug only
@ -574,10 +574,10 @@ struct DIGroup
combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
// The invalid rect should contain the old rect and the new rect
// because the parent should have invalidated this area
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
// but may not because the parent may have been removed.
InvalidateRect(aData->mRect);
aData->mRect = transformedRect.Intersect(mImageBounds);
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
InvalidateRect(aData->mRect);
GP("image rect bounds change\n");
} else {
// XXX: this code can eventually be deleted/made debug only

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

@ -232,7 +232,7 @@ struct WebRenderUserDataProperty {
};
template<class T> already_AddRefed<T>
GetWebRenderUserData(nsIFrame* aFrame, uint32_t aPerFrameKey)
GetWebRenderUserData(const nsIFrame* aFrame, uint32_t aPerFrameKey)
{
MOZ_ASSERT(aFrame);
WebRenderUserDataTable* userDataTable =

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

@ -0,0 +1,10 @@
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><style>
:last-child{
background-image: -moz-element(#id3);
border-width: 9596.6vmin;
border-style: dotted;
}
</style>
</head><body><rect id="id3">
</rect></body></html>

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

@ -167,6 +167,7 @@ load 1408078-1.html
load 1464243.html
load 1467847-1.html
load 1468020.html
load 1470437.html
load 1470440.html
load 1478035.html
load 1490704-1.html

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

@ -747,6 +747,7 @@ WebRenderMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
helper.ReportTexture(aReport.render_target_textures, "render-targets");
helper.ReportTexture(aReport.texture_cache_textures, "texture-cache");
helper.ReportTexture(aReport.depth_target_textures, "depth-targets");
helper.ReportTexture(aReport.swap_chain, "swap-chains");
// Total GPU bytes, for sanity-checking the above.
helper.ReportTotalGPUBytes(aReport.total_gpu_bytes_allocated);

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

@ -799,7 +799,7 @@ already_AddRefed<gfx::VsyncSource>
gfxPlatformGtk::CreateHardwareVsyncSource()
{
#ifdef MOZ_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
RefPtr<VsyncSource> vsyncSource = new GtkVsyncSource();
VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
static_cast<GtkVsyncSource::GLXDisplay&>(display).SetupWayland();

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

@ -57,7 +57,7 @@ use internal_types::{CacheTextureId, DebugOutput, FastHashMap, LayerIndex, Rende
use internal_types::{TextureCacheAllocationKind, TextureCacheUpdate, TextureUpdateList, TextureUpdateSource};
use internal_types::{RenderTargetInfo, SavedTargetIndex};
use prim_store::DeferredResolve;
use profiler::{BackendProfileCounters, FrameProfileCounters,
use profiler::{BackendProfileCounters, FrameProfileCounters, TimeProfileCounter,
GpuProfileTag, RendererProfileCounters, RendererProfileTimers};
use device::query::GpuProfiler;
use rayon::{ThreadPool, ThreadPoolBuilder};
@ -1534,6 +1534,8 @@ pub struct Renderer {
debug_flags: DebugFlags,
backend_profile_counters: BackendProfileCounters,
profile_counters: RendererProfileCounters,
resource_upload_time: u64,
gpu_cache_upload_time: u64,
#[cfg(feature = "debug_renderer")]
profiler: Profiler,
#[cfg(feature = "debug_renderer")]
@ -1985,6 +1987,8 @@ impl Renderer {
debug_flags,
backend_profile_counters: BackendProfileCounters::new(),
profile_counters: RendererProfileCounters::new(),
resource_upload_time: 0,
gpu_cache_upload_time: 0,
#[cfg(feature = "debug_renderer")]
profiler: Profiler::new(),
#[cfg(feature = "debug_renderer")]
@ -2134,6 +2138,7 @@ impl Renderer {
} => {
self.pending_texture_updates.push(updates);
self.device.begin_frame();
self.update_texture_cache();
// Flush the render target pool on memory pressure.
@ -2705,6 +2710,10 @@ impl Renderer {
self.backend_profile_counters.reset();
self.profile_counters.reset();
self.profile_counters.frame_counter.inc();
stats.resource_upload_time = self.resource_upload_time;
self.resource_upload_time = 0;
stats.gpu_cache_upload_time = self.gpu_cache_upload_time;
self.gpu_cache_upload_time = 0;
profile_timers.cpu_time.profile(|| {
let _gm = self.gpu_profile.start_marker("end frame");
@ -2774,7 +2783,11 @@ impl Renderer {
.update(&mut self.device, &update_list);
}
let updated_rows = self.gpu_cache_texture.flush(&mut self.device);
let mut upload_time = TimeProfileCounter::new("GPU cache upload time", false);
let updated_rows = upload_time.profile(|| {
return self.gpu_cache_texture.flush(&mut self.device);
});
self.gpu_cache_upload_time += upload_time.get();
let counters = &mut self.backend_profile_counters.resources.gpu_cache;
counters.updated_rows.set(updated_rows);
@ -2799,101 +2812,104 @@ impl Renderer {
let _gm = self.gpu_profile.start_marker("texture cache update");
let mut pending_texture_updates = mem::replace(&mut self.pending_texture_updates, vec![]);
for update_list in pending_texture_updates.drain(..) {
for allocation in update_list.allocations {
let is_realloc = matches!(allocation.kind, TextureCacheAllocationKind::Realloc(..));
match allocation.kind {
TextureCacheAllocationKind::Alloc(info) |
TextureCacheAllocationKind::Realloc(info) => {
// Create a new native texture, as requested by the texture cache.
//
// Ensure no PBO is bound when creating the texture storage,
// or GL will attempt to read data from there.
let texture = self.device.create_texture(
TextureTarget::Array,
info.format,
info.width,
info.height,
info.filter,
// This needs to be a render target because some render
// tasks get rendered into the texture cache.
Some(RenderTargetInfo { has_depth: false }),
info.layer_count,
);
let old = self.texture_resolver.texture_cache_map.insert(allocation.id, texture);
assert_eq!(old.is_some(), is_realloc, "Renderer and RenderBackend disagree");
if let Some(old) = old {
self.device.blit_renderable_texture(
self.texture_resolver.texture_cache_map.get_mut(&allocation.id).unwrap(),
&old
let mut upload_time = TimeProfileCounter::new("Resource upload time", false);
upload_time.profile(|| {
for update_list in pending_texture_updates.drain(..) {
for allocation in update_list.allocations {
let is_realloc = matches!(allocation.kind, TextureCacheAllocationKind::Realloc(..));
match allocation.kind {
TextureCacheAllocationKind::Alloc(info) |
TextureCacheAllocationKind::Realloc(info) => {
// Create a new native texture, as requested by the texture cache.
//
// Ensure no PBO is bound when creating the texture storage,
// or GL will attempt to read data from there.
let texture = self.device.create_texture(
TextureTarget::Array,
info.format,
info.width,
info.height,
info.filter,
// This needs to be a render target because some render
// tasks get rendered into the texture cache.
Some(RenderTargetInfo { has_depth: false }),
info.layer_count,
);
self.device.delete_texture(old);
let old = self.texture_resolver.texture_cache_map.insert(allocation.id, texture);
assert_eq!(old.is_some(), is_realloc, "Renderer and RenderBackend disagree");
if let Some(old) = old {
self.device.blit_renderable_texture(
self.texture_resolver.texture_cache_map.get_mut(&allocation.id).unwrap(),
&old
);
self.device.delete_texture(old);
}
},
TextureCacheAllocationKind::Free => {
let texture = self.texture_resolver.texture_cache_map.remove(&allocation.id).unwrap();
self.device.delete_texture(texture);
},
}
}
for update in update_list.updates {
let TextureCacheUpdate { id, rect, stride, offset, layer_index, source } = update;
let texture = &self.texture_resolver.texture_cache_map[&id];
let mut uploader = self.device.upload_texture(
texture,
&self.texture_cache_upload_pbo,
0,
);
let bytes_uploaded = match source {
TextureUpdateSource::Bytes { data } => {
uploader.upload(
rect, layer_index, stride,
&data[offset as usize ..],
)
}
},
TextureCacheAllocationKind::Free => {
let texture = self.texture_resolver.texture_cache_map.remove(&allocation.id).unwrap();
self.device.delete_texture(texture);
},
TextureUpdateSource::External { id, channel_index } => {
let handler = self.external_image_handler
.as_mut()
.expect("Found external image, but no handler set!");
// The filter is only relevant for NativeTexture external images.
let size = match handler.lock(id, channel_index, ImageRendering::Auto).source {
ExternalImageSource::RawData(data) => {
uploader.upload(
rect, layer_index, stride,
&data[offset as usize ..],
)
}
ExternalImageSource::Invalid => {
// Create a local buffer to fill the pbo.
let bpp = texture.get_format().bytes_per_pixel();
let width = stride.unwrap_or(rect.size.width * bpp);
let total_size = width * rect.size.height;
// WR haven't support RGBAF32 format in texture_cache, so
// we use u8 type here.
let dummy_data: Vec<u8> = vec![255; total_size as usize];
uploader.upload(rect, layer_index, stride, &dummy_data)
}
ExternalImageSource::NativeTexture(eid) => {
panic!("Unexpected external texture {:?} for the texture cache update of {:?}", eid, id);
}
};
handler.unlock(id, channel_index);
size
}
};
self.profile_counters.texture_data_uploaded.add(bytes_uploaded >> 10);
}
}
for update in update_list.updates {
let TextureCacheUpdate { id, rect, stride, offset, layer_index, source } = update;
let texture = &self.texture_resolver.texture_cache_map[&id];
let mut uploader = self.device.upload_texture(
texture,
&self.texture_cache_upload_pbo,
0,
);
let bytes_uploaded = match source {
TextureUpdateSource::Bytes { data } => {
uploader.upload(
rect, layer_index, stride,
&data[offset as usize ..],
)
}
TextureUpdateSource::External { id, channel_index } => {
let handler = self.external_image_handler
.as_mut()
.expect("Found external image, but no handler set!");
// The filter is only relevant for NativeTexture external images.
let size = match handler.lock(id, channel_index, ImageRendering::Auto).source {
ExternalImageSource::RawData(data) => {
uploader.upload(
rect, layer_index, stride,
&data[offset as usize ..],
)
}
ExternalImageSource::Invalid => {
// Create a local buffer to fill the pbo.
let bpp = texture.get_format().bytes_per_pixel();
let width = stride.unwrap_or(rect.size.width * bpp);
let total_size = width * rect.size.height;
// WR haven't support RGBAF32 format in texture_cache, so
// we use u8 type here.
let dummy_data: Vec<u8> = vec![255; total_size as usize];
uploader.upload(rect, layer_index, stride, &dummy_data)
}
ExternalImageSource::NativeTexture(eid) => {
panic!("Unexpected external texture {:?} for the texture cache update of {:?}", eid, id);
}
};
handler.unlock(id, channel_index);
size
}
};
self.profile_counters.texture_data_uploaded.add(bytes_uploaded >> 10);
}
}
drain_filter(
&mut self.notifications,
|n| { n.when() == Checkpoint::FrameTexturesUpdated },
|n| { n.notify(); },
);
drain_filter(
&mut self.notifications,
|n| { n.when() == Checkpoint::FrameTexturesUpdated },
|n| { n.notify(); },
);
});
self.resource_upload_time += upload_time.get();
}
pub(crate) fn draw_instanced_batch<T>(
@ -4679,6 +4695,8 @@ pub struct RendererStats {
pub alpha_target_count: usize,
pub color_target_count: usize,
pub texture_upload_kb: usize,
pub resource_upload_time: u64,
pub gpu_cache_upload_time: u64,
}
impl RendererStats {
@ -4688,6 +4706,8 @@ impl RendererStats {
alpha_target_count: 0,
color_target_count: 0,
texture_upload_kb: 0,
resource_upload_time: 0,
gpu_cache_upload_time: 0,
}
}
}

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

@ -445,7 +445,10 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
Range<const uint8_t> blob(aBlob.begin() + offset, aBlob.begin() + end);
ret = translator.TranslateRecording((char*)blob.begin().get(), blob.length());
MOZ_RELEASE_ASSERT(ret);
if (!ret) {
gfxCriticalNote << "Replay failure: " << translator.GetError();
MOZ_RELEASE_ASSERT(false);
}
offset = extra_end;
}

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

@ -147,13 +147,14 @@ void
RenderThread::DoAccumulateMemoryReport(MemoryReport aReport, const RefPtr<MemoryReportPromise::Private>& aPromise)
{
MOZ_ASSERT(IsInRenderThread());
MOZ_ASSERT(aReport.total_gpu_bytes_allocated == 0);
for (auto& r: mRenderers) {
wr_renderer_accumulate_memory_report(r.second->GetRenderer(), &aReport);
r.second->AccumulateMemoryReport(&aReport);
}
// Note total gpu bytes allocated across all WR instances.
MOZ_ASSERT(aReport.total_gpu_bytes_allocated == 0);
aReport.total_gpu_bytes_allocated = wr_total_gpu_bytes_allocated();
aReport.total_gpu_bytes_allocated += wr_total_gpu_bytes_allocated();
aPromise->Resolve(aReport, __func__);
}

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

@ -8,6 +8,7 @@
#include "GLContext.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/LayersTypes.h"
@ -248,6 +249,22 @@ RendererOGL::GetRenderTexture(wr::WrExternalImageId aExternalImageId)
return mThread->GetRenderTexture(aExternalImageId);
}
void
RendererOGL::AccumulateMemoryReport(MemoryReport* aReport)
{
wr_renderer_accumulate_memory_report(GetRenderer(), aReport);
LayoutDeviceIntSize size = mCompositor->GetBufferSize();
// Assume BGRA8 for the format since it's not exposed anywhere,
// and all compositor backends should be using that.
uintptr_t swapChainSize = size.width * size.height *
BytesPerPixel(SurfaceFormat::B8G8R8A8) *
(mCompositor->UseTripleBuffering() ? 3 : 2);
aReport->swap_chain += swapChainSize;
aReport->total_gpu_bytes_allocated += swapChainSize;
}
static void
DoNotifyWebRenderError(layers::CompositorBridgeParent* aBridge, WebRenderError aError)
{

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

@ -95,6 +95,8 @@ public:
RenderTextureHost* GetRenderTexture(wr::WrExternalImageId aExternalImageId);
void AccumulateMemoryReport(MemoryReport* aReport);
wr::Renderer* GetRenderer() { return mRenderer; }
gl::GLContext* gl() const;

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

@ -1 +1 @@
fbf65161bef7fbbe07dfd2c9b5b9833784422e9e
dfb2517eea37bce19e686032faae4053cb427ff8

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

@ -45,6 +45,9 @@ jsfuzz_createGlobal(JSContext* cx, JSPrincipals* principals)
JS::RootedObject newGlobal(cx);
JS::RealmOptions options;
options.creationOptions().setStreamsEnabled(true);
#ifdef ENABLE_BIGINT
options.creationOptions().setBigIntEnabled(true);
#endif
newGlobal = JS_NewGlobalObject(cx, getGlobalClass(), principals, JS::FireOnNewGlobalHook,
options);
if (!newGlobal) {

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

@ -993,7 +993,6 @@ GCRuntime::GCRuntime(JSRuntime* rt) :
fullGCForAtomsRequested_(false),
minorGCNumber(0),
majorGCNumber(0),
jitReleaseNumber(0),
number(0),
isFull(false),
incrementalState(gc::State::NotActive),
@ -1341,12 +1340,6 @@ js::gc::DumpArenaInfo()
#endif // JS_GC_ZEAL
/*
* Lifetime in number of major GCs for type sets attached to scripts containing
* observed types.
*/
static const unsigned JIT_SCRIPT_RELEASE_TYPES_PERIOD = 20;
bool
GCRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes)
{
@ -1364,8 +1357,6 @@ GCRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes)
setMarkStackLimit(atoi(size), lock);
}
jitReleaseNumber = majorGCNumber + JIT_SCRIPT_RELEASE_TYPES_PERIOD;
if (!nursery().init(maxNurseryBytes, lock)) {
return false;
}
@ -3961,33 +3952,6 @@ GCRuntime::waitBackgroundSweepEnd()
}
}
bool
GCRuntime::shouldReleaseObservedTypes()
{
bool releaseTypes = false;
if (cleanUpEverything) {
releaseTypes = true;
}
#ifdef JS_GC_ZEAL
if (zealModeBits != 0) {
releaseTypes = true;
}
#endif
/* We may miss the exact target GC due to resets. */
if (majorGCNumber >= jitReleaseNumber) {
releaseTypes = true;
}
if (releaseTypes) {
jitReleaseNumber = majorGCNumber + JIT_SCRIPT_RELEASE_TYPES_PERIOD;
}
return releaseTypes;
}
struct IsAboutToBeFinalizedFunctor {
template <typename T> bool operator()(Cell** t) {
mozilla::DebugOnly<const Cell*> prior = *t;
@ -4559,12 +4523,14 @@ GCRuntime::prepareZonesForCollection(JS::gcreason::Reason reason, bool* isFullOu
}
static void
DiscardJITCodeForGC(JSRuntime* rt, bool releaseTypes)
DiscardJITCodeForGC(JSRuntime* rt)
{
js::CancelOffThreadIonCompile(rt, JS::Zone::Mark);
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
gcstats::AutoPhase ap(rt->gc.stats(), gcstats::PhaseKind::MARK_DISCARD_CODE);
zone->discardJitCode(rt->defaultFreeOp(), /* discardBaselineCode = */ true, releaseTypes);
zone->discardJitCode(rt->defaultFreeOp(),
/* discardBaselineCode = */ true,
/* releaseTypes = */ true);
}
}
@ -4671,7 +4637,7 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason, AutoGCSession& session)
// Discard JIT code. For incremental collections, the sweep phase will
// also discard JIT code.
DiscardJITCodeForGC(rt, shouldReleaseObservedTypes());
DiscardJITCodeForGC(rt);
/*
* Relazify functions after discarding JIT code (we can't relazify

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

@ -632,7 +632,6 @@ class GCRuntime
IncrementalProgress endMarkingSweepGroup(FreeOp* fop, SliceBudget& budget);
void markIncomingCrossCompartmentPointers(MarkColor color);
IncrementalProgress beginSweepingSweepGroup(FreeOp* fop, SliceBudget& budget);
bool shouldReleaseObservedTypes();
void sweepDebuggerOnMainThread(FreeOp* fop);
void sweepJitDataOnMainThread(FreeOp* fop);
IncrementalProgress endSweepingSweepGroup(FreeOp* fop, SliceBudget& budget);
@ -816,9 +815,6 @@ class GCRuntime
/* Incremented at the start of every major GC. */
MainThreadData<uint64_t> majorGCNumber;
/* The major GC number at which to release observed type information. */
MainThreadData<uint64_t> jitReleaseNumber;
/* Incremented on every GC slice. */
MainThreadData<uint64_t> number;

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

@ -86,6 +86,9 @@ JSObject* JSAPITest::createGlobal(JSPrincipals* principals)
JS::RootedObject newGlobal(cx);
JS::RealmOptions options;
options.creationOptions().setStreamsEnabled(true);
#ifdef ENABLE_BIGINT
options.creationOptions().setBigIntEnabled(true);
#endif
newGlobal = JS_NewGlobalObject(cx, getGlobalClass(), principals, JS::FireOnNewGlobalHook,
options);
if (!newGlobal) {

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

@ -1501,6 +1501,9 @@ class JS_PUBLIC_API(RealmCreationOptions)
cloneSingletons_(false),
sharedMemoryAndAtomics_(false),
streams_(false),
#ifdef ENABLE_BIGINT
bigint_(false),
#endif
secureContext_(false),
clampAndJitterTime_(true)
{}
@ -1572,6 +1575,14 @@ class JS_PUBLIC_API(RealmCreationOptions)
return *this;
}
#ifdef ENABLE_BIGINT
bool getBigIntEnabled() const { return bigint_; }
RealmCreationOptions& setBigIntEnabled(bool flag) {
bigint_ = flag;
return *this;
}
#endif
// This flag doesn't affect JS engine behavior. It is used by Gecko to
// mark whether content windows and workers are "Secure Context"s. See
// https://w3c.github.io/webappsec-secure-contexts/
@ -1601,6 +1612,9 @@ class JS_PUBLIC_API(RealmCreationOptions)
bool cloneSingletons_;
bool sharedMemoryAndAtomics_;
bool streams_;
#ifdef ENABLE_BIGINT
bool bigint_;
#endif
bool secureContext_;
bool clampAndJitterTime_;
};

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

@ -522,6 +522,9 @@ static bool enableWasmGc = false;
static bool enableTestWasmAwaitTier2 = false;
static bool enableAsyncStacks = false;
static bool enableStreams = false;
#ifdef ENABLE_BIGINT
static bool enableBigInt = false;
#endif
#ifdef JS_GC_ZEAL
static uint32_t gZealBits = 0;
static uint32_t gZealFrequency = 0;
@ -3749,6 +3752,9 @@ static void
SetStandardRealmOptions(JS::RealmOptions& options)
{
options.creationOptions().setSharedMemoryAndAtomicsEnabled(enableSharedMemory)
#ifdef ENABLE_BIGINT
.setBigIntEnabled(enableBigInt)
#endif
.setStreamsEnabled(enableStreams);
}
@ -10366,6 +10372,9 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
enableTestWasmAwaitTier2 = op.getBoolOption("test-wasm-await-tier2");
enableAsyncStacks = !op.getBoolOption("no-async-stacks");
enableStreams = !op.getBoolOption("no-streams");
#ifdef ENABLE_BIGINT
enableBigInt = !op.getBoolOption("no-bigint");
#endif
#if defined ENABLE_WASM_GC && defined ENABLE_WASM_CRANELIFT
// Note, once we remove --wasm-gc this test will no longer make any sense
@ -11001,6 +11010,9 @@ main(int argc, char** argv, char** envp)
|| !op.addBoolOption('\0', "no-unboxed-objects", "Disable creating unboxed plain objects")
|| !op.addBoolOption('\0', "enable-streams", "Enable WHATWG Streams (default)")
|| !op.addBoolOption('\0', "no-streams", "Disable WHATWG Streams")
#ifdef ENABLE_BIGINT
|| !op.addBoolOption('\0', "no-bigint", "Disable experimental BigInt support")
#endif
#ifdef ENABLE_SHARED_ARRAY_BUFFER
|| !op.addStringOption('\0', "shared-memory", "on/off",
"SharedArrayBuffer and Atomics "

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

@ -110,6 +110,11 @@ GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key)
case JSProto_CountQueuingStrategy:
return !cx->realm()->creationOptions().getStreamsEnabled();
#ifdef ENABLE_BIGINT
case JSProto_BigInt:
return !cx->realm()->creationOptions().getBigIntEnabled();
#endif
// Return true if the given constructor has been disabled at run-time.
case JSProto_Atomics:
case JSProto_SharedArrayBuffer:

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

@ -784,11 +784,17 @@ bool xpc::ExtraWarningsForSystemJS() { return false; }
static mozilla::Atomic<bool> sSharedMemoryEnabled(false);
static mozilla::Atomic<bool> sStreamsEnabled(false);
#ifdef ENABLE_BIGINT
static mozilla::Atomic<bool> sBigIntEnabled(false);
#endif
void
xpc::SetPrefableRealmOptions(JS::RealmOptions &options)
{
options.creationOptions().setSharedMemoryAndAtomicsEnabled(sSharedMemoryEnabled)
#ifdef ENABLE_BIGINT
.setBigIntEnabled(sBigIntEnabled)
#endif
.setStreamsEnabled(sStreamsEnabled);
}
@ -831,6 +837,10 @@ ReloadPrefsCallback(const char* pref, XPCJSContext* xpccx)
bool useAsyncStack = Preferences::GetBool(JS_OPTIONS_DOT_STR "asyncstack");
#ifdef ENABLE_BIGINT
sBigIntEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "bigint");
#endif
bool throwOnDebuggeeWouldRun = Preferences::GetBool(JS_OPTIONS_DOT_STR
"throw_on_debuggee_would_run");

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

@ -1,3 +1,3 @@
[test_loader_global_sharing.py]
skip-if = !manage_instance || appname == 'fennec' || (os == "win" && !(debug || asan)) # Bug 1495667
skip-if = !manage_instance || appname == 'fennec'

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

@ -1795,13 +1795,13 @@ RestyleManager::AddLayerChangesForAnimation(nsIFrame* aFrame,
uint64_t frameGeneration =
RestyleManager::GetAnimationGenerationForFrame(aFrame);
Maybe<nsCSSPropertyIDSet> effectiveAnimationProperties;
Maybe<uint64_t> generation;
nsChangeHint hint = nsChangeHint(0);
for (const LayerAnimationInfo::Record& layerInfo :
LayerAnimationInfo::sRecords) {
Maybe<uint64_t> generation =
layers::AnimationInfo::GetGenerationFromFrame(aFrame,
layerInfo.mDisplayItemType);
if (generation && frameGeneration != *generation) {
auto maybeApplyChangeHint = [&](const Maybe<uint64_t>& aGeneration,
DisplayItemType aDisplayItemType) -> bool {
if (aGeneration && frameGeneration != *aGeneration) {
// If we have a transform layer bug don't have any transform style, we
// probably just removed the transform but haven't destroyed the layer
// yet. In this case we will typically add the appropriate change hint
@ -1821,7 +1821,7 @@ RestyleManager::AddLayerChangesForAnimation(nsIFrame* aFrame,
// Note that we *don't* add nsChangeHint_UpdateTransformLayer since if we
// did, ApplyRenderingChangeToTree would complain that we're updating a
// transform layer without a transform.
if (layerInfo.mDisplayItemType == DisplayItemType::TYPE_TRANSFORM &&
if (aDisplayItemType == DisplayItemType::TYPE_TRANSFORM &&
!aFrame->StyleDisplay()->HasTransformStyle()) {
// Add all the hints for a removing a transform if they are not already
// set for this frame.
@ -1830,9 +1830,9 @@ RestyleManager::AddLayerChangesForAnimation(nsIFrame* aFrame,
aHintForThisFrame))) {
hint |= nsChangeHint_ComprehensiveAddOrRemoveTransform;
}
continue;
return true;
}
hint |= layerInfo.mChangeHint;
hint |= LayerAnimationInfo::GetChangeHintFor(aDisplayItemType);
}
// We consider it's the first paint for the frame if we have an animation
@ -1848,11 +1848,26 @@ RestyleManager::AddLayerChangesForAnimation(nsIFrame* aFrame,
// not have those properies just before. e.g, setting transform by
// setKeyframes or changing target element from other target which prevents
// running on the compositor, etc.
if (!generation &&
nsLayoutUtils::HasEffectiveAnimation(aFrame, layerInfo.mProperty)) {
hint |= layerInfo.mChangeHint;
if (!generation) {
if (!effectiveAnimationProperties) {
effectiveAnimationProperties.emplace(
nsLayoutUtils::GetAnimationPropertiesForCompositor(aFrame));
}
const nsCSSPropertyIDSet& propertiesForDisplayItem =
LayerAnimationInfo::GetCSSPropertiesFor(aDisplayItemType);
if (effectiveAnimationProperties->Intersects(propertiesForDisplayItem)) {
hint |=
LayerAnimationInfo::GetChangeHintFor(aDisplayItemType);
}
}
}
return true;
};
AnimationInfo::EnumerateGenerationOnFrame(
aFrame,
aContent,
LayerAnimationInfo::sDisplayItemTypes,
maybeApplyChangeHint);
if (hint) {
aChangeListToProcess.AppendChange(aFrame, aContent, hint);

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

@ -321,14 +321,31 @@ nsLayoutUtils::HasEffectiveAnimation(const nsIFrame* aFrame,
return HasMatchingAnimations(effects,
[&aProperty](KeyframeEffect& aEffect)
[&aProperty, &effects](KeyframeEffect& aEffect)
{
return (aEffect.IsInEffect() || aEffect.IsCurrent()) &&
aEffect.HasEffectiveAnimationOfProperty(aProperty);
aEffect.HasEffectiveAnimationOfProperty(aProperty, *effects);
}
);
}
/* static */ nsCSSPropertyIDSet
nsLayoutUtils::GetAnimationPropertiesForCompositor(const nsIFrame* aFrame)
{
nsCSSPropertyIDSet properties;
EffectSet* effects = EffectSet::GetEffectSet(aFrame);
if (!effects) {
return properties;
}
for (const KeyframeEffect* effect : *effects) {
properties |= effect->GetPropertiesForCompositor(*effects);
}
return properties;
}
static float
GetSuitableScale(float aMaxScale, float aMinScale,
nscoord aVisibleDimension, nscoord aDisplayDimension)
@ -4819,7 +4836,7 @@ nsLayoutUtils::LastContinuationOrIBSplitSibling(const nsIFrame* aFrame)
}
bool
nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(nsIFrame *aFrame)
nsLayoutUtils::IsFirstContinuationOrIBSplitSibling(const nsIFrame *aFrame)
{
if (aFrame->GetPrevContinuation()) {
return false;

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

@ -1422,8 +1422,7 @@ public:
* Is FirstContinuationOrIBSplitSibling(aFrame) going to return
* aFrame?
*/
static bool
IsFirstContinuationOrIBSplitSibling(nsIFrame *aFrame);
static bool IsFirstContinuationOrIBSplitSibling(const nsIFrame *aFrame);
/**
* Check whether aFrame is a part of the scrollbar or scrollcorner of
@ -2382,6 +2381,14 @@ public:
static bool HasEffectiveAnimation(const nsIFrame* aFrame,
nsCSSPropertyID aProperty);
/**
* Returns all effective animated CSS properties on |aFrame|. That means
* properties that can be animated on the compositor and are not overridden by
* a higher cascade level.
*/
static nsCSSPropertyIDSet
GetAnimationPropertiesForCompositor(const nsIFrame* aFrame);
/**
* Checks if off-main-thread animations are enabled.
*/

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

@ -638,7 +638,7 @@ nsPresContext::AppUnitsPerDevPixelChanged()
MediaFeatureChangeReason::ResolutionChange
});
mCurAppUnitsPerDevPixel = AppUnitsPerDevPixel();
mCurAppUnitsPerDevPixel = mDeviceContext->AppUnitsPerDevPixel();
}
void
@ -648,7 +648,7 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
if (prefName.EqualsLiteral("layout.css.dpi") ||
prefName.EqualsLiteral("layout.css.devPixelsPerPx")) {
int32_t oldAppUnitsPerDevPixel = AppUnitsPerDevPixel();
int32_t oldAppUnitsPerDevPixel = mDeviceContext->AppUnitsPerDevPixel();
if (mDeviceContext->CheckDPIChange() && mShell) {
nsCOMPtr<nsIPresShell> shell = mShell;
// Re-fetch the view manager's window dimensions in case there's a deferred
@ -662,11 +662,11 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
float oldWidthDevPixels = oldWidthAppUnits/oldAppUnitsPerDevPixel;
float oldHeightDevPixels = oldHeightAppUnits/oldAppUnitsPerDevPixel;
nscoord width = NSToCoordRound(oldWidthDevPixels*AppUnitsPerDevPixel());
nscoord height = NSToCoordRound(oldHeightDevPixels*AppUnitsPerDevPixel());
vm->SetWindowDimensions(width, height);
AppUnitsPerDevPixelChanged();
nscoord width = NSToCoordRound(oldWidthDevPixels * AppUnitsPerDevPixel());
nscoord height = NSToCoordRound(oldHeightDevPixels * AppUnitsPerDevPixel());
vm->SetWindowDimensions(width, height);
}
return;
}
@ -803,7 +803,7 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
if (mDeviceContext->SetFullZoom(mFullZoom))
mDeviceContext->FlushFontCache();
mCurAppUnitsPerDevPixel = AppUnitsPerDevPixel();
mCurAppUnitsPerDevPixel = mDeviceContext->AppUnitsPerDevPixel();
mEventManager = new mozilla::EventStateManager();
@ -1280,12 +1280,13 @@ nsPresContext::SetFullZoom(float aZoom)
mSuppressResizeReflow = true;
mFullZoom = aZoom;
AppUnitsPerDevPixelChanged();
mShell->GetViewManager()->
SetWindowDimensions(NSToCoordRound(oldWidthDevPixels * AppUnitsPerDevPixel()),
NSToCoordRound(oldHeightDevPixels * AppUnitsPerDevPixel()));
AppUnitsPerDevPixelChanged();
mSuppressResizeReflow = false;
}
@ -1831,7 +1832,7 @@ nsPresContext::UIResolutionChangedInternalScale(double aScale)
mPendingUIResolutionChanged = false;
mDeviceContext->CheckDPIChange(&aScale);
if (mCurAppUnitsPerDevPixel != AppUnitsPerDevPixel()) {
if (mCurAppUnitsPerDevPixel != mDeviceContext->AppUnitsPerDevPixel()) {
AppUnitsPerDevPixelChanged();
}
@ -2916,12 +2917,6 @@ bool nsPresContext::GetPaintFlashing() const
return mPaintFlashing;
}
int32_t
nsPresContext::AppUnitsPerDevPixel() const
{
return mDeviceContext->AppUnitsPerDevPixel();
}
nscoord
nsPresContext::GfxUnitsToAppUnits(gfxFloat aGfxUnits) const
{

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