Merge autoland to mozilla-central. a=merge

This commit is contained in:
Cristian Tuns 2022-05-28 05:12:34 -04:00
Родитель ce7c56bcac 081d695984
Коммит de15f9c109
195 изменённых файлов: 1966 добавлений и 1057 удалений

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

@ -40,7 +40,7 @@ class StyleInfo {
CSSCoord Margin(Side aSide);
dom::Element* mElement;
RefPtr<ComputedStyle> mComputedStyle;
RefPtr<const ComputedStyle> mComputedStyle;
};
} // namespace a11y

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

@ -2286,6 +2286,12 @@ var Policies = {
},
},
UseSystemPrintDialog: {
onBeforeAddons(manager, param) {
setAndLockPref("print.prefer_system_dialog", param);
},
},
WebsiteFilter: {
onBeforeUIStartup(manager, param) {
WebsiteFilter.init(param.Block || [], param.Exceptions || []);

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

@ -1301,6 +1301,10 @@
}
},
"UseSystemPrintDialog": {
"type": "boolean"
},
"WebsiteFilter": {
"type": "object",
"properties": {

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

@ -935,7 +935,6 @@ const POLICIES_TESTS = [
"network.cookie.cookieBehavior.pbmode": 5,
},
},
{
policies: {
Cookies: {
@ -949,6 +948,15 @@ const POLICIES_TESTS = [
"network.cookie.cookieBehavior.pbmode": 0,
},
},
{
policies: {
UseSystemPrintDialog: true,
},
lockedPrefs: {
"print.prefer_system_dialog": true,
},
},
];
add_task(async function test_policy_simple_prefs() {

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

@ -361,6 +361,10 @@ var pktApi = (function() {
setSetting("premium_status", undefined);
setSetting("latestSince", undefined);
setSetting("tags", undefined);
// An old pref that is no longer used,
// but the user data may still exist on some profiles.
// So best to clean it up just in case.
// Can probably remove this line in the future.
setSetting("usedTags", undefined);
setSetting("fsv1", undefined);
@ -615,32 +619,6 @@ var pktApi = (function() {
};
action = extend(action, actionPart);
// Backup the success callback as we need it later
var finalSuccessCallback = options.success;
// Switch the success callback
options.success = function(data) {
// Update used tags
var usedTagsJSON = getSetting("usedTags");
var usedTags = usedTagsJSON ? JSON.parse(usedTagsJSON) : {};
// Check for each tag if it's already in the used tags
for (var i = 0; i < tags.length; i++) {
var tagToSave = tags[i].trim();
var newUsedTagObject = {
tag: tagToSave,
timestamp: new Date().getTime(),
};
usedTags[tagToSave] = newUsedTagObject;
}
setSetting("usedTags", JSON.stringify(usedTags));
// Let the callback know that we are finished
if (finalSuccessCallback) {
finalSuccessCallback(data);
}
};
// Execute the action
return sendAction(action, options);
}
@ -657,40 +635,8 @@ var pktApi = (function() {
return [];
};
var sortedUsedTagsFromSettings = function() {
// Get and Sort used tags
var usedTags = [];
var usedTagsJSON = getSetting("usedTags");
if (typeof usedTagsJSON !== "undefined") {
var usedTagsObject = JSON.parse(usedTagsJSON);
var usedTagsObjectArray = [];
for (var tagKey in usedTagsObject) {
usedTagsObjectArray.push(usedTagsObject[tagKey]);
}
// Sort usedTagsObjectArray based on timestamp
usedTagsObjectArray.sort(function(usedTagA, usedTagB) {
var a = usedTagA.timestamp;
var b = usedTagB.timestamp;
return a - b;
});
// Get all keys tags
for (var j = 0; j < usedTagsObjectArray.length; j++) {
usedTags.push(usedTagsObjectArray[j].tag);
}
// Reverse to set the last recent used tags to the front
usedTags.reverse();
}
return usedTags;
};
return {
tags: tagsFromSettings(),
usedTags: sortedUsedTagsFromSettings(),
};
}

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

@ -237,7 +237,7 @@ test_runner(async function test_AboutPocketParent_receiveMessage_PKT_getTags({
);
Assert.deepEqual(
sendResponseMessageToPanel.firstCall.args,
["PKT_getTags", { tags: [], usedTags: [] }],
["PKT_getTags", { tags: [] }],
"Should fire sendResponseMessageToPanel with proper args from PKT_getTags"
);
});

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

@ -204,6 +204,8 @@ policy-SupportMenu = Add a custom support menu item to the help menu.
policy-UserMessaging = Dont show certain messages to the user.
policy-UseSystemPrintDialog = Print using the system print dialog.
# “format” refers to the format used for the value of this policy.
policy-WebsiteFilter = Block websites from being visited. See documentation for more details on the format.

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

@ -21,7 +21,7 @@ class InlinePreview extends PureComponent {
highlightDomElement: PropTypes.func.isRequired,
openElementInInspector: PropTypes.func.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
value: PropTypes.any.isRequired,
value: PropTypes.any,
variable: PropTypes.string.isRequired,
};
}

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../utils/connect";
import fuzzyAldrin from "fuzzaldrin-plus";
import { basename } from "../utils/path";
@ -60,6 +61,35 @@ export class QuickOpenModal extends Component {
this.state = { results: null, selectedIndex: 0 };
}
static get propTypes() {
return {
closeQuickOpen: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
displayedSources: PropTypes.array.isRequired,
enabled: PropTypes.bool.isRequired,
highlightLineRange: PropTypes.func.isRequired,
query: PropTypes.string.isRequired,
searchType: PropTypes.oneOf([
"functions",
"goto",
"gotoSource",
"other",
"shortcuts",
"sources",
"variables",
]).isRequired,
selectSpecificLocation: PropTypes.func.isRequired,
selectedContentLoaded: PropTypes.bool,
selectedSource: PropTypes.object,
setQuickOpenQuery: PropTypes.func.isRequired,
shortcutsModalEnabled: PropTypes.bool.isRequired,
symbols: PropTypes.object.isRequired,
symbolsLoading: PropTypes.bool.isRequired,
tabs: PropTypes.array.isRequired,
toggleShortcutsModal: PropTypes.func.isRequired,
};
}
setResults(results) {
if (results) {
results = results.slice(0, maxResults);

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import { connect } from "../../../utils/connect";
import { createSelector } from "reselect";
import classnames from "classnames";
@ -28,6 +29,22 @@ import {
} from "../../../selectors";
class Breakpoint extends PureComponent {
static get propTypes() {
return {
breakpoint: PropTypes.object.isRequired,
cx: PropTypes.object.isRequired,
disableBreakpoint: PropTypes.func.isRequired,
editor: PropTypes.object.isRequired,
enableBreakpoint: PropTypes.func.isRequired,
frame: PropTypes.object,
openConditionalPanel: PropTypes.func.isRequired,
removeBreakpoint: PropTypes.func.isRequired,
selectSpecificLocation: PropTypes.func.isRequired,
selectedSource: PropTypes.object,
source: PropTypes.object.isRequired,
};
}
onContextMenu = e => {
showContextMenu({ ...this.props, contextMenuEvent: e });
};

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

@ -28,11 +28,12 @@ import showContextMenu from "./BreakpointHeadingsContextMenu";
class BreakpointHeading extends PureComponent {
static get propTypes() {
return {
cx: PropTypes.object,
sources: PropTypes.array,
hasSiblingOfSameName: PropTypes.bool,
cx: PropTypes.object.isRequired,
sources: PropTypes.array.isRequired,
source: PropTypes.object.isRequired,
hasSiblingOfSameName: PropTypes.bool.isRequired,
selectSource: PropTypes.func.isRequired,
thread: PropTypes.object,
thread: PropTypes.object.isRequired,
};
}
onContextMenu = e => {

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import PropTypes from "prop-types";
export default function ExceptionOption({
className,
@ -21,3 +22,10 @@ export default function ExceptionOption({
</div>
);
}
ExceptionOption.propTypes = {
className: PropTypes.string.isRequired,
isChecked: PropTypes.bool.isRequired,
label: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
};

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { connect } from "../../../utils/connect";
@ -22,6 +23,16 @@ import { getSelectedSource, getBreakpointSources } from "../../../selectors";
import "./Breakpoints.css";
class Breakpoints extends Component {
static get propTypes() {
return {
breakpointSources: PropTypes.array.isRequired,
pauseOnExceptions: PropTypes.func.isRequired,
selectedSource: PropTypes.object,
shouldPauseOnCaughtExceptions: PropTypes.bool.isRequired,
shouldPauseOnExceptions: PropTypes.bool.isRequired,
};
}
componentWillUnmount() {
this.removeEditor();
}

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

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import PropTypes from "prop-types";
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import classnames from "classnames";
@ -77,6 +77,28 @@ function formatKey(action) {
}
class CommandBar extends Component {
static get propTypes() {
return {
breakOnNext: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
horizontal: PropTypes.bool.isRequired,
isPaused: PropTypes.bool.isRequired,
isWaitingOnBreak: PropTypes.bool.isRequired,
javascriptEnabled: PropTypes.bool.isRequired,
resume: PropTypes.func.isRequired,
skipPausing: PropTypes.bool.isRequired,
stepIn: PropTypes.func.isRequired,
stepOut: PropTypes.func.isRequired,
stepOver: PropTypes.func.isRequired,
toggleEditorWrapping: PropTypes.func.isRequired,
toggleInlinePreview: PropTypes.func.isRequired,
toggleJavaScriptEnabled: PropTypes.func.isRequired,
toggleSkipPausing: PropTypes.any.isRequired,
toggleSourceMapsEnabled: PropTypes.func.isRequired,
topFrameSelected: PropTypes.bool.isRequired,
};
}
componentWillUnmount() {
const { shortcuts } = this.context;

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import Reps from "devtools/client/shared/components/reps/index";
const {
@ -30,6 +31,19 @@ const localizationTerms = {
};
class DOMMutationBreakpointsContents extends Component {
static get propTypes() {
return {
breakpoints: PropTypes.array.isRequired,
deleteBreakpoint: PropTypes.func.isRequired,
highlightDomElement: PropTypes.func.isRequired,
openElementInInspector: PropTypes.func.isRequired,
openInspector: PropTypes.func.isRequired,
setSkipPausing: PropTypes.func.isRequired,
toggleBreakpoint: PropTypes.func.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
};
}
handleBreakpoint(breakpointId, shouldEnable) {
const { toggleBreakpoint, setSkipPausing } = this.props;
@ -127,6 +141,16 @@ const DOMMutationBreakpointsPanel = connect(
)(DOMMutationBreakpointsContents);
class DomMutationBreakpoints extends Component {
static get propTypes() {
return {
highlightDomElement: PropTypes.func.isRequired,
openElementInInspector: PropTypes.func.isRequired,
openInspector: PropTypes.func.isRequired,
setSkipPausing: PropTypes.func.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
};
}
render() {
return (
<DOMMutationBreakpointsPanel

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { connect } from "../../utils/connect";
@ -23,6 +24,18 @@ class EventListeners extends Component {
focused: false,
};
static get propTypes() {
return {
activeEventListeners: PropTypes.array.isRequired,
addEventListenerExpanded: PropTypes.func.isRequired,
addEventListeners: PropTypes.func.isRequired,
categories: PropTypes.array.isRequired,
expandedCategories: PropTypes.array.isRequired,
removeEventListenerExpanded: PropTypes.func.isRequired,
removeEventListeners: PropTypes.func.isRequired,
};
}
hasMatch(eventOrCategoryName, searchText) {
const lowercaseEventOrCategoryName = eventOrCategoryName.toLowerCase();
const lowercaseSearchText = searchText.toLowerCase();

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import classnames from "classnames";
import { features } from "../../utils/prefs";
@ -39,6 +40,27 @@ class Expressions extends Component {
};
}
static get propTypes() {
return {
addExpression: PropTypes.func.isRequired,
autocomplete: PropTypes.func.isRequired,
autocompleteMatches: PropTypes.array,
clearAutocomplete: PropTypes.func.isRequired,
clearExpressionError: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
deleteExpression: PropTypes.func.isRequired,
expressionError: PropTypes.bool.isRequired,
expressions: PropTypes.array.isRequired,
highlightDomElement: PropTypes.func.isRequired,
onExpressionAdded: PropTypes.func.isRequired,
openElementInInspector: PropTypes.func.isRequired,
openLink: PropTypes.any.isRequired,
showInput: PropTypes.bool.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
updateExpression: PropTypes.func.isRequired,
};
}
componentDidMount() {
const { showInput } = this.props;

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

@ -18,6 +18,12 @@ function FrameTitle({ frame, options = {}, l10n }) {
return <span className="title">{displayName}</span>;
}
FrameTitle.propTypes = {
frame: PropTypes.object.isRequired,
options: PropTypes.object.isRequired,
l10n: PropTypes.object.isRequired,
};
const FrameLocation = memo(({ frame, displayFullUrl = false }) => {
if (!frame.source) {
return null;
@ -49,6 +55,11 @@ const FrameLocation = memo(({ frame, displayFullUrl = false }) => {
FrameLocation.displayName = "FrameLocation";
FrameLocation.propTypes = {
frame: PropTypes.object.isRequired,
displayFullUrl: PropTypes.bool.isRequired,
};
export default class FrameComponent extends Component {
static defaultProps = {
hideLocation: false,
@ -56,6 +67,26 @@ export default class FrameComponent extends Component {
disableContextMenu: false,
};
static get propTypes() {
return {
copyStackTrace: PropTypes.func.isRequired,
cx: PropTypes.object,
disableContextMenu: PropTypes.bool.isRequired,
displayFullUrl: PropTypes.bool.isRequired,
frame: PropTypes.object.isRequired,
frameworkGroupingOn: PropTypes.bool.isRequired,
getFrameTitle: PropTypes.func,
hideLocation: PropTypes.bool.isRequired,
panel: PropTypes.oneOf(["debugger", "webconsole"]).isRequired,
restart: PropTypes.func,
selectFrame: PropTypes.func.isRequired,
selectedFrame: PropTypes.object,
shouldMapDisplayName: PropTypes.bool.isRequired,
toggleBlackBox: PropTypes.func,
toggleFrameworkGrouping: PropTypes.func.isRequired,
};
}
get isSelectable() {
return this.props.panel == "webconsole";
}

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

@ -33,6 +33,11 @@ function FrameLocation({ frame, expanded }) {
);
}
FrameLocation.propTypes = {
expanded: PropTypes.any.isRequired,
frame: PropTypes.object.isRequired,
};
FrameLocation.displayName = "FrameLocation";
export default class Group extends Component {
@ -41,6 +46,25 @@ export default class Group extends Component {
this.state = { expanded: false };
}
static get propTypes() {
return {
copyStackTrace: PropTypes.func.isRequired,
cx: PropTypes.object,
disableContextMenu: PropTypes.bool.isRequired,
displayFullUrl: PropTypes.bool.isRequired,
frameworkGroupingOn: PropTypes.bool.isRequired,
getFrameTitle: PropTypes.func,
group: PropTypes.array.isRequired,
panel: PropTypes.oneOf(["debugger", "webconsole"]).isRequired,
restart: PropTypes.func,
selectFrame: PropTypes.func.isRequired,
selectLocation: PropTypes.func,
selectedFrame: PropTypes.object,
toggleBlackBox: PropTypes.func,
toggleFrameworkGrouping: PropTypes.func.isRequired,
};
}
get isSelectable() {
return this.props.panel == "webconsole";
}

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

@ -34,6 +34,25 @@ class Frames extends Component {
};
}
static get propTypes() {
return {
cx: PropTypes.object,
disableContextMenu: PropTypes.bool.isRequired,
disableFrameTruncate: PropTypes.bool.isRequired,
displayFullUrl: PropTypes.bool.isRequired,
frames: PropTypes.array.isRequired,
frameworkGroupingOn: PropTypes.bool.isRequired,
getFrameTitle: PropTypes.func,
panel: PropTypes.oneOf(["debugger", "webconsole"]).isRequired,
restart: PropTypes.func,
selectFrame: PropTypes.func.isRequired,
selectLocation: PropTypes.func,
selectedFrame: PropTypes.object,
toggleBlackBox: PropTypes.func,
toggleFrameworkGrouping: PropTypes.func,
};
}
shouldComponentUpdate(nextProps, nextState) {
const { frames, selectedFrame, frameworkGroupingOn } = this.props;
const { showAllFrames } = this.state;

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import { showMenu } from "../../context-menu/menu";
import { connect } from "../../utils/connect";
import actions from "../../actions";
@ -45,6 +46,28 @@ class Scopes extends PureComponent {
};
}
static get propTypes() {
return {
addWatchpoint: PropTypes.func.isRequired,
cx: PropTypes.object.isRequired,
expandedScopes: PropTypes.array.isRequired,
generatedFrameScopes: PropTypes.object,
highlightDomElement: PropTypes.func.isRequired,
isLoading: PropTypes.bool.isRequired,
isPaused: PropTypes.bool.isRequired,
mapScopesEnabled: PropTypes.bool.isRequired,
openElementInInspector: PropTypes.func.isRequired,
openLink: PropTypes.func.isRequired,
originalFrameScopes: PropTypes.object,
removeWatchpoint: PropTypes.func.isRequired,
selectedFrame: PropTypes.object.isRequired,
setExpandedScope: PropTypes.func.isRequired,
toggleMapScopes: PropTypes.func.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
why: PropTypes.object.isRequired,
};
}
componentWillReceiveProps(nextProps) {
const {
selectedFrame,

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import classnames from "classnames";
@ -11,6 +12,16 @@ import { getCurrentThread, getIsPaused, getContext } from "../../selectors";
import AccessibleImage from "../shared/AccessibleImage";
export class Thread extends Component {
static get propTypes() {
return {
currentThread: PropTypes.string.isRequired,
cx: PropTypes.object.isRequired,
isPaused: PropTypes.bool.isRequired,
selectThread: PropTypes.func.isRequired,
thread: PropTypes.object.isRequired,
};
}
onSelectThread = () => {
const { thread } = this.props;
this.props.selectThread(this.props.cx, thread.actor);

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import { getAllThreads } from "../../selectors";
@ -11,6 +12,12 @@ import Thread from "./Thread";
import "./Threads.css";
export class Threads extends Component {
static get propTypes() {
return {
threads: PropTypes.array.isRequired,
};
}
render() {
const { threads } = this.props;

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

@ -34,6 +34,17 @@ class WhyPaused extends PureComponent {
this.state = { hideWhyPaused: "" };
}
static get propTypes() {
return {
delay: PropTypes.number.isRequired,
endPanelCollapsed: PropTypes.bool.isRequired,
highlightDomElement: PropTypes.func.isRequired,
openElementInInspector: PropTypes.func.isRequired,
unHighlightDomElement: PropTypes.func.isRequired,
why: PropTypes.object,
};
}
componentDidUpdate() {
const { delay } = this.props;

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
import classnames from "classnames";
import actions from "../../actions";
@ -44,6 +45,21 @@ class XHRBreakpoints extends Component {
};
}
static get propTypes() {
return {
disableXHRBreakpoint: PropTypes.func.isRequired,
enableXHRBreakpoint: PropTypes.func.isRequired,
onXHRAdded: PropTypes.func.isRequired,
removeXHRBreakpoint: PropTypes.func.isRequired,
setXHRBreakpoint: PropTypes.func.isRequired,
shouldPauseOnAny: PropTypes.bool.isRequired,
showInput: PropTypes.bool.isRequired,
togglePauseOnAny: PropTypes.func.isRequired,
updateXHRBreakpoint: PropTypes.func.isRequired,
xhrBreakpoints: PropTypes.array.isRequired,
};
}
componentDidMount() {
const { showInput } = this.props;

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

@ -5,6 +5,7 @@
const SplitBox = require("devtools/client/shared/components/splitter/SplitBox");
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { isGeneratedId } from "devtools-source-map";
import { connect } from "../../utils/connect";
@ -71,6 +72,29 @@ class SecondaryPanes extends Component {
};
}
static get propTypes() {
return {
cx: PropTypes.object.isRequired,
evaluateExpressions: PropTypes.func.isRequired,
expressions: PropTypes.array.isRequired,
hasFrames: PropTypes.bool.isRequired,
horizontal: PropTypes.bool.isRequired,
logEventBreakpoints: PropTypes.bool.isRequired,
mapScopesEnabled: PropTypes.bool.isRequired,
pauseOnExceptions: PropTypes.func.isRequired,
pauseReason: PropTypes.string.isRequired,
renderWhyPauseDelay: PropTypes.number.isRequired,
selectedFrame: PropTypes.object,
shouldPauseOnCaughtExceptions: PropTypes.bool.isRequired,
shouldPauseOnExceptions: PropTypes.bool.isRequired,
skipPausing: PropTypes.bool.isRequired,
source: PropTypes.object,
toggleEventLogging: PropTypes.func.isRequired,
toggleMapScopes: PropTypes.func.isRequired,
workers: PropTypes.array.isRequired,
};
}
onExpressionAdded = () => {
this.setState({ showExpressionsInput: false });
};

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import Modal from "./shared/Modal";
import classnames from "classnames";
import { formatKeyShortcut } from "../utils/text";
@ -10,6 +11,14 @@ import { formatKeyShortcut } from "../utils/text";
import "./ShortcutsModal.css";
export class ShortcutsModal extends Component {
static get propTypes() {
return {
additionalClass: PropTypes.string.isRequired,
enabled: PropTypes.bool.isRequired,
handleClose: PropTypes.func.isRequired,
};
}
renderPrettyCombos(combo) {
return combo
.split(" ")

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "../utils/connect";
@ -13,6 +14,14 @@ import { formatKeyShortcut } from "../utils/text";
import "./WelcomeBox.css";
export class WelcomeBox extends Component {
static get propTypes() {
return {
openQuickOpen: PropTypes.func.isRequired,
setActiveSearch: PropTypes.func.isRequired,
toggleShortcutsModal: PropTypes.func.isRequired,
};
}
render() {
const searchSourcesShortcut = formatKeyShortcut(
L10N.getStr("sources.search.key2")

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import "./AccessibleImage.css";
@ -15,4 +16,8 @@ const AccessibleImage = props => {
return <span {...props} />;
};
AccessibleImage.propTypes = {
className: PropTypes.string.isRequired,
};
export default AccessibleImage;

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

@ -3,11 +3,18 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { cloneElement, Component } from "react";
import PropTypes from "prop-types";
import AccessibleImage from "./AccessibleImage";
import "./Accordion.css";
class Accordion extends Component {
static get propTypes() {
return {
items: PropTypes.array.isRequired,
};
}
handleHeaderClick(i) {
const item = this.props.items[i];
const opened = !item.opened;

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

@ -3,10 +3,15 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import PropTypes from "prop-types";
import "./Badge.css";
const Badge = ({ children }) => (
<span className="badge text-white text-center">{children}</span>
);
Badge.propTypes = {
children: PropTypes.node.isRequired,
};
export default Badge;

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import "./BracketArrow.css";
@ -16,4 +17,11 @@ const BracketArrow = ({ orientation, left, top, bottom }) => {
);
};
BracketArrow.propTypes = {
bottom: PropTypes.number,
left: PropTypes.number,
orientation: PropTypes.string.isRequired,
top: PropTypes.number,
};
export default BracketArrow;

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import PropTypes from "prop-types";
import AccessibleImage from "../AccessibleImage";
@ -20,4 +21,10 @@ function CloseButton({ handleClick, buttonClass, tooltip }) {
);
}
CloseButton.propTypes = {
buttonClass: PropTypes.string,
handleClick: PropTypes.func.isRequired,
tooltip: PropTypes.string,
};
export default CloseButton;

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

@ -4,6 +4,7 @@
import classnames from "classnames";
import React from "react";
import PropTypes from "prop-types";
import AccessibleImage from "../AccessibleImage";
@ -45,4 +46,10 @@ const CommandBarButton = props => {
);
};
CommandBarButton.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string.isRequired,
pressed: PropTypes.bool,
};
export default CommandBarButton;

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import AccessibleImage from "../AccessibleImage";
import { CommandBarButton } from "./";
@ -14,6 +15,15 @@ class PaneToggleButton extends PureComponent {
position: "start",
};
static get propTypes() {
return {
collapsed: PropTypes.bool.isRequired,
handleClick: PropTypes.func.isRequired,
horizontal: PropTypes.bool.isRequired,
position: PropTypes.oneOf(["start", "end"]).isRequired,
};
}
label(position, collapsed) {
switch (position) {
case "start":

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import "./Dropdown.css";
export class Dropdown extends Component {
@ -13,6 +14,13 @@ export class Dropdown extends Component {
};
}
static get propTypes() {
return {
icon: PropTypes.node.isRequired,
panel: PropTypes.node.isRequired,
};
}
toggleDropdown = e => {
this.setState(prevState => ({
dropdownShown: !prevState.dropdownShown,

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import "./ManagedTree.css";
const Tree = require("devtools/client/shared/components/Tree");
@ -19,6 +20,20 @@ class ManagedTree extends Component {
onFocus: () => {},
};
static get propTypes() {
return {
expanded: PropTypes.object,
focused: PropTypes.any,
getPath: PropTypes.func.isRequired,
highlightItems: PropTypes.array,
listItems: PropTypes.array,
onCollapse: PropTypes.func.isRequired,
onExpand: PropTypes.func.isRequired,
onFocus: PropTypes.func.isRequired,
renderItem: PropTypes.func.isRequired,
};
}
componentWillReceiveProps(nextProps) {
const { listItems, highlightItems } = this.props;
if (nextProps.listItems && nextProps.listItems != listItems) {

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

@ -11,6 +11,15 @@ import "./Modal.css";
export const transitionTimeout = 50;
export class Modal extends React.Component {
static get propTypes() {
return {
additionalClass: PropTypes.string,
children: PropTypes.node.isRequired,
handleClose: PropTypes.func.isRequired,
status: PropTypes.string.isRequired,
};
}
onClick = e => {
e.stopPropagation();
};
@ -55,3 +64,10 @@ export default function Slide({
</Transition>
);
}
Slide.propTypes = {
additionalClass: PropTypes.string,
children: PropTypes.node.isRequired,
handleClose: PropTypes.func.isRequired,
in: PropTypes.bool.isRequired,
};

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import BracketArrow from "./BracketArrow";
import SmartGap from "./SmartGap";
@ -24,6 +25,17 @@ class Popover extends Component {
type: "popover",
};
static get propTypes() {
return {
children: PropTypes.node.isRequired,
editorRef: PropTypes.object.isRequired,
mouseout: PropTypes.func.isRequired,
target: PropTypes.object.isRequired,
targetPosition: PropTypes.object.isRequired,
type: PropTypes.string.isRequired,
};
}
componentDidMount() {
const { type } = this.props;
this.gapHeight = this.$gap.getBoundingClientRect().height;

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

@ -12,6 +12,12 @@ import "./PreviewFunction.css";
const IGNORED_SOURCE_URLS = ["debugger eval code"];
export default class PreviewFunction extends Component {
static get propTypes() {
return {
func: PropTypes.object.isRequired,
};
}
renderFunctionName(func) {
const { l10n } = this.context;
const name = formatDisplayName(func, undefined, l10n);

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import AccessibleImage from "./AccessibleImage";
@ -15,6 +16,16 @@ export default class ResultList extends Component {
role: "listbox",
};
static get propTypes() {
return {
items: PropTypes.array.isRequired,
role: PropTypes.oneOf(["listbox"]),
selectItem: PropTypes.func.isRequired,
selected: PropTypes.number.isRequired,
size: PropTypes.oneOf(["big", "small"]),
};
}
renderListItem = (item, index) => {
if (item.value === "/" && item.title === "") {
item.title = "(index)";

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { Component } from "react";
import PropTypes from "prop-types";
import { CloseButton } from "./Button";
@ -43,6 +44,32 @@ class SearchInput extends Component {
};
}
static get propTypes() {
return {
count: PropTypes.number.isRequired,
expanded: PropTypes.bool.isRequired,
handleClose: PropTypes.func,
handleNext: PropTypes.func.isRequired,
handlePrev: PropTypes.func.isRequired,
hasPrefix: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
onBlur: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
onFocus: PropTypes.func.isRequired,
onHistoryScroll: PropTypes.func.isRequired,
onKeyDown: PropTypes.func.isRequired,
onKeyUp: PropTypes.func,
placeholder: PropTypes.string,
query: PropTypes.string,
selectedItemId: PropTypes.string,
shouldFocus: PropTypes.bool.isRequired,
showClose: PropTypes.bool.isRequired,
showErrorEmoji: PropTypes.bool.isRequired,
size: PropTypes.string,
summaryMsg: PropTypes.string,
};
}
componentDidMount() {
this.setFocus();
}

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React from "react";
import PropTypes from "prop-types";
function shorten(coordinates) {
// In cases where the token is wider than the preview, the smartGap
@ -154,3 +155,12 @@ export default function SmartGap({
</svg>
);
}
SmartGap.propTypes = {
coords: PropTypes.object.isRequired,
gapHeight: PropTypes.number.isRequired,
offset: PropTypes.number.isRequired,
preview: PropTypes.object.isRequired,
token: PropTypes.object.isRequired,
type: PropTypes.oneOf(["popover", "tooltip"]).isRequired,
};

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

@ -3,6 +3,7 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import { connect } from "../../utils/connect";
@ -15,6 +16,15 @@ import { getSymbols, getTabs } from "../../selectors";
import "./SourceIcon.css";
class SourceIcon extends PureComponent {
static get propTypes() {
return {
framework: PropTypes.string.isRequired,
modifier: PropTypes.func.isRequired,
source: PropTypes.object.isRequired,
symbols: PropTypes.object,
};
}
render() {
const { modifier, source, symbols, framework } = this.props;
let iconClass = "";

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

@ -5,8 +5,10 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ComputedTimingFunction.h"
#include "mozilla/Assertions.h"
#include "mozilla/ServoBindings.h"
#include "nsAlgorithm.h" // For clamped()
#include "mozilla/layers/LayersMessages.h"
namespace mozilla {
@ -192,4 +194,53 @@ void ComputedTimingFunction::AppendToString(nsACString& aResult) const {
Servo_SerializeEasing(&timing, &aResult);
}
Maybe<ComputedTimingFunction> ComputedTimingFunction::FromLayersTimingFunction(
const layers::TimingFunction& aTimingFunction) {
switch (aTimingFunction.type()) {
case layers::TimingFunction::Tnull_t:
return Nothing();
case layers::TimingFunction::TCubicBezierFunction: {
auto cbf = aTimingFunction.get_CubicBezierFunction();
return Some(ComputedTimingFunction::CubicBezier(cbf.x1(), cbf.y1(),
cbf.x2(), cbf.y2()));
}
case layers::TimingFunction::TStepFunction: {
auto sf = aTimingFunction.get_StepFunction();
StyleStepPosition pos = static_cast<StyleStepPosition>(sf.type());
return Some(ComputedTimingFunction::Steps(sf.steps(), pos));
}
case layers::TimingFunction::T__None:
break;
}
MOZ_ASSERT_UNREACHABLE("Unexpected timing function type.");
return Nothing();
}
layers::TimingFunction ComputedTimingFunction::ToLayersTimingFunction(
const Maybe<ComputedTimingFunction>& aComputedTimingFunction) {
if (aComputedTimingFunction.isNothing()) {
return {null_t{}};
}
return aComputedTimingFunction->mFunction.match(
[](const KeywordFunction& aFunction) {
return layers::TimingFunction{layers::CubicBezierFunction{
static_cast<float>(aFunction.mFunction.X1()),
static_cast<float>(aFunction.mFunction.Y1()),
static_cast<float>(aFunction.mFunction.X2()),
static_cast<float>(aFunction.mFunction.Y2())}};
},
[](const SMILKeySpline& aFunction) {
return layers::TimingFunction{
layers::CubicBezierFunction{static_cast<float>(aFunction.X1()),
static_cast<float>(aFunction.Y1()),
static_cast<float>(aFunction.X2()),
static_cast<float>(aFunction.Y2())}};
},
[](const StepFunc& aFunction) {
return layers::TimingFunction{
layers::StepFunction{static_cast<int>(aFunction.mSteps),
static_cast<uint8_t>(aFunction.mPos)}};
});
}
} // namespace mozilla

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

@ -18,6 +18,10 @@
namespace mozilla {
namespace layers {
class TimingFunction;
}
class ComputedTimingFunction {
public:
struct StepFunc {
@ -40,23 +44,17 @@ class ComputedTimingFunction {
return ComputedTimingFunction(aSteps, aPos);
}
static Maybe<ComputedTimingFunction> FromLayersTimingFunction(
const layers::TimingFunction& aTimingFunction);
static layers::TimingFunction ToLayersTimingFunction(
const Maybe<ComputedTimingFunction>& aComputedTimingFunction);
explicit ComputedTimingFunction(const nsTimingFunction& aFunction);
// BeforeFlag is used in step timing function.
// https://drafts.csswg.org/css-easing/#before-flag
enum class BeforeFlag { Unset, Set };
double GetValue(double aPortion, BeforeFlag aBeforeFlag) const;
const SMILKeySpline* GetFunction() const {
NS_ASSERTION(HasSpline(), "Type mismatch");
return mFunction.match(
[](const KeywordFunction& aFunction) { return &aFunction.mFunction; },
[](const SMILKeySpline& aFunction) { return &aFunction; },
[](const StepFunc& aFunction) -> const SMILKeySpline* {
return nullptr;
});
}
bool HasSpline() const { return !mFunction.is<StepFunc>(); }
const StepFunc& GetSteps() const { return mFunction.as<StepFunc>(); }
bool operator==(const ComputedTimingFunction& aOther) const {
return mFunction == aOther.mFunction;
}

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

@ -145,7 +145,8 @@ void KeyframeEffect::SetComposite(const CompositeOperation& aComposite) {
}
if (mTarget) {
RefPtr<ComputedStyle> computedStyle = GetTargetComputedStyle(Flush::None);
RefPtr<const ComputedStyle> computedStyle =
GetTargetComputedStyle(Flush::None);
if (computedStyle) {
UpdateProperties(computedStyle);
}
@ -241,7 +242,7 @@ void KeyframeEffect::SetKeyframes(JSContext* aContext,
return;
}
RefPtr<ComputedStyle> style = GetTargetComputedStyle(Flush::None);
RefPtr<const ComputedStyle> style = GetTargetComputedStyle(Flush::None);
SetKeyframes(std::move(keyframes), style);
}
@ -525,7 +526,7 @@ void KeyframeEffect::EnsureBaseStyles(
" we should have also failed to calculate the computed values"
" passed-in as aProperties");
RefPtr<ComputedStyle> baseComputedStyle;
RefPtr<const ComputedStyle> baseComputedStyle;
for (const AnimationProperty& property : aProperties) {
EnsureBaseStyle(property, presContext, aComputedValues, baseComputedStyle);
}
@ -543,7 +544,7 @@ void KeyframeEffect::EnsureBaseStyles(
void KeyframeEffect::EnsureBaseStyle(
const AnimationProperty& aProperty, nsPresContext* aPresContext,
const ComputedStyle* aComputedStyle,
RefPtr<ComputedStyle>& aBaseComputedStyle) {
RefPtr<const ComputedStyle>& aBaseComputedStyle) {
bool hasAdditiveValues = false;
for (const AnimationPropertySegment& segment : aProperty.mSegments) {
@ -919,7 +920,8 @@ void KeyframeEffect::UpdateTarget(Element* aElement,
if (mTarget) {
UpdateTargetRegistration();
RefPtr<ComputedStyle> computedStyle = GetTargetComputedStyle(Flush::None);
RefPtr<const ComputedStyle> computedStyle =
GetTargetComputedStyle(Flush::None);
if (computedStyle) {
UpdateProperties(computedStyle);
}
@ -1005,7 +1007,7 @@ void KeyframeEffect::RequestRestyle(
}
}
already_AddRefed<ComputedStyle> KeyframeEffect::GetTargetComputedStyle(
already_AddRefed<const ComputedStyle> KeyframeEffect::GetTargetComputedStyle(
Flush aFlushType) const {
if (!GetRenderedDocument()) {
return nullptr;
@ -1230,7 +1232,7 @@ void KeyframeEffect::GetKeyframes(JSContext* aCx, nsTArray<JSObject*>& aResult,
// be consistent with Gecko, we just expand the variables (assuming we have
// enough context to do so). For that we need to grab the ComputedStyle so we
// know what custom property values to provide.
RefPtr<ComputedStyle> computedStyle;
RefPtr<const ComputedStyle> computedStyle;
if (isCSSAnimation) {
// The following will flush style but that's ok since if you update
// a variable's computed value, you expect to see that updated value in the
@ -1756,7 +1758,7 @@ void KeyframeEffect::SetPerformanceWarning(
}
}
already_AddRefed<ComputedStyle>
already_AddRefed<const ComputedStyle>
KeyframeEffect::CreateComputedStyleForAnimationValue(
nsCSSPropertyID aProperty, const AnimationValue& aValue,
nsPresContext* aPresContext, const ComputedStyle* aBaseComputedStyle) {
@ -1827,16 +1829,20 @@ void KeyframeEffect::CalculateCumulativeChangeHint(
continue;
}
RefPtr<ComputedStyle> fromContext = CreateComputedStyleForAnimationValue(
property.mProperty, segment.mFromValue, presContext, aComputedStyle);
RefPtr<const ComputedStyle> fromContext =
CreateComputedStyleForAnimationValue(property.mProperty,
segment.mFromValue, presContext,
aComputedStyle);
if (!fromContext) {
mCumulativeChangeHint = ~nsChangeHint_Hints_CanIgnoreIfNotVisible;
mNeedsStyleData = true;
return;
}
RefPtr<ComputedStyle> toContext = CreateComputedStyleForAnimationValue(
property.mProperty, segment.mToValue, presContext, aComputedStyle);
RefPtr<const ComputedStyle> toContext =
CreateComputedStyleForAnimationValue(property.mProperty,
segment.mToValue, presContext,
aComputedStyle);
if (!toContext) {
mCumulativeChangeHint = ~nsChangeHint_Hints_CanIgnoreIfNotVisible;
mNeedsStyleData = true;

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

@ -400,8 +400,7 @@ class KeyframeEffect : public AnimationEffect {
Style,
None,
};
already_AddRefed<ComputedStyle> GetTargetComputedStyle(
Flush aFlushType) const;
already_AddRefed<const ComputedStyle> GetTargetComputedStyle(Flush) const;
// A wrapper for marking cascade update according to the current
// target and its effectSet.
@ -413,7 +412,7 @@ class KeyframeEffect : public AnimationEffect {
void EnsureBaseStyle(const AnimationProperty& aProperty,
nsPresContext* aPresContext,
const ComputedStyle* aComputedValues,
RefPtr<ComputedStyle>& aBaseComputedValues);
RefPtr<const ComputedStyle>& aBaseComputedValues);
OwningAnimationTarget mTarget;
@ -468,7 +467,7 @@ class KeyframeEffect : public AnimationEffect {
const AnimationPropertySegment& aSegment,
const ComputedTiming& aComputedTiming);
already_AddRefed<ComputedStyle> CreateComputedStyleForAnimationValue(
already_AddRefed<const ComputedStyle> CreateComputedStyleForAnimationValue(
nsCSSPropertyID aProperty, const AnimationValue& aValue,
nsPresContext* aPresContext, const ComputedStyle* aBaseComputedStyle);

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

@ -107,6 +107,80 @@
* various kinds.
*/
namespace geckoprofiler::markers {
struct CCIntervalMarker {
static constexpr mozilla::Span<const char> MarkerTypeName() {
return mozilla::MakeStringSpan("CC");
}
static void StreamJSONMarkerData(
mozilla::baseprofiler::SpliceableJSONWriter& aWriter, bool aIsStart,
const mozilla::ProfilerString8View& aReason,
uint32_t aForgetSkippableBeforeCC, uint32_t aSuspectedAtCCStart,
uint32_t aRemovedPurples, const mozilla::CycleCollectorResults& aResults,
mozilla::TimeDuration aMaxSliceTime) {
if (aIsStart) {
aWriter.StringProperty("mReason", aReason);
aWriter.IntProperty("mSuspected", aSuspectedAtCCStart);
aWriter.IntProperty("mForgetSkippable", aForgetSkippableBeforeCC);
aWriter.IntProperty("mRemovedPurples", aRemovedPurples);
} else {
aWriter.TimeDoubleMsProperty("mMaxSliceTime",
aMaxSliceTime.ToMilliseconds());
aWriter.IntProperty("mSlices", aResults.mNumSlices);
aWriter.BoolProperty("mAnyManual", aResults.mAnyManual);
aWriter.BoolProperty("mForcedGC", aResults.mForcedGC);
aWriter.BoolProperty("mMergedZones", aResults.mMergedZones);
aWriter.IntProperty("mVisitedRefCounted", aResults.mVisitedRefCounted);
aWriter.IntProperty("mVisitedGCed", aResults.mVisitedGCed);
aWriter.IntProperty("mFreedRefCounted", aResults.mFreedRefCounted);
aWriter.IntProperty("mFreedGCed", aResults.mFreedGCed);
aWriter.IntProperty("mFreedJSZones", aResults.mFreedJSZones);
}
}
static mozilla::MarkerSchema MarkerTypeDisplay() {
using MS = mozilla::MarkerSchema;
MS schema{MS::Location::MarkerChart, MS::Location::MarkerTable,
MS::Location::TimelineMemory};
schema.AddStaticLabelValue(
"Description",
"Summary data for the core part of a cycle collection, possibly "
"encompassing a set of incremental slices. The main thread is not "
"blocked for the entire major CC interval, only for the individual "
"slices.");
schema.AddKeyLabelFormatSearchable("mReason", "Reason", MS::Format::String,
MS::Searchable::Searchable);
schema.AddKeyLabelFormat("mMaxSliceTime", "Max Slice Time",
MS::Format::Duration);
schema.AddKeyLabelFormat("mSuspected", "Suspected Objects",
MS::Format::Integer);
schema.AddKeyLabelFormat("mSlices", "Number of Slices",
MS::Format::Integer);
schema.AddKeyLabelFormat("mAnyManual", "Manually Triggered",
MS::Format::Integer);
schema.AddKeyLabelFormat("mForcedGC", "GC Forced", MS::Format::Integer);
schema.AddKeyLabelFormat("mMergedZones", "Zones Merged",
MS::Format::Integer);
schema.AddKeyLabelFormat("mForgetSkippable", "Forget Skippables",
MS::Format::Integer);
schema.AddKeyLabelFormat("mVisitedRefCounted", "Refcounted Objects Visited",
MS::Format::Integer);
schema.AddKeyLabelFormat("mVisitedGCed", "GC Objects Visited",
MS::Format::Integer);
schema.AddKeyLabelFormat("mFreedRefCounted", "Refcounted Objects Freed",
MS::Format::Integer);
schema.AddKeyLabelFormat("mFreedGCed", "GC Objects Freed",
MS::Format::Integer);
schema.AddKeyLabelFormat("mCollectedGCZones", "JS Zones Freed",
MS::Format::Integer);
schema.AddKeyLabelFormat("mRemovedPurples",
"Objects Removed From Purple Buffer",
MS::Format::Integer);
return schema;
}
};
} // namespace geckoprofiler::markers
namespace mozilla {
void CCGCScheduler::NoteGCBegin() {
@ -147,59 +221,34 @@ void CCGCScheduler::NoteGCEnd() {
}
}
#ifdef MOZ_GECKO_PROFILER
struct CCIntervalMarker {
static constexpr mozilla::Span<const char> MarkerTypeName() {
return mozilla::MakeStringSpan("CC");
}
static void StreamJSONMarkerData(
baseprofiler::SpliceableJSONWriter& aWriter,
const mozilla::ProfilerString8View& aReason) {
if (aReason.Length()) {
aWriter.StringProperty("reason", aReason);
}
}
static mozilla::MarkerSchema MarkerTypeDisplay() {
using MS = mozilla::MarkerSchema;
MS schema{MS::Location::MarkerChart, MS::Location::MarkerTable,
MS::Location::TimelineMemory};
schema.AddStaticLabelValue(
"Description",
"Summary data for the core part of a cycle collection, possibly "
"encompassing a set of incremental slices. The main thread is not "
"blocked for the entire major CC interval, only for the individual "
"slices.");
schema.AddKeyLabelFormatSearchable("reason", "Reason", MS::Format::String,
MS::Searchable::Searchable);
return schema;
}
};
#endif
void CCGCScheduler::NoteCCBegin(CCReason aReason, TimeStamp aWhen) {
#ifdef MOZ_GECKO_PROFILER
profiler_add_marker(
"CC", baseprofiler::category::GCCC,
MarkerOptions(MarkerTiming::IntervalStart(aWhen)), CCIntervalMarker{},
ProfilerString8View::WrapNullTerminatedString(CCReasonToString(aReason)));
#endif
void CCGCScheduler::NoteCCBegin(CCReason aReason, TimeStamp aWhen,
uint32_t aNumForgetSkippables,
uint32_t aSuspected, uint32_t aRemovedPurples) {
CycleCollectorResults ignoredResults;
PROFILER_MARKER(
"CC", GCCC, MarkerOptions(MarkerTiming::IntervalStart(aWhen)),
CCIntervalMarker,
/* aIsStart */ true,
ProfilerString8View::WrapNullTerminatedString(CCReasonToString(aReason)),
aNumForgetSkippables, aSuspected, aRemovedPurples, ignoredResults,
TimeDuration());
mIsCollectingCycles = true;
}
void CCGCScheduler::NoteCCEnd(TimeStamp aWhen) {
#ifdef MOZ_GECKO_PROFILER
profiler_add_marker("CC", baseprofiler::category::GCCC,
MarkerOptions(MarkerTiming::IntervalEnd(aWhen)),
CCIntervalMarker{}, nullptr);
#endif
void CCGCScheduler::NoteCCEnd(const CycleCollectorResults& aResults,
TimeStamp aWhen,
mozilla::TimeDuration aMaxSliceTime) {
mCCollectedWaitingForGC += aResults.mFreedGCed;
mCCollectedZonesWaitingForGC += aResults.mFreedJSZones;
PROFILER_MARKER("CC", GCCC, MarkerOptions(MarkerTiming::IntervalEnd(aWhen)),
CCIntervalMarker, /* aIsStart */ false, nullptr, 0, 0, 0,
aResults, aMaxSliceTime);
mIsCollectingCycles = false;
mLastCCEndTime = aWhen;
mNeedsFullCC = CCReason::NO_REASON;
// The GC for this CC has already been requested.
mNeedsGCAfterCC = false;
}
void CCGCScheduler::NoteWontGC() {
@ -450,6 +499,9 @@ void CCGCScheduler::PokeGC(JS::GCReason aReason, JSObject* aObj,
return;
}
// If a post-CC GC was pending, then we'll make sure one is happening.
mNeedsGCAfterCC = false;
if (aObj) {
JS::Zone* zone = JS::GetObjectZone(aObj);
CycleCollectedJSRuntime::Get()->AddZoneWaitingForGC(zone);
@ -604,8 +656,8 @@ js::SliceBudget CCGCScheduler::ComputeCCSliceBudget(
TimeDuration baseBudget =
aDeadline.IsNull() ? kICCSliceBudget : aDeadline - aNow;
if (aCCBeginTime.IsNull()) {
// If no CC is in progress, use the standard slice time.
if (aPrevSliceEndTime.IsNull()) {
// The first slice gets the standard slice time.
return js::SliceBudget(js::TimeBudget(baseBudget));
}

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

@ -245,13 +245,16 @@ class CCGCScheduler {
// This is invoked when we reach the actual cycle collection portion of the
// overall cycle collection.
void NoteCCBegin(CCReason aReason, TimeStamp aWhen);
void NoteCCBegin(CCReason aReason, TimeStamp aWhen,
uint32_t aNumForgetSkippables, uint32_t aSuspected,
uint32_t aRemovedPurples);
// This is invoked when the whole process of collection is done -- i.e., CC
// preparation (eg ForgetSkippables) in addition to the CC itself. There
// really ought to be a separate name for the overall CC as opposed to the
// actual cycle collection portion.
void NoteCCEnd(TimeStamp aWhen);
void NoteCCEnd(const CycleCollectorResults& aResults, TimeStamp aWhen,
mozilla::TimeDuration aMaxSliceTime);
void NoteGCSliceEnd(TimeDuration aSliceDuration) {
if (mMajorGCReason == JS::GCReason::NO_REASON) {
@ -304,13 +307,6 @@ class CCGCScheduler {
return aSuspectedBeforeForgetSkippable - aSuspectedCCObjects;
}
// After collecting cycles, record the results that are used in scheduling
// decisions.
void NoteCycleCollected(const CycleCollectorResults& aResults) {
mCCollectedWaitingForGC += aResults.mFreedGCed;
mCCollectedZonesWaitingForGC += aResults.mFreedJSZones;
}
// Test if we are in the NoteCCBegin .. NoteCCEnd interval.
bool IsCollectingCycles() const { return mIsCollectingCycles; }

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

@ -16832,8 +16832,6 @@ Selection* Document::GetSelection(ErrorResult& aRv) {
}
nsresult Document::HasStorageAccessSync(bool& aHasStorageAccess) {
// Step 1: check if cookie permissions are available or denied to this
// document's principal
nsCOMPtr<nsPIDOMWindowInner> inner = this->GetInnerWindow();
if (!inner) {
aHasStorageAccess = false;
@ -16852,8 +16850,6 @@ nsresult Document::HasStorageAccessSync(bool& aHasStorageAccess) {
}
}
// Step 2: Check if the browser settings determine whether or not this
// document has access to its unpartitioned cookies.
bool isThirdPartyDocument = AntiTrackingUtils::IsThirdPartyDocument(this);
Maybe<bool> resultBecauseBrowserSettings =
ContentBlocking::CheckBrowserSettingsDecidesStorageAccessAPI(
@ -16868,8 +16864,6 @@ nsresult Document::HasStorageAccessSync(bool& aHasStorageAccess) {
}
}
// Step 3: Check if the location of this call (embedded, top level, same-site)
// determines if cookies are permitted or not.
Maybe<bool> resultBecauseCallContext =
ContentBlocking::CheckCallingContextDecidesStorageAccessAPI(this, false);
if (resultBecauseCallContext.isSome()) {
@ -16882,8 +16876,6 @@ nsresult Document::HasStorageAccessSync(bool& aHasStorageAccess) {
}
}
// Step 4: Check if the permissions for this document determine if if has
// access or is denied cookies.
Maybe<bool> resultBecausePreviousPermission =
ContentBlocking::CheckExistingPermissionDecidesStorageAccessAPI(this);
if (resultBecausePreviousPermission.isSome()) {
@ -16896,7 +16888,6 @@ nsresult Document::HasStorageAccessSync(bool& aHasStorageAccess) {
}
}
// If you get here, we default to not giving you permission.
aHasStorageAccess = false;
return NS_OK;
}
@ -16952,111 +16943,6 @@ Document::GetContentBlockingEvents() {
});
}
RefPtr<MozPromise<int, bool, true>> Document::RequestStorageAccessAsyncHelper(
nsPIDOMWindowInner* aInnerWindow, BrowsingContext* aBrowsingContext,
nsIPrincipal* aPrincipal, bool aHasUserInteraction,
ContentBlockingNotifier::StorageAccessPermissionGrantedReason aNotifier) {
RefPtr<Document> self(this);
RefPtr<nsPIDOMWindowInner> inner(aInnerWindow);
RefPtr<nsIPrincipal> principal(aPrincipal);
// This is a lambda function that has some variables bound to it. It will be
// called later in CompleteAllowAccessFor inside of AllowAccessFor.
auto performFinalChecks = [inner, self, principal, aHasUserInteraction]() {
// Create the user prompt
RefPtr<ContentBlocking::StorageAccessFinalCheckPromise::Private> p =
new ContentBlocking::StorageAccessFinalCheckPromise::Private(__func__);
RefPtr<StorageAccessPermissionRequest> sapr =
StorageAccessPermissionRequest::Create(
inner, principal,
// Allow
[p] {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Allow);
p->Resolve(ContentBlocking::eAllow, __func__);
},
// Block
[p] {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Deny);
p->Reject(false, __func__);
});
using PromptResult = ContentPermissionRequestBase::PromptResult;
PromptResult pr = sapr->CheckPromptPrefs();
if (pr == PromptResult::Pending) {
// We're about to show a prompt, record the request attempt
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Request);
}
// Try to auto-grant the storage access so the user doesn't see the prompt.
self->AutomaticStorageAccessPermissionCanBeGranted(aHasUserInteraction)
->Then(
GetCurrentSerialEventTarget(), __func__,
// If the autogrant check didn't fail, call this function
[p, pr, sapr, inner](
const Document::AutomaticStorageAccessPermissionGrantPromise::
ResolveOrRejectValue& aValue) -> void {
// Make a copy because we can't modified copy-captured lambda
// variables.
PromptResult pr2 = pr;
// If the user didn't already click "allow" and we can autogrant,
// do that!
bool storageAccessCanBeGrantedAutomatically =
aValue.IsResolve() && aValue.ResolveValue();
bool autoGrant = false;
if (pr2 == PromptResult::Pending &&
storageAccessCanBeGrantedAutomatically) {
pr2 = PromptResult::Granted;
autoGrant = true;
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::
AllowAutomatically);
}
// If we can complete the permission request, do so.
if (pr2 != PromptResult::Pending) {
MOZ_ASSERT_IF(pr2 != PromptResult::Granted,
pr2 == PromptResult::Denied);
if (pr2 == PromptResult::Granted) {
ContentBlocking::StorageAccessPromptChoices choice =
ContentBlocking::eAllow;
if (autoGrant) {
choice = ContentBlocking::eAllowAutoGrant;
}
if (!autoGrant) {
p->Resolve(choice, __func__);
} else {
sapr->MaybeDelayAutomaticGrants()->Then(
GetCurrentSerialEventTarget(), __func__,
[p, choice] { p->Resolve(choice, __func__); },
[p] { p->Reject(false, __func__); });
}
return;
}
p->Reject(false, __func__);
return;
}
// If we get here, the auto-decision failed and we need to
// wait for the user prompt to complete.
sapr->RequestDelayedTask(
inner->EventTargetFor(TaskCategory::Other),
ContentPermissionRequestBase::DelayedTaskType::Request);
});
return p;
};
// Try to allow access for the given principal.
return ContentBlocking::AllowAccessFor(principal, aBrowsingContext, aNotifier,
performFinalChecks);
}
already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
mozilla::ErrorResult& aRv) {
nsIGlobalObject* global = GetScopeObject();
@ -17139,7 +17025,7 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
// Get pointers to some objects that will be used in the async portion
RefPtr<BrowsingContext> bc = this->GetBrowsingContext();
nsPIDOMWindowInner* inner = this->GetInnerWindow();
nsCOMPtr<nsPIDOMWindowInner> inner = this->GetInnerWindow();
if (!inner) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
@ -17158,12 +17044,92 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
// This prevents usage of other transient activation-gated APIs.
this->ConsumeTransientUserGestureActivation();
// Step 5. Start an async call to request storage access. This will either
// perform an automatic decision or notify the user, then perform some follow
// on work changing state to reflect the result of the API. If it resolves,
// the request was granted. If it rejects it was denied.
RequestStorageAccessAsyncHelper(inner, bc, NodePrincipal(), true,
ContentBlockingNotifier::eStorageAccessAPI)
auto performFinalChecks =
[inner,
self]() -> RefPtr<ContentBlocking::StorageAccessFinalCheckPromise> {
RefPtr<ContentBlocking::StorageAccessFinalCheckPromise::Private> p =
new ContentBlocking::StorageAccessFinalCheckPromise::Private(__func__);
RefPtr<StorageAccessPermissionRequest> sapr =
StorageAccessPermissionRequest::Create(
inner,
// Allow
[p] {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Allow);
p->Resolve(ContentBlocking::eAllow, __func__);
},
// Block
[p] {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Deny);
p->Reject(false, __func__);
});
using PromptResult = ContentPermissionRequestBase::PromptResult;
PromptResult pr = sapr->CheckPromptPrefs();
if (pr == PromptResult::Pending) {
// We're about to show a prompt, record the request attempt
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Request);
}
self->AutomaticStorageAccessPermissionCanBeGranted(true)->Then(
GetCurrentSerialEventTarget(), __func__,
[p, pr, sapr,
inner](const AutomaticStorageAccessPermissionGrantPromise::
ResolveOrRejectValue& aValue) -> void {
// Make a copy because we can't modified copy-captured lambda
// variables.
PromptResult pr2 = pr;
bool storageAccessCanBeGrantedAutomatically =
aValue.IsResolve() && aValue.ResolveValue();
bool autoGrant = false;
if (pr2 == PromptResult::Pending &&
storageAccessCanBeGrantedAutomatically) {
pr2 = PromptResult::Granted;
autoGrant = true;
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::AllowAutomatically);
}
if (pr2 != PromptResult::Pending) {
MOZ_ASSERT_IF(pr2 != PromptResult::Granted,
pr2 == PromptResult::Denied);
if (pr2 == PromptResult::Granted) {
ContentBlocking::StorageAccessPromptChoices choice =
ContentBlocking::eAllow;
if (autoGrant) {
choice = ContentBlocking::eAllowAutoGrant;
}
if (!autoGrant) {
p->Resolve(choice, __func__);
} else {
sapr->MaybeDelayAutomaticGrants()->Then(
GetCurrentSerialEventTarget(), __func__,
[p, choice] { p->Resolve(choice, __func__); },
[p] { p->Reject(false, __func__); });
}
return;
}
p->Reject(false, __func__);
return;
}
sapr->RequestDelayedTask(
inner->EventTargetFor(TaskCategory::Other),
ContentPermissionRequestBase::DelayedTaskType::Request);
});
return p;
};
ContentBlocking::AllowAccessFor(NodePrincipal(), bc,
ContentBlockingNotifier::eStorageAccessAPI,
performFinalChecks)
->Then(
GetCurrentSerialEventTarget(), __func__,
[self, outer, promise] {
@ -17191,146 +17157,233 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccessForOrigin(
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
RefPtr<Promise> promise = Promise::Create(global, aRv);
if (aRv.Failed()) {
return nullptr;
}
// Step 1: Check if the provided URI is different-site to this Document
// Window doesn't have user activation, reject.
bool hasUserActivation = this->HasValidTransientUserGestureActivation();
if (aRequireUserActivation && !hasUserActivation) {
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
nsLiteralCString("requestStorageAccess"),
this, nsContentUtils::eDOM_PROPERTIES,
"RequestStorageAccessUserGesture");
promise->MaybeRejectWithUndefined();
return promise.forget();
}
nsCOMPtr<nsPIDOMWindowInner> inner = GetInnerWindow();
if (!inner) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
// We only allow request storage access for third-party origin from the
// first-party context.
if (AntiTrackingUtils::IsThirdPartyWindow(inner, nullptr)) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
// If the document has a null origin, reject.
if (NodePrincipal()->GetIsNullPrincipal()) {
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
nsLiteralCString("requestStorageAccess"),
this, nsContentUtils::eDOM_PROPERTIES,
"RequestStorageAccessNullPrincipal");
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
nsCOMPtr<nsIURI> thirdPartyURI;
nsresult rv = NS_NewURI(getter_AddRefs(thirdPartyURI), aThirdPartyOrigin);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
return nullptr;
}
bool isThirdPartyDocument;
rv = NodePrincipal()->IsThirdPartyURI(thirdPartyURI, &isThirdPartyDocument);
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
return nullptr;
// If the browser forbids any storage access, reject.
if (CookieJarSettings()->GetBlockingAllContexts()) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
Maybe<bool> resultBecauseBrowserSettings =
ContentBlocking::CheckBrowserSettingsDecidesStorageAccessAPI(
CookieJarSettings(), isThirdPartyDocument);
if (resultBecauseBrowserSettings.isSome()) {
if (resultBecauseBrowserSettings.value()) {
// Only enforce third-party checks when there is a reason to enforce them.
if (!CookieJarSettings()->GetRejectThirdPartyContexts()) {
// If the the thrid party origin is equal to the window's, resolve.
if (NodePrincipal()->IsSameOrigin(thirdPartyURI)) {
promise->MaybeResolveWithUndefined();
return promise.forget();
}
}
// Check any additional rules that the browser has.
if (CookieJarSettings()->GetBlockingAllThirdPartyContexts()) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
// Step 2: Check that this Document is same-site to the top, and check that
// we have user activation if we require it.
Maybe<bool> resultBecauseCallContext =
ContentBlocking::CheckSameSiteCallingContextDecidesStorageAccessAPI(
this, aRequireUserActivation);
if (resultBecauseCallContext.isSome()) {
if (resultBecauseCallContext.value()) {
promise->MaybeResolveWithUndefined();
if (CookieJarSettings()->GetRejectThirdPartyContexts()) {
RefPtr<BrowsingContext> bc = GetBrowsingContext();
if (!bc) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
// Step 3: Get some useful variables that can be captured by the lambda for
// the asynchronous portion
RefPtr<BrowsingContext> bc = this->GetBrowsingContext();
nsCOMPtr<nsPIDOMWindowInner> inner = this->GetInnerWindow();
if (!inner) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
RefPtr<nsGlobalWindowOuter> outer =
nsGlobalWindowOuter::Cast(inner->GetOuterWindow());
if (!outer) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
nsCOMPtr<nsIPrincipal> principal = BasePrincipal::CreateContentPrincipal(
thirdPartyURI, NodePrincipal()->OriginAttributesRef());
if (!principal) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
nsCOMPtr<nsIPrincipal> principal = BasePrincipal::CreateContentPrincipal(
thirdPartyURI, NodePrincipal()->OriginAttributesRef());
RefPtr<Document> self(this);
bool hasUserActivation = HasValidTransientUserGestureActivation();
if (!principal) {
this->ConsumeTransientUserGestureActivation();
promise->MaybeRejectWithUndefined();
return promise.forget();
}
// Consume user activation before entering the async part of this method.
// This prevents usage of other transient activation-gated APIs.
this->ConsumeTransientUserGestureActivation();
RefPtr<Document> self(this);
// Step 4a: Start the async part of this function. Check the cookie
// permission, but this can't be done in this process. We needs the cookie
// permission of the URL as if it were embedded on this page, so we need to
// make this check in the ContentParent.
ContentBlocking::AsyncCheckCookiesPermittedDecidesStorageAccessAPI(
GetBrowsingContext(), principal)
->Then(
GetCurrentSerialEventTarget(), __func__,
[inner, thirdPartyURI, bc, principal, hasUserActivation, self,
promise](Maybe<bool> cookieResult) {
// Handle the result of the cookie permission check that took place
// in the ContentParent.
if (cookieResult.isSome()) {
if (cookieResult.value()) {
return MozPromise<int, bool, true>::CreateAndResolve(true,
__func__);
// Consume user activation before entering the async part of this method.
// This prevents usage of other transient activation-gated APIs.
this->ConsumeTransientUserGestureActivation();
auto performFinalChecks = [inner, self, principal, hasUserActivation]() {
RefPtr<ContentBlocking::StorageAccessFinalCheckPromise::Private> p =
new ContentBlocking::StorageAccessFinalCheckPromise::Private(
__func__);
RefPtr<StorageAccessPermissionRequest> sapr =
StorageAccessPermissionRequest::Create(
inner, principal,
// Allow
[p] {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Allow);
p->Resolve(ContentBlocking::eAllow, __func__);
},
// Block
[p] {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Deny);
p->Reject(false, __func__);
});
using PromptResult = ContentPermissionRequestBase::PromptResult;
PromptResult pr = sapr->CheckPromptPrefs();
if (pr == PromptResult::Pending) {
// We're about to show a prompt, record the request attempt
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::Request);
}
self->AutomaticStorageAccessPermissionCanBeGranted(hasUserActivation)
->Then(GetCurrentSerialEventTarget(), __func__,
[p, pr, sapr,
inner](const AutomaticStorageAccessPermissionGrantPromise::
ResolveOrRejectValue& aValue) -> void {
// Make a copy because we can't modified copy-captured lambda
// variables.
PromptResult pr2 = pr;
bool storageAccessCanBeGrantedAutomatically =
aValue.IsResolve() && aValue.ResolveValue();
bool autoGrant = false;
if (pr2 == PromptResult::Pending &&
storageAccessCanBeGrantedAutomatically) {
pr2 = PromptResult::Granted;
autoGrant = true;
Telemetry::AccumulateCategorical(
Telemetry::LABELS_STORAGE_ACCESS_API_UI::
AllowAutomatically);
}
if (pr2 != PromptResult::Pending) {
MOZ_ASSERT_IF(pr2 != PromptResult::Granted,
pr2 == PromptResult::Denied);
if (pr2 == PromptResult::Granted) {
ContentBlocking::StorageAccessPromptChoices choice =
ContentBlocking::eAllow;
if (autoGrant) {
choice = ContentBlocking::eAllowAutoGrant;
}
if (!autoGrant) {
p->Resolve(choice, __func__);
} else {
sapr->MaybeDelayAutomaticGrants()->Then(
GetCurrentSerialEventTarget(), __func__,
[p, choice] { p->Resolve(choice, __func__); },
[p] { p->Reject(false, __func__); });
}
return;
}
p->Reject(false, __func__);
return;
}
sapr->RequestDelayedTask(
inner->EventTargetFor(TaskCategory::Other),
ContentPermissionRequestBase::DelayedTaskType::Request);
});
return p;
};
// Only do something special for the third party that storage has been
// disabled by anti-tracking feature.
AsyncStorageDisabledByAntiTracking(bc, principal)
->Then(
GetCurrentSerialEventTarget(), __func__,
[performFinalChecks, promise, bc, principal,
self](AsyncStorageDisabledByAntiTrackingPromise::
ResolveOrRejectValue&& aValue) {
if (aValue.IsReject()) {
// Storage was enabled by anti-tracking feature.
return ContentBlocking::StorageAccessPermissionGrantPromise::
CreateAndResolve(0, __func__);
}
return MozPromise<int, bool, true>::CreateAndReject(false,
__func__);
}
// Step 4b: Check for the existing storage access permission
nsAutoCString type;
bool ok =
AntiTrackingUtils::CreateStoragePermissionKey(principal, type);
if (!ok) {
return MozPromise<int, bool, true>::CreateAndReject(false,
__func__);
}
if (AntiTrackingUtils::CheckStoragePermission(
self->NodePrincipal(), type,
nsContentUtils::IsInPrivateBrowsing(self), nullptr, 0)) {
return MozPromise<int, bool, true>::CreateAndResolve(true,
__func__);
}
MOZ_ASSERT(aValue.IsResolve());
// Storage was disabled by anti-tracking feature.
// Step 4c: Try to request storage access, either automatically or
// with a user-prompt. This is the part that is async in the
// typical requestStorageAccess function.
return self->RequestStorageAccessAsyncHelper(
inner, bc, principal, hasUserActivation,
ContentBlockingNotifier::ePrivilegeStorageAccessForOriginAPI);
},
// If the IPC rejects, we should reject our promise here which will
// cause a rejection of the promise we already returned
[promise]() {
return MozPromise<int, bool, true>::CreateAndReject(false,
__func__);
})
->Then(
GetCurrentSerialEventTarget(), __func__,
// If the previous handlers resolved, we should reinstate user
// activation and resolve the promise we returned in Step 5.
[self, promise] {
self->NotifyUserGestureActivation();
promise->MaybeResolveWithUndefined();
},
// If the previous handler rejected, we should reject the promise
// returned by this function.
[promise] { promise->MaybeRejectWithUndefined(); });
// If the storage was disabled by the cookie permission, we don't
// bother to show the prompt.
uint32_t rejectReason = aValue.ResolveValue();
if (rejectReason ==
nsIWebProgressListener::STATE_COOKIES_BLOCKED_BY_PERMISSION) {
return ContentBlocking::StorageAccessPermissionGrantPromise::
CreateAndReject(true, __func__);
;
}
// Step 5: While the async stuff is happening, we should return the promise so
// our caller can continue executing.
MOZ_ASSERT(!self->CookieJarSettings()
->GetIsOnContentBlockingAllowList());
return ContentBlocking::AllowAccessFor(
principal, bc,
ContentBlockingNotifier::ePrivilegeStorageAccessForOriginAPI,
performFinalChecks);
})
->Then(
GetCurrentSerialEventTarget(), __func__,
[self, promise] {
self->NotifyUserGestureActivation();
promise->MaybeResolveWithUndefined();
},
[promise] { promise->MaybeRejectWithUndefined(); });
return promise.forget();
}
promise->MaybeResolveWithUndefined();
return promise.forget();
}

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

@ -25,7 +25,6 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/BitSet.h"
#include "mozilla/OriginTrials.h"
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/CORSMode.h"
#include "mozilla/CallState.h"
#include "mozilla/EventStates.h"
@ -1265,16 +1264,6 @@ class Document : public nsINode,
nsresult HasStorageAccessSync(bool& aHasStorageAccess);
already_AddRefed<Promise> HasStorageAccess(ErrorResult& aRv);
// This function performs the asynchronous portion of checking if requests
// for storage access will be sucessful or not. This includes creating a
// permission prompt request and trying to perform an "autogrant"
// This will return a promise whose values correspond to those of a
// ContentBlocking::AllowAccessFor call that ends the funciton.
RefPtr<MozPromise<int, bool, true>> RequestStorageAccessAsyncHelper(
nsPIDOMWindowInner* aInnerWindow, BrowsingContext* aBrowsingContext,
nsIPrincipal* aPrincipal, bool aHasUserInteraction,
ContentBlockingNotifier::StorageAccessPermissionGrantedReason aNotifier);
already_AddRefed<Promise> RequestStorageAccess(ErrorResult& aRv);
already_AddRefed<Promise> RequestStorageAccessForOrigin(

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

@ -465,7 +465,7 @@ nsresult TimeoutManager::SetTimeout(TimeoutHandler* aHandler, int32_t interval,
// If we don't have a document (we could have been unloaded since
// the call to setTimeout was made), do nothing.
nsCOMPtr<Document> doc = mWindow.GetExtantDoc();
if (!doc) {
if (!doc || mWindow.IsDying()) {
return NS_OK;
}

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

@ -3194,7 +3194,7 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(Element* aElement,
if (!pseudo) {
return NS_ERROR_FAILURE;
}
RefPtr<ComputedStyle> computedStyle =
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetUnanimatedComputedStyleNoFlush(aElement, *pseudo);
if (!computedStyle) {
return NS_ERROR_FAILURE;

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

@ -106,6 +106,7 @@ struct CycleCollectorStats {
constexpr CycleCollectorStats() = default;
void Init();
void Clear();
void PrepareForCycleCollection(TimeStamp aNow);
void AfterPrepareForCycleCollectionSlice(TimeStamp aDeadline,
TimeStamp aBeginTime,
TimeStamp aMaybeAfterGCTime);
@ -114,7 +115,7 @@ struct CycleCollectorStats {
void AfterForgetSkippable(TimeDuration duration, uint32_t aRemovedPurples);
void AfterCycleCollection();
void SendTelemetry(TimeDuration aCCNowDuration) const;
void SendTelemetry(TimeDuration aCCNowDuration, TimeStamp aPrevCCEnd) const;
void MaybeLogStats(const CycleCollectorResults& aResults,
uint32_t aCleanups) const;
void MaybeNotifyStats(const CycleCollectorResults& aResults,
@ -1242,6 +1243,11 @@ void CycleCollectorStats::AfterCycleCollectionSlice() {
mBeginSliceTime = TimeStamp();
}
void CycleCollectorStats::PrepareForCycleCollection(TimeStamp aNow) {
mBeginTime = aNow;
mSuspected = nsCycleCollector_suspectedCount();
}
void CycleCollectorStats::AfterPrepareForCycleCollectionSlice(
TimeStamp aDeadline, TimeStamp aBeginTime, TimeStamp aMaybeAfterGCTime) {
mBeginSliceTime = aBeginTime;
@ -1273,7 +1279,8 @@ void CycleCollectorStats::AfterForgetSkippable(TimeDuration duration,
mRemovedPurples += aRemovedPurples;
}
void CycleCollectorStats::SendTelemetry(TimeDuration aCCNowDuration) const {
void CycleCollectorStats::SendTelemetry(TimeDuration aCCNowDuration,
TimeStamp aPrevCCEnd) const {
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_FINISH_IGC, mAnyLockedOut);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_SYNC_SKIPPABLE,
mRanSyncForgetSkippable);
@ -1282,9 +1289,8 @@ void CycleCollectorStats::SendTelemetry(TimeDuration aCCNowDuration) const {
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_MAX_PAUSE,
mMaxSliceTime.ToMilliseconds());
TimeStamp lastCCEndTime = sScheduler.GetLastCCEndTime();
if (!lastCCEndTime.IsNull()) {
TimeDuration timeBetween = TimeBetween(lastCCEndTime, mBeginTime);
if (!aPrevCCEnd.IsNull()) {
TimeDuration timeBetween = TimeBetween(aPrevCCEnd, mBeginTime);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_TIME_BETWEEN,
timeBetween.ToSeconds());
}
@ -1427,7 +1433,10 @@ void nsJSContext::PrepareForCycleCollectionSlice(CCReason aReason,
}
if (!sScheduler.IsCollectingCycles()) {
sScheduler.NoteCCBegin(aReason, beginTime);
sCCStats.PrepareForCycleCollection(beginTime);
sScheduler.NoteCCBegin(aReason, beginTime,
sCCStats.mForgetSkippableBeforeCC,
sCCStats.mSuspected, sCCStats.mRemovedPurples);
}
sCCStats.AfterPrepareForCycleCollectionSlice(aDeadline, beginTime,
@ -1487,9 +1496,7 @@ void nsJSContext::BeginCycleCollectionCallback(CCReason aReason) {
MOZ_ASSERT(NS_IsMainThread());
TimeStamp startTime = TimeStamp::Now();
sCCStats.mBeginTime =
sCCStats.mBeginSliceTime.IsNull() ? startTime : sCCStats.mBeginSliceTime;
sCCStats.mSuspected = nsCycleCollector_suspectedCount();
sCCStats.PrepareForCycleCollection(startTime);
// Run forgetSkippable synchronously to reduce the size of the CC graph. This
// is particularly useful if we recently finished a GC.
@ -1510,7 +1517,8 @@ void nsJSContext::BeginCycleCollectionCallback(CCReason aReason) {
}
// static
void nsJSContext::EndCycleCollectionCallback(CycleCollectorResults& aResults) {
void nsJSContext::EndCycleCollectionCallback(
const CycleCollectorResults& aResults) {
MOZ_ASSERT(NS_IsMainThread());
sScheduler.KillCCRunner();
@ -1519,10 +1527,28 @@ void nsJSContext::EndCycleCollectionCallback(CycleCollectorResults& aResults) {
// we previously called PrepareForCycleCollectionSlice(). During shutdown
// CCs, this won't happen.
sCCStats.AfterCycleCollectionSlice();
sScheduler.NoteCycleCollected(aResults);
TimeStamp endCCTimeStamp = TimeStamp::Now();
TimeDuration ccNowDuration = TimeBetween(sCCStats.mBeginTime, endCCTimeStamp);
TimeStamp prevCCEnd = sScheduler.GetLastCCEndTime();
sScheduler.NoteCCEnd(aResults, endCCTimeStamp, sCCStats.mMaxSliceTime);
// Log information about the CC via telemetry, JSON and the console.
sCCStats.SendTelemetry(ccNowDuration, prevCCEnd);
uint32_t cleanups = std::max(sCCStats.mForgetSkippableBeforeCC, 1u);
sCCStats.MaybeLogStats(aResults, cleanups);
sCCStats.MaybeNotifyStats(aResults, ccNowDuration, cleanups);
// Update global state to indicate we have just run a cycle collection.
sCCStats.Clear();
// If we need a GC after this CC (typically because lots of GCed objects or
// zones have been collected in the CC), schedule it.
if (sScheduler.NeedsGCAfterCC()) {
MOZ_ASSERT(
@ -1535,20 +1561,6 @@ void nsJSContext::EndCycleCollectionCallback(CycleCollectorResults& aResults) {
StaticPrefs::javascript_options_gc_delay()) -
std::min(ccNowDuration, kMaxICCDuration));
}
// Log information about the CC via telemetry, JSON and the console.
sCCStats.SendTelemetry(ccNowDuration);
uint32_t cleanups = std::max(sCCStats.mForgetSkippableBeforeCC, 1u);
sCCStats.MaybeLogStats(aResults, cleanups);
sCCStats.MaybeNotifyStats(aResults, ccNowDuration, cleanups);
// Update global state to indicate we have just run a cycle collection.
sScheduler.NoteCCEnd(endCCTimeStamp);
sCCStats.Clear();
}
/* static */
@ -1745,8 +1757,7 @@ static void DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress,
// May need to kill the GC runner
sScheduler.KillGCRunner();
TimeStamp now = TimeStamp::Now();
sScheduler.MaybePokeCC(now, nsCycleCollector_suspectedCount());
nsJSContext::MaybePokeCC();
if (aDesc.isZone_) {
sScheduler.PokeFullGC();
@ -1755,7 +1766,8 @@ static void DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress,
sScheduler.KillFullGCTimer();
}
if (sScheduler.IsCCNeeded(now, nsCycleCollector_suspectedCount()) !=
if (sScheduler.IsCCNeeded(TimeStamp::Now(),
nsCycleCollector_suspectedCount()) !=
CCReason::NO_REASON) {
nsCycleCollector_dispatchDeferredDeletion();
}

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

@ -86,7 +86,7 @@ class nsJSContext : public nsIScriptContext {
static void BeginCycleCollectionCallback(mozilla::CCReason aReason);
static void EndCycleCollectionCallback(
mozilla::CycleCollectorResults& aResults);
const mozilla::CycleCollectorResults& aResults);
// Return the longest CC slice time since ClearMaxCCSliceTime() was last
// called.

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

@ -147,6 +147,7 @@ void TestCC::TimerFires(int aNumSlices) {
step = mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
EXPECT_EQ(step.mAction, CCRunnerAction::CleanupDeferred);
mScheduler.NoteCCBegin(CCReason::API, Now(), 0, sSuspected, 0);
RunSlices(aNumSlices);
}
@ -177,8 +178,7 @@ void TestCC::EndCycleCollectionCallback() {
CycleCollectorResults results;
results.mFreedGCed = 10;
results.mFreedJSZones = 2;
mScheduler.NoteCycleCollected(results);
mScheduler.NoteCCEnd(Now());
mScheduler.NoteCCEnd(results, Now(), TimeDuration());
// Because > 0 zones were freed.
EXPECT_TRUE(mScheduler.NeedsGCAfterCC());
@ -186,7 +186,6 @@ void TestCC::EndCycleCollectionCallback() {
void TestCC::KillCCRunner() {
// nsJSContext::KillCCRunner
mScheduler.NoteCCEnd(Now());
mScheduler.KillCCRunner();
}

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

@ -1116,7 +1116,7 @@ bool CanvasRenderingContext2D::ParseColor(const nsACString& aString,
if (wasCurrentColor && mCanvasElement) {
// Otherwise, get the value of the color property, flushing style
// if necessary.
RefPtr<ComputedStyle> canvasStyle =
RefPtr<const ComputedStyle> canvasStyle =
nsComputedDOMStyle::GetComputedStyle(mCanvasElement);
if (canvasStyle) {
*aColor = canvasStyle->StyleText()->mColor.ToColor();
@ -1696,7 +1696,7 @@ void CanvasRenderingContext2D::ClearTarget(int32_t aWidth, int32_t aHeight) {
// For vertical writing-mode, unless text-orientation is sideways,
// we'll modify the initial value of textBaseline to 'middle'.
RefPtr<ComputedStyle> canvasStyle =
RefPtr<const ComputedStyle> canvasStyle =
nsComputedDOMStyle::GetComputedStyle(mCanvasElement);
if (canvasStyle) {
WritingMode wm(canvasStyle);
@ -2453,7 +2453,7 @@ static already_AddRefed<RawServoDeclarationBlock> CreateFontDeclarationForServo(
return CreateDeclarationForServo(eCSSProperty_font, aFont, aDocument);
}
static already_AddRefed<ComputedStyle> GetFontStyleForServo(
static already_AddRefed<const ComputedStyle> GetFontStyleForServo(
Element* aElement, const nsACString& aFont, PresShell* aPresShell,
nsACString& aOutUsedFont, ErrorResult& aError) {
RefPtr<RawServoDeclarationBlock> declarations =
@ -2473,7 +2473,7 @@ static already_AddRefed<ComputedStyle> GetFontStyleForServo(
ServoStyleSet* styleSet = aPresShell->StyleSet();
RefPtr<ComputedStyle> parentStyle;
RefPtr<const ComputedStyle> parentStyle;
// have to get a parent ComputedStyle for inherit-like relative
// values (2em, bolder, etc.)
if (aElement && aElement->IsInComposedDoc()) {
@ -2500,7 +2500,7 @@ static already_AddRefed<ComputedStyle> GetFontStyleForServo(
"We should have returned an error above if the presshell is "
"being destroyed.");
RefPtr<ComputedStyle> sc =
RefPtr<const ComputedStyle> sc =
styleSet->ResolveForDeclarations(parentStyle, declarations);
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-font
@ -2527,7 +2527,7 @@ CreateFilterDeclarationForServo(const nsACString& aFilter,
return CreateDeclarationForServo(eCSSProperty_filter, aFilter, aDocument);
}
static already_AddRefed<ComputedStyle> ResolveFilterStyleForServo(
static already_AddRefed<const ComputedStyle> ResolveFilterStyleForServo(
const nsACString& aFilterString, const ComputedStyle* aParentStyle,
PresShell* aPresShell, ErrorResult& aError) {
RefPtr<RawServoDeclarationBlock> declarations =
@ -2545,7 +2545,7 @@ static already_AddRefed<ComputedStyle> ResolveFilterStyleForServo(
}
ServoStyleSet* styleSet = aPresShell->StyleSet();
RefPtr<ComputedStyle> computedValues =
RefPtr<const ComputedStyle> computedValues =
styleSet->ResolveForDeclarations(aParentStyle, declarations);
return computedValues.forget();
@ -2562,13 +2562,13 @@ bool CanvasRenderingContext2D::ParseFilter(
nsAutoCString usedFont; // unused
RefPtr<ComputedStyle> parentStyle = GetFontStyleForServo(
RefPtr<const ComputedStyle> parentStyle = GetFontStyleForServo(
mCanvasElement, GetFont(), presShell, usedFont, aError);
if (!parentStyle) {
return false;
}
RefPtr<ComputedStyle> style =
RefPtr<const ComputedStyle> style =
ResolveFilterStyleForServo(aString, parentStyle, presShell, aError);
if (!style) {
return false;
@ -3409,7 +3409,7 @@ bool CanvasRenderingContext2D::SetFontInternal(const nsACString& aFont,
}
nsCString usedFont;
RefPtr<ComputedStyle> sc =
RefPtr<const ComputedStyle> sc =
GetFontStyleForServo(mCanvasElement, aFont, presShell, usedFont, aError);
if (!sc) {
return false;
@ -3990,7 +3990,7 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText(
textToDraw.Truncate();
}
RefPtr<ComputedStyle> canvasStyle;
RefPtr<const ComputedStyle> canvasStyle;
if (mCanvasElement && mCanvasElement->IsInComposedDoc()) {
// try to find the closest context
canvasStyle = nsComputedDOMStyle::GetComputedStyle(mCanvasElement);

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

@ -354,7 +354,7 @@ bool DrawTargetWebgl::Init(const IntSize& size, const SurfaceFormat format) {
if (!mSkia->Init(size, SurfaceFormat::B8G8R8A8)) {
return false;
}
mSkia->SetPermitSubpixelAA(IsOpaque(format));
SetPermitSubpixelAA(IsOpaque(format));
return true;
}
@ -384,11 +384,13 @@ bool DrawTargetWebgl::SharedContext::Initialize() {
return true;
}
void DrawTargetWebgl::SharedContext::SetBlendState(CompositionOp aOp) {
if (aOp == mLastCompositionOp) {
void DrawTargetWebgl::SharedContext::SetBlendState(
CompositionOp aOp, const Maybe<DeviceColor>& aColor) {
if (aOp == mLastCompositionOp && mLastBlendColor == aColor) {
return;
}
mLastCompositionOp = aOp;
mLastBlendColor = aColor;
// AA is not supported for all composition ops, so switching blend modes may
// cause a toggle in AA state. Certain ops such as OP_SOURCE require output
// alpha that is blended separately from AA coverage. This would require two
@ -400,17 +402,20 @@ void DrawTargetWebgl::SharedContext::SetBlendState(CompositionOp aOp) {
mWebgl->Enable(LOCAL_GL_BLEND);
switch (aOp) {
case CompositionOp::OP_OVER:
mWebgl->BlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA);
if (aColor) {
// If a color is supplied, then we blend subpixel text.
mWebgl->BlendColor(aColor->b, aColor->g, aColor->r, 1.0f);
mWebgl->BlendFunc(LOCAL_GL_CONSTANT_COLOR,
LOCAL_GL_ONE_MINUS_SRC_COLOR);
} else {
mWebgl->BlendFunc(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA);
}
break;
case CompositionOp::OP_ADD:
mWebgl->BlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE, LOCAL_GL_ONE,
LOCAL_GL_ONE);
mWebgl->BlendFunc(LOCAL_GL_ONE, LOCAL_GL_ONE);
break;
case CompositionOp::OP_ATOP:
mWebgl->BlendFuncSeparate(
LOCAL_GL_DST_ALPHA, LOCAL_GL_ONE_MINUS_SRC_ALPHA, LOCAL_GL_DST_ALPHA,
LOCAL_GL_ONE_MINUS_SRC_ALPHA);
mWebgl->BlendFunc(LOCAL_GL_DST_ALPHA, LOCAL_GL_ONE_MINUS_SRC_ALPHA);
break;
case CompositionOp::OP_SOURCE:
default:
@ -1329,9 +1334,6 @@ bool DrawTargetWebgl::SharedContext::DrawRectAccel(
return false;
}
// Map the composition op to a WebGL blend mode, if possible.
SetBlendState(aOptions.mCompositionOp);
// Set up the scissor test to reflect the clipping rectangle, if supplied.
bool scissor = false;
if (!mClipRect.Contains(IntRect(IntPoint(), mViewportSize))) {
@ -1376,6 +1378,8 @@ bool DrawTargetWebgl::SharedContext::DrawRectAccel(
break;
}
}
// Map the composition op to a WebGL blend mode, if possible.
SetBlendState(aOptions.mCompositionOp);
// Since it couldn't be mapped to a scissored clear, we need to use the
// solid color shader with supplied transform.
if (mLastProgram != mSolidProgram) {
@ -1573,6 +1577,11 @@ bool DrawTargetWebgl::SharedContext::DrawRectAccel(
}
}
// Map the composition op to a WebGL blend mode, if possible. If there is
// a mask color and a texture with multiple channels, assume subpixel
// blending.
SetBlendState(aOptions.mCompositionOp,
format != SurfaceFormat::A8 ? aMaskColor : Nothing());
// Switch to the image shader and set up relevant transforms.
if (mLastProgram != mImageProgram) {
mWebgl->UseProgram(mImageProgram);
@ -1599,10 +1608,13 @@ bool DrawTargetWebgl::SharedContext::DrawRectAccel(
{(const uint8_t*)&aaData, sizeof(aaData)});
mDirtyAA = !!aStrokeOptions;
}
DeviceColor color = aMaskColor.valueOr(DeviceColor(1, 1, 1, 1));
DeviceColor color = aMaskColor && format != SurfaceFormat::A8
? DeviceColor::Mask(1.0f, aMaskColor->a)
: aMaskColor.valueOr(DeviceColor(1, 1, 1, 1));
float a = color.a * aOptions.mAlpha;
float colorData[4] = {color.b * a, color.g * a, color.r * a, a};
float swizzleData = aMaskColor ? 1.0f : 0.0f;
float swizzleData =
aMaskColor && format == SurfaceFormat::A8 ? 1.0f : 0.0f;
Matrix xform(aRect.width, 0.0f, 0.0f, aRect.height, aRect.x, aRect.y);
if (aTransformed) {
xform *= currentTransform;
@ -2140,8 +2152,8 @@ void DrawTargetWebgl::MaskSurface(const Pattern& aSource, SourceSurface* aMask,
}
// Extract the surface's alpha values into an A8 surface.
static already_AddRefed<DataSourceSurface> ExtractAlpha(
SourceSurface* aSurface) {
static already_AddRefed<DataSourceSurface> ExtractAlpha(SourceSurface* aSurface,
bool aAllowSubpixelAA) {
RefPtr<DataSourceSurface> surfaceData = aSurface->GetDataSurface();
if (!surfaceData) {
return nullptr;
@ -2160,8 +2172,12 @@ static already_AddRefed<DataSourceSurface> ExtractAlpha(
if (!dstMap.IsMapped()) {
return nullptr;
}
SwizzleData(srcMap.GetData(), srcMap.GetStride(), surfaceData->GetFormat(),
dstMap.GetData(), dstMap.GetStride(), SurfaceFormat::A8, size);
// For subpixel masks, ignore the alpha and instead sample one of the color
// channels as if they were alpha.
SwizzleData(
srcMap.GetData(), srcMap.GetStride(),
aAllowSubpixelAA ? SurfaceFormat::A8R8G8B8 : surfaceData->GetFormat(),
dstMap.GetData(), dstMap.GetStride(), SurfaceFormat::A8, size);
return alpha.forget();
}
@ -2491,12 +2507,14 @@ bool DrawTargetWebgl::SharedContext::FillGlyphsAccel(
xformBounds.Inflate(2);
IntRect intBounds = RoundedOut(xformBounds);
// Whether to render the text as a full color result as opposed to as a
// grayscale mask. Subpixel AA or fonts with color glyphs require this.
// We currently have to check to check the rasterized result to see if
// there are any color glyphs as there is not yet a way to a priori know
// this.
bool useColor = aUseSubpixelAA;
// Whether the font may use bitmaps. If so, we need to render the glyphs with
// color as grayscale bitmaps will use the color while color emoji will not,
// with no easy way to know ahead of time. We currently have to check the
// rasterized result to see if there are any color glyphs. To render subpixel
// masks, we need to know that the rasterized result actually represents a
// subpixel mask rather than try to interpret it as a normal RGBA result such
// as for color emoji.
bool useBitmaps = aFont->MayUseBitmaps();
// Look for an existing glyph cache on the font. If not there, create it.
GlyphCache* cache =
@ -2508,9 +2526,13 @@ bool DrawTargetWebgl::SharedContext::FillGlyphsAccel(
}
// Hash the incoming text run and looking for a matching entry.
DeviceColor color = static_cast<const ColorPattern&>(aPattern).mColor;
DeviceColor aaColor = useColor ? color : DeviceColor(1.0f, 1.0f, 1.0f, 1.0f);
RefPtr<GlyphCacheEntry> entry =
cache->FindOrInsertEntry(aBuffer, aaColor, currentTransform, intBounds);
// If the font has bitmaps, use the color directly. Otherwise, the texture
// will hold a grayscale mask, so encode the key's subpixel state in the
// color.
RefPtr<GlyphCacheEntry> entry = cache->FindOrInsertEntry(
aBuffer,
useBitmaps ? color : DeviceColor::Mask(aUseSubpixelAA ? 1 : 0, 1),
currentTransform, intBounds);
if (!entry) {
return false;
}
@ -2524,10 +2546,9 @@ bool DrawTargetWebgl::SharedContext::FillGlyphsAccel(
// texture.
SurfacePattern pattern(nullptr, ExtendMode::CLAMP,
Matrix::Translation(intBounds.TopLeft()));
if (DrawRectAccel(
Rect(intBounds), pattern, aOptions,
handle->GetFormat() == SurfaceFormat::A8 ? Some(color) : Nothing(),
&handle, false, true, true)) {
if (DrawRectAccel(Rect(intBounds), pattern, aOptions,
useBitmaps ? Nothing() : Some(color), &handle, false,
true, true)) {
return true;
}
} else {
@ -2536,28 +2557,34 @@ bool DrawTargetWebgl::SharedContext::FillGlyphsAccel(
// If we get here, either there wasn't a cached texture handle or it
// wasn't valid. Render the text run into a temporary target.
RefPtr<DrawTargetSkia> textDT = new DrawTargetSkia;
if (textDT->Init(intBounds.Size(), SurfaceFormat::B8G8R8A8)) {
if (textDT->Init(intBounds.Size(), !useBitmaps && !aUseSubpixelAA
? SurfaceFormat::A8
: SurfaceFormat::B8G8R8A8)) {
textDT->SetTransform(currentTransform *
Matrix::Translation(-intBounds.TopLeft()));
textDT->SetPermitSubpixelAA(aUseSubpixelAA);
DrawOptions drawOptions(1.0f, CompositionOp::OP_OVER,
aOptions.mAntialiasMode);
textDT->FillGlyphs(aFont, aBuffer, ColorPattern(aaColor), drawOptions);
// If bitmaps might be used, then we have to supply the color, as color
// emoji may ignore it while grayscale bitmaps may use it, with no way to
// know ahead of time. Otherwise, assume the output will be a mask and
// just render it white to determine intensity.
textDT->FillGlyphs(
aFont, aBuffer,
ColorPattern(useBitmaps ? color : DeviceColor(1, 1, 1, 1)),
drawOptions);
RefPtr<SourceSurface> textSurface = textDT->Snapshot();
if (textSurface) {
if (!useColor) {
// If we don't expect the text surface to contain color glyphs
// such as from subpixel AA, then do one final check to see if
// any ended up in the result. If not, extract the alpha values
// from the surface so we can render it as a mask.
if (CheckForColorGlyphs(textSurface)) {
useColor = true;
} else {
textSurface = ExtractAlpha(textSurface);
if (!textSurface) {
// Failed extracting alpha for the text surface...
return false;
}
// If we don't expect the text surface to contain color glyphs
// such as from subpixel AA, then do one final check to see if
// any ended up in the result. If not, extract the alpha values
// from the surface so we can render it as a mask.
if (textSurface->GetFormat() != SurfaceFormat::A8 &&
!CheckForColorGlyphs(textSurface)) {
textSurface = ExtractAlpha(textSurface, !useBitmaps);
if (!textSurface) {
// Failed extracting alpha for the text surface...
return false;
}
}
// Attempt to upload the rendered text surface into a texture
@ -2565,7 +2592,7 @@ bool DrawTargetWebgl::SharedContext::FillGlyphsAccel(
SurfacePattern pattern(textSurface, ExtendMode::CLAMP,
Matrix::Translation(intBounds.TopLeft()));
if (DrawRectAccel(Rect(intBounds), pattern, aOptions,
useColor ? Nothing() : Some(color), &handle, false,
useBitmaps ? Nothing() : Some(color), &handle, false,
true) &&
handle) {
// If drawing succeeded, then the text surface was uploaded to
@ -2595,7 +2622,8 @@ void DrawTargetWebgl::FillGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer,
}
bool useSubpixelAA =
GetPermitSubpixelAA() &&
(aaMode == AntialiasMode::DEFAULT || aaMode == AntialiasMode::SUBPIXEL);
(aaMode == AntialiasMode::DEFAULT || aaMode == AntialiasMode::SUBPIXEL) &&
aOptions.mCompositionOp == CompositionOp::OP_OVER;
if (mWebglValid && SupportsDrawOptions(aOptions) &&
aPattern.GetType() == PatternType::COLOR && PrepareContext() &&

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

@ -164,7 +164,10 @@ class DrawTargetWebgl : public DrawTarget, public SupportsWeakPtr {
uint32_t mMaxTextureSize = 0;
// The current blending operation.
CompositionOp mLastCompositionOp = CompositionOp::OP_SOURCE;
// The constant blend color used for the blending operation.
Maybe<DeviceColor> mLastBlendColor;
// A most-recently-used list of allocated texture handles.
LinkedList<RefPtr<TextureHandle>> mTextureHandles;
@ -201,7 +204,8 @@ class DrawTargetWebgl : public DrawTarget, public SupportsWeakPtr {
bool Initialize();
bool CreateShaders();
void SetBlendState(CompositionOp aOp);
void SetBlendState(CompositionOp aOp,
const Maybe<DeviceColor>& aBlendColor = Nothing());
void SetClipRect(const IntRect& aClipRect) { mClipRect = aClipRect; }

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

@ -6458,22 +6458,25 @@ mozilla::ipc::IPCResult ContentParent::RecvStoreUserInteractionAsPermission(
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvTestCookiePermissionDecided(
const MaybeDiscarded<BrowsingContext>& aContext,
mozilla::ipc::IPCResult ContentParent::RecvAsyncShouldAllowAccessFor(
const MaybeDiscarded<BrowsingContext>& aTopContext,
const Principal& aPrincipal,
const TestCookiePermissionDecidedResolver&& aResolver) {
if (aContext.IsNullOrDiscarded()) {
const AsyncShouldAllowAccessForResolver&& aResolver) {
if (aTopContext.IsNullOrDiscarded()) {
return IPC_OK();
}
RefPtr<WindowGlobalParent> wgp =
aContext.get_canonical()->GetCurrentWindowGlobal();
nsCOMPtr<nsICookieJarSettings> cjs = wgp->CookieJarSettings();
ContentBlocking::AsyncShouldAllowAccessFor(aTopContext.get_canonical(),
aPrincipal)
->Then(GetCurrentSerialEventTarget(), __func__,
[aResolver](ContentBlocking::AsyncShouldAllowAccessForPromise::
ResolveOrRejectValue&& aValue) {
bool allowed = aValue.IsResolve();
aResolver(Tuple<const bool&, const uint32_t&>(
allowed, allowed ? 0 : aValue.RejectValue()));
});
Maybe<bool> result =
ContentBlocking::CheckCookiesPermittedDecidesStorageAccessAPI(cjs,
aPrincipal);
aResolver(result);
return IPC_OK();
}

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

@ -1260,10 +1260,10 @@ class ContentParent final : public PContentParent,
mozilla::ipc::IPCResult RecvStoreUserInteractionAsPermission(
const Principal& aPrincipal);
mozilla::ipc::IPCResult RecvTestCookiePermissionDecided(
const MaybeDiscarded<BrowsingContext>& aContext,
mozilla::ipc::IPCResult RecvAsyncShouldAllowAccessFor(
const MaybeDiscarded<BrowsingContext>& aTopContext,
const Principal& aPrincipal,
const TestCookiePermissionDecidedResolver&& aResolver);
const AsyncShouldAllowAccessForResolver&& aResolver);
mozilla::ipc::IPCResult RecvNotifyMediaPlaybackChanged(
const MaybeDiscarded<BrowsingContext>& aContext,

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

@ -1638,9 +1638,9 @@ parent:
async StoreUserInteractionAsPermission(Principal aPrincipal);
async TestCookiePermissionDecided(MaybeDiscardedBrowsingContext aContext,
Principal aPrincipal)
returns (bool? allowed);
async AsyncShouldAllowAccessFor(MaybeDiscardedBrowsingContext aContext,
Principal aPrincipal)
returns (bool allowed, uint32_t rejectReason);
/**
* When media element's controlled state changed in the content process, we

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

@ -34,14 +34,9 @@
*/
#include <stdint.h>
#include <time.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <memory>
#include <assert.h>
#include <limits.h>
#include "gmp-platform.h"
#include "gmp-video-host.h"

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

@ -12,15 +12,11 @@
#include "nsError.h"
#include "pk11pub.h"
#include "sechash.h"
#include "ssl.h"
#include "mozpkix/nss_scoped_ptrs.h"
#include "secerr.h"
#include "sslerr.h"
#include "mozilla/Sprintf.h"
#include "mozilla/dom/CryptoBuffer.h"
#include "mozilla/dom/CryptoKey.h"
#include "ipc/IPCMessageUtils.h"
namespace mozilla {

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

@ -6,8 +6,6 @@
#include "nr_socket_proxy_config.h"
#include "mozilla/dom/ipc/IdType.h"
#include "mozilla/net/NeckoChannelParams.h"
#include "mozilla/net/WebrtcProxyConfig.h"
namespace mozilla {

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

@ -52,7 +52,6 @@
#include <string>
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIEventTarget.h"
#include "nsINamed.h"
@ -63,8 +62,10 @@
#include "mozilla/UniquePtr.h"
extern "C" {
#include "nr_api.h"
#include "async_wait.h"
#include "async_timer.h"
#include "r_errors.h"
#include "r_log.h"
}
namespace mozilla {

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

@ -45,24 +45,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "nr_socket_proxy_config.h"
#include "nsXULAppAPI.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "logging.h"
#include "nspr.h"
#include "nss.h"
#include "pk11pub.h"
#include "plbase64.h"
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsError.h"
#include "nsNetCID.h"
#include "nsServiceManagerUtils.h"
#include "ScopedNSSTypes.h"
#include "runnable_utils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIUUIDGenerator.h"
// nICEr includes
@ -73,19 +66,15 @@ extern "C" {
#include "r_crc32.h"
#include "r_memory.h"
#include "ice_reg.h"
#include "ice_util.h"
#include "transport_addr.h"
#include "nr_crypto.h"
#include "nr_socket.h"
#include "nr_socket_local.h"
#include "stun_client_ctx.h"
#include "stun_reg.h"
#include "stun_server_ctx.h"
#include "stun_util.h"
#include "ice_codeword.h"
#include "ice_ctx.h"
#include "ice_candidate.h"
#include "ice_handler.h"
}
// Local includes
@ -96,10 +85,6 @@ extern "C" {
#include "rlogconnector.h"
#include "test_nr_socket.h"
extern "C" {
#include "mdns_service/mdns_service.h"
}
namespace mozilla {
using std::shared_ptr;

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

@ -50,15 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// nICEr includes
extern "C" {
#include "nr_api.h"
#include "registry.h"
#include "async_timer.h"
#include "ice_util.h"
#include "transport_addr.h"
#include "nr_crypto.h"
#include "nr_socket.h"
#include "nr_socket_local.h"
#include "stun_client_ctx.h"
#include "stun_server_ctx.h"
#include "ice_ctx.h"
#include "ice_candidate.h"
#include "ice_handler.h"

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

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsCOMPtr.h"
#include "nscore.h"
#include "m_cpp_utils.h"

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

@ -43,10 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef nriceresolver_h__
#define nriceresolver_h__
#include <map>
#include <string>
#include "nspr.h"
#include "prnetdb.h"
#include "nsIDNSService.h"
#include "nsIDNSListener.h"
#include "nsICancelable.h"

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

@ -40,15 +40,14 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "nspr.h"
#include "prnetdb.h"
#include "prio.h"
#include "mozilla/Assertions.h"
extern "C" {
#include "nr_api.h"
#include "async_wait.h"
#include "async_timer.h"
#include "nr_resolver.h"
#include "r_macros.h"
#include "transport_addr.h"
}

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

@ -46,8 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <string>
#include "nspr.h"
#include "prnetdb.h"
#include "csi_platform.h"
typedef struct nr_resolver_ nr_resolver;
typedef struct nr_resolver_vtbl_ nr_resolver_vtbl;

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

@ -7,7 +7,6 @@
// nICEr includes
extern "C" {
#include "nr_api.h"
#include "r_memory.h"
#include "local_addr.h"
}

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

@ -7,8 +7,8 @@
#include <string>
#include <vector>
#include "logging.h"
#include "nr_api.h"
#include "nrinterfaceprioritizer.h"
#include "nsCOMPtr.h"
MOZ_MTLOG_MODULE("mtransport")

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

@ -5,7 +5,6 @@
#define nrinterfacepriority_h__
extern "C" {
#include "nr_api.h"
#include "nr_interface_prioritizer.h"
}

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

@ -82,19 +82,15 @@ nrappkit copyright:
extern "C" {
#include "stun_msg.h" // for NR_STUN_MAX_MESSAGE_SIZE
#include "nr_api.h"
#include "async_wait.h"
#include "async_timer.h"
#include "nr_socket.h"
#include "nr_socket_local.h"
#include "stun.h"
#include "stun_hint.h"
#include "transport_addr.h"
}
#include "mozilla/RefPtr.h"
#include "test_nr_socket.h"
#include "runnable_utils.h"
namespace mozilla {

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

@ -94,7 +94,6 @@ extern "C" {
}
#include <set>
#include <vector>
#include <map>
#include <list>
#include <string>

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

@ -7,13 +7,9 @@
// Original author: ekr@rtfm.com
#include <deque>
#include "logging.h"
#include "runnable_utils.h"
#include "transportflow.h"
#include "transportlayer.h"
#include "mozilla/DebugOnly.h"
namespace mozilla {
NS_IMPL_ISUPPORTS0(TransportFlow)

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

@ -6,9 +6,7 @@
// Original author: ekr@rtfm.com
#include "logging.h"
#include "transportflow.h"
#include "transportlayer.h"
#include "nsThreadUtils.h"
// Logging context
namespace mozilla {

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

@ -11,8 +11,6 @@
#include "sigslot.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsIEventTarget.h"

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

@ -19,12 +19,10 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsNetCID.h"
#include "nsServiceManagerUtils.h"
#include "sslexp.h"
#include "sslproto.h"
#include "transportflow.h"
namespace mozilla {

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

@ -18,11 +18,8 @@
# include <Security/CipherSuite.h>
#endif
#include "sigslot.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/TimeStamp.h"
#include "nsCOMPtr.h"
#include "nsITimer.h"
#include "ScopedNSSTypes.h"

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

@ -41,36 +41,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <string>
#include <vector>
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsError.h"
#include "nsNetCID.h"
#include "nsServiceManagerUtils.h"
// nICEr includes
extern "C" {
#include "nr_api.h"
#include "registry.h"
#include "async_timer.h"
#include "ice_util.h"
#include "transport_addr.h"
#include "nr_crypto.h"
#include "nr_socket.h"
#include "nr_socket_local.h"
#include "stun_client_ctx.h"
#include "stun_server_ctx.h"
#include "ice_ctx.h"
#include "ice_candidate.h"
#include "ice_handler.h"
}
// Local includes
#include "logging.h"
#include "nricectx.h"
#include "nricemediastream.h"
#include "transportflow.h"
#include "transportlayerice.h"
namespace mozilla {

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

@ -10,17 +10,13 @@
#ifndef transportlayerice_h__
#define transportlayerice_h__
#include <vector>
#include "sigslot.h"
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "m_cpp_utils.h"
#include "nricemediastream.h"
#include "transportflow.h"
#include "transportlayer.h"
// An ICE transport layer -- corresponds to a single ICE

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

@ -7,7 +7,6 @@
// Original author: ekr@rtfm.com
#include "logging.h"
#include "transportflow.h"
#include "transportlayerlog.h"
namespace mozilla {

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

@ -10,7 +10,6 @@
#define transportlayerlog_h__
#include "m_cpp_utils.h"
#include "transportflow.h"
#include "transportlayer.h"
namespace mozilla {

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

@ -7,15 +7,12 @@
// Original author: ekr@rtfm.com
#include "logging.h"
#include "nspr.h"
#include "prlock.h"
#include "nsNetCID.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "transportflow.h"
#include "transportlayerloopback.h"
namespace mozilla {

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

@ -9,11 +9,8 @@
#ifndef transportlayerloopback_h__
#define transportlayerloopback_h__
#include "nspr.h"
#include "prio.h"
#include "prlock.h"
#include <memory>
#include <queue>
#include "nsCOMPtr.h"
@ -21,7 +18,6 @@
#include "nsITimer.h"
#include "m_cpp_utils.h"
#include "transportflow.h"
#include "transportlayer.h"
// A simple loopback transport layer that is used for testing.

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

@ -12,7 +12,6 @@
#include "logging.h"
#include "nsError.h"
#include "mozilla/Assertions.h"
#include "srtp.h"
namespace mozilla {

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

@ -377,7 +377,7 @@ bool nsPlainTextSerializer::IsIgnorableRubyAnnotation(
// Return true if aElement has 'display:none' or if we just don't know.
static bool IsDisplayNone(Element* aElement) {
RefPtr<ComputedStyle> computedStyle =
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement);
return !computedStyle ||
computedStyle->StyleDisplay()->mDisplay == StyleDisplay::None;
@ -1689,7 +1689,7 @@ bool nsPlainTextSerializer::IsElementPreformatted() const {
}
bool nsPlainTextSerializer::IsElementPreformatted(Element* aElement) {
RefPtr<ComputedStyle> computedStyle =
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement);
if (computedStyle) {
const nsStyleText* textStyle = computedStyle->StyleText();
@ -1700,7 +1700,7 @@ bool nsPlainTextSerializer::IsElementPreformatted(Element* aElement) {
}
bool nsPlainTextSerializer::IsCssBlockLevelElement(Element* aElement) {
RefPtr<ComputedStyle> computedStyle =
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement);
if (computedStyle) {
const nsStyleDisplay* displayStyle = computedStyle->StyleDisplay();

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

@ -633,7 +633,7 @@ bool nsXHTMLContentSerializer::IsElementPreformatted(nsIContent* aNode) {
if (!aNode->IsElement()) {
return false;
}
RefPtr<ComputedStyle> computedStyle =
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aNode->AsElement());
if (computedStyle) {
const nsStyleText* textStyle = computedStyle->StyleText();

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

@ -23,7 +23,7 @@ namespace mozilla {
// Class Methods
SMILCSSProperty::SMILCSSProperty(nsCSSPropertyID aPropID,
dom::Element* aElement,
ComputedStyle* aBaseComputedStyle)
const ComputedStyle* aBaseComputedStyle)
: mPropID(aPropID),
mElement(aElement),
mBaseComputedStyle(aBaseComputedStyle) {

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

@ -38,7 +38,7 @@ class SMILCSSProperty : public SMILAttr {
* the SMILCSSValueType will be returned.
*/
SMILCSSProperty(nsCSSPropertyID aPropID, dom::Element* aElement,
ComputedStyle* aBaseComputedStyle);
const ComputedStyle* aBaseComputedStyle);
// SMILAttr methods
virtual nsresult ValueFromString(
@ -71,7 +71,7 @@ class SMILCSSProperty : public SMILAttr {
// As with mElement, since a SMILAttr only lives as long as the
// compositing step and since ComposeAttribute holds an owning reference to
// the base ComputedStyle, we can use a non-owning reference here.
ComputedStyle* mBaseComputedStyle;
const ComputedStyle* mBaseComputedStyle;
};
} // namespace mozilla

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

@ -410,11 +410,10 @@ nsresult SMILCSSValueType::Interpolate(const SMILValue& aStartVal,
return InterpolateForServo(startWrapper, *endWrapper, aUnitDistance, aResult);
}
static ServoAnimationValues ValueFromStringHelper(nsCSSPropertyID aPropID,
Element* aTargetElement,
nsPresContext* aPresContext,
ComputedStyle* aComputedStyle,
const nsAString& aString) {
static ServoAnimationValues ValueFromStringHelper(
nsCSSPropertyID aPropID, Element* aTargetElement,
nsPresContext* aPresContext, const ComputedStyle* aComputedStyle,
const nsAString& aString) {
ServoAnimationValues result;
Document* doc = aTargetElement->GetComposedDoc();
@ -461,7 +460,7 @@ void SMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
return;
}
RefPtr<ComputedStyle> computedStyle =
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyle(aTargetElement);
if (!computedStyle) {
return;

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

@ -49,7 +49,7 @@ void SMILCompositor::ComposeAttribute(bool& aMightHavePendingStyleUpdates) {
// If we might need to resolve base styles, grab a suitable ComputedStyle
// for initializing our SMILAttr with.
RefPtr<ComputedStyle> baseComputedStyle;
RefPtr<const ComputedStyle> baseComputedStyle;
if (MightNeedBaseStyle()) {
baseComputedStyle = nsComputedDOMStyle::GetUnanimatedComputedStyleNoFlush(
mKey.mElement, PseudoStyleType::NotPseudo);
@ -122,7 +122,7 @@ void SMILCompositor::ClearAnimationEffects() {
// Protected Helper Functions
// --------------------------
UniquePtr<SMILAttr> SMILCompositor::CreateSMILAttr(
ComputedStyle* aBaseComputedStyle) {
const ComputedStyle* aBaseComputedStyle) {
nsCSSPropertyID propID = GetCSSPropertyToAnimate();
if (propID != eCSSProperty_UNKNOWN) {

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

@ -79,7 +79,7 @@ class SMILCompositor : public PLDHashEntryHdr {
//
// @param aBaseComputedStyle An optional ComputedStyle which, if set, will be
// used when fetching the base style.
UniquePtr<SMILAttr> CreateSMILAttr(ComputedStyle* aBaseComputedStyle);
UniquePtr<SMILAttr> CreateSMILAttr(const ComputedStyle* aBaseComputedStyle);
// Returns the CSS property this compositor should animate, or
// eCSSProperty_UNKNOWN if this compositor does not animate a CSS property.

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

@ -325,7 +325,7 @@ Float SVGContentUtils::GetStrokeWidth(SVGElement* aElement,
SVGContextPaint* aContextPaint) {
Float res = 0.0;
auto doCompute = [&](ComputedStyle const* computedStyle) {
auto doCompute = [&](const ComputedStyle* computedStyle) {
const nsStyleSVG* styleSVG = computedStyle->StyleSVG();
if (styleSVG->mStrokeWidth.IsContextValue()) {
@ -366,7 +366,7 @@ float SVGContentUtils::GetFontSize(Element* aElement) {
return GetFontSize(f->Style(), pc);
}
if (RefPtr<ComputedStyle> style =
if (RefPtr<const ComputedStyle> style =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement)) {
return GetFontSize(style, pc);
}
@ -381,7 +381,7 @@ float SVGContentUtils::GetFontSize(nsIFrame* aFrame) {
return GetFontSize(aFrame->Style(), aFrame->PresContext());
}
float SVGContentUtils::GetFontSize(ComputedStyle* aComputedStyle,
float SVGContentUtils::GetFontSize(const ComputedStyle* aComputedStyle,
nsPresContext* aPresContext) {
MOZ_ASSERT(aComputedStyle);
MOZ_ASSERT(aPresContext);
@ -404,7 +404,7 @@ float SVGContentUtils::GetFontXHeight(Element* aElement) {
return GetFontXHeight(f->Style(), pc);
}
if (RefPtr<ComputedStyle> style =
if (RefPtr<const ComputedStyle> style =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement)) {
return GetFontXHeight(style, pc);
}
@ -419,7 +419,7 @@ float SVGContentUtils::GetFontXHeight(nsIFrame* aFrame) {
return GetFontXHeight(aFrame->Style(), aFrame->PresContext());
}
float SVGContentUtils::GetFontXHeight(ComputedStyle* aComputedStyle,
float SVGContentUtils::GetFontXHeight(const ComputedStyle* aComputedStyle,
nsPresContext* aPresContext) {
MOZ_ASSERT(aComputedStyle && aPresContext);

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

@ -167,7 +167,7 @@ class SVGContentUtils {
*/
static float GetFontSize(mozilla::dom::Element* aElement);
static float GetFontSize(nsIFrame* aFrame);
static float GetFontSize(ComputedStyle*, nsPresContext*);
static float GetFontSize(const ComputedStyle*, nsPresContext*);
/*
* Get the number of CSS px (user units) per ex (i.e. the x-height in user
* units) for an nsIContent
@ -177,7 +177,7 @@ class SVGContentUtils {
*/
static float GetFontXHeight(mozilla::dom::Element* aElement);
static float GetFontXHeight(nsIFrame* aFrame);
static float GetFontXHeight(ComputedStyle*, nsPresContext*);
static float GetFontXHeight(const ComputedStyle*, nsPresContext*);
/*
* Report a localized error message to the error console.

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

@ -235,7 +235,7 @@ bool DoForComputedStyle(const SVGElement* aElement, Func aFunc) {
return true;
}
if (RefPtr<ComputedStyle> computedStyle =
if (RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement)) {
aFunc(computedStyle.get());
return true;

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