зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
44a2124609
|
@ -186,10 +186,16 @@ MARKUPMAP(hr,
|
|||
|
||||
MARKUPMAP(input,
|
||||
[](Element* aElement, Accessible* aContext) -> Accessible* {
|
||||
// TODO(emilio): This would be faster if it used
|
||||
// HTMLInputElement's already-parsed representation.
|
||||
if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox, eIgnoreCase)) {
|
||||
return new CheckboxAccessible(aElement, aContext->Document());
|
||||
}
|
||||
if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::image, eIgnoreCase)) {
|
||||
return new HTMLButtonAccessible(aElement, aContext->Document());
|
||||
}
|
||||
if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::radio, eIgnoreCase)) {
|
||||
return new HTMLRadioButtonAccessible(aElement,
|
||||
|
|
|
@ -716,6 +716,7 @@
|
|||
actions: "press",
|
||||
};
|
||||
testElm("input_image", obj);
|
||||
testElm("input_image_display", obj);
|
||||
testElm("input_submit", obj);
|
||||
|
||||
obj = {
|
||||
|
@ -1651,6 +1652,7 @@
|
|||
<input id="input_checkbox_true" type="checkbox" checked>
|
||||
<input id="input_file" type="file">
|
||||
<input id="input_image" type="image">
|
||||
<input id="input_image_display" type="image" style="display: block">
|
||||
<form>
|
||||
<input id="input_image_default" type="image">
|
||||
</form>
|
||||
|
|
|
@ -16,8 +16,6 @@ ChromeUtils.defineModuleGetter(this, "WebNavigationFrames",
|
|||
|
||||
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);
|
||||
|
||||
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gPipNSSBundle", function() {
|
||||
return Services.strings.createBundle("chrome://pipnss/locale/pipnss.properties");
|
||||
});
|
||||
|
|
|
@ -1123,7 +1123,7 @@ var ContentBlocking = {
|
|||
|
||||
if (!isBrowserPrivate) {
|
||||
let introCount = Services.prefs.getIntPref(this.prefIntroCount);
|
||||
if (introCount < this.MAX_INTROS) {
|
||||
if (introCount < this.MAX_INTROS && !this.anyOtherWindowHasTour()) {
|
||||
Services.prefs.setIntPref(this.prefIntroCount, ++introCount);
|
||||
Services.prefs.savePrefFile(null);
|
||||
this.showIntroPanel();
|
||||
|
@ -1189,6 +1189,16 @@ var ContentBlocking = {
|
|||
}
|
||||
},
|
||||
|
||||
// Check if any existing window has a UItour initiated, both showing and hidden.
|
||||
anyOtherWindowHasTour() {
|
||||
for (let win of BrowserWindowTracker.orderedWindows) {
|
||||
if (win != window && UITour.tourBrowsersByWindow.has(win)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
disableForCurrentPage() {
|
||||
let baseURI = this._baseURIForChannelClassifier;
|
||||
|
||||
|
|
|
@ -357,6 +357,7 @@ support-files =
|
|||
[browser_removeTabsToTheEnd.js]
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_restore_isAppTab.js]
|
||||
skip-if = !crashreporter # test requires crashreporter due to 1536221
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_save_link-perwindowpb.js]
|
||||
skip-if = (e10s && debug && os == "win") || verify # Bug 1280505
|
||||
|
|
|
@ -92,8 +92,8 @@ skip-if = (os == 'win' && processor == 'aarch64') # bug 1533164
|
|||
[browser_globalplugin_crashinfobar.js]
|
||||
skip-if = !crashreporter
|
||||
[browser_pluginCrashCommentAndURL.js]
|
||||
skip-if = !crashreporter
|
||||
skip-if = !crashreporter || (processor == 'aarch64' && os == 'win') # aarch64 due to 1538785
|
||||
[browser_pluginCrashReportNonDeterminism.js]
|
||||
skip-if = !crashreporter
|
||||
skip-if = !crashreporter || (processor == 'aarch64' && os == 'win') # aarch64 due to 1538785
|
||||
[browser_private_clicktoplay.js]
|
||||
[browser_subframe_access_hidden_plugins.js]
|
||||
|
|
|
@ -39,6 +39,7 @@ skip-if = os != 'mac'
|
|||
[browser_policy_default_browser_check.js]
|
||||
[browser_policy_disable_feedback_commands.js]
|
||||
[browser_policy_disable_flash_plugin.js]
|
||||
skip-if = (processor == 'aarch64' && os == 'win') # aarch64 due to 1538785
|
||||
[browser_policy_disable_fxaccounts.js]
|
||||
skip-if = (verify && debug && (os == 'mac'))
|
||||
[browser_policy_disable_masterpassword.js]
|
||||
|
|
|
@ -157,7 +157,7 @@ disabled = bug 1438663
|
|||
[browser_ext_popup_sendMessage.js]
|
||||
[browser_ext_popup_shutdown.js]
|
||||
[browser_ext_port_disconnect_on_crash.js]
|
||||
skip-if = !e10s || !crashreporter # the tab's process is killed during the test. Without e10s the parent process would die too.
|
||||
skip-if = !e10s || !crashreporter || (processor == 'aarch64' && os == 'win') # the tab's process is killed during the test. Without e10s the parent process would die too, aarch64 due to 1538785
|
||||
[browser_ext_port_disconnect_on_window_close.js]
|
||||
[browser_ext_runtime_openOptionsPage.js]
|
||||
[browser_ext_runtime_openOptionsPage_uninstall.js]
|
||||
|
|
|
@ -45,7 +45,14 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||
gConnectionsDialog.proxyTypeChanged.bind(gConnectionsDialog));
|
||||
Preferences.get("network.proxy.socks_version").on("change",
|
||||
gConnectionsDialog.updateDNSPref.bind(gConnectionsDialog));
|
||||
gConnectionsDialog.initDnsOverHttpsUI();
|
||||
|
||||
// wait until the network.trr prefs are added before init'ing the UI for them
|
||||
gConnectionsDialog.uiReady = new Promise(resolve => {
|
||||
gConnectionsDialog._initialPrefsAdded = resolve;
|
||||
}).then(() => {
|
||||
delete gConnectionsDialog._initialPrefsAdded;
|
||||
gConnectionsDialog.initDnsOverHttpsUI();
|
||||
});
|
||||
|
||||
document
|
||||
.getElementById("disableProxyExtension")
|
||||
|
@ -302,9 +309,13 @@ var gConnectionsDialog = {
|
|||
|
||||
readDnsOverHttpsMode() {
|
||||
// called to update checked element property to reflect current pref value
|
||||
// this is the first signal we get when the prefs are added, so lazy-init
|
||||
let enabled = this.isDnsOverHttpsEnabled();
|
||||
let uriPref = Preferences.get("network.trr.uri");
|
||||
uriPref.disabled = !enabled || this.isDnsOverHttpsLocked();
|
||||
if (this._initialPrefsAdded) {
|
||||
this._initialPrefsAdded();
|
||||
}
|
||||
return enabled;
|
||||
},
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const kFontNameListFmtSerif = "font.name-list.serif.%LANG%";
|
|||
const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
|
||||
const kFontNameListFmtMonospace = "font.name-list.monospace.%LANG%";
|
||||
const kFontSizeFmtVariable = "font.size.variable.%LANG%";
|
||||
const kFontSizeFmtFixed = "font.size.fixed.%LANG%";
|
||||
const kFontSizeFmtFixed = "font.size.monospace.%LANG%";
|
||||
const kFontMinSizeFmt = "font.minimum-size.%LANG%";
|
||||
|
||||
document.documentElement.addEventListener("dialoghelp", window.top.openPrefsHelp);
|
||||
|
|
|
@ -35,6 +35,7 @@ skip-if = (os == 'win' && (processor == "x86_64" || processor == "aarch64")) # B
|
|||
[browser_bug1184989_prevent_scrolling_when_preferences_flipped.js]
|
||||
support-files =
|
||||
browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul
|
||||
[browser_cookie_exceptions_addRemove.js]
|
||||
[browser_cert_export.js]
|
||||
[browser_engines.js]
|
||||
[browser_change_app_handler.js]
|
||||
|
|
|
@ -64,6 +64,7 @@ async function testWithProperties(props, startTime) {
|
|||
}
|
||||
|
||||
let dialog = await openConnectionsSubDialog();
|
||||
await dialog.uiReady;
|
||||
info((Date.now() - startTime) + ": testWithProperties: connections dialog now open");
|
||||
let doc = dialog.document;
|
||||
let win = doc.ownerGlobal;
|
||||
|
|
|
@ -0,0 +1,241 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
|
||||
|
||||
async function openCookiesDialog(doc) {
|
||||
let cookieExceptionsButton = doc.getElementById("cookieExceptions");
|
||||
ok(cookieExceptionsButton, "cookieExceptionsButton found");
|
||||
let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
|
||||
cookieExceptionsButton.click();
|
||||
let dialog = await dialogPromise;
|
||||
return dialog;
|
||||
}
|
||||
|
||||
function checkCookiesDialog(dialog) {
|
||||
ok(dialog, "dialog loaded");
|
||||
let buttonIds = ["removePermission", "removeAllPermissions", "btnApplyChanges"];
|
||||
|
||||
for (let buttonId of buttonIds) {
|
||||
let button = dialog.document.getElementById(buttonId);
|
||||
ok(button, `${buttonId} found`);
|
||||
}
|
||||
|
||||
let cancelButton =
|
||||
dialog.document.getElementsByClassName("actionButtons")[1].children[0];
|
||||
|
||||
is(cancelButton.getAttribute("label"), "Cancel", "cancelButton found");
|
||||
}
|
||||
|
||||
function addNewPermission(websiteAddress, dialog) {
|
||||
let url = dialog.document.getElementById("url");
|
||||
let buttonDialog = dialog.document.getElementById("btnBlock");
|
||||
let permissionsBox = dialog.document.getElementById("permissionsBox");
|
||||
let currentPermissions = permissionsBox.itemCount;
|
||||
|
||||
url.value = websiteAddress;
|
||||
url.dispatchEvent(new Event("input", {bubbles: true}));
|
||||
is(buttonDialog.hasAttribute("disabled"), false,
|
||||
"When the user add an url the button should be clickable");
|
||||
buttonDialog.click();
|
||||
|
||||
is(permissionsBox.itemCount, currentPermissions + 1,
|
||||
"Website added in url should be in the list");
|
||||
}
|
||||
|
||||
async function cleanList(dialog) {
|
||||
let removeAllButton = dialog.document.getElementById("removeAllPermissions");
|
||||
if (!removeAllButton.hasAttribute("disabled")) removeAllButton.click();
|
||||
}
|
||||
|
||||
function addData(websites, dialog) {
|
||||
for (let website of websites) {
|
||||
addNewPermission(website, dialog);
|
||||
}
|
||||
}
|
||||
|
||||
function deletePermission(permission, dialog) {
|
||||
let permissionsBox = dialog.document.getElementById("permissionsBox");
|
||||
let elements = permissionsBox.getElementsByAttribute("origin", permission);
|
||||
is(elements.length, 1, "It should find only one entry");
|
||||
permissionsBox.selectItem(elements[0]);
|
||||
let removePermissionButton = dialog.document.getElementById("removePermission");
|
||||
is(removePermissionButton.hasAttribute("disabled"), false,
|
||||
"The button should be clickable to remove selected item");
|
||||
removePermissionButton.click();
|
||||
}
|
||||
|
||||
function save(dialog) {
|
||||
let saveButton = dialog.document.getElementById("btnApplyChanges");
|
||||
saveButton.click();
|
||||
}
|
||||
|
||||
function cancel(dialog) {
|
||||
let cancelButton =
|
||||
dialog.document.getElementsByClassName("actionButtons")[1].children[0];
|
||||
is(cancelButton.getAttribute("label"), "Cancel", "cancelButton found");
|
||||
cancelButton.click();
|
||||
}
|
||||
|
||||
async function checkExpected(expected, doc) {
|
||||
let dialog = await openCookiesDialog(doc);
|
||||
let permissionsBox = dialog.document.getElementById("permissionsBox");
|
||||
|
||||
is(permissionsBox.itemCount, expected.length,
|
||||
`There should be ${expected.length} elements in the list`);
|
||||
|
||||
for (let website of expected) {
|
||||
let elements = permissionsBox.getElementsByAttribute("origin", website);
|
||||
is(elements.length, 1, "It should find only one entry");
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
|
||||
async function runTest(test, websites, doc) {
|
||||
let dialog = await openCookiesDialog(doc);
|
||||
checkCookiesDialog(dialog);
|
||||
|
||||
if (test.needPreviousData) {
|
||||
addData(websites, dialog);
|
||||
save(dialog);
|
||||
dialog = await openCookiesDialog(doc);
|
||||
}
|
||||
|
||||
for (let step of test.steps) {
|
||||
switch (step) {
|
||||
case "addNewPermission":
|
||||
addNewPermission(test.newData, dialog);
|
||||
break;
|
||||
case "deletePermission":
|
||||
deletePermission(test.newData, dialog);
|
||||
break;
|
||||
case "deleteAllPermission":
|
||||
await cleanList(dialog);
|
||||
break;
|
||||
case "save":
|
||||
save(dialog);
|
||||
break;
|
||||
case "cancel":
|
||||
cancel(dialog);
|
||||
break;
|
||||
case "openPane":
|
||||
dialog = await openCookiesDialog(doc);
|
||||
break;
|
||||
default:
|
||||
// code block
|
||||
}
|
||||
}
|
||||
dialog = await checkExpected(test.expected, doc);
|
||||
await cleanList(dialog);
|
||||
save(dialog);
|
||||
}
|
||||
|
||||
add_task(async function checkPermissions() {
|
||||
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
|
||||
let win = gBrowser.selectedBrowser.contentWindow;
|
||||
let doc = win.document;
|
||||
let websites = ["http://test1.com", "http://test2.com"];
|
||||
|
||||
let tests = [{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "save"],
|
||||
"expected": ["https://mytest.com"], // when open the pane again it should find this in the list
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "cancel"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "deletePermission", "save"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "deletePermission", "cancel"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "save", "openPane", "deletePermission", "save"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "save", "openPane", "deletePermission", "cancel"],
|
||||
"expected": ["https://mytest.com"],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "deleteAllPermission", "save"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "deleteAllPermission", "cancel"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "save", "openPane", "deleteAllPermission", "save"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "save", "openPane", "deleteAllPermission", "cancel"],
|
||||
"expected": ["https://mytest.com"],
|
||||
},
|
||||
{
|
||||
"needPreviousData": true,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["deleteAllPermission", "save"],
|
||||
"expected": [],
|
||||
},
|
||||
{
|
||||
"needPreviousData": true,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["deleteAllPermission", "cancel"],
|
||||
"expected": websites,
|
||||
},
|
||||
{
|
||||
"needPreviousData": true,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "save"],
|
||||
"expected": (function() {
|
||||
let result = websites.slice();
|
||||
result.push("https://mytest.com");
|
||||
return result;
|
||||
}()),
|
||||
},
|
||||
{
|
||||
"needPreviousData": true,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "cancel"],
|
||||
"expected": websites,
|
||||
},
|
||||
{
|
||||
"needPreviousData": false,
|
||||
"newData": "https://mytest.com",
|
||||
"steps": ["addNewPermission", "save", "openPane", "deleteAllPermission", "addNewPermission", "save"],
|
||||
"expected": ["https://mytest.com"],
|
||||
}];
|
||||
|
||||
for (let test of tests) {
|
||||
await runTest(test, websites, doc);
|
||||
}
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
|
@ -375,14 +375,14 @@ var gPermissionManager = {
|
|||
// to update the UI
|
||||
this.uninit();
|
||||
|
||||
for (let p of this._permissionsToAdd.values()) {
|
||||
Services.perms.addFromPrincipal(p.principal, p.type, p.capability);
|
||||
}
|
||||
|
||||
for (let p of this._permissionsToDelete.values()) {
|
||||
Services.perms.removeFromPrincipal(p.principal, p.type);
|
||||
}
|
||||
|
||||
for (let p of this._permissionsToAdd.values()) {
|
||||
Services.perms.addFromPrincipal(p.principal, p.type, p.capability);
|
||||
}
|
||||
|
||||
window.close();
|
||||
},
|
||||
|
||||
|
|
|
@ -12,6 +12,6 @@ ac_add_options --disable-profiling
|
|||
ac_add_options --disable-warnings-as-errors
|
||||
ac_add_options --enable-coverage
|
||||
|
||||
export LDFLAGS="--coverage -L$topsrcdir/clang/lib/clang/7.0.1/lib/linux/"
|
||||
export LDFLAGS="--coverage -L$topsrcdir/clang/lib/clang/8.0.0/lib/linux/"
|
||||
export LIBS="-lclang_rt.profile-x86_64"
|
||||
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads"
|
||||
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads -Clink-dead-code -Coverflow-checks=off"
|
||||
|
|
|
@ -8,6 +8,6 @@ ac_add_options --disable-sandbox
|
|||
ac_add_options --disable-warnings-as-errors
|
||||
ac_add_options --enable-coverage
|
||||
|
||||
export LDFLAGS="-coverage -L$topsrcdir/clang/lib/clang/7.0.1/lib/darwin/"
|
||||
export LDFLAGS="-coverage -L$topsrcdir/clang/lib/clang/8.0.0/lib/darwin/"
|
||||
export LIBS="-lclang_rt.profile_osx"
|
||||
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads"
|
||||
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads -Clink-dead-code -Coverflow-checks=off"
|
||||
|
|
|
@ -28,7 +28,7 @@ if [ -d "$topsrcdir/clang" ]; then
|
|||
export LDFLAGS="clang_rt.profile-x86_64.lib"
|
||||
fi
|
||||
|
||||
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads"
|
||||
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads -Clink-dead-code -Coverflow-checks=off"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.clang-cl"
|
||||
|
|
|
@ -1,2 +1,17 @@
|
|||
#filter substitution
|
||||
script topsrcdir = "@topsrcdir@"; lldb.debugger.HandleCommand("command source -s true '%s'" % os.path.join(topsrcdir, ".lldbinit"))
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
settings set symbols.enable-external-lookup true
|
||||
|
||||
# This is where libxul.so and libmozglue.so are produced in full builds.
|
||||
settings append target.exec-search-paths @topobjdir@/toolkit/library
|
||||
settings append target.exec-search-paths @topobjdir@/mozglue/build
|
||||
|
||||
# This is where artifact builds unpacks "crashreporter-symbols-full.zip" uncompressed ELF debug symbols.
|
||||
settings append target.debug-file-search-paths @topobjdir@/dist/crashreporter-symbols
|
||||
|
||||
# These are specific paths encoded into Mozilla's automation outputs.
|
||||
settings append target.source-map /builds/worker/workspace/build/src/obj-firefox @topobjdir@
|
||||
settings append target.source-map /builds/worker/workspace/build/src @topsrcdir@
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"llvm_revision": "349247",
|
||||
"llvm_revision": "356365",
|
||||
"stages": "2",
|
||||
"build_libcxx": true,
|
||||
"build_type": "Release",
|
||||
"assertions": false,
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_701/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_701/final",
|
||||
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_701/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_701/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_701/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_701/final",
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final",
|
||||
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_800/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_800/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_800/final",
|
||||
"python_path": "/usr/bin/python2.7",
|
||||
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
|
||||
"cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
|
||||
|
@ -47,7 +47,6 @@
|
|||
"patches": [
|
||||
"static-llvm-symbolizer.patch",
|
||||
"find_symbolizer_linux.patch",
|
||||
"rename_gcov_flush_.patch",
|
||||
"r350774.patch"
|
||||
"rename_gcov_flush_.patch"
|
||||
]
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"llvm_revision": "349247",
|
||||
"llvm_revision": "356365",
|
||||
"stages": "3",
|
||||
"build_libcxx": true,
|
||||
"build_type": "Release",
|
||||
"assertions": false,
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_701/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_701/final",
|
||||
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_701/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_701/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_701/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_701/final",
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final",
|
||||
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_800/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_800/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_800/final",
|
||||
"python_path": "/usr/bin/python2.7",
|
||||
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
|
||||
"cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
|
||||
|
@ -19,7 +19,6 @@
|
|||
"static-llvm-symbolizer.patch",
|
||||
"find_symbolizer_linux.patch",
|
||||
"rename_gcov_flush_.patch",
|
||||
"r350774.patch",
|
||||
"android-mangling-error.patch"
|
||||
]
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"llvm_revision": "349247",
|
||||
"llvm_revision": "356365",
|
||||
"stages": "1",
|
||||
"build_libcxx": true,
|
||||
"build_type": "Release",
|
||||
"assertions": false,
|
||||
"osx_cross_compile": true,
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_701/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_701/final",
|
||||
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_701/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_701/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_701/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_701/final",
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final",
|
||||
"lld_repo": "https://llvm.org/svn/llvm-project/lld/tags/RELEASE_800/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_800/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_800/final",
|
||||
"python_path": "/usr/bin/python2.7",
|
||||
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
|
||||
"cc": "/builds/worker/workspace/build/src/clang/bin/clang",
|
||||
|
@ -23,7 +23,6 @@
|
|||
"patches": [
|
||||
"static-llvm-symbolizer.patch",
|
||||
"compiler-rt-cross-compile.patch",
|
||||
"compiler-rt-no-codesign.patch",
|
||||
"r350774.patch"
|
||||
"compiler-rt-no-codesign.patch"
|
||||
]
|
||||
}
|
|
@ -16,6 +16,5 @@
|
|||
"cxx": "/builds/worker/workspace/build/src/gcc/bin/g++",
|
||||
"as": "/builds/worker/workspace/build/src/gcc/bin/gcc",
|
||||
"patches": [
|
||||
"r350774.patch"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
--- a/extra/clang-tidy/tool/run-clang-tidy.py 2019-03-27 15:12:48.000000000 +0200
|
||||
+++ b/extra/clang-tidy/tool/run-clang-tidy.py 2019-03-27 15:12:39.000000000 +0200
|
||||
@@ -169,6 +169,7 @@
|
||||
with lock:
|
||||
sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + '\n')
|
||||
if len(err) > 0:
|
||||
+ sys.stdout.flush()
|
||||
sys.stderr.write(err.decode('utf-8') + '\n')
|
||||
queue.task_done()
|
||||
|
|
@ -1,20 +1,21 @@
|
|||
{
|
||||
"llvm_revision": "349247",
|
||||
"llvm_revision": "356365",
|
||||
"stages": "1",
|
||||
"build_libcxx": true,
|
||||
"build_type": "Release",
|
||||
"assertions": false,
|
||||
"build_clang_tidy": true,
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_701/final/",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_701/final/",
|
||||
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_701/final/",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_701/final/",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_701/final/",
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final/",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final/",
|
||||
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_800/final/",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final/",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_800/final/",
|
||||
"python_path": "/usr/bin/python2.7",
|
||||
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
|
||||
"cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
|
||||
"cxx": "/builds/worker/workspace/build/src/gcc/bin/g++",
|
||||
"as": "/builds/worker/workspace/build/src/gcc/bin/gcc",
|
||||
"patches": [
|
||||
"clang-tidy-8.patch"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"llvm_revision": "349247",
|
||||
"llvm_revision": "356365",
|
||||
"stages": "1",
|
||||
"build_libcxx": true,
|
||||
"build_type": "Release",
|
||||
"assertions": false,
|
||||
"build_clang_tidy": true,
|
||||
"osx_cross_compile": true,
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_701/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_701/final",
|
||||
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_701/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_701/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_701/final",
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final",
|
||||
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_800/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final",
|
||||
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_800/final",
|
||||
"python_path": "/usr/bin/python2.7",
|
||||
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
|
||||
"cc": "/builds/worker/workspace/build/src/clang/bin/clang",
|
||||
|
@ -21,5 +21,6 @@
|
|||
"libtool": "/builds/worker/workspace/build/src/cctools/bin/x86_64-darwin11-libtool",
|
||||
"ld": "/builds/worker/workspace/build/src/clang/bin/clang",
|
||||
"patches": [
|
||||
"clang-tidy-8.patch"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
{
|
||||
"llvm_revision": "349247",
|
||||
"llvm_revision": "356365",
|
||||
"stages": "1",
|
||||
"build_libcxx": false,
|
||||
"build_type": "Release",
|
||||
"assertions": false,
|
||||
"build_clang_tidy": true,
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_701/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_701/final",
|
||||
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_701/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_701/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_701/final",
|
||||
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final",
|
||||
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final",
|
||||
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_800/final",
|
||||
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_800/final",
|
||||
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_800/final",
|
||||
"python_path": "c:/mozilla-build/python/python.exe",
|
||||
"cc": "cl.exe",
|
||||
"cxx": "cl.exe",
|
||||
"ml": "ml64.exe",
|
||||
"patches": [
|
||||
"clang-tidy-8.patch"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
diff --git a/llvm/lib/Object/Binary.cpp b/llvm/lib/Object/Binary.cpp
|
||||
index d7c25921ec3..fe41987f5c2 100644
|
||||
--- a/llvm/lib/Object/Binary.cpp
|
||||
+++ b/llvm/lib/Object/Binary.cpp
|
||||
@@ -88,7 +88,8 @@ Expected<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
|
||||
|
||||
Expected<OwningBinary<Binary>> object::createBinary(StringRef Path) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
|
||||
- MemoryBuffer::getFileOrSTDIN(Path);
|
||||
+ MemoryBuffer::getFileOrSTDIN(Path, /*FileSize=*/-1,
|
||||
+ /*RequiresNullTerminator=*/false);
|
||||
if (std::error_code EC = FileOrErr.getError())
|
||||
return errorCodeToError(EC);
|
||||
std::unique_ptr<MemoryBuffer> &Buffer = FileOrErr.get();
|
|
@ -12,3 +12,16 @@ diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/G
|
|||
struct fn_node* curr = flush_fn_list.head;
|
||||
|
||||
while (curr) {
|
||||
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
|
||||
index 9af64ed332c..bcebe303ff4 100644
|
||||
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
|
||||
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
|
||||
@@ -648,7 +648,7 @@ void GCOVProfiler::AddFlushBeforeForkAndExec() {
|
||||
for (auto I : ForkAndExecs) {
|
||||
IRBuilder<> Builder(I);
|
||||
FunctionType *FTy = FunctionType::get(Builder.getVoidTy(), {}, false);
|
||||
- Constant *GCOVFlush = M->getOrInsertFunction("__gcov_flush", FTy);
|
||||
+ Constant *GCOVFlush = M->getOrInsertFunction("__custom_llvm_gcov_flush", FTy);
|
||||
Builder.CreateCall(GCOVFlush);
|
||||
I->getParent()->splitBasicBlock(I);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ add_clang_library(clangTidyMozillaModule
|
|||
clangTidy
|
||||
clangTidyReadabilityModule
|
||||
clangTidyUtils
|
||||
clangTidyMPIModule
|
||||
)""" % {'names': "\n".join(names)})
|
||||
|
||||
|
||||
|
|
|
@ -70,6 +70,11 @@ HOST_COMPILE_FLAGS['VISIBILITY'] = []
|
|||
if CONFIG['HOST_OS_ARCH'] == 'Darwin':
|
||||
HOST_CXXFLAGS += ['-stdlib=libc++']
|
||||
|
||||
# As of clang 8, llvm-config doesn't output the flags used to build clang
|
||||
# itself, so we don't end up with -fPIC as a side effect. llvm.org/PR8220
|
||||
if CONFIG['HOST_OS_ARCH'] != 'Windows':
|
||||
HOST_CXXFLAGS += ['-fPIC']
|
||||
|
||||
DIRS += [
|
||||
'tests',
|
||||
]
|
||||
|
|
|
@ -114,6 +114,7 @@ OBJDIR_FILES += ['/.gdbinit']
|
|||
# directories as the current working directory. The .lldbinit file will
|
||||
# load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are.
|
||||
DEFINES['topsrcdir'] = TOPSRCDIR
|
||||
DEFINES['topobjdir'] = TOPOBJDIR
|
||||
FINAL_TARGET_PP_FILES += ['.lldbinit.in']
|
||||
OBJDIR_FILES += ['!/dist/bin/.lldbinit']
|
||||
|
||||
|
|
|
@ -1148,7 +1148,8 @@ nsresult nsScriptSecurityManager::ReportError(const char* aMessageTag,
|
|||
|
||||
// using category of "SOP" so we can link to MDN
|
||||
rv = error->Init(message, EmptyString(), EmptyString(), 0, 0,
|
||||
nsIScriptError::errorFlag, "SOP", aFromPrivateWindow);
|
||||
nsIScriptError::errorFlag, "SOP", aFromPrivateWindow,
|
||||
true /* From chrome context */);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
console->LogMessage(error);
|
||||
return NS_OK;
|
||||
|
|
|
@ -80,10 +80,10 @@ void nsChromeRegistry::LogMessageWithContext(nsIURI* aURL, uint32_t aLineNumber,
|
|||
nsCString spec;
|
||||
if (aURL) aURL->GetSpec(spec);
|
||||
|
||||
rv = error->Init(NS_ConvertUTF8toUTF16(formatted.get()),
|
||||
NS_ConvertUTF8toUTF16(spec), EmptyString(), aLineNumber, 0,
|
||||
flags, "chrome registration",
|
||||
false /* from private window */);
|
||||
rv = error->Init(
|
||||
NS_ConvertUTF8toUTF16(formatted.get()), NS_ConvertUTF8toUTF16(spec),
|
||||
EmptyString(), aLineNumber, 0, flags, "chrome registration",
|
||||
false /* from private window */, true /* from chrome context */);
|
||||
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
|
|
|
@ -2104,6 +2104,7 @@ stubPackets.set(`console.log('foobar', 'test')`, {
|
|||
"foobar",
|
||||
"test"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2133,6 +2134,7 @@ stubPackets.set(`console.log(undefined)`, {
|
|||
"type": "undefined"
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2160,6 +2162,7 @@ stubPackets.set(`console.warn('danger, will robinson!')`, {
|
|||
"arguments": [
|
||||
"danger, will robinson!"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2189,6 +2192,7 @@ stubPackets.set(`console.log(NaN)`, {
|
|||
"type": "NaN"
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2218,6 +2222,7 @@ stubPackets.set(`console.log(null)`, {
|
|||
"type": "null"
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2245,6 +2250,7 @@ stubPackets.set(`console.log('鼬')`, {
|
|||
"arguments": [
|
||||
"鼬"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2270,6 +2276,7 @@ stubPackets.set(`console.clear()`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2297,6 +2304,7 @@ stubPackets.set(`console.count('bar')`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": {
|
||||
"count": 1,
|
||||
|
@ -2350,6 +2358,7 @@ stubPackets.set(`console.assert(false, {message: 'foobar'})`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2386,6 +2395,7 @@ stubPackets.set(`console.log('hello \nfrom \rthe \"string world!')`, {
|
|||
"arguments": [
|
||||
"hello \nfrom \rthe \"string world!"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2413,6 +2423,7 @@ stubPackets.set(`console.log('úṇĩçödê țĕșť')`, {
|
|||
"arguments": [
|
||||
"úṇĩçödê țĕșť"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2452,6 +2463,7 @@ stubPackets.set(`console.dirxml(window)`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2497,6 +2509,7 @@ stubPackets.set(`console.log('myarray', ['red', 'green', 'blue'])`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2534,6 +2547,7 @@ stubPackets.set(`console.log('myregex', /a.b.c/)`, {
|
|||
"displayString": "/a.b.c/"
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2578,6 +2592,7 @@ stubPackets.set(`console.table(['red', 'green', 'blue']);`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2641,6 +2656,7 @@ stubPackets.set(`console.log('myobject', {red: 'redValue', green: 'greenValue',
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2668,6 +2684,7 @@ stubPackets.set(`console.debug('debug message');`, {
|
|||
"arguments": [
|
||||
"debug message"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2695,6 +2712,7 @@ stubPackets.set(`console.info('info message');`, {
|
|||
"arguments": [
|
||||
"info message"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2722,6 +2740,7 @@ stubPackets.set(`console.error('error message');`, {
|
|||
"arguments": [
|
||||
"error message"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2781,6 +2800,7 @@ stubPackets.set(`console.log('mymap')`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2825,6 +2845,7 @@ stubPackets.set(`console.log('myset')`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2850,6 +2871,7 @@ stubPackets.set(`console.trace()`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 11,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2942,6 +2964,7 @@ stubPackets.set(`console.trace('bar', {'foo': 'bar'}, [1,2,3])`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 11,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -2992,6 +3015,7 @@ stubPackets.set(`console.time('bar')`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3021,6 +3045,7 @@ stubPackets.set(`timerAlreadyExists`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3051,6 +3076,7 @@ stubPackets.set(`console.timeLog('bar') - 1`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3106,6 +3132,7 @@ stubPackets.set(`console.timeLog('bar') - 2`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3136,6 +3163,7 @@ stubPackets.set(`console.timeEnd('bar')`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3166,6 +3194,7 @@ stubPackets.set(`timeEnd.timerDoesntExist`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3196,6 +3225,7 @@ stubPackets.set(`timeLog.timerDoesntExist`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3226,6 +3256,7 @@ stubPackets.set(`console.table('bar')`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3270,6 +3301,7 @@ stubPackets.set(`console.table(['a', 'b', 'c'])`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3297,6 +3329,7 @@ stubPackets.set(`console.group('bar')`, {
|
|||
"arguments": [
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3322,6 +3355,7 @@ stubPackets.set(`console.groupEnd('bar')`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3349,6 +3383,7 @@ stubPackets.set(`console.groupCollapsed('foo')`, {
|
|||
"arguments": [
|
||||
"foo"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3374,6 +3409,7 @@ stubPackets.set(`console.groupEnd('foo')`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3399,6 +3435,7 @@ stubPackets.set(`console.group()`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3424,6 +3461,7 @@ stubPackets.set(`console.groupEnd()`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3452,6 +3490,7 @@ stubPackets.set(`console.log(%cfoobar)`, {
|
|||
"foo",
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3484,6 +3523,7 @@ stubPackets.set(`console.log("%cHello%c|%cWorld")`, {
|
|||
"|",
|
||||
"World"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 11,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3516,6 +3556,7 @@ stubPackets.set(`console.group(%cfoo%cbar)`, {
|
|||
"foo",
|
||||
"bar"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3544,6 +3585,7 @@ stubPackets.set(`console.groupEnd(%cfoo%cbar)`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3572,6 +3614,7 @@ stubPackets.set(`console.groupCollapsed(%cfoo%cbaz)`, {
|
|||
"foo",
|
||||
"baz"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3600,6 +3643,7 @@ stubPackets.set(`console.groupEnd(%cfoo%cbaz)`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 9,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3668,6 +3712,7 @@ stubPackets.set(`console.dir({C, M, Y, K})`, {
|
|||
}
|
||||
}
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 35,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3695,6 +3740,7 @@ stubPackets.set(`console.count | default: 1`, {
|
|||
"arguments": [
|
||||
"default"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 1,
|
||||
|
@ -3725,6 +3771,7 @@ stubPackets.set(`console.count | default: 2`, {
|
|||
"arguments": [
|
||||
"default"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 2,
|
||||
|
@ -3755,6 +3802,7 @@ stubPackets.set(`console.count | test counter: 1`, {
|
|||
"arguments": [
|
||||
"test counter"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 1,
|
||||
|
@ -3785,6 +3833,7 @@ stubPackets.set(`console.count | test counter: 2`, {
|
|||
"arguments": [
|
||||
"test counter"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 2,
|
||||
|
@ -3815,6 +3864,7 @@ stubPackets.set(`console.count | default: 3`, {
|
|||
"arguments": [
|
||||
"default"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 3,
|
||||
|
@ -3843,6 +3893,7 @@ stubPackets.set(`console.count | clear`, {
|
|||
"message": {
|
||||
"addonId": "",
|
||||
"arguments": [],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": null,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
|
||||
|
@ -3870,6 +3921,7 @@ stubPackets.set(`console.count | default: 4`, {
|
|||
"arguments": [
|
||||
"default"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 4,
|
||||
|
@ -3900,6 +3952,7 @@ stubPackets.set(`console.count | test counter: 3`, {
|
|||
"arguments": [
|
||||
"test counter"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 3,
|
||||
|
@ -3930,6 +3983,7 @@ stubPackets.set(`console.countReset | test counter: 0`, {
|
|||
"arguments": [
|
||||
"test counter"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"count": 0,
|
||||
|
@ -3960,6 +4014,7 @@ stubPackets.set(`console.countReset | counterDoesntExist`, {
|
|||
"arguments": [
|
||||
"test counter"
|
||||
],
|
||||
"chromeContext": false,
|
||||
"columnNumber": 13,
|
||||
"counter": {
|
||||
"error": "counterDoesntExist",
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/UnionConversions.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIConsoleService.h"
|
||||
|
@ -137,9 +136,10 @@ PostMessageEvent::Run() {
|
|||
rv = NS_GetSanitizedURIStringFromURI(callerDocumentURI, uriSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = errorObject->Init(errorText, uriSpec, EmptyString(), 0, 0,
|
||||
nsIScriptError::errorFlag, "DOM Window",
|
||||
mIsFromPrivateWindow);
|
||||
rv = errorObject->Init(
|
||||
errorText, uriSpec, EmptyString(), 0, 0, nsIScriptError::errorFlag,
|
||||
"DOM Window", mIsFromPrivateWindow,
|
||||
nsContentUtils::IsSystemPrincipal(mProvidedPrincipal));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/MaybeOneOf.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
|
|
|
@ -3734,16 +3734,17 @@ nsresult nsContentUtils::FormatLocalizedString(
|
|||
/* static */
|
||||
void nsContentUtils::LogSimpleConsoleError(const nsAString& aErrorText,
|
||||
const char* classification,
|
||||
bool aFromPrivateWindow) {
|
||||
bool aFromPrivateWindow,
|
||||
bool aFromChromeContext) {
|
||||
nsCOMPtr<nsIScriptError> scriptError =
|
||||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
|
||||
if (scriptError) {
|
||||
nsCOMPtr<nsIConsoleService> console =
|
||||
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
|
||||
if (console &&
|
||||
NS_SUCCEEDED(scriptError->Init(aErrorText, EmptyString(), EmptyString(),
|
||||
0, 0, nsIScriptError::errorFlag,
|
||||
classification, aFromPrivateWindow))) {
|
||||
if (console && NS_SUCCEEDED(scriptError->Init(
|
||||
aErrorText, EmptyString(), EmptyString(), 0, 0,
|
||||
nsIScriptError::errorFlag, classification,
|
||||
aFromPrivateWindow, aFromChromeContext))) {
|
||||
console->LogMessage(scriptError);
|
||||
}
|
||||
}
|
||||
|
@ -5299,6 +5300,7 @@ nsContentUtils::GetMostRecentNonPBWindow() {
|
|||
void nsContentUtils::WarnScriptWasIgnored(Document* aDocument) {
|
||||
nsAutoString msg;
|
||||
bool privateBrowsing = false;
|
||||
bool chromeContext = false;
|
||||
|
||||
if (aDocument) {
|
||||
nsCOMPtr<nsIURI> uri = aDocument->GetDocumentURI();
|
||||
|
@ -5308,11 +5310,12 @@ void nsContentUtils::WarnScriptWasIgnored(Document* aDocument) {
|
|||
}
|
||||
privateBrowsing =
|
||||
!!aDocument->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId;
|
||||
chromeContext = IsSystemPrincipal(aDocument->NodePrincipal());
|
||||
}
|
||||
|
||||
msg.AppendLiteral(
|
||||
"Unable to run script because scripts are blocked internally.");
|
||||
LogSimpleConsoleError(msg, "DOM", privateBrowsing);
|
||||
LogSimpleConsoleError(msg, "DOM", privateBrowsing, chromeContext);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -6513,7 +6516,7 @@ bool nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
|
|||
JS::Rooted<JSObject*> re(
|
||||
cx,
|
||||
JS::NewUCRegExpObject(cx, static_cast<char16_t*>(aPattern.BeginWriting()),
|
||||
aPattern.Length(), JS::RegExpFlags::Unicode));
|
||||
aPattern.Length(), JS::RegExpFlag::Unicode));
|
||||
if (!re) {
|
||||
// Remove extra patterns added above to report with the original pattern.
|
||||
aPattern.Cut(0, 4);
|
||||
|
|
|
@ -1025,7 +1025,8 @@ class nsContentUtils {
|
|||
*/
|
||||
static void LogSimpleConsoleError(const nsAString& aErrorText,
|
||||
const char* classification,
|
||||
bool aFromPrivateWindow);
|
||||
bool aFromPrivateWindow,
|
||||
bool aFromChromeContext);
|
||||
|
||||
/**
|
||||
* Report a non-localized error message to the error console.
|
||||
|
|
|
@ -409,7 +409,8 @@ bool nsFrameMessageManager::GetParamsForMessage(JSContext* aCx,
|
|||
"you trying to send an XPCOM object?"),
|
||||
filename, EmptyString(), lineno, column,
|
||||
nsIScriptError::warningFlag, "chrome javascript",
|
||||
false /* from private window */);
|
||||
false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
console->LogMessage(error);
|
||||
}
|
||||
|
||||
|
@ -824,7 +825,8 @@ void nsFrameMessageManager::ReceiveMessage(
|
|||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||
error->Init(msg, EmptyString(), EmptyString(), 0, 0,
|
||||
nsIScriptError::warningFlag, "chrome javascript",
|
||||
false /* from private window */);
|
||||
false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
console->LogMessage(error);
|
||||
}
|
||||
|
||||
|
|
|
@ -5951,7 +5951,8 @@ bool nsGlobalWindowOuter::GetPrincipalForPostMessage(
|
|||
R"(origin "%s" from a system principal scope with mismatched )"
|
||||
R"(origin "%s".)",
|
||||
targetURL.get(), targetOrigin.get(), sourceOrigin.get())),
|
||||
"DOM", !!principal->PrivateBrowsingId());
|
||||
"DOM", !!principal->PrivateBrowsingId(),
|
||||
nsContentUtils::IsSystemPrincipal(principal));
|
||||
|
||||
attrs = principal->OriginAttributesRef();
|
||||
}
|
||||
|
|
|
@ -758,7 +758,7 @@ tags = audiochannel
|
|||
[test_openDialogChromeOnly.html]
|
||||
tags = openwindow
|
||||
[test_plugin_freezing.html]
|
||||
skip-if = toolkit == 'android' #CLICK_TO_PLAY
|
||||
skip-if = toolkit == 'android' || (os == 'win' && processor == 'aarch64') #CLICK_TO_PLAY, aarch64 due to 1538785
|
||||
[test_pluginAudioNotification.html]
|
||||
tags = audiochannel
|
||||
skip-if = toolkit == 'android' # Plugins don't work on Android
|
||||
|
|
|
@ -93,6 +93,8 @@ interface nsIScriptError : nsIConsoleMessage
|
|||
|
||||
readonly attribute boolean isFromPrivateWindow;
|
||||
|
||||
readonly attribute boolean isFromChromeContext;
|
||||
|
||||
attribute jsval stack;
|
||||
|
||||
/**
|
||||
|
@ -131,7 +133,8 @@ interface nsIScriptError : nsIConsoleMessage
|
|||
in uint32_t columnNumber,
|
||||
in uint32_t flags,
|
||||
in string category,
|
||||
[optional] in bool fromPrivateWindow);
|
||||
[optional] in bool fromPrivateWindow,
|
||||
[optional] in bool fromChromeContext);
|
||||
|
||||
/* This should be called instead of nsIScriptError.init to
|
||||
* initialize with a window id. The window id should be for the
|
||||
|
|
|
@ -45,7 +45,8 @@ nsScriptErrorBase::nsScriptErrorBase()
|
|||
mTimeStamp(0),
|
||||
mTimeWarpTarget(0),
|
||||
mInitializedOnMainThread(false),
|
||||
mIsFromPrivateWindow(false) {}
|
||||
mIsFromPrivateWindow(false),
|
||||
mIsFromChromeContext(false) {}
|
||||
|
||||
nsScriptErrorBase::~nsScriptErrorBase() {}
|
||||
|
||||
|
@ -63,7 +64,7 @@ void nsScriptErrorBase::InitializeOnMainThread() {
|
|||
if (window) {
|
||||
nsPIDOMWindowOuter* outer = window->GetOuterWindow();
|
||||
if (outer) mOuterWindowID = outer->WindowID();
|
||||
|
||||
mIsFromChromeContext = ComputeIsFromChromeContext(window);
|
||||
mIsFromPrivateWindow = ComputeIsFromPrivateWindow(window);
|
||||
}
|
||||
}
|
||||
|
@ -217,13 +218,15 @@ NS_IMETHODIMP
|
|||
nsScriptErrorBase::Init(const nsAString& message, const nsAString& sourceName,
|
||||
const nsAString& sourceLine, uint32_t lineNumber,
|
||||
uint32_t columnNumber, uint32_t flags,
|
||||
const char* category, bool fromPrivateWindow) {
|
||||
const char* category, bool fromPrivateWindow,
|
||||
bool fromChromeContext) {
|
||||
InitializationHelper(message, sourceLine, lineNumber, columnNumber, flags,
|
||||
category ? nsDependentCString(category) : EmptyCString(),
|
||||
0 /* inner Window ID */);
|
||||
AssignSourceNameHelper(mSourceName, sourceName);
|
||||
|
||||
mIsFromPrivateWindow = fromPrivateWindow;
|
||||
mIsFromChromeContext = fromChromeContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -393,6 +396,18 @@ nsScriptErrorBase::GetTimeWarpTarget(uint64_t* aTarget) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptErrorBase::GetIsFromChromeContext(bool* aIsFromChromeContext) {
|
||||
NS_WARNING_ASSERTION(NS_IsMainThread() || mInitializedOnMainThread,
|
||||
"This can't be safely determined off the main thread, "
|
||||
"returning an inaccurate value!");
|
||||
if (!mInitializedOnMainThread && NS_IsMainThread()) {
|
||||
InitializeOnMainThread();
|
||||
}
|
||||
*aIsFromChromeContext = mIsFromChromeContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptErrorBase::GetNotes(nsIArray** aNotes) {
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -416,6 +431,13 @@ bool nsScriptErrorBase::ComputeIsFromPrivateWindow(
|
|||
!nsContentUtils::IsSystemPrincipal(winPrincipal);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool nsScriptErrorBase::ComputeIsFromChromeContext(
|
||||
nsGlobalWindowInner* aWindow) {
|
||||
nsIPrincipal* winPrincipal = aWindow->GetPrincipal();
|
||||
return nsContentUtils::IsSystemPrincipal(winPrincipal);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsScriptError, nsIConsoleMessage, nsIScriptError)
|
||||
|
||||
nsScriptErrorNote::nsScriptErrorNote()
|
||||
|
|
|
@ -55,6 +55,8 @@ class nsScriptErrorBase : public nsIScriptError {
|
|||
|
||||
static bool ComputeIsFromPrivateWindow(nsGlobalWindowInner* aWindow);
|
||||
|
||||
static bool ComputeIsFromChromeContext(nsGlobalWindowInner* aWindow);
|
||||
|
||||
protected:
|
||||
virtual ~nsScriptErrorBase();
|
||||
|
||||
|
@ -82,10 +84,11 @@ class nsScriptErrorBase : public nsIScriptError {
|
|||
uint64_t mInnerWindowID;
|
||||
int64_t mTimeStamp;
|
||||
uint64_t mTimeWarpTarget;
|
||||
// mInitializedOnMainThread and mIsFromPrivateWindow are set on the main
|
||||
// thread from InitializeOnMainThread().
|
||||
// mInitializedOnMainThread, mIsFromPrivateWindow and mIsFromChromeContext are
|
||||
// set on the main thread from InitializeOnMainThread().
|
||||
mozilla::Atomic<bool> mInitializedOnMainThread;
|
||||
bool mIsFromPrivateWindow;
|
||||
bool mIsFromChromeContext;
|
||||
};
|
||||
|
||||
class nsScriptError final : public nsScriptErrorBase {
|
||||
|
|
|
@ -3911,8 +3911,8 @@ gfxFontGroup* CanvasRenderingContext2D::GetCurrentFontStyle() {
|
|||
GetAppUnitsValues(&perDevPixel, &perCSSPixel);
|
||||
gfxFloat devToCssSize = gfxFloat(perDevPixel) / gfxFloat(perCSSPixel);
|
||||
CurrentState().fontGroup = gfxPlatform::GetPlatform()->CreateFontGroup(
|
||||
FontFamilyList(eFamily_sans_serif), &style, tp, nullptr,
|
||||
devToCssSize);
|
||||
FontFamilyList(StyleGenericFontFamily::SansSerif), &style, tp,
|
||||
nullptr, devToCssSize);
|
||||
if (CurrentState().fontGroup) {
|
||||
CurrentState().font = kDefaultFontStyle;
|
||||
} else {
|
||||
|
|
|
@ -1276,6 +1276,7 @@ void Console::ProfileMethodMainthread(JSContext* aCx, const nsAString& aAction,
|
|||
|
||||
RootedDictionary<ConsoleProfileEvent> event(aCx);
|
||||
event.mAction = aAction;
|
||||
event.mChromeContext = nsContentUtils::ThreadsafeIsSystemCaller(aCx);
|
||||
|
||||
event.mArguments.Construct();
|
||||
Sequence<JS::Value>& sequence = event.mArguments.Value();
|
||||
|
@ -1683,6 +1684,8 @@ bool Console::PopulateConsoleNotificationInTheTargetScope(
|
|||
event.mID.Construct();
|
||||
event.mInnerID.Construct();
|
||||
|
||||
event.mChromeContext = nsContentUtils::ThreadsafeIsSystemCaller(aCx);
|
||||
|
||||
if (aData->mIDType == ConsoleCallData::eString) {
|
||||
event.mID.Value().SetAsString() = aData->mOuterIDString;
|
||||
event.mInnerID.Value().SetAsString() = aData->mInnerIDString;
|
||||
|
|
|
@ -39,7 +39,8 @@ ConsoleLogLevel PrefToValue(const nsAString& aPref) {
|
|||
"Console.maxLogLevelPref used with a non-existing pref: ");
|
||||
message.Append(aPref);
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false);
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false,
|
||||
true /* from chrome context*/);
|
||||
return ConsoleLogLevel::All;
|
||||
}
|
||||
|
||||
|
@ -50,7 +51,8 @@ ConsoleLogLevel PrefToValue(const nsAString& aPref) {
|
|||
message.AssignLiteral("Invalid Console.maxLogLevelPref value: ");
|
||||
message.Append(NS_ConvertUTF8toUTF16(value));
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false);
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false,
|
||||
true /* from chrome context*/);
|
||||
return ConsoleLogLevel::All;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ consoleListener.prototype = {
|
|||
observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "console-api-log-event") {
|
||||
var obj = aSubject.wrappedJSObject;
|
||||
ok(!obj.chromeContext, "Thils is not a chrome context");
|
||||
if (order + 1 == parseInt(obj.arguments[0])) {
|
||||
ok(true, "Message received: " + obj.arguments[0]);
|
||||
order++;
|
||||
|
|
|
@ -15,6 +15,7 @@ function consoleListener(expected) {
|
|||
let observer = {
|
||||
observe: function listener(aSubject, aTopic, aData) {
|
||||
var obj = aSubject.wrappedJSObject;
|
||||
ok(!obj.chromeContext, "This is not a chrome context");
|
||||
messages.push(parseInt(obj.arguments[0]));
|
||||
if (messages.length == expected) {
|
||||
SpecialPowers.removeObserver(observer, "console-api-log-event");
|
||||
|
|
|
@ -34,6 +34,8 @@ consoleListener.prototype = {
|
|||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "console-api-log-event") {
|
||||
var obj = aSubject.wrappedJSObject;
|
||||
ok(obj.chromeContext, "JSM is always a chrome context");
|
||||
|
||||
if (obj.innerID == JSM) {
|
||||
is(obj.ID, "jsm", "ID and InnerID are correctly set.");
|
||||
is(obj.arguments[0], "Hello world!", "Message matches");
|
||||
|
|
|
@ -5,35 +5,58 @@
|
|||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<script>
|
||||
// We move the mouse from the #host to #target, then to #child-target.
|
||||
//
|
||||
// By the time we get to #child-target, we shouldn't have fired any mouseleave.
|
||||
function runTests() {
|
||||
let iframe = document.createElement('iframe');
|
||||
iframe.style.width = "600px";
|
||||
iframe.style.height = "600px";
|
||||
document.body.appendChild(iframe);
|
||||
iframe.onload = () => frameLoaded(iframe);
|
||||
iframe.srcdoc =
|
||||
`<div id="host"><div id="target"></div></div>`
|
||||
iframe.srcdoc = `
|
||||
<style>
|
||||
#child-target {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: yellow;
|
||||
}
|
||||
</style>
|
||||
<div id="host"><div id="target"><div id="child-target"></div></div></div>
|
||||
`;
|
||||
}
|
||||
|
||||
function frameLoaded(iframe) {
|
||||
let host = iframe.contentDocument.getElementById('host');
|
||||
let target = iframe.contentDocument.getElementById('target');
|
||||
let childTarget = iframe.contentDocument.getElementById('child-target');
|
||||
let sawHost = false;
|
||||
let sawTarget = false;
|
||||
let finished = false;
|
||||
|
||||
host.attachShadow({ mode: 'open' }).innerHTML = `
|
||||
<style>
|
||||
:host {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
background: purple;
|
||||
}
|
||||
::slotted(div) {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<slot></slot>
|
||||
`;
|
||||
|
||||
host.addEventListener("mouseenter", e => {
|
||||
if (finished)
|
||||
return;
|
||||
sawHost = true;
|
||||
ok(true, "Should fire mouseenter on the host.");
|
||||
});
|
||||
|
||||
host.addEventListener("mouseleave", e => {
|
||||
if (finished)
|
||||
return;
|
||||
|
@ -43,15 +66,28 @@ function frameLoaded(iframe) {
|
|||
target.addEventListener("mouseenter", () => {
|
||||
if (finished)
|
||||
return;
|
||||
ok(sawHost, "Should've seen the hostmouseenter already");
|
||||
sawTarget = true;
|
||||
ok(true, "Moving the mouse into the target should trigger a mouseenter there");
|
||||
setTimeout(() => {
|
||||
finished = true;
|
||||
SimpleTest.finish()
|
||||
}, 0);
|
||||
});
|
||||
|
||||
target.addEventListener("mouseleave", () => {
|
||||
if (finished)
|
||||
return;
|
||||
ok(false, "Should not fire mouseleave when moving the cursor to the slotted target's child");
|
||||
});
|
||||
|
||||
childTarget.addEventListener("mouseenter", () => {
|
||||
if (finished)
|
||||
return;
|
||||
ok(sawTarget, "Should've seen the target mouseenter already");
|
||||
finished = true;
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
synthesizeMouseAtCenter(host, { type: "mousemove" });
|
||||
synthesizeMouseAtCenter(target, { type: "mousemove" });
|
||||
synthesizeMouseAtCenter(childTarget, { type: "mousemove" });
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -26,7 +26,8 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
|||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(
|
||||
nsPrintfCString("IndexedDB %s: %s:%" PRIu32, aStr, aFile, aLine)),
|
||||
"indexedDB", false /* no IDB in private window */);
|
||||
"indexedDB", false /* no IDB in private window */,
|
||||
true /* Internal errors are chrome context only */);
|
||||
}
|
||||
|
||||
} // namespace indexedDB
|
||||
|
|
|
@ -111,7 +111,8 @@ class ScriptErrorRunnable final : public mozilla::Runnable {
|
|||
aMessage, aFilename,
|
||||
/* aSourceLine */ EmptyString(), aLineNumber, aColumnNumber,
|
||||
aSeverityFlag, category.get(),
|
||||
/* IDB doesn't run on Private browsing mode */ false));
|
||||
/* IDB doesn't run on Private browsing mode */ false,
|
||||
/* from chrome context */ aIsChrome));
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(consoleService->LogMessage(scriptError));
|
||||
|
|
|
@ -443,7 +443,7 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
|
|||
nsAutoString msg, sourceName, sourceLine;
|
||||
nsCString category;
|
||||
uint32_t lineNum, colNum, flags;
|
||||
bool fromPrivateWindow;
|
||||
bool fromPrivateWindow, fromChromeContext;
|
||||
|
||||
nsresult rv = scriptError->GetErrorMessage(msg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -465,6 +465,8 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = scriptError->GetIsFromPrivateWindow(&fromPrivateWindow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = scriptError->GetIsFromChromeContext(&fromChromeContext);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
|
@ -496,15 +498,15 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mChild->SendScriptErrorWithStack(msg, sourceName, sourceLine, lineNum,
|
||||
colNum, flags, category,
|
||||
fromPrivateWindow, cloned);
|
||||
mChild->SendScriptErrorWithStack(
|
||||
msg, sourceName, sourceLine, lineNum, colNum, flags, category,
|
||||
fromPrivateWindow, fromChromeContext, cloned);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
mChild->SendScriptError(msg, sourceName, sourceLine, lineNum, colNum, flags,
|
||||
category, fromPrivateWindow);
|
||||
category, fromPrivateWindow, fromChromeContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -4100,10 +4100,11 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptError(
|
|||
const nsString& aMessage, const nsString& aSourceName,
|
||||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow) {
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow,
|
||||
const bool& aFromChromeContext) {
|
||||
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
|
||||
aLineNumber, aColNumber, aFlags, aCategory,
|
||||
aFromPrivateWindow);
|
||||
aFromPrivateWindow, aFromChromeContext);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorWithStack(
|
||||
|
@ -4111,10 +4112,10 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorWithStack(
|
|||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow,
|
||||
const ClonedMessageData& aFrame) {
|
||||
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
|
||||
aLineNumber, aColNumber, aFlags, aCategory,
|
||||
aFromPrivateWindow, &aFrame);
|
||||
const bool& aFromChromeContext, const ClonedMessageData& aFrame) {
|
||||
return RecvScriptErrorInternal(
|
||||
aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags,
|
||||
aCategory, aFromPrivateWindow, aFromChromeContext, &aFrame);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
|
||||
|
@ -4122,7 +4123,7 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
|
|||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow,
|
||||
const ClonedMessageData* aStack) {
|
||||
const bool& aFromChromeContext, const ClonedMessageData* aStack) {
|
||||
RefPtr<nsConsoleService> consoleService = GetConsoleService();
|
||||
if (!consoleService) {
|
||||
return IPC_OK();
|
||||
|
@ -4157,9 +4158,9 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
|
|||
msg = new nsScriptError();
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber,
|
||||
aFlags, aCategory.get(), aFromPrivateWindow);
|
||||
nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber,
|
||||
aColNumber, aFlags, aCategory.get(),
|
||||
aFromPrivateWindow, aFromChromeContext);
|
||||
if (NS_FAILED(rv)) return IPC_OK();
|
||||
|
||||
consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog);
|
||||
|
|
|
@ -1007,14 +1007,15 @@ class ContentParent final : public PContentParent,
|
|||
const nsString& aMessage, const nsString& aSourceName,
|
||||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow);
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow,
|
||||
const bool& aIsFromChromeContext);
|
||||
|
||||
mozilla::ipc::IPCResult RecvScriptErrorWithStack(
|
||||
const nsString& aMessage, const nsString& aSourceName,
|
||||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow,
|
||||
const ClonedMessageData& aStack);
|
||||
const bool& aIsFromChromeContext, const ClonedMessageData& aStack);
|
||||
|
||||
private:
|
||||
mozilla::ipc::IPCResult RecvScriptErrorInternal(
|
||||
|
@ -1022,6 +1023,7 @@ class ContentParent final : public PContentParent,
|
|||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow,
|
||||
const bool& aIsFromChromeContext,
|
||||
const ClonedMessageData* aStack = nullptr);
|
||||
|
||||
public:
|
||||
|
|
|
@ -936,11 +936,12 @@ parent:
|
|||
async ConsoleMessage(nsString message);
|
||||
async ScriptError(nsString message, nsString sourceName, nsString sourceLine,
|
||||
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
|
||||
nsCString category, bool privateWindow);
|
||||
nsCString category, bool privateWindow,
|
||||
bool fromChromeContext);
|
||||
async ScriptErrorWithStack(nsString message, nsString sourceName, nsString sourceLine,
|
||||
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
|
||||
nsCString category, bool privateWindow,
|
||||
ClonedMessageData stack);
|
||||
bool fromChromeContext, ClonedMessageData stack);
|
||||
|
||||
// Places the items within dataTransfer on the clipboard.
|
||||
async SetClipboard(IPCDataTransfer aDataTransfer,
|
||||
|
|
|
@ -26,7 +26,7 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
|||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(
|
||||
nsPrintfCString("LocalStorage %s: %s:%" PRIu32, aStr, aFile, aLine)),
|
||||
"localstorage", false);
|
||||
"localstorage", false, true /* Internal errors are chrome context only*/);
|
||||
}
|
||||
|
||||
} // namespace localstorage
|
||||
|
|
|
@ -92,6 +92,10 @@ static dom::AudioContext::AudioContextId gAudioContextId = 1;
|
|||
NS_IMPL_CYCLE_COLLECTION_CLASS(AudioContext)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioContext)
|
||||
// The destination node and AudioContext form a cycle and so the destination
|
||||
// stream will be destroyed. mWorklet must be shut down before the stream
|
||||
// is destroyed. Do this before clearing mWorklet.
|
||||
tmp->ShutdownWorklet();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDestination)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWorklet)
|
||||
|
@ -632,6 +636,12 @@ AudioNodeStream* AudioContext::DestinationStream() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void AudioContext::ShutdownWorklet() {
|
||||
if (mWorklet) {
|
||||
mWorklet->Impl()->NotifyWorkletFinished();
|
||||
}
|
||||
}
|
||||
|
||||
double AudioContext::CurrentTime() {
|
||||
MediaStream* stream = Destination()->Stream();
|
||||
|
||||
|
@ -703,6 +713,12 @@ void AudioContext::Shutdown() {
|
|||
// Node is already unregistered.
|
||||
mActiveNodes.Clear();
|
||||
|
||||
// On process shutdown, the MSG thread shuts down before the destination
|
||||
// stream is destroyed, but AudioWorklet needs to release objects on the MSG
|
||||
// thread. AudioContext::Shutdown() is invoked on processing the
|
||||
// PBrowser::Destroy() message before xpcom shutdown begins.
|
||||
ShutdownWorklet();
|
||||
|
||||
// For offline contexts, we can destroy the MediaStreamGraph at this point.
|
||||
if (mIsOffline && mDestination) {
|
||||
mDestination->OfflineShutdown();
|
||||
|
|
|
@ -310,6 +310,7 @@ class AudioContext final : public DOMEventTargetHelper,
|
|||
|
||||
BasicWaveFormCache* GetBasicWaveFormCache();
|
||||
|
||||
void ShutdownWorklet();
|
||||
// Steals from |aParamMap|
|
||||
void SetParamMapForWorkletName(const nsAString& aName,
|
||||
AudioParamDescriptorMap* aParamMap);
|
||||
|
|
|
@ -401,6 +401,8 @@ void AudioDestinationNode::DestroyMediaStream() {
|
|||
|
||||
if (!mStream) return;
|
||||
|
||||
Context()->ShutdownWorklet();
|
||||
|
||||
mStream->RemoveMainThreadListener(this);
|
||||
MediaStreamGraph* graph = mStream->Graph();
|
||||
if (graph->IsNonRealtime()) {
|
||||
|
|
|
@ -60,6 +60,7 @@ skip-if = toolkit == 'android' # needs plugin support
|
|||
[test_bug1092842.html]
|
||||
skip-if = (verify && (os == 'win'))
|
||||
[test_bug1165981.html]
|
||||
skip-if = (processor == 'aarch64' && os == 'win') # aarch64 due to 1538785
|
||||
[test_bug1245545.html]
|
||||
[test_bug1307694.html]
|
||||
skip-if = verify
|
||||
|
@ -93,6 +94,7 @@ skip-if = !crashreporter || e10s
|
|||
[test_instance_unparent3.html]
|
||||
[test_instantiation.html]
|
||||
[test_mixed_case_mime.html]
|
||||
skip-if = (processor == 'aarch64' && os == 'win') # aarch64 due to 1538785
|
||||
[test_multipleinstanceobjects.html]
|
||||
[test_newstreamondestroy.html]
|
||||
[test_npn_timers.html]
|
||||
|
|
|
@ -21,5 +21,5 @@ skip-if = appname == "thunderbird"
|
|||
reason = plugins are disabled by default in Thunderbird
|
||||
[test_bug854467.js]
|
||||
[test_plugin_default_state.js]
|
||||
skip-if = appname == "thunderbird"
|
||||
reason = plugins are disabled by default in Thunderbird
|
||||
skip-if = appname == "thunderbird" || (processor == 'aarch64' && os == 'win') # aarch64 due to 1538785
|
||||
reason = plugins are disabled by default in Thunderbird and Windows10-aarch64
|
||||
|
|
|
@ -16,6 +16,7 @@ skip-if = os == "win" # Bug 1373346
|
|||
[test_register_key.html]
|
||||
[test_multiple_register.html]
|
||||
[test_multiple_register_during_service_activation.html]
|
||||
skip-if = (os == "win") || (os == "linux") || (os == "mac") #Bug 1274773
|
||||
[test_unregister.html]
|
||||
[test_multiple_register_different_scope.html]
|
||||
[test_subscription_change.html]
|
||||
|
|
|
@ -1368,8 +1368,8 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
|||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(
|
||||
nsPrintfCString("Quota %s: %s:%" PRIu32, aStr, aFile, aLine)),
|
||||
"quota",
|
||||
false /* Quota Manager is not active in private browsing mode */);
|
||||
"quota", false /* Quota Manager is not active in private browsing mode */,
|
||||
true /* Quota Manager runs always in a chrome context */);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -159,7 +159,8 @@ void CSP_LogMessage(const nsAString& aMessage, const nsAString& aSourceName,
|
|||
aInnerWindowID);
|
||||
} else {
|
||||
rv = error->Init(cspMsg, aSourceName, aSourceLine, aLineNumber,
|
||||
aColumnNumber, aFlags, category.get(), aFromPrivateWindow);
|
||||
aColumnNumber, aFlags, category.get(), aFromPrivateWindow,
|
||||
true /* from chrome context */);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
|
|
|
@ -70,7 +70,7 @@ skip-if = toolkit == 'android' #TIMED_OUT
|
|||
[test_bug414291.html]
|
||||
tags = openwindow
|
||||
[test_bug427744.html]
|
||||
skip-if = toolkit == 'android'
|
||||
skip-if = toolkit == 'android' || (processor == 'aarch64' && os == 'win') # aarch64 due to 1538785
|
||||
[test_bug42976.html]
|
||||
[test_bug430276.html]
|
||||
[test_bug440572.html]
|
||||
|
|
|
@ -51,8 +51,16 @@ NS_INTERFACE_MAP_END_INHERITING(WebAuthnManagerBase)
|
|||
NS_IMPL_ADDREF_INHERITED(U2F, WebAuthnManagerBase)
|
||||
NS_IMPL_RELEASE_INHERITED(U2F, WebAuthnManagerBase)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_INHERITED(U2F, WebAuthnManagerBase,
|
||||
mTransaction)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(U2F)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(U2F, WebAuthnManagerBase)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTransaction)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
tmp->ClearTransaction();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(U2F, WebAuthnManagerBase)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTransaction)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(U2F)
|
||||
|
||||
/***********************************************************************
|
||||
* Utility Functions
|
||||
|
@ -513,7 +521,7 @@ void U2F::FinishGetAssertion(const uint64_t& aTransactionId,
|
|||
}
|
||||
|
||||
void U2F::ClearTransaction() {
|
||||
if (!NS_WARN_IF(mTransaction.isNothing())) {
|
||||
if (!mTransaction.isNothing()) {
|
||||
StopListeningForVisibilityEvents();
|
||||
}
|
||||
|
||||
|
|
|
@ -141,11 +141,12 @@ class U2F final : public WebAuthnManagerBase, public nsWrapperCache {
|
|||
MOZ_CAN_RUN_SCRIPT void ExecuteCallback(T& aResp,
|
||||
nsMainThreadPtrHandle<C>& aCb);
|
||||
|
||||
// Clears all information we have about the current transaction.
|
||||
void ClearTransaction();
|
||||
// Rejects the current transaction and clears it.
|
||||
MOZ_CAN_RUN_SCRIPT void RejectTransaction(const nsresult& aError);
|
||||
|
||||
// Clears all information we have about the current transaction.
|
||||
void ClearTransaction();
|
||||
|
||||
nsString mOrigin;
|
||||
|
||||
// The current transaction, if any.
|
||||
|
|
|
@ -38,8 +38,18 @@ static mozilla::LazyLogModule gWebAuthnManagerLog("webauthnmanager");
|
|||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(WebAuthnManager,
|
||||
WebAuthnManagerBase)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(WebAuthnManager, WebAuthnManagerBase,
|
||||
mFollowingSignal, mTransaction)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(WebAuthnManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(WebAuthnManager,
|
||||
WebAuthnManagerBase)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFollowingSignal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTransaction)
|
||||
tmp->ClearTransaction();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(WebAuthnManager,
|
||||
WebAuthnManagerBase)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFollowingSignal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTransaction)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
/***********************************************************************
|
||||
* Utility Functions
|
||||
|
@ -156,7 +166,7 @@ nsresult RelaxSameOrigin(nsPIDOMWindowInner* aParent,
|
|||
**********************************************************************/
|
||||
|
||||
void WebAuthnManager::ClearTransaction() {
|
||||
if (!NS_WARN_IF(mTransaction.isNothing())) {
|
||||
if (!mTransaction.isNothing()) {
|
||||
StopListeningForVisibilityEvents();
|
||||
}
|
||||
|
||||
|
|
|
@ -116,11 +116,12 @@ class WebAuthnManager final : public WebAuthnManagerBase, public AbortFollower {
|
|||
private:
|
||||
virtual ~WebAuthnManager();
|
||||
|
||||
// Clears all information we have about the current transaction.
|
||||
void ClearTransaction();
|
||||
// Rejects the current transaction and calls ClearTransaction().
|
||||
void RejectTransaction(const nsresult& aError);
|
||||
|
||||
// Clears all information we have about the current transaction.
|
||||
void ClearTransaction();
|
||||
|
||||
// The current transaction, if any.
|
||||
Maybe<WebAuthnTransaction> mTransaction;
|
||||
};
|
||||
|
|
|
@ -107,12 +107,14 @@ dictionary ConsoleEvent {
|
|||
any timer = null;
|
||||
any counter = null;
|
||||
DOMString prefix = "";
|
||||
boolean chromeContext = false;
|
||||
};
|
||||
|
||||
// Event for profile operations
|
||||
dictionary ConsoleProfileEvent {
|
||||
DOMString action = "";
|
||||
sequence<any> arguments;
|
||||
boolean chromeContext = false;
|
||||
};
|
||||
|
||||
// This dictionary is used to manage stack trace data.
|
||||
|
|
|
@ -102,6 +102,7 @@ class WebSocketImpl final : public nsIInterfaceRequestor,
|
|||
mScriptColumn(0),
|
||||
mInnerWindowID(0),
|
||||
mPrivateBrowsing(false),
|
||||
mIsChromeContext(false),
|
||||
mIsMainThread(true),
|
||||
mMutex("WebSocketImpl::mMutex"),
|
||||
mWorkerShuttingDown(false) {
|
||||
|
@ -201,6 +202,7 @@ class WebSocketImpl final : public nsIInterfaceRequestor,
|
|||
uint32_t mScriptColumn;
|
||||
uint64_t mInnerWindowID;
|
||||
bool mPrivateBrowsing;
|
||||
bool mIsChromeContext;
|
||||
|
||||
RefPtr<ThreadSafeWorkerRef> mWorkerRef;
|
||||
|
||||
|
@ -344,7 +346,7 @@ void WebSocketImpl::PrintErrorOnConsole(const char* aBundleURI,
|
|||
rv = errorObject->Init(message, NS_ConvertUTF8toUTF16(mScriptFile),
|
||||
EmptyString(), mScriptLine, mScriptColumn,
|
||||
nsIScriptError::errorFlag, "Web Socket",
|
||||
mPrivateBrowsing);
|
||||
mPrivateBrowsing, mIsChromeContext);
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
@ -1505,6 +1507,7 @@ nsresult WebSocketImpl::Init(JSContext* aCx, nsIPrincipal* aLoadingPrincipal,
|
|||
}
|
||||
|
||||
mPrivateBrowsing = !!aPrincipal->OriginAttributesRef().mPrivateBrowsingId;
|
||||
mIsChromeContext = nsContentUtils::IsSystemPrincipal(aPrincipal);
|
||||
|
||||
// parses the url
|
||||
rv = ParseURL(aURL);
|
||||
|
|
|
@ -326,7 +326,8 @@ NS_IMETHODIMP
|
|||
ExecutionRunnable::Run() {
|
||||
// WorkletThread::IsOnWorkletThread() cannot be used here because it depends
|
||||
// on a WorkletJSContext having been created for this thread. That does not
|
||||
// happen until the first time RunOnWorkletThread() is called.
|
||||
// happen until the global scope is created the first time
|
||||
// RunOnWorkletThread() is called.
|
||||
if (!NS_IsMainThread()) {
|
||||
RunOnWorkletThread();
|
||||
return NS_DispatchToMainThread(this);
|
||||
|
@ -339,11 +340,7 @@ ExecutionRunnable::Run() {
|
|||
void ExecutionRunnable::RunOnWorkletThread() {
|
||||
WorkletThread::EnsureCycleCollectedJSContext(mParentRuntime);
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
RefPtr<WorkletGlobalScope> globalScope =
|
||||
mWorkletImpl->CreateGlobalScope(jsapi.cx());
|
||||
WorkletGlobalScope* globalScope = mWorkletImpl->GetGlobalScope();
|
||||
MOZ_ASSERT(globalScope);
|
||||
|
||||
AutoEntryScript aes(globalScope, "Worklet");
|
||||
|
|
|
@ -46,6 +46,8 @@ class Worklet final : public nsISupports, public nsWrapperCache {
|
|||
const WorkletOptions& aOptions,
|
||||
CallerType aCallerType, ErrorResult& aRv);
|
||||
|
||||
WorkletImpl* Impl() const { return mImpl; }
|
||||
|
||||
private:
|
||||
~Worklet();
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/dom/RegisterWorkletBindings.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/WorkletBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -42,7 +43,7 @@ WorkletLoadInfo::~WorkletLoadInfo() {
|
|||
WorkletImpl::WorkletImpl(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal)
|
||||
: mWorkletLoadInfo(aWindow, aPrincipal), mTerminated(false) {}
|
||||
|
||||
WorkletImpl::~WorkletImpl() = default;
|
||||
WorkletImpl::~WorkletImpl() { MOZ_ASSERT(!mGlobalScope); }
|
||||
|
||||
JSObject* WorkletImpl::WrapWorklet(JSContext* aCx, dom::Worklet* aWorklet,
|
||||
JS::Handle<JSObject*> aGivenProto) {
|
||||
|
@ -50,30 +51,46 @@ JSObject* WorkletImpl::WrapWorklet(JSContext* aCx, dom::Worklet* aWorklet,
|
|||
return dom::Worklet_Binding::Wrap(aCx, aWorklet, aGivenProto);
|
||||
}
|
||||
|
||||
already_AddRefed<dom::WorkletGlobalScope> WorkletImpl::CreateGlobalScope(
|
||||
JSContext* aCx) {
|
||||
dom::WorkletGlobalScope* WorkletImpl::GetGlobalScope() {
|
||||
dom::WorkletThread::AssertIsOnWorkletThread();
|
||||
|
||||
RefPtr<dom::WorkletGlobalScope> scope = ConstructGlobalScope();
|
||||
if (mGlobalScope) {
|
||||
return mGlobalScope;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx);
|
||||
NS_ENSURE_TRUE(scope->WrapGlobalObject(aCx, &global), nullptr);
|
||||
dom::AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
JSAutoRealm ar(aCx, global);
|
||||
mGlobalScope = ConstructGlobalScope();
|
||||
|
||||
JS::Rooted<JSObject*> global(cx);
|
||||
NS_ENSURE_TRUE(mGlobalScope->WrapGlobalObject(cx, &global), nullptr);
|
||||
|
||||
JSAutoRealm ar(cx, global);
|
||||
|
||||
// Init Web IDL bindings
|
||||
if (!dom::RegisterWorkletBindings(aCx, global)) {
|
||||
if (!dom::RegisterWorkletBindings(cx, global)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS_FireOnNewGlobalObject(aCx, global);
|
||||
JS_FireOnNewGlobalObject(cx, global);
|
||||
|
||||
return scope.forget();
|
||||
return mGlobalScope;
|
||||
}
|
||||
|
||||
void WorkletImpl::NotifyWorkletFinished() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mTerminated) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Release global scope on its thread.
|
||||
SendControlMessage(NS_NewRunnableFunction(
|
||||
"WorkletImpl::NotifyWorkletFinished",
|
||||
[self = RefPtr<WorkletImpl>(this)]() { self->mGlobalScope = nullptr; }));
|
||||
|
||||
mTerminated = true;
|
||||
if (mWorkletThread) {
|
||||
mWorkletThread->Terminate();
|
||||
|
@ -93,7 +110,7 @@ nsresult WorkletImpl::SendControlMessage(
|
|||
|
||||
if (!mWorkletThread) {
|
||||
// Thread creation. FIXME: this will change.
|
||||
mWorkletThread = dom::WorkletThread::Create();
|
||||
mWorkletThread = dom::WorkletThread::Create(this);
|
||||
if (!mWorkletThread) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ class WorkletImpl {
|
|||
void NotifyWorkletFinished();
|
||||
|
||||
// Execution thread only.
|
||||
already_AddRefed<dom::WorkletGlobalScope> CreateGlobalScope(JSContext* aCx);
|
||||
dom::WorkletGlobalScope* GetGlobalScope();
|
||||
|
||||
// Any thread.
|
||||
|
||||
|
@ -93,6 +93,9 @@ class WorkletImpl {
|
|||
// Parent thread only.
|
||||
RefPtr<dom::WorkletThread> mWorkletThread;
|
||||
bool mTerminated;
|
||||
|
||||
// Execution thread only.
|
||||
RefPtr<dom::WorkletGlobalScope> mGlobalScope;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -210,10 +210,11 @@ class WorkletThread::TerminateRunnable final : public Runnable {
|
|||
RefPtr<WorkletThread> mWorkletThread;
|
||||
};
|
||||
|
||||
WorkletThread::WorkletThread()
|
||||
WorkletThread::WorkletThread(WorkletImpl* aWorkletImpl)
|
||||
: nsThread(MakeNotNull<ThreadEventQueue<mozilla::EventQueue>*>(
|
||||
MakeUnique<mozilla::EventQueue>()),
|
||||
nsThread::NOT_MAIN_THREAD, kWorkletStackSize),
|
||||
mWorkletImpl(aWorkletImpl),
|
||||
mExitLoop(false),
|
||||
mIsTerminating(false) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -226,8 +227,9 @@ WorkletThread::~WorkletThread() {
|
|||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<WorkletThread> WorkletThread::Create() {
|
||||
RefPtr<WorkletThread> thread = new WorkletThread();
|
||||
already_AddRefed<WorkletThread> WorkletThread::Create(
|
||||
WorkletImpl* aWorkletImpl) {
|
||||
RefPtr<WorkletThread> thread = new WorkletThread(aWorkletImpl);
|
||||
if (NS_WARN_IF(NS_FAILED(thread->Init()))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -368,7 +370,9 @@ WorkletThread::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
const char16_t*) {
|
||||
MOZ_ASSERT(strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0);
|
||||
|
||||
Terminate();
|
||||
// The WorkletImpl will terminate the worklet thread after sending a message
|
||||
// to release worklet thread objects.
|
||||
mWorkletImpl->NotifyWorkletFinished();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/CondVar.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/WorkletImpl.h"
|
||||
#include "nsThread.h"
|
||||
|
||||
class nsIRunnable;
|
||||
|
@ -23,7 +24,7 @@ class WorkletThread final : public nsThread, public nsIObserver {
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
static already_AddRefed<WorkletThread> Create();
|
||||
static already_AddRefed<WorkletThread> Create(WorkletImpl* aWorkletImpl);
|
||||
|
||||
// Threads that call EnsureCycleCollectedJSContext must call
|
||||
// DeleteCycleCollectedJSContext::Get() before terminating. Clients of
|
||||
|
@ -40,7 +41,7 @@ class WorkletThread final : public nsThread, public nsIObserver {
|
|||
void Terminate();
|
||||
|
||||
private:
|
||||
WorkletThread();
|
||||
explicit WorkletThread(WorkletImpl* aWorkletImpl);
|
||||
~WorkletThread();
|
||||
|
||||
void RunEventLoop();
|
||||
|
@ -60,6 +61,8 @@ class WorkletThread final : public nsThread, public nsIObserver {
|
|||
NS_IMETHOD
|
||||
DelayedDispatch(already_AddRefed<nsIRunnable>, uint32_t) override;
|
||||
|
||||
const RefPtr<WorkletImpl> mWorkletImpl;
|
||||
|
||||
bool mExitLoop; // worklet execution thread
|
||||
|
||||
bool mIsTerminating; // main thread
|
||||
|
|
|
@ -88,9 +88,7 @@ UniquePtr<SurfaceFactory> GLScreenBuffer::CreateFactory(
|
|||
factory = MakeUnique<SurfaceFactory_GLTexture>(mGLContext, caps, ipcChannel,
|
||||
mFlags);
|
||||
#elif defined(MOZ_WIDGET_ANDROID)
|
||||
// XXX WebRender does not support SurfaceFactory_EGLImage usage.
|
||||
if (XRE_IsParentProcess() && !gfxPrefs::WebGLSurfaceTextureEnabled() &&
|
||||
backend != layers::LayersBackend::LAYERS_WR) {
|
||||
if (XRE_IsParentProcess() && !gfxPrefs::WebGLSurfaceTextureEnabled()) {
|
||||
factory = SurfaceFactory_EGLImage::Create(gl, caps, ipcChannel, flags);
|
||||
} else {
|
||||
factory =
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/gfx/BaseSize.h" // for BaseSize
|
||||
#include "mozilla/gfx/Logging.h" // for gfxCriticalError
|
||||
#include "mozilla/layers/ISurfaceAllocator.h"
|
||||
#include "mozilla/webrender/RenderEGLImageTextureHost.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
#include "nsRegion.h" // for nsIntRegion
|
||||
#include "AndroidSurfaceTexture.h"
|
||||
|
@ -817,6 +818,44 @@ gfx::SurfaceFormat EGLImageTextureHost::GetFormat() const {
|
|||
: gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
|
||||
void EGLImageTextureHost::CreateRenderTexture(
|
||||
const wr::ExternalImageId& aExternalImageId) {
|
||||
RefPtr<wr::RenderTextureHost> texture =
|
||||
new wr::RenderEGLImageTextureHost(mImage, mSync, mSize);
|
||||
wr::RenderThread::Get()->RegisterExternalImage(wr::AsUint64(aExternalImageId),
|
||||
texture.forget());
|
||||
}
|
||||
|
||||
void EGLImageTextureHost::PushResourceUpdates(
|
||||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
||||
auto method = aOp == TextureHost::ADD_IMAGE
|
||||
? &wr::TransactionBuilder::AddExternalImage
|
||||
: &wr::TransactionBuilder::UpdateExternalImage;
|
||||
auto bufferType = wr::WrExternalImageBufferType::TextureExternalHandle;
|
||||
|
||||
gfx::SurfaceFormat format =
|
||||
mHasAlpha ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::R8G8B8X8;
|
||||
|
||||
MOZ_ASSERT(aImageKeys.length() == 1);
|
||||
// XXX Add RGBA handling. Temporary hack to avoid crash
|
||||
// With BGRA format setting, rendering works without problem.
|
||||
auto formatTmp = format == gfx::SurfaceFormat::R8G8B8A8
|
||||
? gfx::SurfaceFormat::B8G8R8A8
|
||||
: gfx::SurfaceFormat::B8G8R8X8;
|
||||
wr::ImageDescriptor descriptor(GetSize(), formatTmp);
|
||||
(aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0);
|
||||
}
|
||||
|
||||
void EGLImageTextureHost::PushDisplayItems(
|
||||
wr::DisplayListBuilder& aBuilder, const wr::LayoutRect& aBounds,
|
||||
const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
|
||||
const Range<wr::ImageKey>& aImageKeys) {
|
||||
MOZ_ASSERT(aImageKeys.length() == 1);
|
||||
aBuilder.PushImage(aBounds, aClip, true, aFilter, aImageKeys[0],
|
||||
!(mFlags & TextureFlags::NON_PREMULTIPLIED));
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
GLTextureHost::GLTextureHost(TextureFlags aFlags, GLuint aTextureHandle,
|
||||
|
|
|
@ -545,6 +545,20 @@ class EGLImageTextureHost final : public TextureHost {
|
|||
|
||||
virtual const char* Name() override { return "EGLImageTextureHost"; }
|
||||
|
||||
virtual void CreateRenderTexture(
|
||||
const wr::ExternalImageId& aExternalImageId) override;
|
||||
|
||||
virtual void PushResourceUpdates(wr::TransactionBuilder& aResources,
|
||||
ResourceUpdateOp aOp,
|
||||
const Range<wr::ImageKey>& aImageKeys,
|
||||
const wr::ExternalImageId& aExtID) override;
|
||||
|
||||
virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
|
||||
const wr::LayoutRect& aBounds,
|
||||
const wr::LayoutRect& aClip,
|
||||
wr::ImageRendering aFilter,
|
||||
const Range<wr::ImageKey>& aImageKeys) override;
|
||||
|
||||
protected:
|
||||
const EGLImage mImage;
|
||||
const EGLSync mSync;
|
||||
|
|
|
@ -21,7 +21,7 @@ using namespace mozilla;
|
|||
nsFont::nsFont(const FontFamilyList& aFontlist, nscoord aSize)
|
||||
: fontlist(aFontlist), size(aSize) {}
|
||||
|
||||
nsFont::nsFont(FontFamilyType aGenericType, nscoord aSize)
|
||||
nsFont::nsFont(StyleGenericFontFamily aGenericType, nscoord aSize)
|
||||
: fontlist(aGenericType), size(aSize) {}
|
||||
|
||||
nsFont::nsFont(const nsFont& aOther) = default;
|
||||
|
|
|
@ -21,22 +21,6 @@
|
|||
|
||||
struct gfxFontStyle;
|
||||
|
||||
// IDs for generic fonts
|
||||
// NOTE: 0, 1 are reserved for the special IDs of the default variable
|
||||
// and fixed fonts in the presentation context, see nsPresContext.h
|
||||
const uint8_t kGenericFont_NONE = 0x00;
|
||||
// Special
|
||||
const uint8_t kGenericFont_moz_variable =
|
||||
0x00; // for the default variable width font
|
||||
const uint8_t kGenericFont_moz_fixed =
|
||||
0x01; // our special "use the user's fixed font"
|
||||
// CSS
|
||||
const uint8_t kGenericFont_serif = 0x02;
|
||||
const uint8_t kGenericFont_sans_serif = 0x04;
|
||||
const uint8_t kGenericFont_monospace = 0x08;
|
||||
const uint8_t kGenericFont_cursive = 0x10;
|
||||
const uint8_t kGenericFont_fantasy = 0x20;
|
||||
|
||||
// Font structure.
|
||||
struct nsFont {
|
||||
typedef mozilla::FontStretch FontStretch;
|
||||
|
@ -117,7 +101,7 @@ struct nsFont {
|
|||
nsFont(const mozilla::FontFamilyList& aFontlist, nscoord aSize);
|
||||
|
||||
// initialize the font with a single generic
|
||||
nsFont(mozilla::FontFamilyType aGenericType, nscoord aSize);
|
||||
nsFont(mozilla::StyleGenericFontFamily, nscoord aSize);
|
||||
|
||||
// Make a copy of the given font
|
||||
nsFont(const nsFont& aFont);
|
||||
|
|
|
@ -1972,15 +1972,10 @@ bool gfxFcPlatformFontList::GetStandardFamilyName(const nsCString& aFontName,
|
|||
}
|
||||
|
||||
void gfxFcPlatformFontList::AddGenericFonts(
|
||||
mozilla::FontFamilyType aGenericType, nsAtom* aLanguage,
|
||||
mozilla::StyleGenericFontFamily aGenericType, nsAtom* aLanguage,
|
||||
nsTArray<FamilyAndGeneric>& aFamilyList) {
|
||||
bool usePrefFontList = false;
|
||||
|
||||
// treat -moz-fixed as monospace
|
||||
if (aGenericType == eFamily_moz_fixed) {
|
||||
aGenericType = eFamily_monospace;
|
||||
}
|
||||
|
||||
const char* generic = GetGenericName(aGenericType);
|
||||
NS_ASSERTION(generic, "weird generic font type");
|
||||
if (!generic) {
|
||||
|
|
|
@ -301,7 +301,7 @@ class gfxFcPlatformFontList : public gfxPlatformFontList {
|
|||
FcConfig* GetLastConfig() const { return mLastConfig; }
|
||||
|
||||
// override to use fontconfig lookup for generics
|
||||
void AddGenericFonts(mozilla::FontFamilyType aGenericType, nsAtom* aLanguage,
|
||||
void AddGenericFonts(mozilla::StyleGenericFontFamily, nsAtom* aLanguage,
|
||||
nsTArray<FamilyAndGeneric>& aFamilyList) override;
|
||||
|
||||
void ClearLangGroupPrefFonts() override;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/FontPropertyTypes.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "mozilla/SVGContextPaint.h"
|
||||
|
@ -4000,10 +4001,11 @@ bool gfxFont::TryGetMathTable() {
|
|||
void SharedFontList::Initialize() {
|
||||
sEmpty = new SharedFontList();
|
||||
|
||||
for (uint8_t i = 0; i < uint8_t(eFamily_generic_count_including_special);
|
||||
++i) {
|
||||
auto type = static_cast<FontFamilyType>(i + uint8_t(eFamily_generic_first));
|
||||
sSingleGenerics[i] = new SharedFontList(type);
|
||||
for (auto i : IntegerRange(ArrayLength(sSingleGenerics))) {
|
||||
auto type = static_cast<StyleGenericFontFamily>(i);
|
||||
if (type != StyleGenericFontFamily::None) {
|
||||
sSingleGenerics[i] = new SharedFontList(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4019,4 +4021,4 @@ void SharedFontList::Shutdown() {
|
|||
StaticRefPtr<SharedFontList> SharedFontList::sEmpty;
|
||||
|
||||
StaticRefPtr<SharedFontList>
|
||||
SharedFontList::sSingleGenerics[eFamily_generic_count_including_special];
|
||||
SharedFontList::sSingleGenerics[size_t(StyleGenericFontFamily::MozEmoji)];
|
||||
|
|
|
@ -937,28 +937,28 @@ struct FontFamily {
|
|||
// particular case (so it can be reported to the DevTools font inspector).
|
||||
struct FamilyAndGeneric final {
|
||||
FamilyAndGeneric()
|
||||
: mFamily(), mGeneric(mozilla::FontFamilyType::eFamily_none) {}
|
||||
: mFamily(), mGeneric(mozilla::StyleGenericFontFamily::None) {}
|
||||
FamilyAndGeneric(const FamilyAndGeneric& aOther)
|
||||
: mFamily(aOther.mFamily), mGeneric(aOther.mGeneric) {}
|
||||
explicit FamilyAndGeneric(
|
||||
gfxFontFamily* aFamily,
|
||||
mozilla::FontFamilyType aGeneric = mozilla::FontFamilyType::eFamily_none)
|
||||
explicit FamilyAndGeneric(gfxFontFamily* aFamily,
|
||||
mozilla::StyleGenericFontFamily aGeneric =
|
||||
mozilla::StyleGenericFontFamily::None)
|
||||
: mFamily(aFamily), mGeneric(aGeneric) {}
|
||||
explicit FamilyAndGeneric(
|
||||
mozilla::fontlist::Family* aFamily,
|
||||
mozilla::FontFamilyType aGeneric = mozilla::FontFamilyType::eFamily_none)
|
||||
explicit FamilyAndGeneric(mozilla::fontlist::Family* aFamily,
|
||||
mozilla::StyleGenericFontFamily aGeneric =
|
||||
mozilla::StyleGenericFontFamily::None)
|
||||
: mFamily(aFamily), mGeneric(aGeneric) {}
|
||||
explicit FamilyAndGeneric(
|
||||
const FontFamily& aFamily,
|
||||
mozilla::FontFamilyType aGeneric = mozilla::FontFamilyType::eFamily_none)
|
||||
explicit FamilyAndGeneric(const FontFamily& aFamily,
|
||||
mozilla::StyleGenericFontFamily aGeneric =
|
||||
mozilla::StyleGenericFontFamily::None)
|
||||
: mFamily(aFamily), mGeneric(aGeneric) {}
|
||||
|
||||
bool operator==(const FamilyAndGeneric& aOther) const {
|
||||
return (mFamily == aOther.mFamily && mGeneric == aOther.mGeneric);
|
||||
return mFamily == aOther.mFamily && mGeneric == aOther.mGeneric;
|
||||
}
|
||||
|
||||
FontFamily mFamily;
|
||||
mozilla::FontFamilyType mGeneric;
|
||||
mozilla::StyleGenericFontFamily mGeneric;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsDebug.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
@ -19,116 +20,70 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* type of font family name, either a name (e.g. Helvetica) or a
|
||||
* generic (e.g. serif, sans-serif), with the ability to distinguish
|
||||
* between unquoted and quoted names for serializaiton
|
||||
*/
|
||||
|
||||
enum FontFamilyType : uint8_t {
|
||||
eFamily_none = 0, // used when finding generics
|
||||
|
||||
// explicitly named font family (e.g. Helvetica)
|
||||
eFamily_named,
|
||||
eFamily_named_quoted,
|
||||
|
||||
// generics
|
||||
eFamily_serif, // pref font code relies on this ordering!!!
|
||||
eFamily_sans_serif,
|
||||
eFamily_monospace,
|
||||
eFamily_cursive,
|
||||
eFamily_fantasy,
|
||||
|
||||
// special
|
||||
eFamily_moz_variable,
|
||||
eFamily_moz_fixed,
|
||||
eFamily_moz_emoji,
|
||||
|
||||
eFamily_generic_first = eFamily_serif,
|
||||
eFamily_generic_last = eFamily_fantasy,
|
||||
eFamily_generic_last_including_special = eFamily_moz_emoji,
|
||||
|
||||
eFamily_generic_count = eFamily_generic_last - eFamily_generic_first + 1,
|
||||
eFamily_generic_count_including_special =
|
||||
eFamily_generic_last_including_special - eFamily_generic_first + 1,
|
||||
};
|
||||
|
||||
enum QuotedName { eQuotedName, eUnquotedName };
|
||||
|
||||
/**
|
||||
* font family name, an Atom for the name if not a generic and
|
||||
* a font type indicated named family or which generic family
|
||||
*/
|
||||
|
||||
struct FontFamilyName final {
|
||||
FontFamilyName() : mType(eFamily_none) {}
|
||||
using Syntax = StyleFontFamilyNameSyntax;
|
||||
|
||||
FontFamilyName() = delete;
|
||||
|
||||
// named font family - e.g. Helvetica
|
||||
explicit FontFamilyName(nsAtom* aFamilyName,
|
||||
QuotedName aQuoted = eUnquotedName) {
|
||||
mType = (aQuoted == eQuotedName) ? eFamily_named_quoted : eFamily_named;
|
||||
mName = aFamilyName;
|
||||
}
|
||||
explicit FontFamilyName(nsAtom* aFamilyName, Syntax aSyntax)
|
||||
: mName(aFamilyName), mSyntax(aSyntax) {}
|
||||
|
||||
explicit FontFamilyName(const nsACString& aFamilyName,
|
||||
QuotedName aQuoted = eUnquotedName) {
|
||||
mType = (aQuoted == eQuotedName) ? eFamily_named_quoted : eFamily_named;
|
||||
mName = NS_Atomize(aFamilyName);
|
||||
}
|
||||
explicit FontFamilyName(const nsACString& aFamilyName, Syntax aSyntax)
|
||||
: mName(NS_Atomize(aFamilyName)), mSyntax(aSyntax) {}
|
||||
|
||||
// generic font family - e.g. sans-serif
|
||||
explicit FontFamilyName(FontFamilyType aType) {
|
||||
NS_ASSERTION(aType != eFamily_named && aType != eFamily_named_quoted &&
|
||||
aType != eFamily_none,
|
||||
"expected a generic font type");
|
||||
mName = nullptr;
|
||||
mType = aType;
|
||||
explicit FontFamilyName(StyleGenericFontFamily aGeneric)
|
||||
: mGeneric(aGeneric) {
|
||||
MOZ_ASSERT(mGeneric != StyleGenericFontFamily::None);
|
||||
}
|
||||
|
||||
FontFamilyName(const FontFamilyName& aCopy) {
|
||||
mType = aCopy.mType;
|
||||
mName = aCopy.mName;
|
||||
}
|
||||
FontFamilyName(const FontFamilyName&) = default;
|
||||
|
||||
bool IsNamed() const {
|
||||
return mType == eFamily_named || mType == eFamily_named_quoted;
|
||||
}
|
||||
bool IsNamed() const { return !!mName; }
|
||||
|
||||
bool IsGeneric() const { return !IsNamed(); }
|
||||
|
||||
void AppendToString(nsACString& aFamilyList, bool aQuotes = true) const {
|
||||
switch (mType) {
|
||||
case eFamily_named:
|
||||
aFamilyList.Append(nsAtomCString(mName));
|
||||
break;
|
||||
case eFamily_named_quoted:
|
||||
if (aQuotes) {
|
||||
aFamilyList.Append('"');
|
||||
}
|
||||
aFamilyList.Append(nsAtomCString(mName));
|
||||
if (aQuotes) {
|
||||
aFamilyList.Append('"');
|
||||
}
|
||||
break;
|
||||
case eFamily_serif:
|
||||
if (IsNamed()) {
|
||||
if (mSyntax == Syntax::Identifiers) {
|
||||
return aFamilyList.Append(nsAtomCString(mName));
|
||||
}
|
||||
if (aQuotes) {
|
||||
aFamilyList.Append('"');
|
||||
}
|
||||
aFamilyList.Append(nsAtomCString(mName));
|
||||
if (aQuotes) {
|
||||
aFamilyList.Append('"');
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch (mGeneric) {
|
||||
case StyleGenericFontFamily::None:
|
||||
case StyleGenericFontFamily::MozEmoji:
|
||||
MOZ_FALLTHROUGH_ASSERT("Should never appear in a font-family name!");
|
||||
case StyleGenericFontFamily::Serif:
|
||||
aFamilyList.AppendLiteral("serif");
|
||||
break;
|
||||
case eFamily_sans_serif:
|
||||
case StyleGenericFontFamily::SansSerif:
|
||||
aFamilyList.AppendLiteral("sans-serif");
|
||||
break;
|
||||
case eFamily_monospace:
|
||||
case StyleGenericFontFamily::Monospace:
|
||||
aFamilyList.AppendLiteral("monospace");
|
||||
break;
|
||||
case eFamily_cursive:
|
||||
case StyleGenericFontFamily::Cursive:
|
||||
aFamilyList.AppendLiteral("cursive");
|
||||
break;
|
||||
case eFamily_fantasy:
|
||||
case StyleGenericFontFamily::Fantasy:
|
||||
aFamilyList.AppendLiteral("fantasy");
|
||||
break;
|
||||
case eFamily_moz_fixed:
|
||||
aFamilyList.AppendLiteral("-moz-fixed");
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown generic font-family!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -141,32 +96,33 @@ struct FontFamilyName final {
|
|||
NS_ASSERTION(aFamilyOrGenericName.FindChar(',') == -1,
|
||||
"Convert method should only be passed a single family name");
|
||||
|
||||
FontFamilyType genericType = eFamily_none;
|
||||
auto genericType = StyleGenericFontFamily::None;
|
||||
if (aFamilyOrGenericName.LowerCaseEqualsLiteral("serif")) {
|
||||
genericType = eFamily_serif;
|
||||
genericType = StyleGenericFontFamily::Serif;
|
||||
} else if (aFamilyOrGenericName.LowerCaseEqualsLiteral("sans-serif")) {
|
||||
genericType = eFamily_sans_serif;
|
||||
} else if (aFamilyOrGenericName.LowerCaseEqualsLiteral("monospace")) {
|
||||
genericType = eFamily_monospace;
|
||||
genericType = StyleGenericFontFamily::SansSerif;
|
||||
} else if (aFamilyOrGenericName.LowerCaseEqualsLiteral("monospace") ||
|
||||
aFamilyOrGenericName.LowerCaseEqualsLiteral("-moz-fixed")) {
|
||||
genericType = StyleGenericFontFamily::Monospace;
|
||||
} else if (aFamilyOrGenericName.LowerCaseEqualsLiteral("cursive")) {
|
||||
genericType = eFamily_cursive;
|
||||
genericType = StyleGenericFontFamily::Cursive;
|
||||
} else if (aFamilyOrGenericName.LowerCaseEqualsLiteral("fantasy")) {
|
||||
genericType = eFamily_fantasy;
|
||||
} else if (aFamilyOrGenericName.LowerCaseEqualsLiteral("-moz-fixed")) {
|
||||
genericType = eFamily_moz_fixed;
|
||||
genericType = StyleGenericFontFamily::Fantasy;
|
||||
} else {
|
||||
return FontFamilyName(aFamilyOrGenericName, eUnquotedName);
|
||||
return FontFamilyName(aFamilyOrGenericName, Syntax::Identifiers);
|
||||
}
|
||||
|
||||
return FontFamilyName(genericType);
|
||||
}
|
||||
|
||||
FontFamilyType mType;
|
||||
RefPtr<nsAtom> mName; // null if mType != eFamily_named
|
||||
RefPtr<nsAtom> mName; // null if mGeneric != Default
|
||||
StyleFontFamilyNameSyntax mSyntax = StyleFontFamilyNameSyntax::Quoted;
|
||||
StyleGenericFontFamily mGeneric = StyleGenericFontFamily::None;
|
||||
};
|
||||
|
||||
inline bool operator==(const FontFamilyName& a, const FontFamilyName& b) {
|
||||
return a.mType == b.mType && a.mName == b.mName;
|
||||
return a.mName == b.mName && a.mSyntax == b.mSyntax &&
|
||||
a.mGeneric == b.mGeneric;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,36 +133,25 @@ inline bool operator==(const FontFamilyName& a, const FontFamilyName& b) {
|
|||
* FontFamilyName) in Rust.
|
||||
*/
|
||||
class SharedFontList {
|
||||
using Syntax = StyleFontFamilyNameSyntax;
|
||||
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedFontList);
|
||||
|
||||
SharedFontList() {}
|
||||
SharedFontList() = default;
|
||||
|
||||
explicit SharedFontList(FontFamilyType aGenericType)
|
||||
explicit SharedFontList(StyleGenericFontFamily aGenericType)
|
||||
: mNames{FontFamilyName(aGenericType)} {}
|
||||
|
||||
SharedFontList(nsAtom* aFamilyName, QuotedName aQuoted)
|
||||
: mNames{FontFamilyName(aFamilyName, aQuoted)} {}
|
||||
SharedFontList(nsAtom* aFamilyName, Syntax aSyntax)
|
||||
: mNames{FontFamilyName(aFamilyName, aSyntax)} {}
|
||||
|
||||
SharedFontList(const nsACString& aFamilyName, QuotedName aQuoted)
|
||||
: mNames{FontFamilyName(aFamilyName, aQuoted)} {}
|
||||
|
||||
explicit SharedFontList(const FontFamilyName& aName) : mNames{aName} {}
|
||||
SharedFontList(const nsACString& aFamilyName, Syntax aSyntax)
|
||||
: mNames{FontFamilyName(aFamilyName, aSyntax)} {}
|
||||
|
||||
explicit SharedFontList(nsTArray<FontFamilyName>&& aNames)
|
||||
: mNames(std::move(aNames)) {}
|
||||
|
||||
FontFamilyType FirstGeneric() const {
|
||||
for (const FontFamilyName& name : mNames) {
|
||||
if (name.IsGeneric()) {
|
||||
return name.mType;
|
||||
}
|
||||
}
|
||||
return eFamily_none;
|
||||
}
|
||||
|
||||
bool HasGeneric() const { return FirstGeneric() != eFamily_none; }
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
|
||||
size_t n = 0;
|
||||
n += aMallocSizeOf(this);
|
||||
|
@ -228,7 +173,7 @@ class SharedFontList {
|
|||
static void Shutdown();
|
||||
static StaticRefPtr<SharedFontList> sEmpty;
|
||||
static StaticRefPtr<SharedFontList>
|
||||
sSingleGenerics[eFamily_generic_count_including_special];
|
||||
sSingleGenerics[size_t(StyleGenericFontFamily::MozEmoji)];
|
||||
|
||||
private:
|
||||
~SharedFontList() = default;
|
||||
|
@ -240,37 +185,29 @@ class SharedFontList {
|
|||
* font type is used to preserve the variable font fallback behavior
|
||||
*/
|
||||
class FontFamilyList {
|
||||
using Syntax = StyleFontFamilyNameSyntax;
|
||||
|
||||
public:
|
||||
FontFamilyList()
|
||||
: mFontlist(WrapNotNull(SharedFontList::sEmpty.get())),
|
||||
mDefaultFontType(eFamily_none) {}
|
||||
FontFamilyList() : mFontlist(WrapNotNull(SharedFontList::sEmpty.get())) {}
|
||||
|
||||
explicit FontFamilyList(FontFamilyType aGenericType)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(aGenericType)),
|
||||
mDefaultFontType(eFamily_none) {}
|
||||
explicit FontFamilyList(StyleGenericFontFamily aGenericType)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(aGenericType)) {}
|
||||
|
||||
FontFamilyList(nsAtom* aFamilyName, QuotedName aQuoted)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(aFamilyName, aQuoted)),
|
||||
mDefaultFontType(eFamily_none) {}
|
||||
FontFamilyList(nsAtom* aFamilyName, Syntax aSyntax)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(aFamilyName, aSyntax)) {}
|
||||
|
||||
FontFamilyList(const nsACString& aFamilyName, QuotedName aQuoted)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(aFamilyName, aQuoted)),
|
||||
mDefaultFontType(eFamily_none) {}
|
||||
|
||||
explicit FontFamilyList(const FontFamilyName& aName)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(aName)),
|
||||
mDefaultFontType(eFamily_none) {}
|
||||
FontFamilyList(const nsACString& aFamilyName, Syntax aSyntax)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(aFamilyName, aSyntax)) {}
|
||||
|
||||
explicit FontFamilyList(nsTArray<FontFamilyName>&& aNames)
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(std::move(aNames))),
|
||||
mDefaultFontType(eFamily_none) {}
|
||||
: mFontlist(MakeNotNull<SharedFontList*>(std::move(aNames))) {}
|
||||
|
||||
FontFamilyList(const FontFamilyList& aOther)
|
||||
: mFontlist(aOther.mFontlist),
|
||||
mDefaultFontType(aOther.mDefaultFontType) {}
|
||||
|
||||
explicit FontFamilyList(NotNull<SharedFontList*> aFontList)
|
||||
: mFontlist(aFontList), mDefaultFontType(eFamily_none) {}
|
||||
: mFontlist(aFontList) {}
|
||||
|
||||
void SetFontlist(nsTArray<FontFamilyName>&& aNames) {
|
||||
mFontlist = MakeNotNull<SharedFontList*>(std::move(aNames));
|
||||
|
@ -292,13 +229,12 @@ class FontFamilyList {
|
|||
mDefaultFontType == aFontlist.mDefaultFontType;
|
||||
}
|
||||
|
||||
FontFamilyType FirstGeneric() const { return mFontlist->FirstGeneric(); }
|
||||
|
||||
bool HasGeneric() const { return mFontlist->HasGeneric(); }
|
||||
|
||||
bool HasDefaultGeneric() const {
|
||||
if (mDefaultFontType == StyleGenericFontFamily::None) {
|
||||
return false;
|
||||
}
|
||||
for (const FontFamilyName& name : mFontlist->mNames) {
|
||||
if (name.mType == mDefaultFontType) {
|
||||
if (name.mGeneric == mDefaultFontType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +249,8 @@ class FontFamilyList {
|
|||
for (uint32_t i = 0; i < len; i++) {
|
||||
const FontFamilyName name = mFontlist->mNames[i];
|
||||
if (name.IsGeneric()) {
|
||||
if (name.mType == eFamily_cursive || name.mType == eFamily_fantasy) {
|
||||
if (name.mGeneric == StyleGenericFontFamily::Cursive ||
|
||||
name.mGeneric == StyleGenericFontFamily::Fantasy) {
|
||||
continue;
|
||||
}
|
||||
if (i > 0) {
|
||||
|
@ -329,10 +266,10 @@ class FontFamilyList {
|
|||
return false;
|
||||
}
|
||||
|
||||
void PrependGeneric(FontFamilyType aType) {
|
||||
void PrependGeneric(StyleGenericFontFamily aGeneric) {
|
||||
nsTArray<FontFamilyName> names;
|
||||
names.AppendElements(mFontlist->mNames);
|
||||
names.InsertElementAt(0, FontFamilyName(aType));
|
||||
names.InsertElementAt(0, FontFamilyName(aGeneric));
|
||||
SetFontlist(std::move(names));
|
||||
}
|
||||
|
||||
|
@ -348,11 +285,11 @@ class FontFamilyList {
|
|||
const FontFamilyName& name = names[i];
|
||||
name.AppendToString(aFamilyList, aQuotes);
|
||||
}
|
||||
if (aIncludeDefault && mDefaultFontType != eFamily_none) {
|
||||
if (aIncludeDefault && mDefaultFontType != StyleGenericFontFamily::None) {
|
||||
if (!aFamilyList.IsEmpty()) {
|
||||
aFamilyList.Append(',');
|
||||
}
|
||||
if (mDefaultFontType == eFamily_serif) {
|
||||
if (mDefaultFontType == StyleGenericFontFamily::Serif) {
|
||||
aFamilyList.AppendLiteral("serif");
|
||||
} else {
|
||||
aFamilyList.AppendLiteral("sans-serif");
|
||||
|
@ -375,10 +312,11 @@ class FontFamilyList {
|
|||
return false;
|
||||
}
|
||||
|
||||
FontFamilyType GetDefaultFontType() const { return mDefaultFontType; }
|
||||
void SetDefaultFontType(FontFamilyType aType) {
|
||||
NS_ASSERTION(aType == eFamily_none || aType == eFamily_serif ||
|
||||
aType == eFamily_sans_serif,
|
||||
StyleGenericFontFamily GetDefaultFontType() const { return mDefaultFontType; }
|
||||
void SetDefaultFontType(StyleGenericFontFamily aType) {
|
||||
NS_ASSERTION(aType == StyleGenericFontFamily::None ||
|
||||
aType == StyleGenericFontFamily::Serif ||
|
||||
aType == StyleGenericFontFamily::SansSerif,
|
||||
"default font type must be either serif or sans-serif");
|
||||
mDefaultFontType = aType;
|
||||
}
|
||||
|
@ -396,7 +334,8 @@ class FontFamilyList {
|
|||
|
||||
protected:
|
||||
NotNull<RefPtr<SharedFontList>> mFontlist;
|
||||
FontFamilyType mDefaultFontType; // none, serif or sans-serif
|
||||
StyleGenericFontFamily mDefaultFontType =
|
||||
StyleGenericFontFamily::None; // or serif, or sans-serif
|
||||
};
|
||||
|
||||
inline bool operator==(const FontFamilyList& a, const FontFamilyList& b) {
|
||||
|
|
|
@ -891,7 +891,7 @@ void gfxPlatformFontList::RemoveCmap(const gfxCharacterMap* aCharMap) {
|
|||
}
|
||||
|
||||
void gfxPlatformFontList::ResolveGenericFontNames(
|
||||
FontFamilyType aGenericType, eFontPrefLang aPrefLang,
|
||||
StyleGenericFontFamily aGenericType, eFontPrefLang aPrefLang,
|
||||
PrefFontList* aGenericFamilies) {
|
||||
const char* langGroupStr = GetPrefLangName(aPrefLang);
|
||||
const char* generic = GetGenericName(aGenericType);
|
||||
|
@ -957,13 +957,8 @@ void gfxPlatformFontList::GetFontFamiliesFromGenericFamilies(
|
|||
}
|
||||
|
||||
gfxPlatformFontList::PrefFontList* gfxPlatformFontList::GetPrefFontsLangGroup(
|
||||
mozilla::FontFamilyType aGenericType, eFontPrefLang aPrefLang) {
|
||||
// treat -moz-fixed as monospace
|
||||
if (aGenericType == eFamily_moz_fixed) {
|
||||
aGenericType = eFamily_monospace;
|
||||
}
|
||||
|
||||
if (aGenericType == eFamily_moz_emoji) {
|
||||
StyleGenericFontFamily aGenericType, eFontPrefLang aPrefLang) {
|
||||
if (aGenericType == StyleGenericFontFamily::MozEmoji) {
|
||||
// Emoji font has no lang
|
||||
PrefFontList* prefFonts = mEmojiPrefFont.get();
|
||||
if (MOZ_UNLIKELY(!prefFonts)) {
|
||||
|
@ -974,17 +969,18 @@ gfxPlatformFontList::PrefFontList* gfxPlatformFontList::GetPrefFontsLangGroup(
|
|||
return prefFonts;
|
||||
}
|
||||
|
||||
PrefFontList* prefFonts = mLangGroupPrefFonts[aPrefLang][aGenericType].get();
|
||||
auto index = static_cast<size_t>(aGenericType);
|
||||
PrefFontList* prefFonts = mLangGroupPrefFonts[aPrefLang][index].get();
|
||||
if (MOZ_UNLIKELY(!prefFonts)) {
|
||||
prefFonts = new PrefFontList;
|
||||
ResolveGenericFontNames(aGenericType, aPrefLang, prefFonts);
|
||||
mLangGroupPrefFonts[aPrefLang][aGenericType].reset(prefFonts);
|
||||
mLangGroupPrefFonts[aPrefLang][index].reset(prefFonts);
|
||||
}
|
||||
return prefFonts;
|
||||
}
|
||||
|
||||
void gfxPlatformFontList::AddGenericFonts(
|
||||
mozilla::FontFamilyType aGenericType, nsAtom* aLanguage,
|
||||
mozilla::StyleGenericFontFamily aGenericType, nsAtom* aLanguage,
|
||||
nsTArray<FamilyAndGeneric>& aFamilyList) {
|
||||
// map lang ==> langGroup
|
||||
nsAtom* langGroup = GetLangGroup(aLanguage);
|
||||
|
@ -1282,10 +1278,10 @@ void gfxPlatformFontList::AppendPrefLang(eFontPrefLang aPrefLangs[],
|
|||
}
|
||||
}
|
||||
|
||||
mozilla::FontFamilyType gfxPlatformFontList::GetDefaultGeneric(
|
||||
mozilla::StyleGenericFontFamily gfxPlatformFontList::GetDefaultGeneric(
|
||||
eFontPrefLang aLang) {
|
||||
if (aLang == eFontPrefLang_Emoji) {
|
||||
return eFamily_moz_emoji;
|
||||
return StyleGenericFontFamily::MozEmoji;
|
||||
}
|
||||
|
||||
// initialize lang group pref font defaults (i.e. serif/sans-serif)
|
||||
|
@ -1297,9 +1293,9 @@ mozilla::FontFamilyType gfxPlatformFontList::GetDefaultGeneric(
|
|||
nsAutoCString serifOrSans;
|
||||
Preferences::GetCString(prefDefaultFontType.get(), serifOrSans);
|
||||
if (serifOrSans.EqualsLiteral("sans-serif")) {
|
||||
mDefaultGenericsLangGroup[i] = eFamily_sans_serif;
|
||||
mDefaultGenericsLangGroup[i] = StyleGenericFontFamily::SansSerif;
|
||||
} else {
|
||||
mDefaultGenericsLangGroup[i] = eFamily_serif;
|
||||
mDefaultGenericsLangGroup[i] = StyleGenericFontFamily::Serif;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1307,7 +1303,7 @@ mozilla::FontFamilyType gfxPlatformFontList::GetDefaultGeneric(
|
|||
if (uint32_t(aLang) < ArrayLength(gPrefLangNames)) {
|
||||
return mDefaultGenericsLangGroup[uint32_t(aLang)];
|
||||
}
|
||||
return eFamily_serif;
|
||||
return StyleGenericFontFamily::Serif;
|
||||
}
|
||||
|
||||
FontFamily gfxPlatformFontList::GetDefaultFont(const gfxFontStyle* aStyle) {
|
||||
|
@ -1343,7 +1339,7 @@ nsAtom* gfxPlatformFontList::GetLangGroup(nsAtom* aLanguage) {
|
|||
}
|
||||
|
||||
/* static */ const char* gfxPlatformFontList::GetGenericName(
|
||||
FontFamilyType aGenericType) {
|
||||
StyleGenericFontFamily aGenericType) {
|
||||
static const char kGeneric_serif[] = "serif";
|
||||
static const char kGeneric_sans_serif[] = "sans-serif";
|
||||
static const char kGeneric_monospace[] = "monospace";
|
||||
|
@ -1351,32 +1347,22 @@ nsAtom* gfxPlatformFontList::GetLangGroup(nsAtom* aLanguage) {
|
|||
static const char kGeneric_fantasy[] = "fantasy";
|
||||
|
||||
// type should be standard generic type at this point
|
||||
NS_ASSERTION(aGenericType >= eFamily_serif && aGenericType <= eFamily_fantasy,
|
||||
"standard generic font family type required");
|
||||
|
||||
// map generic type to string
|
||||
const char* generic = nullptr;
|
||||
switch (aGenericType) {
|
||||
case eFamily_serif:
|
||||
generic = kGeneric_serif;
|
||||
break;
|
||||
case eFamily_sans_serif:
|
||||
generic = kGeneric_sans_serif;
|
||||
break;
|
||||
case eFamily_monospace:
|
||||
generic = kGeneric_monospace;
|
||||
break;
|
||||
case eFamily_cursive:
|
||||
generic = kGeneric_cursive;
|
||||
break;
|
||||
case eFamily_fantasy:
|
||||
generic = kGeneric_fantasy;
|
||||
break;
|
||||
case StyleGenericFontFamily::Serif:
|
||||
return kGeneric_serif;
|
||||
case StyleGenericFontFamily::SansSerif:
|
||||
return kGeneric_sans_serif;
|
||||
case StyleGenericFontFamily::Monospace:
|
||||
return kGeneric_monospace;
|
||||
case StyleGenericFontFamily::Cursive:
|
||||
return kGeneric_cursive;
|
||||
case StyleGenericFontFamily::Fantasy:
|
||||
return kGeneric_fantasy;
|
||||
default:
|
||||
break;
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown generic");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return generic;
|
||||
}
|
||||
|
||||
void gfxPlatformFontList::InitLoader() {
|
||||
|
@ -1504,9 +1490,8 @@ void gfxPlatformFontList::ClearLangGroupPrefFonts() {
|
|||
for (uint32_t i = eFontPrefLang_First;
|
||||
i < eFontPrefLang_First + eFontPrefLang_Count; i++) {
|
||||
auto& prefFontsLangGroup = mLangGroupPrefFonts[i];
|
||||
for (uint32_t j = eFamily_generic_first;
|
||||
j < eFamily_generic_first + eFamily_generic_count; j++) {
|
||||
prefFontsLangGroup[j] = nullptr;
|
||||
for (auto& pref : prefFontsLangGroup) {
|
||||
pref = nullptr;
|
||||
}
|
||||
}
|
||||
mCJKPrefLangs.Clear();
|
||||
|
@ -1564,9 +1549,7 @@ void gfxPlatformFontList::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
|
|||
for (uint32_t i = eFontPrefLang_First;
|
||||
i < eFontPrefLang_First + eFontPrefLang_Count; i++) {
|
||||
auto& prefFontsLangGroup = mLangGroupPrefFonts[i];
|
||||
for (uint32_t j = eFamily_generic_first;
|
||||
j < eFamily_generic_first + eFamily_generic_count; j++) {
|
||||
PrefFontList* pf = prefFontsLangGroup[j].get();
|
||||
for (const UniquePtr<PrefFontList>& pf : prefFontsLangGroup) {
|
||||
if (pf) {
|
||||
aSizes->mFontListSize += pf->ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
|
|
@ -258,12 +258,12 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
aLoaderState = (uint32_t)mState;
|
||||
}
|
||||
|
||||
virtual void AddGenericFonts(mozilla::FontFamilyType aGenericType,
|
||||
virtual void AddGenericFonts(mozilla::StyleGenericFontFamily aGenericType,
|
||||
nsAtom* aLanguage,
|
||||
nsTArray<FamilyAndGeneric>& aFamilyList);
|
||||
|
||||
PrefFontList* GetPrefFontsLangGroup(mozilla::FontFamilyType aGenericType,
|
||||
eFontPrefLang aPrefLang);
|
||||
PrefFontList* GetPrefFontsLangGroup(
|
||||
mozilla::StyleGenericFontFamily aGenericType, eFontPrefLang aPrefLang);
|
||||
|
||||
// in some situations, need to make decisions about ambiguous characters, may
|
||||
// need to look at multiple pref langs
|
||||
|
@ -295,7 +295,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
eFontPrefLang aAddLang);
|
||||
|
||||
// default serif/sans-serif choice based on font.default.xxx prefs
|
||||
mozilla::FontFamilyType GetDefaultGeneric(eFontPrefLang aLang);
|
||||
mozilla::StyleGenericFontFamily GetDefaultGeneric(eFontPrefLang aLang);
|
||||
|
||||
// Returns true if the font family whitelist is not empty.
|
||||
bool IsFontFamilyWhitelistActive();
|
||||
|
@ -305,7 +305,8 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
bool AddWithLegacyFamilyName(const nsACString& aLegacyName,
|
||||
gfxFontEntry* aFontEntry);
|
||||
|
||||
static const char* GetGenericName(mozilla::FontFamilyType aGenericType);
|
||||
static const char* GetGenericName(
|
||||
mozilla::StyleGenericFontFamily aGenericType);
|
||||
|
||||
protected:
|
||||
class InitOtherFamilyNamesRunnable : public mozilla::CancelableRunnable {
|
||||
|
@ -486,7 +487,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
|
||||
void RebuildLocalFonts();
|
||||
|
||||
void ResolveGenericFontNames(mozilla::FontFamilyType aGenericType,
|
||||
void ResolveGenericFontNames(mozilla::StyleGenericFontFamily aGenericType,
|
||||
eFontPrefLang aPrefLang,
|
||||
PrefFontList* aGenericFamilies);
|
||||
|
||||
|
@ -552,8 +553,9 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
mozilla::UniquePtr<nsTHashtable<nsCStringHashKey>> mOtherNamesMissed;
|
||||
|
||||
typedef mozilla::RangedArray<mozilla::UniquePtr<PrefFontList>,
|
||||
mozilla::eFamily_generic_first,
|
||||
mozilla::eFamily_generic_count>
|
||||
size_t(mozilla::StyleGenericFontFamily::None),
|
||||
size_t(
|
||||
mozilla::StyleGenericFontFamily::MozEmoji)>
|
||||
PrefFontsForLangGroup;
|
||||
mozilla::RangedArray<PrefFontsForLangGroup, eFontPrefLang_First,
|
||||
eFontPrefLang_Count>
|
||||
|
@ -589,7 +591,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
nsLanguageAtomService* mLangService;
|
||||
|
||||
nsTArray<uint32_t> mCJKPrefLangs;
|
||||
nsTArray<mozilla::FontFamilyType> mDefaultGenericsLangGroup;
|
||||
nsTArray<mozilla::StyleGenericFontFamily> mDefaultGenericsLangGroup;
|
||||
|
||||
bool mFontFamilyWhitelistActive;
|
||||
};
|
||||
|
|
|
@ -1535,7 +1535,7 @@ void gfxTextRun::SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
|
|||
aDrawTarget, &space, 1, gfxShapedWord::HashMix(0, ' '), Script::LATIN,
|
||||
vertical, mAppUnitsPerDevUnit, flags, roundingFlags, nullptr);
|
||||
if (sw) {
|
||||
AddGlyphRun(aFont, FontMatchType::kFontGroup, aCharIndex, false,
|
||||
AddGlyphRun(aFont, FontMatchType::Kind::kFontGroup, aCharIndex, false,
|
||||
aOrientation);
|
||||
CopyGlyphDataFrom(sw, aCharIndex);
|
||||
GetCharacterGlyphs()[aCharIndex].SetIsSpace();
|
||||
|
@ -1560,7 +1560,7 @@ bool gfxTextRun::SetSpaceGlyphIfSimple(gfxFont* aFont, uint32_t aCharIndex,
|
|||
return false;
|
||||
}
|
||||
|
||||
AddGlyphRun(aFont, FontMatchType::kFontGroup, aCharIndex, false,
|
||||
AddGlyphRun(aFont, FontMatchType::Kind::kFontGroup, aCharIndex, false,
|
||||
aOrientation);
|
||||
CompressedGlyph g =
|
||||
CompressedGlyph::MakeSimpleGlyph(spaceWidthAppUnits, spaceGlyph);
|
||||
|
@ -1715,7 +1715,7 @@ void gfxFontGroup::BuildFontList() {
|
|||
MOZ_ASSERT_UNREACHABLE("broken FontFamilyName, no atom!");
|
||||
}
|
||||
} else {
|
||||
pfl->AddGenericFonts(name.mType, mStyle.language, fonts);
|
||||
pfl->AddGenericFonts(name.mGeneric, mStyle.language, fonts);
|
||||
if (mTextPerf) {
|
||||
mTextPerf->current.genericLookups++;
|
||||
}
|
||||
|
@ -1723,7 +1723,7 @@ void gfxFontGroup::BuildFontList() {
|
|||
}
|
||||
|
||||
// if necessary, append default generic onto the end
|
||||
if (mFamilyList.GetDefaultFontType() != eFamily_none &&
|
||||
if (mFamilyList.GetDefaultFontType() != StyleGenericFontFamily::None &&
|
||||
!mFamilyList.HasDefaultGeneric()) {
|
||||
pfl->AddGenericFonts(mFamilyList.GetDefaultFontType(), mStyle.language,
|
||||
fonts);
|
||||
|
@ -1761,7 +1761,7 @@ void gfxFontGroup::AddPlatformFont(const nsACString& aName,
|
|||
}
|
||||
|
||||
void gfxFontGroup::AddFamilyToFontList(gfxFontFamily* aFamily,
|
||||
FontFamilyType aGeneric) {
|
||||
StyleGenericFontFamily aGeneric) {
|
||||
if (!aFamily) {
|
||||
MOZ_ASSERT_UNREACHABLE("don't try to add a null font family!");
|
||||
return;
|
||||
|
@ -1963,7 +1963,7 @@ gfxFont* gfxFontGroup::GetDefaultFont() {
|
|||
}
|
||||
|
||||
gfxFont* gfxFontGroup::GetFirstValidFont(uint32_t aCh,
|
||||
FontFamilyType* aGeneric) {
|
||||
StyleGenericFontFamily* aGeneric) {
|
||||
uint32_t count = mFonts.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
FamilyFace& ff = mFonts[i];
|
||||
|
@ -2006,7 +2006,7 @@ gfxFont* gfxFontGroup::GetFirstValidFont(uint32_t aCh,
|
|||
}
|
||||
}
|
||||
if (aGeneric) {
|
||||
*aGeneric = eFamily_none;
|
||||
*aGeneric = StyleGenericFontFamily::None;
|
||||
}
|
||||
return GetDefaultFont();
|
||||
}
|
||||
|
@ -2078,7 +2078,7 @@ already_AddRefed<gfxTextRun> gfxFontGroup::MakeSpaceTextRun(
|
|||
// Short-circuit for size-0 fonts, as Windows and ATSUI can't handle
|
||||
// them, and always create at least size 1 fonts, i.e. they still
|
||||
// render something for size 0 fonts.
|
||||
textRun->AddGlyphRun(font, FontMatchType::kFontGroup, 0, false,
|
||||
textRun->AddGlyphRun(font, FontMatchType::Kind::kFontGroup, 0, false,
|
||||
orientation);
|
||||
} else {
|
||||
if (font->GetSpaceGlyph()) {
|
||||
|
@ -2116,8 +2116,8 @@ already_AddRefed<gfxTextRun> gfxFontGroup::MakeBlankTextRun(
|
|||
if (orientation == ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED) {
|
||||
orientation = ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
|
||||
}
|
||||
textRun->AddGlyphRun(GetFirstValidFont(), FontMatchType::kFontGroup, 0, false,
|
||||
orientation);
|
||||
textRun->AddGlyphRun(GetFirstValidFont(), FontMatchType::Kind::kFontGroup, 0,
|
||||
false, orientation);
|
||||
return textRun.forget();
|
||||
}
|
||||
|
||||
|
@ -2274,9 +2274,10 @@ void gfxFontGroup::InitTextRun(DrawTarget* aDrawTarget, gfxTextRun* aTextRun,
|
|||
"len %d weight: %g stretch: %g%% style: %s size: %6.2f %zu-byte "
|
||||
"TEXTRUN [%s] ENDTEXTRUN\n",
|
||||
(mStyle.systemFont ? "textrunui" : "textrun"), families.get(),
|
||||
(mFamilyList.GetDefaultFontType() == eFamily_serif
|
||||
(mFamilyList.GetDefaultFontType() == StyleGenericFontFamily::Serif
|
||||
? "serif"
|
||||
: (mFamilyList.GetDefaultFontType() == eFamily_sans_serif
|
||||
: (mFamilyList.GetDefaultFontType() ==
|
||||
StyleGenericFontFamily::SansSerif
|
||||
? "sans-serif"
|
||||
: "none")),
|
||||
lang.get(), static_cast<int>(Script::LATIN), aLength,
|
||||
|
@ -2320,9 +2321,11 @@ void gfxFontGroup::InitTextRun(DrawTarget* aDrawTarget, gfxTextRun* aTextRun,
|
|||
"len %d weight: %g stretch: %g%% style: %s size: %6.2f "
|
||||
"%zu-byte TEXTRUN [%s] ENDTEXTRUN\n",
|
||||
(mStyle.systemFont ? "textrunui" : "textrun"), families.get(),
|
||||
(mFamilyList.GetDefaultFontType() == eFamily_serif
|
||||
(mFamilyList.GetDefaultFontType() ==
|
||||
StyleGenericFontFamily::Serif
|
||||
? "serif"
|
||||
: (mFamilyList.GetDefaultFontType() == eFamily_sans_serif
|
||||
: (mFamilyList.GetDefaultFontType() ==
|
||||
StyleGenericFontFamily::SansSerif
|
||||
? "sans-serif"
|
||||
: "none")),
|
||||
lang.get(), static_cast<int>(runScript), runLen,
|
||||
|
@ -2500,7 +2503,7 @@ void gfxFontGroup::InitScriptRun(DrawTarget* aDrawTarget, gfxTextRun* aTextRun,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
aTextRun->AddGlyphRun(mainFont, FontMatchType::kFontGroup,
|
||||
aTextRun->AddGlyphRun(mainFont, FontMatchType::Kind::kFontGroup,
|
||||
aOffset + runStart, (matchedLength > 0),
|
||||
range.orientation);
|
||||
}
|
||||
|
@ -2707,8 +2710,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
gfxFont* firstFont = GetFontAt(0, aCh);
|
||||
if (firstFont) {
|
||||
if (firstFont->HasCharacter(aCh)) {
|
||||
*aMatchType =
|
||||
FontMatchType::kFontGroup | FontMatchType(mFonts[0].Generic());
|
||||
*aMatchType = {FontMatchType::Kind::kFontGroup, mFonts[0].Generic()};
|
||||
return firstFont;
|
||||
}
|
||||
|
||||
|
@ -2723,8 +2725,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
font = FindFallbackFaceForChar(mFonts[0].Family(), aCh);
|
||||
}
|
||||
if (font) {
|
||||
*aMatchType =
|
||||
FontMatchType::kFontGroup | FontMatchType(mFonts[0].Generic());
|
||||
*aMatchType = {FontMatchType::Kind::kFontGroup, mFonts[0].Generic()};
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
@ -2774,7 +2775,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
gfxFont* font = ff.Font();
|
||||
if (font) {
|
||||
if (font->HasCharacter(aCh)) {
|
||||
*aMatchType = FontMatchType::kFontGroup | FontMatchType(ff.Generic());
|
||||
*aMatchType = {FontMatchType::Kind::kFontGroup, ff.Generic()};
|
||||
return font;
|
||||
}
|
||||
continue;
|
||||
|
@ -2803,8 +2804,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
if (pfe && pfe->HasCharacter(aCh)) {
|
||||
font = GetFontAt(i, aCh);
|
||||
if (font) {
|
||||
*aMatchType =
|
||||
FontMatchType::kFontGroup | FontMatchType(mFonts[i].Generic());
|
||||
*aMatchType = {FontMatchType::Kind::kFontGroup, mFonts[i].Generic()};
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
@ -2813,8 +2813,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
// build the font via GetFontAt
|
||||
font = GetFontAt(i, aCh);
|
||||
if (font) {
|
||||
*aMatchType =
|
||||
FontMatchType::kFontGroup | FontMatchType(mFonts[i].Generic());
|
||||
*aMatchType = {FontMatchType::Kind::kFontGroup, mFonts[i].Generic()};
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
@ -2828,7 +2827,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
"should only do fallback once per font family");
|
||||
font = FindFallbackFaceForChar(ff.Family(), aCh);
|
||||
if (font) {
|
||||
*aMatchType = FontMatchType::kFontGroup | FontMatchType(ff.Generic());
|
||||
*aMatchType = {FontMatchType::Kind::kFontGroup, ff.Generic()};
|
||||
return font;
|
||||
}
|
||||
} else {
|
||||
|
@ -2839,7 +2838,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
if (!fe->mIsUserFontContainer && !fe->IsUserFont()) {
|
||||
font = FindFallbackFaceForChar(ff.Family(), aCh);
|
||||
if (font) {
|
||||
*aMatchType = FontMatchType::kFontGroup | FontMatchType(ff.Generic());
|
||||
*aMatchType = {FontMatchType::Kind::kFontGroup, ff.Generic()};
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
@ -2849,7 +2848,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
if (fontListLength == 0) {
|
||||
gfxFont* defaultFont = GetDefaultFont();
|
||||
if (defaultFont->HasCharacter(aCh)) {
|
||||
*aMatchType = FontMatchType::kFontGroup;
|
||||
*aMatchType = FontMatchType::Kind::kFontGroup;
|
||||
return defaultFont;
|
||||
}
|
||||
}
|
||||
|
@ -2862,7 +2861,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
// 2. search pref fonts
|
||||
gfxFont* font = WhichPrefFontSupportsChar(aCh, aNextCh);
|
||||
if (font) {
|
||||
*aMatchType = FontMatchType::kPrefsFallback;
|
||||
*aMatchType = FontMatchType::Kind::kPrefsFallback;
|
||||
return font;
|
||||
}
|
||||
|
||||
|
@ -2870,7 +2869,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
// -- before searching for something else check the font used for the
|
||||
// previous character
|
||||
if (aPrevMatchedFont && aPrevMatchedFont->HasCharacter(aCh)) {
|
||||
*aMatchType = FontMatchType::kSystemFallback;
|
||||
*aMatchType = FontMatchType::Kind::kSystemFallback;
|
||||
return aPrevMatchedFont;
|
||||
}
|
||||
|
||||
|
@ -2882,7 +2881,7 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
|
|||
}
|
||||
|
||||
// -- otherwise look for other stuff
|
||||
*aMatchType = FontMatchType::kSystemFallback;
|
||||
*aMatchType = FontMatchType::Kind::kSystemFallback;
|
||||
return WhichSystemFontSupportsChar(aCh, aNextCh, aRunScript);
|
||||
}
|
||||
|
||||
|
@ -2906,12 +2905,12 @@ void gfxFontGroup::ComputeRanges(nsTArray<TextRange>& aRanges, const T* aString,
|
|||
// initialize prevFont to the group's primary font, so that this will be
|
||||
// used for string-initial control chars, etc rather than risk hitting font
|
||||
// fallback for these (bug 716229)
|
||||
FontFamilyType generic = eFamily_none;
|
||||
StyleGenericFontFamily generic = StyleGenericFontFamily::None;
|
||||
gfxFont* prevFont = GetFirstValidFont(' ', &generic);
|
||||
|
||||
// if we use the initial value of prevFont, we treat this as a match from
|
||||
// the font group; fixes bug 978313
|
||||
FontMatchType matchType = FontMatchType::kFontGroup | FontMatchType(generic);
|
||||
FontMatchType matchType = {FontMatchType::Kind::kFontGroup, generic};
|
||||
|
||||
for (uint32_t i = 0; i < aLength; i++) {
|
||||
const uint32_t origI = i; // save off in case we increase for surrogate
|
||||
|
@ -2958,8 +2957,7 @@ void gfxFontGroup::ComputeRanges(nsTArray<TextRange>& aRanges, const T* aString,
|
|||
!gfxFontUtils::IsJoinControl(ch) &&
|
||||
!gfxFontUtils::IsJoinCauser(prevCh) &&
|
||||
!gfxFontUtils::IsVarSelector(ch)))) {
|
||||
matchType =
|
||||
FontMatchType::kFontGroup | FontMatchType(mFonts[0].Generic());
|
||||
matchType = {FontMatchType::Kind::kFontGroup, mFonts[0].Generic()};
|
||||
} else {
|
||||
font =
|
||||
FindFontForChar(ch, prevCh, nextCh, aRunScript, prevFont, &matchType);
|
||||
|
@ -2967,9 +2965,9 @@ void gfxFontGroup::ComputeRanges(nsTArray<TextRange>& aRanges, const T* aString,
|
|||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
if (MOZ_UNLIKELY(mTextPerf)) {
|
||||
if (matchType & FontMatchType::kPrefsFallback) {
|
||||
if (matchType.kind == FontMatchType::Kind::kPrefsFallback) {
|
||||
mTextPerf->current.fallbackPrefs++;
|
||||
} else if (matchType & FontMatchType::kSystemFallback) {
|
||||
} else if (matchType.kind == FontMatchType::Kind::kSystemFallback) {
|
||||
mTextPerf->current.fallbackSystem++;
|
||||
}
|
||||
}
|
||||
|
@ -3051,16 +3049,16 @@ void gfxFontGroup::ComputeRanges(nsTArray<TextRange>& aRanges, const T* aString,
|
|||
for (size_t i = 0, i_end = aRanges.Length(); i < i_end; i++) {
|
||||
const TextRange& r = aRanges[i];
|
||||
nsAutoCString matchTypes;
|
||||
if (r.matchType & FontMatchType::kFontGroup) {
|
||||
if (r.matchType.kind & FontMatchType::Kind::kFontGroup) {
|
||||
matchTypes.AppendLiteral("list");
|
||||
}
|
||||
if (r.matchType & FontMatchType::kPrefsFallback) {
|
||||
if (r.matchType.kind & FontMatchType::Kind::kPrefsFallback) {
|
||||
if (!matchTypes.IsEmpty()) {
|
||||
matchTypes.AppendLiteral(",");
|
||||
}
|
||||
matchTypes.AppendLiteral("prefs");
|
||||
}
|
||||
if (r.matchType & FontMatchType::kPrefsFallback) {
|
||||
if (r.matchType.kind & FontMatchType::Kind::kPrefsFallback) {
|
||||
if (!matchTypes.IsEmpty()) {
|
||||
matchTypes.AppendLiteral(",");
|
||||
}
|
||||
|
@ -3075,9 +3073,10 @@ void gfxFontGroup::ComputeRanges(nsTArray<TextRange>& aRanges, const T* aString,
|
|||
("(%s-fontmatching) fontgroup: [%s] default: %s lang: %s script: %d"
|
||||
"%s\n",
|
||||
(mStyle.systemFont ? "textrunui" : "textrun"), families.get(),
|
||||
(mFamilyList.GetDefaultFontType() == eFamily_serif
|
||||
(mFamilyList.GetDefaultFontType() == StyleGenericFontFamily::Serif
|
||||
? "serif"
|
||||
: (mFamilyList.GetDefaultFontType() == eFamily_sans_serif
|
||||
: (mFamilyList.GetDefaultFontType() ==
|
||||
StyleGenericFontFamily::SansSerif
|
||||
? "sans-serif"
|
||||
: "none")),
|
||||
lang.get(), static_cast<int>(aRunScript), fontMatches.get()));
|
||||
|
@ -3175,8 +3174,7 @@ gfxFont* gfxFontGroup::WhichPrefFontSupportsChar(uint32_t aCh,
|
|||
|
||||
for (i = 0; i < numLangs; i++) {
|
||||
eFontPrefLang currentLang = prefLangs[i];
|
||||
mozilla::FontFamilyType defaultGeneric =
|
||||
pfl->GetDefaultGeneric(currentLang);
|
||||
StyleGenericFontFamily defaultGeneric = pfl->GetDefaultGeneric(currentLang);
|
||||
gfxPlatformFontList::PrefFontList* families =
|
||||
pfl->GetPrefFontsLangGroup(defaultGeneric, currentLang);
|
||||
NS_ASSERTION(families, "no pref font families found");
|
||||
|
|
|
@ -851,8 +851,8 @@ class gfxFontGroup final : public gfxTextRunFactory {
|
|||
// Initiates userfont loads if userfont not loaded.
|
||||
// aGeneric: if non-null, returns the CSS generic type that was mapped to
|
||||
// this font
|
||||
gfxFont* GetFirstValidFont(uint32_t aCh = 0x20,
|
||||
mozilla::FontFamilyType* aGeneric = nullptr);
|
||||
gfxFont* GetFirstValidFont(
|
||||
uint32_t aCh = 0x20, mozilla::StyleGenericFontFamily* aGeneric = nullptr);
|
||||
|
||||
// Returns the first font in the font-group that has an OpenType MATH table,
|
||||
// or null if no such font is available. The GetMathConstant methods may be
|
||||
|
@ -1024,14 +1024,14 @@ class gfxFontGroup final : public gfxTextRunFactory {
|
|||
FamilyFace()
|
||||
: mFamily(nullptr),
|
||||
mFontEntry(nullptr),
|
||||
mGeneric(mozilla::eFamily_none),
|
||||
mGeneric(mozilla::StyleGenericFontFamily::None),
|
||||
mFontCreated(false),
|
||||
mLoading(false),
|
||||
mInvalid(false),
|
||||
mCheckForFallbackFaces(false) {}
|
||||
|
||||
FamilyFace(gfxFontFamily* aFamily, gfxFont* aFont,
|
||||
mozilla::FontFamilyType aGeneric)
|
||||
mozilla::StyleGenericFontFamily aGeneric)
|
||||
: mFamily(aFamily),
|
||||
mGeneric(aGeneric),
|
||||
mFontCreated(true),
|
||||
|
@ -1046,7 +1046,7 @@ class gfxFontGroup final : public gfxTextRunFactory {
|
|||
}
|
||||
|
||||
FamilyFace(gfxFontFamily* aFamily, gfxFontEntry* aFontEntry,
|
||||
mozilla::FontFamilyType aGeneric)
|
||||
mozilla::StyleGenericFontFamily aGeneric)
|
||||
: mFamily(aFamily),
|
||||
mGeneric(aGeneric),
|
||||
mFontCreated(false),
|
||||
|
@ -1115,7 +1115,7 @@ class gfxFontGroup final : public gfxTextRunFactory {
|
|||
return mFontCreated ? mFont->GetFontEntry() : mFontEntry;
|
||||
}
|
||||
|
||||
mozilla::FontFamilyType Generic() const { return mGeneric; }
|
||||
mozilla::StyleGenericFontFamily Generic() const { return mGeneric; }
|
||||
|
||||
bool IsUserFontContainer() const {
|
||||
return FontEntry()->mIsUserFontContainer;
|
||||
|
@ -1152,7 +1152,7 @@ class gfxFontGroup final : public gfxTextRunFactory {
|
|||
gfxFont* MOZ_OWNING_REF mFont;
|
||||
gfxFontEntry* MOZ_OWNING_REF mFontEntry;
|
||||
};
|
||||
mozilla::FontFamilyType mGeneric;
|
||||
mozilla::StyleGenericFontFamily mGeneric;
|
||||
bool mFontCreated : 1;
|
||||
bool mLoading : 1;
|
||||
bool mInvalid : 1;
|
||||
|
@ -1261,7 +1261,7 @@ class gfxFontGroup final : public gfxTextRunFactory {
|
|||
|
||||
// do style selection and add entries to list
|
||||
void AddFamilyToFontList(gfxFontFamily* aFamily,
|
||||
mozilla::FontFamilyType aGeneric);
|
||||
mozilla::StyleGenericFontFamily aGeneric);
|
||||
};
|
||||
|
||||
// A "missing font recorder" is to be used during text-run creation to keep
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
||||
typedef struct _cairo_surface cairo_surface_t;
|
||||
typedef struct _cairo_user_data_key cairo_user_data_key_t;
|
||||
|
@ -87,19 +88,42 @@ enum class gfxAlphaType {
|
|||
* Type used to record how a particular font is selected during the font-
|
||||
* matching process, so that this can be exposed to the Inspector.
|
||||
*/
|
||||
enum class FontMatchType : uint16_t {
|
||||
// The CSS generic that mapped to this font, if any. This field of
|
||||
// the MatchType stores a FontFamilyType value as defined in the enum
|
||||
// in gfxFontFamilyList.h.
|
||||
kGenericMask = 0x00ff,
|
||||
struct FontMatchType {
|
||||
enum class Kind : uint8_t {
|
||||
kFontGroup = 1,
|
||||
kPrefsFallback = 1 << 1,
|
||||
kSystemFallback = 1 << 2,
|
||||
};
|
||||
|
||||
// Flags for recording the kind of font-matching that was used.
|
||||
// Note that multiple flags may be set on a single range.
|
||||
kFontGroup = 0x0100,
|
||||
kPrefsFallback = 0x0200,
|
||||
kSystemFallback = 0x0400
|
||||
inline FontMatchType& operator|=(const FontMatchType& aOther);
|
||||
|
||||
bool operator==(const FontMatchType& aOther) const {
|
||||
return kind == aOther.kind && generic == aOther.generic;
|
||||
}
|
||||
|
||||
bool operator!=(const FontMatchType& aOther) const {
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
MOZ_IMPLICIT FontMatchType() = default;
|
||||
MOZ_IMPLICIT FontMatchType(Kind aKind) : kind(aKind) {}
|
||||
FontMatchType(Kind aKind, mozilla::StyleGenericFontFamily aGeneric)
|
||||
: kind(aKind), generic(aGeneric) {}
|
||||
|
||||
Kind kind = static_cast<Kind>(0);
|
||||
mozilla::StyleGenericFontFamily generic =
|
||||
mozilla::StyleGenericFontFamily::None;
|
||||
};
|
||||
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(FontMatchType)
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(FontMatchType::Kind)
|
||||
|
||||
FontMatchType& FontMatchType::operator|=(const FontMatchType& aOther) {
|
||||
kind |= aOther.kind;
|
||||
// We only keep track of one generic.
|
||||
if (generic != aOther.generic) {
|
||||
generic = mozilla::StyleGenericFontFamily::None;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif /* GFX_TYPES_H */
|
||||
|
|
|
@ -40,7 +40,12 @@ UniquePtr<RenderCompositor> RenderCompositor::Create(
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
// RenderCompositorOGL is not used on android
|
||||
return nullptr;
|
||||
#else
|
||||
return RenderCompositorOGL::Create(std::move(aWidget));
|
||||
#endif
|
||||
}
|
||||
|
||||
RenderCompositor::RenderCompositor(RefPtr<widget::CompositorWidget>&& aWidget)
|
||||
|
|
|
@ -47,27 +47,9 @@ void RenderCompositorOGL::EndFrame() { mGL->SwapBuffers(); }
|
|||
|
||||
void RenderCompositorOGL::WaitForGPU() {}
|
||||
|
||||
void RenderCompositorOGL::Pause() {
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (!mGL || mGL->IsDestroyed()) {
|
||||
return;
|
||||
}
|
||||
// ReleaseSurface internally calls MakeCurrent.
|
||||
mGL->ReleaseSurface();
|
||||
#endif
|
||||
}
|
||||
void RenderCompositorOGL::Pause() {}
|
||||
|
||||
bool RenderCompositorOGL::Resume() {
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (!mGL || mGL->IsDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
// RenewSurface internally calls MakeCurrent.
|
||||
return mGL->RenewSurface(mWidget);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
bool RenderCompositorOGL::Resume() { return true; }
|
||||
|
||||
LayoutDeviceIntSize RenderCompositorOGL::GetBufferSize() {
|
||||
return mWidget->GetClientSize();
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "RenderEGLImageTextureHost.h"
|
||||
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLLibraryEGL.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace wr {
|
||||
|
||||
RenderEGLImageTextureHost::RenderEGLImageTextureHost(EGLImage aImage,
|
||||
EGLSync aSync,
|
||||
gfx::IntSize aSize)
|
||||
: mImage(aImage),
|
||||
mSync(aSync),
|
||||
mSize(aSize),
|
||||
mTextureTarget(LOCAL_GL_TEXTURE_2D),
|
||||
mTextureHandle(0) {
|
||||
MOZ_COUNT_CTOR_INHERITED(RenderEGLImageTextureHost, RenderTextureHostOGL);
|
||||
}
|
||||
|
||||
RenderEGLImageTextureHost::~RenderEGLImageTextureHost() {
|
||||
MOZ_COUNT_DTOR_INHERITED(RenderEGLImageTextureHost, RenderTextureHostOGL);
|
||||
DeleteTextureHandle();
|
||||
}
|
||||
|
||||
GLuint RenderEGLImageTextureHost::GetGLHandle(uint8_t aChannelIndex) const {
|
||||
return mTextureHandle;
|
||||
}
|
||||
|
||||
gfx::IntSize RenderEGLImageTextureHost::GetSize(uint8_t aChannelIndex) const {
|
||||
return mSize;
|
||||
}
|
||||
|
||||
wr::WrExternalImage RenderEGLImageTextureHost::Lock(
|
||||
uint8_t aChannelIndex, gl::GLContext* aGL, wr::ImageRendering aRendering) {
|
||||
MOZ_ASSERT(aChannelIndex == 0);
|
||||
|
||||
if (mGL.get() != aGL) {
|
||||
if (mGL) {
|
||||
// This should not happen. SharedSurface_EGLImage is created only in
|
||||
// parent process.
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected GL context");
|
||||
return InvalidToWrExternalImage();
|
||||
}
|
||||
mGL = aGL;
|
||||
}
|
||||
|
||||
if (!mImage || !mGL || !mGL->MakeCurrent()) {
|
||||
return InvalidToWrExternalImage();
|
||||
}
|
||||
|
||||
EGLint status = LOCAL_EGL_CONDITION_SATISFIED;
|
||||
if (mSync) {
|
||||
auto* egl = gl::GLLibraryEGL::Get();
|
||||
MOZ_ASSERT(egl->IsExtensionSupported(gl::GLLibraryEGL::KHR_fence_sync));
|
||||
status = egl->fClientWaitSync(egl->Display(), mSync, 0, LOCAL_EGL_FOREVER);
|
||||
// We do not need to delete sync here. It is deleted by
|
||||
// SharedSurface_EGLImage.
|
||||
mSync = 0;
|
||||
}
|
||||
|
||||
if (status != LOCAL_EGL_CONDITION_SATISFIED) {
|
||||
MOZ_ASSERT(
|
||||
status != 0,
|
||||
"ClientWaitSync generated an error. Has mSync already been destroyed?");
|
||||
return InvalidToWrExternalImage();
|
||||
}
|
||||
|
||||
if (!mTextureHandle) {
|
||||
mTextureTarget = mGL->GetPreferredEGLImageTextureTarget();
|
||||
MOZ_ASSERT(mTextureTarget == LOCAL_GL_TEXTURE_2D ||
|
||||
mTextureTarget == LOCAL_GL_TEXTURE_EXTERNAL);
|
||||
|
||||
mGL->fGenTextures(1, &mTextureHandle);
|
||||
// Cache rendering filter.
|
||||
mCachedRendering = aRendering;
|
||||
ActivateBindAndTexParameteri(mGL, LOCAL_GL_TEXTURE0, mTextureTarget,
|
||||
mTextureHandle, aRendering);
|
||||
mGL->fEGLImageTargetTexture2D(mTextureTarget, mImage);
|
||||
} else if (IsFilterUpdateNecessary(aRendering)) {
|
||||
// Cache new rendering filter.
|
||||
mCachedRendering = aRendering;
|
||||
ActivateBindAndTexParameteri(mGL, LOCAL_GL_TEXTURE0, mTextureTarget,
|
||||
mTextureHandle, aRendering);
|
||||
}
|
||||
|
||||
return NativeTextureToWrExternalImage(mTextureHandle, 0, 0, mSize.width,
|
||||
mSize.height);
|
||||
}
|
||||
|
||||
void RenderEGLImageTextureHost::Unlock() {}
|
||||
|
||||
void RenderEGLImageTextureHost::DeleteTextureHandle() {
|
||||
if (mTextureHandle) {
|
||||
// XXX recycle gl texture, since SharedSurface_EGLImage and
|
||||
// RenderEGLImageTextureHost is not recycled.
|
||||
mGL->fDeleteTextures(1, &mTextureHandle);
|
||||
mTextureHandle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,46 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef MOZILLA_GFX_RENDEREGLIMAGETEXTUREHOSTOGL_H
|
||||
#define MOZILLA_GFX_RENDEREGLIMAGETEXTUREHOSTOGL_H
|
||||
|
||||
#include "mozilla/layers/TextureHostOGL.h"
|
||||
#include "RenderTextureHostOGL.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace wr {
|
||||
|
||||
// RenderEGLImageTextureHost is created only for SharedSurface_EGLImage that is
|
||||
// created in parent process.
|
||||
class RenderEGLImageTextureHost final : public RenderTextureHostOGL {
|
||||
public:
|
||||
RenderEGLImageTextureHost(EGLImage aImage, EGLSync aSync, gfx::IntSize aSize);
|
||||
|
||||
wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL,
|
||||
wr::ImageRendering aRendering) override;
|
||||
void Unlock() override;
|
||||
|
||||
virtual gfx::IntSize GetSize(uint8_t aChannelIndex) const override;
|
||||
virtual GLuint GetGLHandle(uint8_t aChannelIndex) const override;
|
||||
|
||||
private:
|
||||
virtual ~RenderEGLImageTextureHost();
|
||||
void DeleteTextureHandle();
|
||||
|
||||
const EGLImage mImage;
|
||||
EGLSync mSync;
|
||||
const gfx::IntSize mSize;
|
||||
|
||||
RefPtr<gl::GLContext> mGL;
|
||||
GLenum mTextureTarget;
|
||||
GLuint mTextureHandle;
|
||||
};
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // MOZILLA_GFX_RENDEREGLIMAGETEXTUREHOSTOGL_H
|
|
@ -11,6 +11,7 @@ EXPORTS.mozilla.webrender += [
|
|||
'RenderBufferTextureHost.h',
|
||||
'RenderCompositor.h',
|
||||
'RenderCompositorOGL.h',
|
||||
'RenderEGLImageTextureHost.h',
|
||||
'RendererOGL.h',
|
||||
'RendererScreenshotGrabber.h',
|
||||
'RenderSharedSurfaceTextureHost.h',
|
||||
|
@ -28,6 +29,7 @@ UNIFIED_SOURCES += [
|
|||
'RenderBufferTextureHost.cpp',
|
||||
'RenderCompositor.cpp',
|
||||
'RenderCompositorOGL.cpp',
|
||||
'RenderEGLImageTextureHost.cpp',
|
||||
'RendererOGL.cpp',
|
||||
'RendererScreenshotGrabber.cpp',
|
||||
'RenderSharedSurfaceTextureHost.cpp',
|
||||
|
|
|
@ -114,8 +114,10 @@ function checkIfFinished() {
|
|||
|
||||
if ((gNumFrameUpdates[0] >= kNumFrameUpdatesToExpect) &&
|
||||
(gNumFrameUpdates[1] >= kNumFrameUpdatesToExpect) &&
|
||||
(gNumFrameUpdates[2] >= kNumFrameUpdatesToExpect) &&
|
||||
(gNumSnapShotChanges[0] >= kNumFrameUpdatesToExpect) &&
|
||||
(gNumSnapShotChanges[1] >= kNumFrameUpdatesToExpect)) {
|
||||
(gNumSnapShotChanges[1] >= kNumFrameUpdatesToExpect) &&
|
||||
(gNumSnapShotChanges[2] >= kNumFrameUpdatesToExpect)) {
|
||||
ok(true, "got expected frame updates");
|
||||
gFinished = true;
|
||||
SimpleTest.finish();
|
||||
|
@ -129,7 +131,7 @@ function addCallbacks(anImage, arrayIndex) {
|
|||
observer.discard = function () {
|
||||
gNumDiscards++;
|
||||
ok(true, "got image discard");
|
||||
if (arrayIndex >= 2) {
|
||||
if (arrayIndex >= 3) {
|
||||
// The last two images are finite, so we don't expect any frame updates,
|
||||
// this image is done the test, so remove the observer.
|
||||
if (!gRemovedObserver[arrayIndex]) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче