Merge inbound to mozilla-central r=merge a=merge

This commit is contained in:
Bogdan Tara 2018-01-09 00:05:31 +02:00
Родитель f147df06d4 e7889065a7
Коммит 73b4d6b26a
320 изменённых файлов: 15594 добавлений и 5170 удалений

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

@ -639,14 +639,6 @@ html|input.urlbar-input[textoverflow]:not([focused]) {
-moz-binding: url("chrome://browser/content/search/search.xml#browser-search-autocomplete-result-popup");
}
/* Overlay a badge on top of the icon of additional open search providers
in the search panel. */
.addengine-item > .button-box > .button-icon,
.addengine-item[type="menu"] > .button-box > .box-inherit > .button-icon {
-moz-binding: url("chrome://browser/content/search/search.xml#addengine-icon");
display: -moz-stack;
}
#PopupAutoCompleteRichResult {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-rich-result-popup");
}

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

@ -71,16 +71,15 @@ async function test() {
Services.prefs.clearUserPref("privacy.firstparty.isolate");
});
let url = "https://example.com/browser/browser/base/content/test/pageinfo/image.html";
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedBrowser.loadURI("https://example.com/browser/browser/base/content/test/pageinfo/image.html");
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
let spec = gBrowser.selectedBrowser.currentURI.spec;
gBrowser.selectedBrowser.loadURI(url);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, url);
// Pass a dummy imageElement, if there isn't an imageElement, pageInfo.js
// will do a preview, however this sometimes will cause intermittent failures,
// see bug 1403365.
let pageInfo = BrowserPageInfo(spec, "mediaTab", {});
let pageInfo = BrowserPageInfo(url, "mediaTab", {});
info("waitForEvent pageInfo");
await waitForEvent(pageInfo, "load");

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

@ -1153,14 +1153,6 @@
</binding>
<!-- Used for additional open search providers in the search panel. -->
<binding id="addengine-icon" extends="xul:box">
<content>
<xul:image class="addengine-icon" xbl:inherits="src"/>
<xul:image class="addengine-badge"/>
</content>
</binding>
<binding id="search-one-offs">
<content context="_child">
<xul:deck anonid="search-panel-one-offs-header"
@ -1699,9 +1691,9 @@
if (tooManyEngines) {
// Make the top-level menu button.
let button = document.createElementNS(kXULNS, "button");
let button = document.createElementNS(kXULNS, "toolbarbutton");
list.appendChild(button);
button.classList.add("addengine-item");
button.classList.add("addengine-item", "badged-button");
button.setAttribute("anonid", "addengine-menu-button");
button.setAttribute("type", "menu");
button.setAttribute("label",
@ -1743,10 +1735,13 @@
// menupopup created earlier. In the latter case, create menuitem
// elements instead of buttons, because buttons don't get keyboard
// handling for free inside menupopups.
let eltType = tooManyEngines ? "menuitem" : "button";
let eltType = tooManyEngines ? "menuitem" : "toolbarbutton";
for (let engine of engines) {
let button = document.createElementNS(kXULNS, eltType);
button.classList.add("addengine-item");
if (!tooManyEngines) {
button.classList.add("badged-button");
}
button.id = this.telemetryOrigin + "-add-engine-" +
this._fixUpEngineNameForID(engine.title);
let label = this.bundle.formatStringFromName("cmd_addFoundEngine",

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

@ -158,10 +158,6 @@ menuitem[cmd="cmd_clearhistory"][disabled] {
padding: 0 10px;
}
.addengine-item > .button-box {
-moz-box-pack: start;
}
.addengine-item:first-of-type {
border-top: 1px solid var(--panel-separator-color);
}
@ -176,20 +172,25 @@ menuitem[cmd="cmd_clearhistory"][disabled] {
background-color: var(--arrowpanel-dimmed-further);
}
.addengine-icon {
width: 16px;
}
.addengine-badge {
.addengine-item > .toolbarbutton-badge-stack > .toolbarbutton-icon {
width: 16px;
height: 16px;
margin: -7px -9px 7px 9px;
list-style-image: url("chrome://browser/skin/badge-add-engine.png");
}
.addengine-item > .button-box > .button-text,
.addengine-item[type=menu] > .button-box > .box-inherit > .button-text {
-moz-box-flex: 1;
.addengine-item > .toolbarbutton-badge-stack > .toolbarbutton-badge {
display: -moz-box;
background: url(chrome://browser/skin/search-indicator-badge-add.svg) no-repeat center;
box-shadow: none;
/* "!important" is necessary to override the rule in toolbarbutton.css */
margin: -4px 0 0 !important;
margin-inline-end: -4px !important;
width: 11px;
height: 11px;
min-width: 11px;
min-height: 11px;
}
.addengine-item > .toolbarbutton-text {
text-align: start;
padding-inline-start: 10px;
}
@ -199,16 +200,12 @@ menuitem[cmd="cmd_clearhistory"][disabled] {
}
@media (min-resolution: 1.1dppx) {
.addengine-badge {
list-style-image: url("chrome://browser/skin/badge-add-engine@2x.png");
}
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder@2x.png");
}
}
.addengine-item[type=menu] > .button-box > .button-menu-dropmarker {
.addengine-item[type=menu] > .toolbarbutton-menu-dropmarker {
display: -moz-box;
-moz-appearance: menuarrow !important;
list-style-image: none;

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

@ -151,10 +151,6 @@
padding: 0 10px;
}
.addengine-item > .button-box {
-moz-box-pack: start;
}
.addengine-item:first-of-type {
border-top: 1px solid var(--panel-separator-color);
}
@ -169,20 +165,25 @@
background-color: var(--arrowpanel-dimmed-further);
}
.addengine-icon {
width: 16px;
}
.addengine-badge {
.addengine-item > .toolbarbutton-badge-stack > .toolbarbutton-icon {
width: 16px;
height: 16px;
margin: -7px -9px 7px 9px;
list-style-image: url("chrome://browser/skin/badge-add-engine.png");
}
.addengine-item > .button-box > .button-text,
.addengine-item[type=menu] > .button-box > .box-inherit > .button-text {
-moz-box-flex: 1;
.addengine-item > .toolbarbutton-badge-stack > .toolbarbutton-badge {
display: -moz-box;
background: url(chrome://browser/skin/search-indicator-badge-add.svg) no-repeat center;
box-shadow: none;
/* "!important" is necessary to override the rule in toolbarbutton.css */
margin: -4px 0 0 !important;
margin-inline-end: -4px !important;
width: 11px;
height: 11px;
min-width: 11px;
min-height: 11px;
}
.addengine-item > .toolbarbutton-text {
text-align: start;
padding-inline-start: 10px;
}
@ -192,16 +193,12 @@
}
@media (min-resolution: 2dppx) {
.addengine-badge {
list-style-image: url("chrome://browser/skin/badge-add-engine@2x.png");
}
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder@2x.png");
}
}
.addengine-item[type=menu] > .button-box > .button-menu-dropmarker {
.addengine-item[type=menu] > .toolbarbutton-menu-dropmarker {
display: -moz-box;
-moz-appearance: menuarrow !important;
list-style-image: none;

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

@ -176,8 +176,6 @@
skin/classic/browser/zoom-out.svg (../shared/icons/zoom-out.svg)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/badge-add-engine@2x.png (../shared/search/badge-add-engine@2x.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/search-engine-placeholder@2x.png (../shared/search/search-engine-placeholder@2x.png)
skin/classic/browser/search-indicator-badge-add.svg (../shared/search/search-indicator-badge-add.svg)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 425 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 888 B

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

@ -152,10 +152,6 @@
padding: 0 10px;
}
.addengine-item > .button-box {
-moz-box-pack: start;
}
.addengine-item:first-of-type {
border-top: 1px solid var(--panel-separator-color);
}
@ -170,20 +166,25 @@
background-color: var(--arrowpanel-dimmed-further);
}
.addengine-icon {
width: 16px;
}
.addengine-badge {
.addengine-item > .toolbarbutton-badge-stack > .toolbarbutton-icon {
width: 16px;
height: 16px;
margin: -7px -9px 7px 9px;
list-style-image: url("chrome://browser/skin/badge-add-engine.png");
}
.addengine-item > .button-box > .button-text,
.addengine-item[type=menu] > .button-box > .box-inherit > .button-text {
-moz-box-flex: 1;
.addengine-item > .toolbarbutton-badge-stack > .toolbarbutton-badge {
display: -moz-box;
background: url(chrome://browser/skin/search-indicator-badge-add.svg) no-repeat center;
box-shadow: none;
/* "!important" is necessary to override the rule in toolbarbutton.css */
margin: -4px 0 0 !important;
margin-inline-end: -4px !important;
width: 11px;
height: 11px;
min-width: 11px;
min-height: 11px;
}
.addengine-item > .toolbarbutton-text {
text-align: start;
padding-inline-start: 10px;
}
@ -193,16 +194,12 @@
}
@media (min-resolution: 1.1dppx) {
.addengine-badge {
list-style-image: url("chrome://browser/skin/badge-add-engine@2x.png");
}
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder@2x.png");
}
}
.addengine-item[type=menu] > .button-box > .button-menu-dropmarker {
.addengine-item[type=menu] > .toolbarbutton-menu-dropmarker {
display: -moz-box;
-moz-appearance: menuarrow !important;
list-style-image: none;

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

@ -1,7 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Taken from upstream commit: 0bcf3e687305960077e1255510e424d0437a3b69
Version 5.0
Comparison - https://github.com/devtools-html/debugger.html/compare/release-4...release-5
Commit: https://github.com/devtools-html/debugger.html/commit/5ecfc84198524399ae75748bd1a28d2df2b45733
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.0

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

@ -3167,6 +3167,7 @@ html .breakpoints-list .breakpoint.paused {
line-height: 1em;
position: relative;
transition: all 0.25s ease;
cursor: pointer;
}
/* 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
@ -3602,20 +3603,16 @@ img.ignore-exceptions {
display: inline-block;
}
.welcomebox .toggle-button-end {
position: absolute;
top: auto;
bottom: 0;
offset-inline-end: 0;
offset-inline-start: auto;
}
.welcomebox .small-size-layout {
.welcomebox .normal-layout {
display: none;
}
.welcomebox .normal-layout {
display: inline-block;
.welcomebox .command-bar-button {
position: absolute;
top: auto;
offset-inline-end: 0;
offset-inline-start: auto;
bottom: 0;
}
.shortcutKeys {

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -4,10 +4,13 @@
"use strict";
const { Task } = require("devtools/shared/task");
var { LocalizationHelper } = require("devtools/shared/l10n");
const { LocalizationHelper } = require("devtools/shared/l10n");
const { gDevTools } = require("devtools/client/framework/devtools");
const { TargetFactory } = require("devtools/client/framework/target");
const { Toolbox } = require("devtools/client/framework/toolbox");
const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
var L10N = new LocalizationHelper(DBG_STRINGS_URI);
const L10N = new LocalizationHelper(DBG_STRINGS_URI);
function DebuggerPanel(iframeWindow, toolbox) {
this.panelWin = iframeWindow;
@ -33,7 +36,8 @@ DebuggerPanel.prototype = {
sourceMaps: this.toolbox.sourceMapService,
toolboxActions: {
// Open a link in a new browser tab.
openLink: this.openLink.bind(this)
openLink: this.openLink.bind(this),
openWorkerToolbox: this.openWorkerToolbox.bind(this)
}
});
@ -77,6 +81,20 @@ DebuggerPanel.prototype = {
top.openUILinkIn(url, "tab");
},
openWorkerToolbox: function(worker) {
this.toolbox.target.client.attachWorker(
worker.actor,
(response, workerClient) => {
const workerTarget = TargetFactory.forWorker(workerClient);
gDevTools
.showToolbox(workerTarget, "jsdebugger", Toolbox.HostType.WINDOW)
.then(toolbox => {
toolbox.once("destroy", () => workerClient.detach());
});
}
);
},
getFrames: function() {
let frames = this._selectors.getFrames(this._getState());

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

@ -35691,8 +35691,18 @@ function getMemberExpression(root) {
}
function getVariables(dec) {
if (dec.id.type === "ArrayPattern") {
return dec.id.elements.map(element => {
if (!dec.id) {
return [];
}
if (t.isArrayPattern(dec.id)) {
if (!dec.id.elements) {
return [];
}
// NOTE: it's possible that an element is empty
// e.g. const [, a] = arr
return dec.id.elements.filter(element => element).map(element => {
return {
name: element.name || element.argument.name,
location: element.loc
@ -36004,139 +36014,142 @@ function getSpecifiers(specifiers) {
return specifiers.map(specifier => specifier.local && specifier.local.name);
}
function extractSymbol(path, symbols) {
if ((0, _helpers.isVariable)(path)) {
symbols.variables.push(...getVariableNames(path));
}
if ((0, _helpers.isFunction)(path)) {
symbols.functions.push({
name: (0, _getFunctionName2.default)(path),
klass: (0, _inferClassName.inferClassName)(path),
location: path.node.loc,
parameterNames: getFunctionParameterNames(path),
identifier: path.node.id
});
}
if (t.isJSXElement(path)) {
symbols.hasJsx = true;
}
if (t.isClassDeclaration(path)) {
symbols.classes.push({
name: path.node.id.name,
parent: path.node.superClass,
location: path.node.loc
});
}
if (t.isImportDeclaration(path)) {
symbols.imports.push({
source: path.node.source.value,
location: path.node.loc,
specifiers: getSpecifiers(path.node.specifiers)
});
}
if (t.isObjectProperty(path)) {
const { start, end, identifierName } = path.node.key.loc;
symbols.objectProperties.push({
name: identifierName,
location: { start, end },
expression: getSnippet(path)
});
}
if (t.isMemberExpression(path)) {
const { start, end } = path.node.property.loc;
symbols.memberExpressions.push({
name: path.node.property.name,
location: { start, end },
expressionLocation: path.node.loc,
expression: getSnippet(path),
computed: path.node.computed
});
}
if (t.isCallExpression(path)) {
const callee = path.node.callee;
const args = path.node.arguments;
if (!t.isMemberExpression(callee)) {
const { start, end, identifierName } = callee.loc;
symbols.callExpressions.push({
name: identifierName,
values: args.filter(arg => arg.value).map(arg => arg.value),
location: { start, end }
});
}
}
if (t.isIdentifier(path)) {
let { start, end } = path.node.loc;
if (path.node.typeAnnotation) {
const column = path.node.typeAnnotation.loc.start.column;
end = _extends({}, end, { column });
}
symbols.identifiers.push({
name: path.node.name,
expression: path.node.name,
location: { start, end }
});
}
if (t.isThisExpression(path.node)) {
const { start, end } = path.node.loc;
symbols.identifiers.push({
name: "this",
location: { start, end },
expressionLocation: path.node.loc,
expression: "this"
});
}
if (t.isVariableDeclarator(path)) {
const node = path.node.id;
const { start, end } = path.node.loc;
if (t.isArrayPattern(node)) {
return;
}
symbols.identifiers.push({
name: node.name,
expression: node.name,
location: { start, end }
});
}
}
function extractSymbols(source) {
const functions = [];
const variables = [];
const memberExpressions = [];
const callExpressions = [];
const objectProperties = [];
const identifiers = [];
const classes = [];
const imports = [];
let hasJsx = false;
const symbols = {
functions: [],
variables: [],
callExpressions: [],
memberExpressions: [],
objectProperties: [],
comments: [],
identifiers: [],
classes: [],
imports: [],
hasJsx: false
};
const ast = (0, _ast.traverseAst)(source, {
enter(path) {
if ((0, _helpers.isVariable)(path)) {
variables.push(...getVariableNames(path));
}
if ((0, _helpers.isFunction)(path)) {
functions.push({
name: (0, _getFunctionName2.default)(path),
klass: (0, _inferClassName.inferClassName)(path),
location: path.node.loc,
parameterNames: getFunctionParameterNames(path),
identifier: path.node.id
});
}
if (t.isJSXElement(path)) {
hasJsx = true;
}
if (t.isClassDeclaration(path)) {
classes.push({
name: path.node.id.name,
parent: path.node.superClass,
location: path.node.loc
});
}
if (t.isImportDeclaration(path)) {
imports.push({
source: path.node.source.value,
location: path.node.loc,
specifiers: getSpecifiers(path.node.specifiers)
});
}
if (t.isObjectProperty(path)) {
const { start, end, identifierName } = path.node.key.loc;
objectProperties.push({
name: identifierName,
location: { start, end },
expression: getSnippet(path)
});
}
if (t.isMemberExpression(path)) {
const { start, end } = path.node.property.loc;
memberExpressions.push({
name: path.node.property.name,
location: { start, end },
expressionLocation: path.node.loc,
expression: getSnippet(path),
computed: path.node.computed
});
}
if (t.isCallExpression(path)) {
const callee = path.node.callee;
const args = path.node.arguments;
if (!t.isMemberExpression(callee)) {
const { start, end, identifierName } = callee.loc;
callExpressions.push({
name: identifierName,
values: args.filter(arg => arg.value).map(arg => arg.value),
location: { start, end }
});
}
}
if (t.isIdentifier(path)) {
let { start, end } = path.node.loc;
if (path.node.typeAnnotation) {
const column = path.node.typeAnnotation.loc.start.column;
end = _extends({}, end, { column });
}
identifiers.push({
name: path.node.name,
expression: path.node.name,
location: { start, end }
});
}
if (t.isThisExpression(path.node)) {
const { start, end } = path.node.loc;
identifiers.push({
name: "this",
location: { start, end },
expressionLocation: path.node.loc,
expression: "this"
});
}
if (t.isVariableDeclarator(path)) {
const node = path.node.id;
const { start, end } = path.node.loc;
identifiers.push({
name: node.name,
expression: node.name,
location: { start, end }
});
try {
extractSymbol(path, symbols);
} catch (e) {
console.error(e);
}
}
});
// comments are extracted separately from the AST
const comments = getComments(ast);
symbols.comments = getComments(ast);
return {
functions,
variables,
callExpressions,
memberExpressions,
objectProperties,
comments,
identifiers,
classes,
imports,
hasJsx
};
return symbols;
}
function getSymbols(source) {
@ -36148,6 +36161,7 @@ function getSymbols(source) {
}
const symbols = extractSymbols(source);
symbolDeclarations.set(source.id, symbols);
return symbols;
}

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

@ -120,6 +120,7 @@ skip-if = true # regular failures during release in Bug 1415300
[browser_dbg-sourcemaps-bogus.js]
[browser_dbg-sources.js]
[browser_dbg-tabs.js]
[browser_dbg-tabs-pretty-print.js]
[browser_dbg-toggling-tools.js]
skip-if = true # Bug 1414124
[browser_dbg-wasm-sourcemaps.js]

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

@ -20,14 +20,11 @@ function toggleButton(dbg) {
add_task(async function() {
const dbg = await initDebugger("doc-script-switching.html");
toggleCallStack(dbg);
const notPaused = findElement(dbg, "callStackBody").innerText;
is(notPaused, "Not paused", "Not paused message is shown");
const found = findElement(dbg, "callStackBody");
is(found, null, "Call stack is hidden");
invokeInTab("firstCall");
await waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "secondCall"), "the first frame is selected");
let button = toggleButton(dbg);
@ -37,11 +34,8 @@ add_task(async function() {
add_task(async function() {
const dbg = await initDebugger("doc-frames.html");
toggleCallStack(dbg);
invokeInTab("startRecursion");
await waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "recurseA"), "the first frame is selected");
// check to make sure that the toggle button isn't there

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

@ -12,7 +12,7 @@ function countSources(dbg) {
*/
add_task(async function() {
const dbg = await initDebugger("doc-script-switching.html");
const { selectors: { getSelectedSource, getPause }, getState } = dbg;
const { selectors: { getSelectedSource, isPaused }, getState } = dbg;
invokeInTab("firstCall");
await waitForPaused(dbg);
@ -22,6 +22,7 @@ add_task(async function() {
invokeInTab("main");
await waitForPaused(dbg);
await waitForLoadedSource(dbg, "simple1");
toggleScopes(dbg);
assertPausedLocation(dbg);
is(countSources(dbg), 5, "5 sources are loaded.");
@ -29,7 +30,7 @@ add_task(async function() {
await navigate(dbg, "about:blank");
await waitForDispatch(dbg, "NAVIGATE");
is(countSources(dbg), 0, "0 sources are loaded.");
ok(!getPause(getState()), "No pause state exists");
ok(!isPaused(getState()), "Is not paused");
await navigate(
dbg,

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

@ -14,10 +14,8 @@ add_task(async function() {
assertPausedLocation(dbg);
clickElement(dbg, "prettyPrintButton");
await waitForDispatch(dbg, "SELECT_SOURCE");
// this doesnt work yet
// assertPausedLocation(dbg);
await waitForSelectedSource(dbg, "math.min.js:formatted");
assertPausedLocation(dbg);
await resume(dbg);
});

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

@ -9,7 +9,7 @@ add_task(async function() {
await selectSource(dbg, "math.min.js", 2);
clickElement(dbg, "prettyPrintButton");
await waitForSource(dbg, "math.min.js:formatted");
await waitForSelectedSource(dbg, "math.min.js:formatted");
const ppSrc = findSource(dbg, "math.min.js:formatted");
ok(ppSrc, "Pretty-printed source exists");

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

@ -6,10 +6,6 @@ function getValue(dbg, index) {
return findElement(dbg, "scopeValue", index).innerText;
}
function toggleScopes(dbg) {
return findElement(dbg, "scopesHeader").click();
}
async function testReturnValue(dbg, val) {
invokeInTab("return_something", val);
await waitForPaused(dbg);
@ -61,7 +57,6 @@ async function testThrowValue(dbg, val) {
add_task(async function() {
const dbg = await initDebugger("doc-return-values.html");
toggleScopes(dbg);
await togglePauseOnExceptions(dbg, true, false);
await testReturnValue(dbg, "to sender");

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

@ -15,10 +15,6 @@ function expandNode(dbg, index) {
return onLoadProperties;
}
function toggleScopes(dbg) {
return findElement(dbg, "scopesHeader").click();
}
function onLoadObjectProperties(dbg) {
return waitForDispatch(dbg, "LOAD_OBJECT_PROPERTIES");
}
@ -26,8 +22,6 @@ function onLoadObjectProperties(dbg) {
add_task(async function() {
const dbg = await initDebugger("doc-script-mutate.html");
toggleScopes(dbg);
let onPaused = waitForPaused(dbg);
invokeInTab("mutate");
await onPaused;

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

@ -12,8 +12,6 @@ function getLabel(dbg, index) {
add_task(async function() {
const dbg = await initDebugger("doc-script-switching.html");
toggleScopes(dbg);
invokeInTab("firstCall");
await waitForPaused(dbg);
await waitForLoadedSource(dbg, "switching-02");

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

@ -29,8 +29,6 @@ add_task(async function() {
const dbg = await initDebugger("doc-sourcemaps3.html");
const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
toggleScopes(dbg);
await waitForSources(dbg, "bundle.js", "sorted.js", "test.js");
ok(true, "Original sources exist");

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

@ -0,0 +1,18 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests re-opening pretty printed tabs on load
add_task(async function() {
const dbg = await initDebugger("doc-minified.html");
await selectSource(dbg, "math.min.js");
clickElement(dbg, "prettyPrintButton");
await waitForSource(dbg, "math.min.js:formatted");
// Test reloading the debugger
await waitForSelectedSource(dbg, "math.min.js:formatted");
await reload(dbg);
await waitForSelectedSource(dbg, "math.min.js:formatted");
ok(true, "Pretty printed source is selected on reload");
});

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

@ -8,7 +8,7 @@ function countTabs(dbg) {
}
add_task(async function() {
let dbg = await initDebugger("doc-scripts.html");
const dbg = await initDebugger("doc-scripts.html");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2");
@ -26,7 +26,7 @@ add_task(async function() {
});
add_task(async function() {
let dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2");

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

@ -280,13 +280,13 @@ function assertNotPaused(dbg) {
* @static
*/
function assertPausedLocation(dbg) {
const { selectors: { getSelectedSource, getPause }, getState } = dbg;
const { selectors: { getSelectedSource, getTopFrame }, getState } = dbg;
ok(isTopFrameSelected(dbg, getState()), "top frame's source is selected");
// Check the pause location
const pause = getPause(getState());
const pauseLine = pause && pause.frame && pause.frame.location.line;
const frame = getTopFrame(getState());
const pauseLine = frame && frame.location.line;
assertDebugLine(dbg, pauseLine);
ok(isVisibleInEditor(dbg, getCM(dbg).display.gutters), "gutter is visible");
@ -344,7 +344,7 @@ function assertDebugLine(dbg, line) {
* @static
*/
function assertHighlightLocation(dbg, source, line) {
const { selectors: { getSelectedSource, getPause }, getState } = dbg;
const { selectors: { getSelectedSource }, getState } = dbg;
source = findSource(dbg, source);
// Check the selected source
@ -381,8 +381,8 @@ function assertHighlightLocation(dbg, source, line) {
* @static
*/
function isPaused(dbg) {
const { selectors: { getPause }, getState } = dbg;
return !!getPause(getState());
const { selectors: { isPaused }, getState } = dbg;
return !!isPaused(getState());
}
async function waitForLoadedObjects(dbg) {
@ -452,16 +452,11 @@ async function waitForMappedScopes(dbg) {
}
function isTopFrameSelected(dbg, state) {
const pause = dbg.selectors.getPause(state);
// Make sure we have the paused state.
if (!pause) {
return false;
}
const frame = dbg.selectors.getTopFrame(state);
// Make sure the source text is completely loaded for the
// source we are paused in.
const sourceId = pause.frame && pause.frame.location.sourceId;
const sourceId = frame.location.sourceId;
const source = dbg.selectors.getSelectedSource(state);
if (!source) {
@ -503,6 +498,8 @@ function clearDebuggerPreferences() {
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location");
Services.prefs.clearUserPref("devtools.debugger.pending-breakpoints");
Services.prefs.clearUserPref("devtools.debugger.expressions");
Services.prefs.clearUserPref("devtools.debugger.call-stack-visible");
Services.prefs.clearUserPref("devtools.debugger.scopes-visible");
}
/**

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

@ -677,14 +677,17 @@ functionSearchSeparatorLabel=←
# text displayed when the user searches for specific lines in a file
gotoLineModal.placeholder=Go to line…
gotoLineModal.key=CmdOrCtrl+Shift+;
gotoLineModal.title=Go to a line number in a file
# LOCALIZATION NOTE(symbolSearch.search.functionsPlaceholder): The placeholder
# text displayed when the user searches for functions in a file
symbolSearch.search.functionsPlaceholder=Search functions…
symbolSearch.search.functionsPlaceholder.title=Search for a function in a file
# LOCALIZATION NOTE(symbolSearch.search.variablesPlaceholder): The placeholder
# text displayed when the user searches for variables in a file
symbolSearch.search.variablesPlaceholder=Search variables…
symbolSearch.search.variablesPlaceholder.title=Search for a variable in a file
# LOCALIZATION NOTE(symbolSearch.search.key2): The Key Shortcut for
# searching for a function or variable

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

@ -26,7 +26,8 @@ pref("devtools.debugger.ui.variables-sorting-enabled", true);
pref("devtools.debugger.ui.variables-only-enum-visible", false);
pref("devtools.debugger.ui.variables-searchbox-visible", false);
pref("devtools.debugger.ui.framework-grouping-on", true);
pref("devtools.debugger.call-stack-visible", false);
pref("devtools.debugger.call-stack-visible", true);
pref("devtools.debugger.scopes-visible", true);
pref("devtools.debugger.start-panel-collapsed", false);
pref("devtools.debugger.end-panel-collapsed", false);
pref("devtools.debugger.tabs", "[]");
@ -46,4 +47,5 @@ pref("devtools.debugger.features.root", false);
pref("devtools.debugger.features.column-breakpoints", false);
pref("devtools.debugger.features.map-scopes", true);
pref("devtools.debugger.features.breakpoints-dropdown", false);
pref("devtools.debugger.features.remove-command-bar-options", false);
pref("devtools.debugger.features.remove-command-bar-options", false);
pref("devtools.debugger.features.workers", false);

69
dom/base/DOMPrefs.cpp Normal file
Просмотреть файл

@ -0,0 +1,69 @@
/* -*- 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 "DOMPrefs.h"
#include "mozilla/Atomics.h"
#include "mozilla/Preferences.h"
namespace mozilla {
namespace dom {
void
DOMPrefs::Initialize()
{
MOZ_ASSERT(NS_IsMainThread());
// Let's cache all the values on the main-thread.
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
DOMPrefs::DumpEnabled();
#endif
#define DOM_PREF(name, pref) DOMPrefs::name();
#define DOM_WEBIDL_PREF(name)
#include "DOMPrefsInternal.h"
#undef DOM_PREF
#undef DOM_WEBIDL_PREF
}
#define DOM_PREF(name, pref) \
/* static */ bool \
DOMPrefs::name() \
{ \
static bool initialized = false; \
static Atomic<bool> cachedValue; \
if (!initialized) { \
initialized = true; \
Preferences::AddAtomicBoolVarCache(&cachedValue, pref, false); \
} \
return cachedValue; \
}
#define DOM_WEBIDL_PREF(name) \
/* static */ bool \
DOMPrefs::name(JSContext* aCx, JSObject* aObj) \
{ \
return DOMPrefs::name(); \
}
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
DOM_PREF(DumpEnabled, "browser.dom.window.dump.enabled")
#else
/* static */ bool
DOMPrefs::DumpEnabled()
{
return true;
}
#endif
#include "DOMPrefsInternal.h"
#undef DOM_PREF
#undef DOM_WEBIDL_PREF
} // dom namespace
} // mozilla namespace

34
dom/base/DOMPrefs.h Normal file
Просмотреть файл

@ -0,0 +1,34 @@
/* -*- 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_dom_DOMPrefs_h
#define mozilla_dom_DOMPrefs_h
namespace mozilla {
namespace dom {
class DOMPrefs final
{
public:
// This must be called on the main-thread.
static void Initialize();
// Returns true if the browser.dom.window.dump.enabled pref is set.
static bool DumpEnabled();
#define DOM_PREF(name, pref) static bool name();
#define DOM_WEBIDL_PREF(name) static bool name(JSContext* aCx, JSObject* aObj);
#include "DOMPrefsInternal.h"
#undef DOM_PREF
#undef DOM_WEBIDL_PREF
};
} // dom namespace
} // mozilla namespace
#endif // mozilla_dom_DOMPrefs_h

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

@ -0,0 +1,56 @@
/* -*- 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/. */
// This is the list of the preferences that are exposed to workers and
// main-thread in DOM.
// The format is as follows:
//
// DOM_PREF(FooBar, "foo.bar")
//
// * First argument is the name of the getter function. This defines a
// DOMPrefs::FooBar()
// * The second argument is the name of the pref.
//
// DOM_WEBIDL_PREF(FooBar)
//
// * This defines DOMPrefs::FooBar(JSContext* aCx, JSObject* aObj);
// This is allows the use of DOMPrefs in WebIDL files.
DOM_PREF(ImageBitmapExtensionsEnabled, "canvas.imagebitmap_extensions.enabled")
DOM_PREF(DOMCachesEnabled, "dom.caches.enabled")
DOM_PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
DOM_PREF(PerformanceLoggingEnabled, "dom.performance.enable_user_timing_logging")
DOM_PREF(NotificationEnabled, "dom.webnotifications.enabled")
DOM_PREF(NotificationEnabledInServiceWorkers, "dom.webnotifications.serviceworker.enabled")
DOM_PREF(NotificationRIEnabled, "dom.webnotifications.requireinteraction.enabled")
DOM_PREF(ServiceWorkersEnabled, "dom.serviceWorkers.enabled")
DOM_PREF(ServiceWorkersTestingEnabled, "dom.serviceWorkers.testing.enabled")
DOM_PREF(StorageManagerEnabled, "dom.storageManager.enabled")
DOM_PREF(PromiseRejectionEventsEnabled, "dom.promise_rejection_events.enabled")
DOM_PREF(PushEnabled, "dom.push.enabled")
DOM_PREF(StreamsEnabled, "dom.streams.enabled")
DOM_PREF(RequestContextEnabled, "dom.requestcontext.enabled")
DOM_PREF(OffscreenCanvasEnabled, "gfx.offscreencanvas.enabled")
DOM_PREF(WebkitBlinkDirectoryPickerEnabled, "dom.webkitBlink.dirPicker.enabled")
DOM_PREF(NetworkInformationEnabled, "dom.netinfo.enabled")
DOM_PREF(FetchObserverEnabled, "dom.fetchObserver.enabled")
DOM_PREF(ResistFingerprintingEnabled, "privacy.resistFingerprinting")
DOM_PREF(DevToolsEnabled, "devtools.enabled")
DOM_WEBIDL_PREF(ImageBitmapExtensionsEnabled)
DOM_WEBIDL_PREF(DOMCachesEnabled)
DOM_WEBIDL_PREF(NotificationEnabledInServiceWorkers)
DOM_WEBIDL_PREF(NotificationRIEnabled)
DOM_WEBIDL_PREF(ServiceWorkersEnabled)
DOM_WEBIDL_PREF(StorageManagerEnabled)
DOM_WEBIDL_PREF(PromiseRejectionEventsEnabled)
DOM_WEBIDL_PREF(PushEnabled)
DOM_WEBIDL_PREF(StreamsEnabled)
DOM_WEBIDL_PREF(RequestContextEnabled)
DOM_WEBIDL_PREF(OffscreenCanvasEnabled)
DOM_WEBIDL_PREF(WebkitBlinkDirectoryPickerEnabled)
DOM_WEBIDL_PREF(NetworkInformationEnabled)
DOM_WEBIDL_PREF(FetchObserverEnabled)

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

@ -4402,6 +4402,15 @@ Element::SetCustomElementData(CustomElementData* aData)
{
nsExtendedDOMSlots *slots = ExtendedDOMSlots();
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
#if DEBUG
nsAtom* name = NodeInfo()->NameAtom();
nsAtom* type = aData->GetCustomElementType();
if (nsContentUtils::IsCustomElementName(name)) {
MOZ_ASSERT(type == name);
} else {
MOZ_ASSERT(type != name);
}
#endif
slots->mCustomElementData = aData;
}

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

@ -172,6 +172,8 @@ EXPORTS.mozilla.dom += [
'DOMMatrix.h',
'DOMParser.h',
'DOMPoint.h',
'DOMPrefs.h',
'DOMPrefsInternal.h',
'DOMQuad.h',
'DOMRect.h',
'DOMRequest.h',
@ -250,6 +252,7 @@ UNIFIED_SOURCES += [
'DOMMatrix.cpp',
'DOMParser.cpp',
'DOMPoint.cpp',
'DOMPrefs.cpp',
'DOMQuad.cpp',
'DOMRect.cpp',
'DOMRequest.cpp',

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

@ -292,11 +292,9 @@ bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
bool nsContentUtils::sIsResourceTimingEnabled = false;
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
bool nsContentUtils::sIsWebComponentsEnabled = false;
bool nsContentUtils::sIsCustomElementsEnabled = false;
bool nsContentUtils::sDevToolsEnabled = false;
bool nsContentUtils::sSendPerformanceTimingNotifications = false;
bool nsContentUtils::sUseActivityCursor = false;
bool nsContentUtils::sAnimationsAPICoreEnabled = false;
@ -334,10 +332,6 @@ nsIParser* nsContentUtils::sXMLFragmentParser = nullptr;
nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nullptr;
bool nsContentUtils::sFragmentParsingActive = false;
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
bool nsContentUtils::sDOMWindowDumpEnabled;
#endif
bool nsContentUtils::sDoNotTrackEnabled = false;
mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
@ -653,9 +647,6 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
"dom.enable_performance_navigation_timing", true);
Preferences::AddBoolVarCache(&sIsUserTimingLoggingEnabled,
"dom.performance.enable_user_timing_logging", false);
Preferences::AddBoolVarCache(&sIsFrameTimingPrefEnabled,
"dom.enable_frame_timing", false);
@ -668,9 +659,6 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
"dom.webcomponents.customelements.enabled", false);
Preferences::AddBoolVarCache(&sDevToolsEnabled,
"devtools.enabled");
Preferences::AddIntVarCache(&sPrivacyMaxInnerWidth,
"privacy.window.maxInnerWidth",
1000);
@ -694,11 +682,6 @@ nsContentUtils::Init()
"network.cookie.cookieBehavior",
nsICookieService::BEHAVIOR_ACCEPT);
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
Preferences::AddBoolVarCache(&sDOMWindowDumpEnabled,
"browser.dom.window.dump.enabled");
#endif
Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
"privacy.donottrackheader.enabled", false);
@ -2364,17 +2347,7 @@ nsContentUtils::IsCallerChrome()
bool
nsContentUtils::ShouldResistFingerprinting()
{
if (NS_IsMainThread()) {
return nsRFPService::IsResistFingerprintingEnabled();
}
workers::WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
if (NS_WARN_IF(!workerPrivate)) {
return false;
}
workerPrivate->AssertIsOnWorkerThread();
return workerPrivate->ResistFingerprintingEnabled();
return DOMPrefs::ResistFingerprintingEnabled();
}
bool
@ -7586,19 +7559,6 @@ nsContentUtils::IsAllowedNonCorsContentType(const nsACString& aHeaderValue)
contentType.LowerCaseEqualsLiteral("multipart/form-data");
}
bool
nsContentUtils::DOMWindowDumpEnabled()
{
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
// In optimized builds we check a pref that controls if we should
// enable output from dump() or not, in debug builds it's always
// enabled.
return nsContentUtils::sDOMWindowDumpEnabled;
#else
return true;
#endif
}
bool
nsContentUtils::DoNotTrackEnabled()
{
@ -8911,63 +8871,6 @@ nsContentUtils::GetReferrerPolicyFromHeader(const nsAString& aHeader)
return referrerPolicy;
}
// static
bool
nsContentUtils::PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.promise_rejection_events.enabled", false);
}
using namespace workers;
// Otherwise, check the pref via the WorkerPrivate
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->PromiseRejectionEventsEnabled();
}
// static
bool
nsContentUtils::PushEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.push.enabled", false);
}
using namespace workers;
// Otherwise, check the pref via the WorkerPrivate
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->PushEnabled();
}
// static
bool
nsContentUtils::StreamsEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.streams.enabled", false);
}
using namespace workers;
// Otherwise, check the pref via the WorkerPrivate
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->StreamsEnabled();
}
// static
bool
nsContentUtils::IsNonSubresourceRequest(nsIChannel* aChannel)
@ -10086,9 +9989,6 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a
"Can only create XUL or XHTML elements.");
nsAtom *name = nodeInfo->NameAtom();
RefPtr<nsAtom> tagAtom = nodeInfo->NameAtom();
RefPtr<nsAtom> typeAtom = aIs ? NS_Atomize(*aIs) : tagAtom;
int32_t tag = eHTMLTag_unknown;
bool isCustomElementName = false;
if (nodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) {
@ -10098,7 +9998,14 @@ nsContentUtils::NewXULOrHTMLElement(Element** aResult, mozilla::dom::NodeInfo* a
} else {
isCustomElementName = nsContentUtils::IsCustomElementName(name);
}
RefPtr<nsAtom> tagAtom = nodeInfo->NameAtom();
RefPtr<nsAtom> typeAtom;
bool isCustomElement = isCustomElementName || aIs;
if (isCustomElement) {
typeAtom = isCustomElementName ? tagAtom : NS_Atomize(*aIs);
}
MOZ_ASSERT_IF(aDefinition, isCustomElement);
// https://dom.spec.whatwg.org/#concept-create-element
@ -11112,21 +11019,6 @@ nsContentUtils::ExtractErrorValues(JSContext* aCx,
#undef EXTRACT_EXN_VALUES
/* static */ bool
nsContentUtils::DevToolsEnabled(JSContext* aCx)
{
if (NS_IsMainThread()) {
return sDevToolsEnabled;
}
workers::WorkerPrivate* workerPrivate = workers::GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->DevToolsEnabled();
}
/* static */ bool
nsContentUtils::ContentIsLink(nsIContent* aContent)
{

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

@ -2286,14 +2286,6 @@ public:
return sIsPerformanceTimingEnabled;
}
/*
* Returns true if user timing API should print to console.
*/
static bool IsUserTimingLoggingEnabled()
{
return sIsUserTimingLoggingEnabled;
}
/*
* Returns true if the performance timing APIs are enabled.
*/
@ -2695,11 +2687,6 @@ public:
*/
static mozilla::HTMLEditor* GetHTMLEditor(nsPresContext* aPresContext);
/**
* Returns true if the browser.dom.window.dump.enabled pref is set.
*/
static bool DOMWindowDumpEnabled();
/**
* Returns true if the privacy.donottrackheader.enabled pref is set.
*/
@ -2924,12 +2911,6 @@ public:
*/
static mozilla::net::ReferrerPolicy GetReferrerPolicyFromHeader(const nsAString& aHeader);
static bool PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj);
static bool PushEnabled(JSContext* aCx, JSObject* aObj);
static bool StreamsEnabled(JSContext* aCx, JSObject* aObj);
static bool IsNonSubresourceRequest(nsIChannel* aChannel);
static uint32_t CookiesBehavior()
@ -3418,12 +3399,10 @@ private:
static bool sIsPerformanceTimingEnabled;
static bool sIsResourceTimingEnabled;
static bool sIsPerformanceNavigationTimingEnabled;
static bool sIsUserTimingLoggingEnabled;
static bool sIsFrameTimingPrefEnabled;
static bool sIsFormAutofillAutocompleteEnabled;
static bool sIsWebComponentsEnabled;
static bool sIsCustomElementsEnabled;
static bool sDevToolsEnabled;
static bool sSendPerformanceTimingNotifications;
static bool sUseActivityCursor;
static bool sAnimationsAPICoreEnabled;
@ -3472,9 +3451,6 @@ private:
// bytecode out of the nsCacheInfoChannel.
static nsCString* sJSBytecodeMimeType;
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
static bool sDOMWindowDumpEnabled;
#endif
static bool sDoNotTrackEnabled;
static mozilla::LazyLogModule sDOMDumpLog;

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

@ -14008,3 +14008,16 @@ nsDocument::RecordNavigationTiming(ReadyState aReadyState)
break;
}
}
bool
nsIDocument::ModuleScriptsEnabled()
{
static bool sEnabledForContent = false;
static bool sCachedPref = false;
if (!sCachedPref) {
sCachedPref = true;
Preferences::AddBoolVarCache(&sEnabledForContent, "dom.moduleScripts.enabled", false);
}
return nsContentUtils::IsChromeDoc(this) || sEnabledForContent;
}

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

@ -36,6 +36,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/ScriptPreloader.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/ContentParent.h"
@ -805,7 +806,7 @@ nsFrameMessageManager::ReleaseCachedProcesses()
NS_IMETHODIMP
nsFrameMessageManager::Dump(const nsAString& aStr)
{
if (!nsContentUtils::DOMWindowDumpEnabled()) {
if (!DOMPrefs::DumpEnabled()) {
return NS_OK;
}

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

@ -17,6 +17,7 @@
#include "nsHistory.h"
#include "nsDOMNavigationTiming.h"
#include "nsIDOMStorageManager.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/LocalStorage.h"
#include "mozilla/dom/Storage.h"
#include "mozilla/dom/IdleRequest.h"
@ -3520,7 +3521,7 @@ nsGlobalWindowInner::GetFullScreen()
void
nsGlobalWindowInner::Dump(const nsAString& aStr)
{
if (!nsContentUtils::DOMWindowDumpEnabled()) {
if (!DOMPrefs::DumpEnabled()) {
return;
}
@ -7737,7 +7738,7 @@ nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx,
const Sequence<ChannelPixelLayout>& aLayout,
ErrorResult& aRv)
{
if (!ImageBitmap::ExtensionsEnabled(aCx)) {
if (!DOMPrefs::ImageBitmapExtensionsEnabled()) {
aRv.Throw(NS_ERROR_TYPE_ERR);
return nullptr;
}

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

@ -37,6 +37,7 @@
#include "nsSize.h"
#include "mozilla/FlushType.h"
#include "prclist.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/StorageEvent.h"
#include "mozilla/dom/StorageEventBinding.h"

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

@ -3222,6 +3222,8 @@ public:
return mIsWebComponentsEnabled;
}
bool ModuleScriptsEnabled();
protected:
bool GetUseCounter(mozilla::UseCounter aUseCounter)
{

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

@ -504,7 +504,13 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
cloneElem->GetAttr(kNameSpaceID_None, nsGkAtoms::is, extension);
}
if (data || !extension.IsEmpty()) {
if ((data && data->GetCustomElementType() == tagAtom) ||
!extension.IsEmpty()) {
// The typeAtom can be determined by extension, because we only need to
// consider two cases: 1) Original node is a autonomous custom element
// which has CustomElementData. 2) Original node is a built-in custom
// element or normal element, but it has `is` attribute when it is being
// cloned.
RefPtr<nsAtom> typeAtom = extension.IsEmpty() ? tagAtom : NS_Atomize(extension);
cloneElem->SetCustomElementData(new CustomElementData(typeAtom));
CustomElementDefinition* definition =

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

@ -243,7 +243,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* by setting aForceFormat to true.
* @return boolean true if the element can be output
*/
virtual bool CheckElementStart(Element* aElement,
virtual bool CheckElementStart(mozilla::dom::Element* aElement,
bool & aForceFormat,
nsAString& aStr,
nsresult& aResult);

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

@ -46,8 +46,10 @@ SimpleGlobal_finalize(js::FreeOp *fop, JSObject *obj)
{
SimpleGlobalObject* globalObject =
static_cast<SimpleGlobalObject*>(JS_GetPrivate(obj));
globalObject->ClearWrapper(obj);
NS_RELEASE(globalObject);
if (globalObject) {
globalObject->ClearWrapper(obj);
NS_RELEASE(globalObject);
}
}
static size_t
@ -55,7 +57,9 @@ SimpleGlobal_moved(JSObject *obj, JSObject *old)
{
SimpleGlobalObject* globalObject =
static_cast<SimpleGlobalObject*>(JS_GetPrivate(obj));
globalObject->UpdateWrapper(obj, old);
if (globalObject) {
globalObject->UpdateWrapper(obj, old);
}
return 0;
}

24
dom/cache/Cache.cpp поставляемый
Просмотреть файл

@ -17,6 +17,7 @@
#include "mozilla/dom/cache/CacheChild.h"
#include "mozilla/dom/cache/CacheWorkerHolder.h"
#include "mozilla/dom/cache/ReadStream.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
@ -517,29 +518,6 @@ Cache::Keys(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
return ExecuteOp(args, aRv);
}
// static
bool
Cache::PrefEnabled(JSContext* aCx, JSObject* aObj)
{
using mozilla::dom::workers::WorkerPrivate;
using mozilla::dom::workers::GetWorkerPrivateFromContext;
// If we're on the main thread, then check the pref directly.
if (NS_IsMainThread()) {
bool enabled = false;
Preferences::GetBool("dom.caches.enabled", &enabled);
return enabled;
}
// Otherwise check the pref via the work private helper
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->DOMCachesEnabled();
}
nsISupports*
Cache::GetParentObject() const
{

2
dom/cache/Cache.h поставляемый
Просмотреть файл

@ -68,8 +68,6 @@ public:
const CacheQueryOptions& aParams, ErrorResult& aRv);
// binding methods
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
nsISupports* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto) override;

14
dom/cache/CacheStorage.cpp поставляемый
Просмотреть файл

@ -9,6 +9,7 @@
#include "mozilla/Unused.h"
#include "mozilla/dom/CacheBinding.h"
#include "mozilla/dom/CacheStorageBinding.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/InternalRequest.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/Response.h"
@ -161,7 +162,7 @@ CacheStorage::CreateOnMainThread(Namespace aNamespace, nsIGlobalObject* aGlobal,
bool testingEnabled = aForceTrustedOrigin ||
Preferences::GetBool("dom.caches.testing.enabled", false) ||
Preferences::GetBool("dom.serviceWorkers.testing.enabled", false);
DOMPrefs::ServiceWorkersTestingEnabled();
if (!IsTrusted(principalInfo, testingEnabled)) {
NS_WARNING("CacheStorage not supported on untrusted origins.");
@ -219,8 +220,8 @@ CacheStorage::CreateOnWorker(Namespace aNamespace, nsIGlobalObject* aGlobal,
// origin checks. The ServiceWorker has its own trusted origin checks
// that are better than ours. In addition, we don't have information
// about the window any more, so we can't do our own checks.
bool testingEnabled = aWorkerPrivate->DOMCachesTestingEnabled() ||
aWorkerPrivate->ServiceWorkersTestingEnabled() ||
bool testingEnabled = DOMPrefs::DOMCachesTestingEnabled() ||
DOMPrefs::ServiceWorkersTestingEnabled() ||
aWorkerPrivate->ServiceWorkersTestingInWindow() ||
aWorkerPrivate->IsServiceWorker();
@ -444,13 +445,6 @@ CacheStorage::Keys(ErrorResult& aRv)
return promise.forget();
}
// static
bool
CacheStorage::PrefEnabled(JSContext* aCx, JSObject* aObj)
{
return Cache::PrefEnabled(aCx, aObj);
}
// static
already_AddRefed<CacheStorage>
CacheStorage::Constructor(const GlobalObject& aGlobal,

2
dom/cache/CacheStorage.h поставляемый
Просмотреть файл

@ -73,8 +73,6 @@ public:
nsIPrincipal* aPrincipal, ErrorResult& aRv);
// binding methods
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
nsISupports* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto) override;

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

@ -6,6 +6,7 @@
#include "mozilla/dom/ImageBitmap.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ImageBitmapBinding.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/StructuredCloneTags.h"
@ -1434,18 +1435,6 @@ ImageBitmap::WriteStructuredClone(JSStructuredCloneWriter* aWriter,
return true;
}
/*static*/ bool
ImageBitmap::ExtensionsEnabled(JSContext* aCx, JSObject*)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("canvas.imagebitmap_extensions.enabled");
} else {
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
MOZ_ASSERT(workerPrivate);
return workerPrivate->ImageBitmapExtensionsEnabled();
}
}
// ImageBitmap extensions.
ImageBitmapFormat
ImageBitmap::FindOptimalFormat(const Optional<Sequence<ImageBitmapFormat>>& aPossibleFormats,

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

@ -152,12 +152,6 @@ public:
nsTArray<RefPtr<gfx::DataSourceSurface>>& aClonedSurfaces,
ImageBitmap* aImageBitmap);
// Mozilla Extensions
// aObj is an optional argument that isn't used by ExtensionsEnabled() and
// only exists because the bindings layer insists on passing it to us. All
// other consumers of this function should only call it passing one argument.
static bool ExtensionsEnabled(JSContext* aCx, JSObject* aObj = nullptr);
friend CreateImageBitmapFromBlob;
friend CreateImageBitmapFromBlobTask;
friend CreateImageBitmapFromBlobWorkerTask;

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

@ -6,6 +6,7 @@
#include "OffscreenCanvas.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/OffscreenCanvasBinding.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"
@ -325,18 +326,6 @@ OffscreenCanvas::CreateFromCloneData(nsIGlobalObject* aGlobal, OffscreenCanvasCl
return wc.forget();
}
/* static */ bool
OffscreenCanvas::PrefEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("gfx.offscreencanvas.enabled");
} else {
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
MOZ_ASSERT(workerPrivate);
return workerPrivate->OffscreenCanvasEnabled();
}
}
/* static */ bool
OffscreenCanvas::PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj)
{
@ -344,7 +333,7 @@ OffscreenCanvas::PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj)
return true;
}
return PrefEnabled(aCx, aObj);
return DOMPrefs::OffscreenCanvasEnabled(aCx, aObj);
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(OffscreenCanvas, DOMEventTargetHelper, mCurrentContext)

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

@ -9,6 +9,7 @@
#include "gfxTypes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/RefPtr.h"
#include "CanvasRenderingContextHelper.h"
@ -130,8 +131,6 @@ public:
static already_AddRefed<OffscreenCanvas>
CreateFromCloneData(nsIGlobalObject* aGlobal, OffscreenCanvasCloneData* aData);
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
// Return true on main-thread, and return gfx.offscreencanvas.enabled
// on worker thread.
static bool PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj);

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

@ -1084,7 +1084,7 @@ Console::IsEnabled(JSContext* aCx) const
}
// Make all Console API no-op if DevTools aren't enabled.
return nsContentUtils::DevToolsEnabled(aCx);
return DOMPrefs::DevToolsEnabled();
}
void

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

@ -309,11 +309,11 @@ ContentEventHandler::InitRootContent(Selection* aNormalSelection)
}
// See bug 537041 comment 5, the range could have removed node.
if (NS_WARN_IF(startNode->GetUncomposedDoc() != mPresShell->GetDocument())) {
if (NS_WARN_IF(startNode->GetComposedDoc() != mPresShell->GetDocument())) {
return NS_ERROR_FAILURE;
}
NS_ASSERTION(startNode->GetUncomposedDoc() == endNode->GetUncomposedDoc(),
NS_ASSERTION(startNode->GetComposedDoc() == endNode->GetComposedDoc(),
"firstNormalSelectionRange crosses the document boundary");
mRootContent = startNode->GetSelectionRootContent(mPresShell);

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

@ -26,24 +26,6 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(FetchObserver, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(FetchObserver, DOMEventTargetHelper)
/* static */ bool
FetchObserver::IsEnabled(JSContext* aCx, JSObject* aGlobal)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.fetchObserver.enabled", false);
}
using namespace workers;
// Otherwise, check the pref via the WorkerPrivate
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->FetchObserverEnabled();
}
FetchObserver::FetchObserver(nsIGlobalObject* aGlobal,
AbortSignal* aSignal)
: DOMEventTargetHelper(aGlobal)

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

@ -21,9 +21,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchObserver, DOMEventTargetHelper)
static bool
IsEnabled(JSContext* aCx, JSObject* aGlobal);
FetchObserver(nsIGlobalObject* aGlobal, AbortSignal* aSignal);
JSObject*

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

@ -77,25 +77,6 @@ Request::~Request()
{
}
// static
bool
Request::RequestContextEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.requestcontext.enabled", false);
}
using namespace workers;
// Otherwise, check the pref via the WorkerPrivate
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->RequestContextEnabled();
}
already_AddRefed<InternalRequest>
Request::GetInternalRequest()
{

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

@ -35,9 +35,6 @@ public:
Request(nsIGlobalObject* aOwner, InternalRequest* aRequest,
AbortSignal* aSignal);
static bool
RequestContextEnabled(JSContext* aCx, JSObject* aObj);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{

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

@ -47,24 +47,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Directory)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
/* static */ bool
Directory::WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false);
}
// aCx can be null when this function is called by something else than WebIDL
// binding code.
workers::WorkerPrivate* workerPrivate =
workers::GetCurrentThreadWorkerPrivate();
if (!workerPrivate) {
return false;
}
return workerPrivate->WebkitBlinkDirectoryPickerEnabled();
}
/* static */ already_AddRefed<Directory>
Directory::Constructor(const GlobalObject& aGlobal,
const nsAString& aRealPath,

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

@ -29,9 +29,6 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Directory)
static bool
WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj);
static already_AddRefed<Directory>
Constructor(const GlobalObject& aGlobal,
const nsAString& aRealPath,

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

@ -36,6 +36,7 @@
#include "nsContentUtils.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/File.h"
namespace mozilla {
@ -487,7 +488,7 @@ FSMultipartFormData::AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob)
if (file) {
nsAutoString relativePath;
file->GetRelativePath(relativePath);
if (Directory::WebkitBlinkDirectoryPickerEnabled(nullptr, nullptr) &&
if (DOMPrefs::WebkitBlinkDirectoryPickerEnabled() &&
!relativePath.IsEmpty()) {
filename16 = relativePath;
}
@ -546,7 +547,7 @@ nsresult
FSMultipartFormData::AddNameDirectoryPair(const nsAString& aName,
Directory* aDirectory)
{
if (!Directory::WebkitBlinkDirectoryPickerEnabled(nullptr, nullptr)) {
if (!DOMPrefs::WebkitBlinkDirectoryPickerEnabled()) {
return NS_OK;
}

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

@ -11,6 +11,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/Date.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/HTMLFormSubmission.h"
#include "mozilla/dom/FileSystemUtils.h"
#include "mozilla/dom/GetFilesHelper.h"
@ -685,7 +686,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
new DispatchChangeEventCallback(mInput);
if (IsWebkitDirPickerEnabled() &&
if (DOMPrefs::WebkitBlinkDirectoryPickerEnabled() &&
mInput->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
ErrorResult error;
GetFilesHelper* helper = mInput->GetOrCreateGetFilesHelper(true, error);
@ -2746,7 +2747,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
if (mFileData->mFilesOrDirectories.IsEmpty()) {
if ((IsDirPickerEnabled() && Allowdirs()) ||
(IsWebkitDirPickerEnabled() &&
(DOMPrefs::WebkitBlinkDirectoryPickerEnabled() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"NoDirSelected", value);
@ -2839,7 +2840,7 @@ HTMLInputElement::MozSetDndFilesAndDirectories(const nsTArray<OwningFileOrDirect
RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
new DispatchChangeEventCallback(this);
if (IsWebkitDirPickerEnabled() &&
if (DOMPrefs::WebkitBlinkDirectoryPickerEnabled() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
ErrorResult rv;
GetFilesHelper* helper = GetOrCreateGetFilesHelper(true /* recursionFlag */,
@ -2921,7 +2922,7 @@ HTMLInputElement::GetFiles()
}
if (IsDirPickerEnabled() && Allowdirs() &&
(!IsWebkitDirPickerEnabled() ||
(!DOMPrefs::WebkitBlinkDirectoryPickerEnabled() ||
!HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
return nullptr;
}
@ -4172,7 +4173,7 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
if (target &&
target->FindFirstNonChromeOnlyAccessContent() == this &&
((IsDirPickerEnabled() && Allowdirs()) ||
(IsWebkitDirPickerEnabled() &&
(DOMPrefs::WebkitBlinkDirectoryPickerEnabled() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)))) {
type = FILE_PICKER_DIRECTORY;
}
@ -5633,21 +5634,6 @@ HTMLInputElement::IsDateTimeTypeSupported(uint8_t aDateTimeInputType)
IsInputDateTimeOthersEnabled());
}
/* static */ bool
HTMLInputElement::IsWebkitDirPickerEnabled()
{
static bool sWebkitDirPickerEnabled = false;
static bool sWebkitDirPickerPrefCached = false;
if (!sWebkitDirPickerPrefCached) {
sWebkitDirPickerPrefCached = true;
Preferences::AddBoolVarCache(&sWebkitDirPickerEnabled,
"dom.webkitBlink.dirPicker.enabled",
false);
}
return sWebkitDirPickerEnabled;
}
/* static */ bool
HTMLInputElement::IsWebkitFileSystemEnabled()
{

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

@ -1727,13 +1727,6 @@ private:
static bool
IsDateTimeTypeSupported(uint8_t aDateTimeInputType);
/**
* Checks preference "dom.webkitBlink.dirPicker.enabled" to determine if
* webkitdirectory should be supported.
*/
static bool
IsWebkitDirPickerEnabled();
/**
* Checks preference "dom.webkitBlink.filesystem.enabled" to determine if
* webkitEntries should be supported.

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

@ -190,12 +190,20 @@ HTMLScriptElement::GetScriptCharset(nsAString& charset)
}
void
HTMLScriptElement::FreezeUriAsyncDefer()
HTMLScriptElement::FreezeExecutionAttrs(nsIDocument* aOwnerDoc)
{
if (mFrozen) {
return;
}
MOZ_ASSERT(!mIsModule && !mAsync && !mDefer && !mExternal);
// Determine whether this is a classic script or a module script.
nsAutoString type;
GetScriptType(type);
mIsModule = aOwnerDoc->ModuleScriptsEnabled() &&
!type.IsEmpty() && type.LowerCaseEqualsASCII("module");
// variation of this code in nsSVGScriptElement - check if changes
// need to be transfered when modifying. Note that we don't use GetSrc here
// because it will return the base URL when the attr value is "".
@ -228,14 +236,14 @@ HTMLScriptElement::FreezeUriAsyncDefer()
// At this point mUri will be null for invalid URLs.
mExternal = true;
bool async = Async();
bool defer = Defer();
mDefer = !async && defer;
mAsync = async;
}
bool async = (mExternal || mIsModule) && Async();
bool defer = mExternal && Defer();
mDefer = !async && defer;
mAsync = async;
mFrozen = true;
}

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

@ -36,7 +36,7 @@ public:
virtual bool GetScriptType(nsAString& type) override;
virtual void GetScriptText(nsAString& text) override;
virtual void GetScriptCharset(nsAString& charset) override;
virtual void FreezeUriAsyncDefer() override;
virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) override;
virtual CORSMode GetCORSMode() const override;
// nsIContent

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ImageDocument.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ImageDocumentBinding.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "nsRect.h"
@ -49,7 +50,7 @@
//XXX A hack needed for Firefox's site specific zoom.
static bool IsSiteSpecific()
{
return !mozilla::Preferences::GetBool("privacy.resistFingerprinting", false) &&
return !mozilla::dom::DOMPrefs::ResistFingerprintingEnabled() &&
mozilla::Preferences::GetBool("browser.zoom.siteSpecific", false);
}

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

@ -26,6 +26,7 @@
#include "mozilla/dom/ClientOpenWindowOpActors.h"
#include "mozilla/dom/ContentBridgeChild.h"
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/VideoDecoderManagerChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/DataTransfer.h"
@ -1228,6 +1229,8 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit,
// Set the dynamic scalar definitions for this process.
TelemetryIPC::AddDynamicScalarDefinitions(aXPCOMInit.dynamicScalarDefs());
DOMPrefs::Initialize();
}
mozilla::ipc::IPCResult

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

@ -8,6 +8,7 @@
#include "mozilla/dom/PTabContext.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/DOMPrefs.h"
#include "nsIScriptSecurityManager.h"
#include "nsServiceManagerUtils.h"
@ -246,7 +247,7 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
// It is meant as a temporary solution until service workers can
// provide a TabChild equivalent. Don't allow this on b2g since
// it might be used to escalate privileges.
if (!Preferences::GetBool("dom.serviceWorkers.enabled", false)) {
if (!DOMPrefs::ServiceWorkersEnabled()) {
mInvalidReason = "ServiceWorkers should be enabled.";
return;
}

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

@ -106,18 +106,6 @@ Connection::Update(ConnectionType aType, bool aIsWifi, uint32_t aDHCPGateway,
}
}
/* static */ bool
Connection::IsEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.netinfo.enabled");
}
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
MOZ_ASSERT(workerPrivate);
return workerPrivate->NetworkInformationEnabled();
}
/* static */ Connection*
Connection::CreateForWindow(nsPIDOMWindowInner* aWindow)
{

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

@ -37,8 +37,6 @@ public:
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
static bool IsEnabled(JSContext* aCx, JSObject* aObj);
static Connection*
CreateForWindow(nsPIDOMWindowInner* aWindow);

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

@ -19,6 +19,7 @@
#include "mozilla/dom/AppNotificationServiceOptionsBinding.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/NotificationEvent.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/Promise.h"
@ -893,39 +894,22 @@ NotificationTask::Run()
return NS_OK;
}
bool
Notification::RequireInteractionEnabled(JSContext* aCx, JSObject* aOjb)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.webnotifications.requireinteraction.enabled", false);
}
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->DOMWorkerNotificationRIEnabled();
}
// static
bool
Notification::PrefEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.webnotifications.enabled", false);
if (!NS_IsMainThread()) {
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
if (workerPrivate->IsServiceWorker()) {
return DOMPrefs::NotificationEnabledInServiceWorkers();
}
}
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
if (workerPrivate->IsServiceWorker()) {
return workerPrivate->DOMServiceWorkerNotificationEnabled();
}
return workerPrivate->DOMWorkerNotificationEnabled();
return DOMPrefs::NotificationEnabled();
}
// static
@ -1740,7 +1724,7 @@ Notification::ShowInternal()
bool inPrivateBrowsing = IsInPrivateBrowsing();
bool requireInteraction = mRequireInteraction;
if (!Preferences::GetBool("dom.webnotifications.requireinteraction.enabled", false)) {
if (!DOMPrefs::NotificationRIEnabled()) {
requireInteraction = false;
}

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

@ -152,7 +152,6 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Notification, DOMEventTargetHelper)
NS_DECL_NSIOBSERVER
static bool RequireInteractionEnabled(JSContext* aCx, JSObject* aObj);
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
// Returns if Notification.get() is allowed for the current global.
static bool IsGetEnabled(JSContext* aCx, JSObject* aObj);

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

@ -6,6 +6,7 @@
#include "PerformanceMainThread.h"
#include "PerformanceNavigation.h"
#include "mozilla/dom/DOMPrefs.h"
#include "nsICacheInfoChannel.h"
namespace mozilla {
@ -282,7 +283,7 @@ PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry)
nsAutoCString uri;
uint64_t markCreationEpoch = 0;
if (nsContentUtils::IsUserTimingLoggingEnabled() ||
if (DOMPrefs::PerformanceLoggingEnabled() ||
nsContentUtils::SendPerformanceTimingNotifications()) {
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
@ -296,7 +297,7 @@ PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry)
}
markCreationEpoch = static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC);
if (nsContentUtils::IsUserTimingLoggingEnabled()) {
if (DOMPrefs::PerformanceLoggingEnabled()) {
Performance::LogEntry(aEntry, uri);
}
}

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "PerformanceWorker.h"
#include "mozilla/dom/DOMPrefs.h"
#include "WorkerPrivate.h"
namespace mozilla {
@ -26,7 +27,7 @@ PerformanceWorker::~PerformanceWorker()
void
PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
{
if (mWorkerPrivate->PerformanceLoggingEnabled()) {
if (DOMPrefs::PerformanceLoggingEnabled()) {
nsAutoCString uri;
nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {

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

@ -32,9 +32,9 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/DOMPrefs.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
#include "mozilla/RefPtr.h"
class nsIGlobalObject;

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

@ -10,13 +10,13 @@
#include "jsapi.h"
#include "nsCOMPtr.h"
#include "nsWrapperCache.h"
#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/PushSubscriptionBinding.h"
#include "mozilla/dom/PushSubscriptionOptionsBinding.h"
#include "mozilla/dom/TypedArray.h"

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

@ -8,9 +8,9 @@
#define mozilla_dom_PushSubscriptionOptions_h
#include "nsCycleCollectionParticipant.h"
#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
#include "nsTArray.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/DOMPrefs.h"
class nsIGlobalObject;

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

@ -6,6 +6,7 @@
#include "StorageManager.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/PromiseWorkerProxy.h"
#include "mozilla/dom/quota/QuotaManagerService.h"
#include "mozilla/dom/StorageManagerBinding.h"
@ -865,20 +866,6 @@ StorageManager::Estimate(ErrorResult& aRv)
aRv);
}
// static
bool
StorageManager::PrefEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.storageManager.enabled");
}
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
MOZ_ASSERT(workerPrivate);
return workerPrivate->StorageManagerEnabled();
}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(StorageManager, mOwner)
NS_IMPL_CYCLE_COLLECTING_ADDREF(StorageManager)

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

@ -25,10 +25,6 @@ class StorageManager final
nsCOMPtr<nsIGlobalObject> mOwner;
public:
// Return dom.quota.storageManager.enabled on main/worker thread.
static bool
PrefEnabled(JSContext* aCx, JSObject* aObj);
explicit
StorageManager(nsIGlobalObject* aGlobal);

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

@ -35,7 +35,7 @@ ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
nsIURI* aReferrer,
mozilla::net::ReferrerPolicy aReferrerPolicy,
ScriptLoader* aLoader)
: ScriptLoadRequest(ScriptKind::Module,
: ScriptLoadRequest(ScriptKind::eModule,
aURI,
aElement,
aValidJSVersion,
@ -52,7 +52,7 @@ ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
ModuleLoadRequest* aParent)
: ScriptLoadRequest(ScriptKind::Module,
: ScriptLoadRequest(ScriptKind::eModule,
aURI,
aParent->mElement,
aParent->mValidJSVersion,
@ -68,6 +68,7 @@ ModuleLoadRequest::ModuleLoadRequest(nsIURI* aURI,
mTriggeringPrincipal = aParent->mTriggeringPrincipal;
mIsInline = false;
mScriptMode = aParent->mScriptMode;
}
void
@ -75,7 +76,7 @@ ModuleLoadRequest::Cancel()
{
ScriptLoadRequest::Cancel();
mModuleScript = nullptr;
mProgress = ScriptLoadRequest::Progress::Ready;
mProgress = ScriptLoadRequest::Progress::eReady;
CancelImports();
mReady.RejectIfExists(NS_ERROR_DOM_ABORT_ERR, __func__);
}

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

@ -126,11 +126,11 @@ ScriptElement::MaybeProcessScript()
return false;
}
FreezeUriAsyncDefer();
nsIDocument* ownerDoc = cont->OwnerDoc();
FreezeExecutionAttrs(ownerDoc);
mAlreadyStarted = true;
nsIDocument* ownerDoc = cont->OwnerDoc();
nsCOMPtr<nsIParser> parser = ((nsIScriptElement*) this)->GetCreatorParser();
if (parser) {
nsCOMPtr<nsIContentSink> sink = parser->GetContentSink();

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

@ -274,7 +274,7 @@ ScriptLoadHandler::EnsureKnownDataType(nsIIncrementalStreamLoader* aLoader)
MOZ_ASSERT(mRequest->IsUnknownDataType());
MOZ_ASSERT(mRequest->IsLoading());
if (mRequest->IsLoadingSource()) {
mRequest->mDataType = ScriptLoadRequest::DataType::Source;
mRequest->mDataType = ScriptLoadRequest::DataType::eSource;
TRACE_FOR_TEST(mRequest->mElement, "scriptloader_load_source");
return NS_OK;
}
@ -289,15 +289,15 @@ ScriptLoadHandler::EnsureKnownDataType(nsIIncrementalStreamLoader* aLoader)
nsAutoCString altDataType;
cic->GetAlternativeDataType(altDataType);
if (altDataType.Equals(nsContentUtils::JSBytecodeMimeType())) {
mRequest->mDataType = ScriptLoadRequest::DataType::Bytecode;
mRequest->mDataType = ScriptLoadRequest::DataType::eBytecode;
TRACE_FOR_TEST(mRequest->mElement, "scriptloader_load_bytecode");
} else {
MOZ_ASSERT(altDataType.IsEmpty());
mRequest->mDataType = ScriptLoadRequest::DataType::Source;
mRequest->mDataType = ScriptLoadRequest::DataType::eSource;
TRACE_FOR_TEST(mRequest->mElement, "scriptloader_load_source");
}
} else {
mRequest->mDataType = ScriptLoadRequest::DataType::Source;
mRequest->mDataType = ScriptLoadRequest::DataType::eSource;
TRACE_FOR_TEST(mRequest->mElement, "scriptloader_load_source");
}
MOZ_ASSERT(!mRequest->IsUnknownDataType());

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

@ -49,14 +49,13 @@ ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
: mKind(aKind)
, mElement(aElement)
, mScriptFromHead(false)
, mProgress(Progress::Loading)
, mDataType(DataType::Unknown)
, mProgress(Progress::eLoading)
, mDataType(DataType::eUnknown)
, mScriptMode(ScriptMode::eBlocking)
, mIsInline(true)
, mHasSourceMapURL(false)
, mIsDefer(false)
, mIsAsync(false)
, mPreloadAsAsync(false)
, mPreloadAsDefer(false)
, mInDeferList(false)
, mInAsyncList(false)
, mIsNonAsyncScriptInserted(false)
, mIsXSLT(false)
, mIsCanceled(false)
@ -93,8 +92,8 @@ ScriptLoadRequest::~ScriptLoadRequest()
void
ScriptLoadRequest::SetReady()
{
MOZ_ASSERT(mProgress != Progress::Ready);
mProgress = Progress::Ready;
MOZ_ASSERT(mProgress != Progress::eReady);
mProgress = Progress::eReady;
}
void
@ -141,6 +140,18 @@ ScriptLoadRequest::AsModuleRequest()
return static_cast<ModuleLoadRequest*>(this);
}
void
ScriptLoadRequest::SetScriptMode(bool aDeferAttr, bool aAsyncAttr)
{
if (aAsyncAttr) {
mScriptMode = ScriptMode::eAsync;
} else if (aDeferAttr || IsModuleRequest()) {
mScriptMode = ScriptMode::eDeferred;
} else {
mScriptMode = ScriptMode::eBlocking;
}
}
//////////////////////////////////////////////////////////////
// ScriptLoadRequestList
//////////////////////////////////////////////////////////////

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

@ -25,13 +25,13 @@ class ModuleLoadRequest;
class ScriptLoadRequestList;
enum class ScriptKind {
Classic,
Module
eClassic,
eModule
};
enum class ValidJSVersion : bool {
Invalid,
Valid
eInvalid,
eValid
};
/*
@ -65,7 +65,7 @@ public:
bool IsModuleRequest() const
{
return mKind == ScriptKind::Module;
return mKind == ScriptKind::eModule;
}
ModuleLoadRequest* AsModuleRequest();
@ -111,43 +111,73 @@ public:
}
enum class Progress : uint8_t {
Loading, // Request either source or bytecode
Loading_Source, // Explicitly Request source stream
Compiling,
FetchingImports,
Ready
eLoading, // Request either source or bytecode
eLoading_Source, // Explicitly Request source stream
eCompiling,
eFetchingImports,
eReady
};
bool IsReadyToRun() const {
return mProgress == Progress::Ready;
bool IsReadyToRun() const
{
return mProgress == Progress::eReady;
}
bool IsLoading() const {
return mProgress == Progress::Loading ||
mProgress == Progress::Loading_Source;
bool IsLoading() const
{
return mProgress == Progress::eLoading ||
mProgress == Progress::eLoading_Source;
}
bool IsLoadingSource() const {
return mProgress == Progress::Loading_Source;
bool IsLoadingSource() const
{
return mProgress == Progress::eLoading_Source;
}
bool InCompilingStage() const {
return mProgress == Progress::Compiling ||
bool InCompilingStage() const
{
return mProgress == Progress::eCompiling ||
(IsReadyToRun() && mWasCompiledOMT);
}
// Type of data provided by the nsChannel.
enum class DataType : uint8_t {
Unknown,
Source,
Bytecode
eUnknown,
eSource,
eBytecode
};
bool IsUnknownDataType() const {
return mDataType == DataType::Unknown;
bool IsUnknownDataType() const
{
return mDataType == DataType::eUnknown;
}
bool IsSource() const {
return mDataType == DataType::Source;
bool IsSource() const
{
return mDataType == DataType::eSource;
}
bool IsBytecode() const {
return mDataType == DataType::Bytecode;
bool IsBytecode() const
{
return mDataType == DataType::eBytecode;
}
enum class ScriptMode : uint8_t {
eBlocking,
eDeferred,
eAsync
};
void SetScriptMode(bool aDeferAttr, bool aAsyncAttr);
bool IsBlockingScript() const
{
return mScriptMode == ScriptMode::eBlocking;
}
bool IsDeferredScript() const
{
return mScriptMode == ScriptMode::eDeferred;
}
bool IsAsyncScript() const
{
return mScriptMode == ScriptMode::eAsync;
}
void MaybeCancelOffThreadScript();
@ -161,12 +191,11 @@ public:
bool mScriptFromHead; // Synchronous head script block loading of other non js/css content.
Progress mProgress; // Are we still waiting for a load to complete?
DataType mDataType; // Does this contain Source or Bytecode?
ScriptMode mScriptMode; // Whether this is a blocking, defer or async script.
bool mIsInline; // Is the script inline or loaded?
bool mHasSourceMapURL; // Does the HTTP header have a source map url?
bool mIsDefer; // True if we live in mDeferRequests.
bool mIsAsync; // True if we live in mLoadingAsyncRequests or mLoadedAsyncRequests.
bool mPreloadAsAsync; // True if this is a preload request and the script is async
bool mPreloadAsDefer; // True if this is a preload request and the script is defer
bool mInDeferList; // True if we live in mDeferRequests.
bool mInAsyncList; // True if we live in mLoadingAsyncRequests or mLoadedAsyncRequests.
bool mIsNonAsyncScriptInserted; // True if we live in mNonAsyncExternalScriptInsertedRequests
bool mIsXSLT; // True if we live in mXSLTRequests.
bool mIsCanceled; // True if we have been explicitly canceled.

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

@ -246,7 +246,7 @@ CollectScriptTelemetry(nsIIncrementalStreamLoader* aLoader,
static bool
IsScriptEventHandler(ScriptKind kind, nsIContent* aScriptElement)
{
if (kind != ScriptKind::Classic) {
if (kind != ScriptKind::eClassic) {
return false;
}
@ -327,19 +327,6 @@ ScriptLoader::CheckContentPolicy(nsIDocument* aDocument,
return NS_OK;
}
bool
ScriptLoader::ModuleScriptsEnabled()
{
static bool sEnabledForContent = false;
static bool sCachedPref = false;
if (!sCachedPref) {
sCachedPref = true;
Preferences::AddBoolVarCache(&sEnabledForContent, "dom.moduleScripts.enabled", false);
}
return nsContentUtils::IsChromeDoc(mDocument) || sEnabledForContent;
}
bool
ScriptLoader::ModuleMapContainsURL(nsIURI* aURL) const
{
@ -490,9 +477,6 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
nsresult rv;
{
// Update our current script.
AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
JSContext* cx = aes.cx();
JS::Rooted<JSObject*> module(cx);
@ -687,7 +671,7 @@ ScriptLoader::StartFetchingModuleDependencies(ModuleLoadRequest* aRequest)
auto visitedSet = aRequest->mVisitedSet;
MOZ_ASSERT(visitedSet->Contains(aRequest->mURI));
aRequest->mProgress = ModuleLoadRequest::Progress::FetchingImports;
aRequest->mProgress = ModuleLoadRequest::Progress::eFetchingImports;
nsCOMArray<nsIURI> urls;
nsresult rv = ResolveRequestedModules(aRequest, &urls);
@ -971,7 +955,7 @@ ScriptLoader::RestartLoad(ScriptLoadRequest* aRequest)
// Start a new channel from which we explicitly request to stream the source
// instead of the bytecode.
aRequest->mProgress = ScriptLoadRequest::Progress::Loading_Source;
aRequest->mProgress = ScriptLoadRequest::Progress::eLoading_Source;
nsresult rv = StartLoad(aRequest);
if (NS_FAILED(rv)) {
return rv;
@ -987,7 +971,7 @@ ScriptLoader::StartLoad(ScriptLoadRequest* aRequest)
{
MOZ_ASSERT(aRequest->IsLoading());
NS_ENSURE_TRUE(mDocument, NS_ERROR_NULL_POINTER);
aRequest->mDataType = ScriptLoadRequest::DataType::Unknown;
aRequest->mDataType = ScriptLoadRequest::DataType::eUnknown;
// If this document is sandboxed without 'allow-scripts', abort.
if (mDocument->HasScriptsBlockedBySandbox()) {
@ -1080,7 +1064,7 @@ ScriptLoader::StartLoad(ScriptLoadRequest* aRequest)
aRequest->mCacheInfo = nullptr;
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
if (cic && nsContentUtils::IsBytecodeCacheEnabled() &&
aRequest->mValidJSVersion == ValidJSVersion::Valid) {
aRequest->mValidJSVersion == ValidJSVersion::eValid) {
if (!aRequest->IsLoadingSource()) {
// Inform the HTTP cache that we prefer to have information coming from the
// bytecode cache instead of the sources, if such entry is already registered.
@ -1098,24 +1082,21 @@ ScriptLoader::StartLoad(ScriptLoadRequest* aRequest)
}
}
nsIScriptElement* script = aRequest->mElement;
bool async = script ? script->GetScriptAsync() : aRequest->mPreloadAsAsync;
bool defer = script ? script->GetScriptDeferred() : aRequest->mPreloadAsDefer;
LOG(("ScriptLoadRequest (%p): async=%d defer=%d tracking=%d",
aRequest, async, defer, aRequest->IsTracking()));
LOG(("ScriptLoadRequest (%p): mode=%u tracking=%d",
aRequest, unsigned(aRequest->mScriptMode), aRequest->IsTracking()));
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(channel));
if (cos) {
if (aRequest->mScriptFromHead && !async && !defer) {
if (aRequest->mScriptFromHead && aRequest->IsBlockingScript()) {
// synchronous head scripts block loading of most other non js/css
// content such as images, Leader implicitely disallows tailing
cos->AddClassFlags(nsIClassOfService::Leader);
} else if (defer && (!async || !nsContentUtils::IsTailingEnabled())) {
} else if (aRequest->IsDeferredScript() &&
!nsContentUtils::IsTailingEnabled()) {
// Bug 1395525 and the !nsContentUtils::IsTailingEnabled() bit:
// We want to make sure that turing tailing off by the pref makes
// the browser behave exactly the same way as before landing
// the tailing patch, which has added the "&& !async" part.
// the tailing patch.
// head/body deferred scripts are blocked by leaders but are not
// allowed tailing because they block DOMContentLoaded
@ -1125,7 +1106,7 @@ ScriptLoader::StartLoad(ScriptLoadRequest* aRequest)
// nor prioritized
cos->AddClassFlags(nsIClassOfService::Unblocked);
if (async) {
if (aRequest->IsAsyncScript()) {
// async scripts are allowed tailing, since those and only those
// don't block DOMContentLoaded; this flag doesn't enforce tailing,
// just overweights the Unblocked flag when the channel is found
@ -1194,20 +1175,20 @@ ScriptLoader::PreloadURIComparator::Equals(const PreloadInfo& aPi,
}
/**
* Returns ValidJSVersion::Valid if aVersionStr is a string of the form
* '1.n', n = 0, ..., 8, and ValidJSVersion::Invalid for other strings.
* Returns ValidJSVersion::eValid if aVersionStr is a string of the form '1.n',
* n = 0, ..., 8, and ValidJSVersion::eInvalid for other strings.
*/
static ValidJSVersion
ParseJavascriptVersion(const nsAString& aVersionStr)
{
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' ||
aVersionStr[1] != '.') {
return ValidJSVersion::Invalid;
return ValidJSVersion::eInvalid;
}
if ('0' <= aVersionStr[2] && aVersionStr[2] <= '8') {
return ValidJSVersion::Valid;
return ValidJSVersion::eValid;
}
return ValidJSVersion::Invalid;
return ValidJSVersion::eInvalid;
}
static inline bool
@ -1215,7 +1196,7 @@ ParseTypeAttribute(const nsAString& aType, ValidJSVersion* aVersion)
{
MOZ_ASSERT(!aType.IsEmpty());
MOZ_ASSERT(aVersion);
MOZ_ASSERT(*aVersion == ValidJSVersion::Valid);
MOZ_ASSERT(*aVersion == ValidJSVersion::eValid);
nsContentTypeParser parser(aType);
@ -1242,7 +1223,7 @@ ParseTypeAttribute(const nsAString& aType, ValidJSVersion* aVersion)
}
*aVersion = ParseJavascriptVersion(versionName);
if (*aVersion == ValidJSVersion::Valid) {
if (*aVersion == ValidJSVersion::eValid) {
Telemetry::Accumulate(Telemetry::SCRIPT_LOADED_WITH_VERSION, true);
return true;
}
@ -1289,7 +1270,7 @@ ScriptLoader::CreateLoadRequest(ScriptKind aKind,
{
nsIURI* referrer = mDocument->GetDocumentURI();
if (aKind == ScriptKind::Classic) {
if (aKind == ScriptKind::eClassic) {
ScriptLoadRequest* slr = new ScriptLoadRequest(aKind, aURI, aElement,
aValidJSVersion, aCORSMode, aIntegrity,
referrer, aReferrerPolicy);
@ -1298,7 +1279,7 @@ ScriptLoader::CreateLoadRequest(ScriptKind aKind,
return slr;
}
MOZ_ASSERT(aKind == ScriptKind::Module);
MOZ_ASSERT(aKind == ScriptKind::eModule);
return new ModuleLoadRequest(aURI, aElement, aValidJSVersion, aCORSMode,
aIntegrity, referrer, aReferrerPolicy, this);
}
@ -1318,25 +1299,22 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
nsCOMPtr<nsIContent> scriptContent = do_QueryInterface(aElement);
// Determine whether this is a classic script or a module script.
nsAutoString type;
bool hasType = aElement->GetScriptType(type);
ScriptKind scriptKind = ScriptKind::Classic;
if (ModuleScriptsEnabled() &&
!type.IsEmpty() && type.LowerCaseEqualsASCII("module")) {
scriptKind = ScriptKind::Module;
}
ScriptKind scriptKind =
aElement->GetScriptIsModule() ? ScriptKind::eModule : ScriptKind::eClassic;
// Step 13. Check that the script is not an eventhandler
if (IsScriptEventHandler(scriptKind, scriptContent)) {
return false;
}
ValidJSVersion validJSVersion = ValidJSVersion::Valid;
ValidJSVersion validJSVersion = ValidJSVersion::eValid;
// For classic scripts, check the type attribute to determine language and
// version. If type exists, it trumps the deprecated 'language='
if (scriptKind == ScriptKind::Classic) {
if (scriptKind == ScriptKind::eClassic) {
if (!type.IsEmpty()) {
NS_ENSURE_TRUE(ParseTypeAttribute(type, &validJSVersion), false);
} else if (!hasType) {
@ -1361,8 +1339,8 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
// the nomodule attribute will be ignored".
// "The nomodule attribute must not be specified on module scripts (and will
// be ignored if it is)."
if (ModuleScriptsEnabled() &&
scriptKind == ScriptKind::Classic &&
if (mDocument->ModuleScriptsEnabled() &&
scriptKind == ScriptKind::eClassic &&
scriptContent->IsHTMLElement() &&
scriptContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::nomodule)) {
return false;
@ -1417,8 +1395,15 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
}
}
if (!request) {
// no usable preload
if (request) {
// Use a preload request.
// It's possible these attributes changed since we started the preload so
// update them here.
request->SetScriptMode(aElement->GetScriptDeferred(),
aElement->GetScriptAsync());
} else {
// No usable preload found.
SRIMetadata sriMetadata;
{
@ -1449,6 +1434,8 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
ourRefPolicy);
request->mTriggeringPrincipal = Move(principal);
request->mIsInline = false;
request->SetScriptMode(aElement->GetScriptDeferred(),
aElement->GetScriptAsync());
// keep request->mScriptFromHead to false so we don't treat non preloaded
// scripts as blockers for full page load. See bug 792438.
@ -1471,18 +1458,15 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
request->mValidJSVersion = validJSVersion;
if (aElement->GetScriptAsync()) {
request->mIsAsync = true;
if (request->IsAsyncScript()) {
AddAsyncRequest(request);
if (request->IsReadyToRun()) {
mLoadedAsyncRequests.AppendElement(request);
// The script is available already. Run it ASAP when the event
// loop gets a chance to spin.
// KVKV TODO: Instead of processing immediately, try off-thread-parsing
// it and only schedule a pending ProcessRequest if that fails.
ProcessPendingRequestsAsync();
} else {
mLoadingAsyncRequests.AppendElement(request);
}
return false;
}
@ -1501,7 +1485,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
}
// we now have a parser-inserted request that may or may not be still
// loading
if (aElement->GetScriptDeferred() || request->IsModuleRequest()) {
if (request->IsDeferredScript()) {
// We don't want to run this yet.
// If we come here, the script is a parser-created script and it has
// the defer attribute but not the async attribute. Since a
@ -1571,7 +1555,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
// Inline classic scripts ignore their CORS mode and are always CORS_NONE.
CORSMode corsMode = CORS_NONE;
if (scriptKind == ScriptKind::Module) {
if (scriptKind == ScriptKind::eModule) {
corsMode = aElement->GetCORSMode();
}
@ -1583,22 +1567,27 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
request->mIsInline = true;
request->mTriggeringPrincipal = mDocument->NodePrincipal();
request->mLineNo = aElement->GetScriptLineNumber();
request->mProgress = ScriptLoadRequest::Progress::Loading_Source;
request->mDataType = ScriptLoadRequest::DataType::Source;
request->mProgress = ScriptLoadRequest::Progress::eLoading_Source;
request->mDataType = ScriptLoadRequest::DataType::eSource;
TRACE_FOR_TEST_BOOL(request->mElement, "scriptloader_load_source");
CollectScriptTelemetry(nullptr, request);
// Only the 'async' attribute is heeded on an inline module script and
// inline classic scripts ignore both these attributes.
MOZ_ASSERT(!aElement->GetScriptDeferred());
MOZ_ASSERT_IF(!request->IsModuleRequest(), !aElement->GetScriptAsync());
request->SetScriptMode(false, aElement->GetScriptAsync());
LOG(("ScriptLoadRequest (%p): Created request for inline script",
request.get()));
if (request->IsModuleRequest()) {
ModuleLoadRequest* modReq = request->AsModuleRequest();
modReq->mBaseURL = mDocument->GetDocBaseURI();
modReq->mIsAsync = aElement->GetScriptAsync();
if (aElement->GetParserCreated() != NOT_FROM_PARSER) {
if (modReq->mIsAsync) {
mLoadingAsyncRequests.AppendElement(modReq);
if (aElement->GetScriptAsync()) {
AddAsyncRequest(modReq);
} else {
AddDeferRequest(modReq);
}
@ -1612,7 +1601,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
return false;
}
request->mProgress = ScriptLoadRequest::Progress::Ready;
request->mProgress = ScriptLoadRequest::Progress::eReady;
if (aElement->GetParserCreated() == FROM_PARSER_XSLT &&
(!ReadyToExecuteParserBlockingScripts() || !mXSLTRequests.isEmpty())) {
// Need to maintain order for XSLT-inserted scripts
@ -1692,7 +1681,7 @@ public:
nsresult
ScriptLoader::ProcessOffThreadRequest(ScriptLoadRequest* aRequest)
{
MOZ_ASSERT(aRequest->mProgress == ScriptLoadRequest::Progress::Compiling);
MOZ_ASSERT(aRequest->mProgress == ScriptLoadRequest::Progress::eCompiling);
MOZ_ASSERT(!aRequest->mWasCompiledOMT);
aRequest->mWasCompiledOMT = true;
@ -1837,7 +1826,7 @@ ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest)
// Once the compilation is finished, an event would be added to the event loop
// to call ScriptLoader::ProcessOffThreadRequest with the same request.
aRequest->mProgress = ScriptLoadRequest::Progress::Compiling;
aRequest->mProgress = ScriptLoadRequest::Progress::eCompiling;
Unused << runnable.forget();
return NS_OK;
@ -2203,7 +2192,7 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
return NS_ERROR_FAILURE;
}
if (aRequest->mValidJSVersion == ValidJSVersion::Invalid) {
if (aRequest->mValidJSVersion == ValidJSVersion::eInvalid) {
return NS_OK;
}
@ -2218,15 +2207,15 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
context->SetProcessingScriptTag(true);
nsresult rv;
{
// Update our current script.
AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
if (aRequest->IsModuleRequest()) {
// When a module is already loaded, it is not feched a second time and the
// mDataType of the request might remain set to DataType::Unknown.
MOZ_ASSERT(!aRequest->IsBytecode());
LOG(("ScriptLoadRequest (%p): Evaluate Module", aRequest));
// currentScript is set to null for modules.
AutoCurrentScriptUpdater scriptUpdater(this, nullptr);
rv = EnsureModuleResolveHook(cx);
NS_ENSURE_SUCCESS(rv, rv);
@ -2254,6 +2243,9 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
aRequest->mCacheInfo = nullptr;
} else {
// Update our current script.
AutoCurrentScriptUpdater scriptUpdater(this, aRequest->mElement);
JS::CompileOptions options(cx);
rv = FillCompileOptionsForRequest(aes, aRequest, global, &options);
@ -2952,14 +2944,14 @@ ScriptLoader::HandleLoadError(ScriptLoadRequest *aRequest, nsresult aResult)
SetModuleFetchFinishedAndResumeWaitingRequests(request, aResult);
}
if (aRequest->mIsDefer) {
if (aRequest->mInDeferList) {
MOZ_ASSERT_IF(aRequest->IsModuleRequest(),
aRequest->AsModuleRequest()->IsTopLevel());
if (aRequest->isInList()) {
RefPtr<ScriptLoadRequest> req = mDeferRequests.Steal(aRequest);
FireScriptAvailable(aResult, req);
}
} else if (aRequest->mIsAsync) {
} else if (aRequest->mInAsyncList) {
MOZ_ASSERT_IF(aRequest->IsModuleRequest(),
aRequest->AsModuleRequest()->IsTopLevel());
if (aRequest->isInList()) {
@ -3026,23 +3018,6 @@ ScriptLoader::NumberOfProcessors()
return mNumberOfProcessors;
}
void
ScriptLoader::MaybeMoveToLoadedList(ScriptLoadRequest* aRequest)
{
MOZ_ASSERT(aRequest->IsReadyToRun());
// If it's async, move it to the loaded list. aRequest->mIsAsync really
// _should_ be in a list, but the consequences if it's not are bad enough we
// want to avoid trying to move it if it's not.
if (aRequest->mIsAsync) {
MOZ_ASSERT(aRequest->isInList());
if (aRequest->isInList()) {
RefPtr<ScriptLoadRequest> req = mLoadingAsyncRequests.Steal(aRequest);
mLoadedAsyncRequests.AppendElement(req);
}
}
}
nsresult
ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
nsIIncrementalStreamLoader* aLoader,
@ -3159,7 +3134,7 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
MOZ_ASSERT(!aRequest->IsModuleRequest());
nsresult rv = AttemptAsyncScriptCompile(aRequest);
if (rv == NS_OK) {
MOZ_ASSERT(aRequest->mProgress == ScriptLoadRequest::Progress::Compiling,
MOZ_ASSERT(aRequest->mProgress == ScriptLoadRequest::Progress::eCompiling,
"Request should be off-thread compiling now.");
return NS_OK;
}
@ -3218,7 +3193,7 @@ ScriptLoader::PreloadURI(nsIURI* aURI, const nsAString& aCharset,
}
// TODO: Preload module scripts.
if (ModuleScriptsEnabled() && aType.LowerCaseEqualsASCII("module")) {
if (mDocument->ModuleScriptsEnabled() && aType.LowerCaseEqualsASCII("module")) {
return;
}
@ -3235,14 +3210,13 @@ ScriptLoader::PreloadURI(nsIURI* aURI, const nsAString& aCharset,
}
RefPtr<ScriptLoadRequest> request =
CreateLoadRequest(ScriptKind::Classic, aURI, nullptr, ValidJSVersion::Valid,
CreateLoadRequest(ScriptKind::eClassic, aURI, nullptr, ValidJSVersion::eValid,
Element::StringToCORSMode(aCrossOrigin), sriMetadata,
aReferrerPolicy);
request->mTriggeringPrincipal = mDocument->NodePrincipal();
request->mIsInline = false;
request->mScriptFromHead = aScriptFromHead;
request->mPreloadAsAsync = aAsync;
request->mPreloadAsDefer = aDefer;
request->SetScriptMode(aDefer, aAsync);
nsresult rv = StartLoad(request);
if (NS_FAILED(rv)) {
@ -3257,7 +3231,10 @@ ScriptLoader::PreloadURI(nsIURI* aURI, const nsAString& aCharset,
void
ScriptLoader::AddDeferRequest(ScriptLoadRequest* aRequest)
{
aRequest->mIsDefer = true;
MOZ_ASSERT(aRequest->IsDeferredScript());
MOZ_ASSERT(!aRequest->mInDeferList && !aRequest->mInAsyncList);
aRequest->mInDeferList = true;
mDeferRequests.AppendElement(aRequest);
if (mDeferEnabled && aRequest == mDeferRequests.getFirst() &&
mDocument && !mBlockingDOMContentLoaded) {
@ -3267,6 +3244,37 @@ ScriptLoader::AddDeferRequest(ScriptLoadRequest* aRequest)
}
}
void
ScriptLoader::AddAsyncRequest(ScriptLoadRequest* aRequest)
{
MOZ_ASSERT(aRequest->IsAsyncScript());
MOZ_ASSERT(!aRequest->mInDeferList && !aRequest->mInAsyncList);
aRequest->mInAsyncList = true;
if (aRequest->IsReadyToRun()) {
mLoadedAsyncRequests.AppendElement(aRequest);
} else {
mLoadingAsyncRequests.AppendElement(aRequest);
}
}
void
ScriptLoader::MaybeMoveToLoadedList(ScriptLoadRequest* aRequest)
{
MOZ_ASSERT(aRequest->IsReadyToRun());
// If it's async, move it to the loaded list. aRequest->mInAsyncList really
// _should_ be in a list, but the consequences if it's not are bad enough we
// want to avoid trying to move it if it's not.
if (aRequest->mInAsyncList) {
MOZ_ASSERT(aRequest->isInList());
if (aRequest->isInList()) {
RefPtr<ScriptLoadRequest> req = mLoadingAsyncRequests.Steal(aRequest);
mLoadedAsyncRequests.AppendElement(req);
}
}
}
bool
ScriptLoader::MaybeRemovedDeferRequests()
{

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

@ -470,6 +470,7 @@ private:
nsresult aStatus);
void AddDeferRequest(ScriptLoadRequest* aRequest);
void AddAsyncRequest(ScriptLoadRequest* aRequest);
bool MaybeRemovedDeferRequests();
void MaybeMoveToLoadedList(ScriptLoadRequest* aRequest);
@ -477,8 +478,6 @@ private:
JS::SourceBufferHolder GetScriptSource(ScriptLoadRequest* aRequest,
nsAutoString& inlineData);
bool ModuleScriptsEnabled();
void SetModuleFetchStarted(ModuleLoadRequest *aRequest);
void SetModuleFetchFinishedAndResumeWaitingRequests(ModuleLoadRequest* aRequest,
nsresult aResult);

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

@ -38,6 +38,7 @@ public:
mForceAsync(aFromParser == mozilla::dom::NOT_FROM_PARSER ||
aFromParser == mozilla::dom::FROM_PARSER_FRAGMENT),
mFrozen(false),
mIsModule(false),
mDefer(false),
mAsync(false),
mExternal(false),
@ -80,11 +81,24 @@ public:
virtual void GetScriptCharset(nsAString& charset) = 0;
/**
* Freezes the return values of GetScriptDeferred(), GetScriptAsync() and
* GetScriptURI() so that subsequent modifications to the attributes don't
* change execution behavior.
* Freezes the return values of the following methods so that subsequent
* modifications to the attributes don't change execution behavior:
* - GetScriptIsModule()
* - GetScriptDeferred()
* - GetScriptAsync()
* - GetScriptURI()
* - GetScriptExternal()
*/
virtual void FreezeUriAsyncDefer() = 0;
virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) = 0;
/**
* Is the script a module script. Currently only supported by HTML scripts.
*/
bool GetScriptIsModule()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
return mIsModule;
}
/**
* Is the script deferred. Currently only supported by HTML scripts.
@ -302,6 +316,11 @@ protected:
*/
bool mFrozen;
/**
* The effective moduleness.
*/
bool mIsModule;
/**
* The effective deferredness.
*/

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

@ -139,7 +139,7 @@ SVGScriptElement::GetScriptCharset(nsAString& charset)
}
void
SVGScriptElement::FreezeUriAsyncDefer()
SVGScriptElement::FreezeExecutionAttrs(nsIDocument* aOwnerDoc)
{
if (mFrozen) {
return;

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

@ -44,7 +44,7 @@ public:
virtual bool GetScriptType(nsAString& type) override;
virtual void GetScriptText(nsAString& text) override;
virtual void GetScriptCharset(nsAString& charset) override;
virtual void FreezeUriAsyncDefer() override;
virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) override;
virtual CORSMode GetCORSMode() const override;
// ScriptElement

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

@ -11,7 +11,7 @@
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache
[Exposed=(Window,Worker),
Func="mozilla::dom::cache::Cache::PrefEnabled"]
Func="mozilla::dom::DOMPrefs::DOMCachesEnabled"]
interface Cache {
[NewObject]
Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);

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

@ -14,7 +14,7 @@ interface Principal;
[Exposed=(Window,Worker),
ChromeConstructor(CacheStorageNamespace namespace, Principal principal),
Func="mozilla::dom::cache::CacheStorage::PrefEnabled"]
Func="mozilla::dom::DOMPrefs::DOMCachesEnabled"]
interface CacheStorage {
[NewObject]
Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);

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

@ -16,7 +16,7 @@ enum FetchState {
};
[Exposed=(Window,Worker),
Func="FetchObserver::IsEnabled"]
Func="mozilla::dom::DOMPrefs::FetchObserverEnabled"]
interface FetchObserver : EventTarget {
readonly attribute FetchState state;

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

@ -34,7 +34,7 @@ partial interface File {
[GetterThrows, Deprecated="FileLastModifiedDate"]
readonly attribute Date lastModifiedDate;
[BinaryName="relativePath", Func="mozilla::dom::Directory::WebkitBlinkDirectoryPickerEnabled"]
[BinaryName="relativePath", Func="mozilla::dom::DOMPrefs::WebkitBlinkDirectoryPickerEnabled"]
readonly attribute USVString webkitRelativePath;
[GetterThrows, ChromeOnly, NeedsCallerType]

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

@ -403,10 +403,10 @@ dictionary ChannelPixelLayout {
typedef sequence<ChannelPixelLayout> ImagePixelLayout;
partial interface ImageBitmap {
[Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
[Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"]
ImageBitmapFormat findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
[Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
[Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"]
long mappedDataLength (ImageBitmapFormat aFormat);
[Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
[Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"]
Promise<ImagePixelLayout> mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset);
};

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

@ -89,7 +89,7 @@ interface NavigatorContentUtils {
[SecureContext, NoInterfaceObject, Exposed=(Window,Worker)]
interface NavigatorStorage {
[Func="mozilla::dom::StorageManager::PrefEnabled"]
[Func="mozilla::dom::DOMPrefs::StorageManagerEnabled"]
readonly attribute StorageManager storage;
};

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

@ -18,7 +18,7 @@ enum ConnectionType {
"unknown"
};
[Func="mozilla::dom::network::Connection::IsEnabled",
[Func="mozilla::dom::DOMPrefs::NetworkInformationEnabled",
Exposed=(Window,Worker)]
interface NetworkInformation : EventTarget {
readonly attribute ConnectionType type;

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

@ -51,7 +51,7 @@ interface Notification : EventTarget {
[Pure]
readonly attribute DOMString? icon;
[Constant, Func="mozilla::dom::Notification::RequireInteractionEnabled"]
[Constant, Func="mozilla::dom::DOMPrefs::NotificationRIEnabled"]
readonly attribute boolean requireInteraction;
[Constant]

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

@ -9,7 +9,7 @@
[Constructor(unsigned long width, unsigned long height),
Exposed=(Window,Worker),
Func="mozilla::dom::OffscreenCanvas::PrefEnabled"]
Func="mozilla::dom::DOMPrefs::OffscreenCanvasEnabled"]
interface OffscreenCanvas : EventTarget {
[Pure, SetterThrows]
attribute unsigned long width;

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

@ -6,7 +6,7 @@
[Constructor(DOMString type, PromiseRejectionEventInit eventInitDict),
Exposed=(Window,Worker),
Func="nsContentUtils::PromiseRejectionEventsEnabled"]
Func="mozilla::dom::DOMPrefs::PromiseRejectionEventsEnabled"]
interface PromiseRejectionEvent : Event
{
[BinaryName="rejectedPromise"]

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

@ -8,7 +8,7 @@
*/
[Constructor(DOMString type, optional PushEventInit eventInitDict),
Func="nsContentUtils::PushEnabled",
Func="mozilla::dom::DOMPrefs::PushEnabled",
Exposed=ServiceWorker]
interface PushEvent : ExtendableEvent {
readonly attribute PushMessageData? data;

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

@ -22,7 +22,7 @@ interface PushManagerImpl {
Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options);
};
[Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled",
[Exposed=(Window,Worker), Func="mozilla::dom::DOMPrefs::PushEnabled",
ChromeConstructor(DOMString scope)]
interface PushManager {
[Throws, UseCounter]

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