Merge inbound to mozilla-central. a=merge

This commit is contained in:
Csoregi Natalia 2018-08-08 12:58:36 +03:00
Родитель 12a50f2d0e 7786b357e9
Коммит 0f4d50ff52
245 изменённых файлов: 2499 добавлений и 12708 удалений

42
Cargo.lock сгенерированный
Просмотреть файл

@ -28,15 +28,6 @@ dependencies = [
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "app_units"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "app_units"
version = "0.7.0"
@ -676,14 +667,6 @@ name = "error-chain"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "euclid"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "euclid"
version = "0.19.0"
@ -1152,9 +1135,9 @@ dependencies = [
name = "malloc_size_of"
version = "0.0.1"
dependencies = [
"app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
"selectors 0.19.0",
"servo_arc 0.1.1",
@ -1581,7 +1564,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "plane-split"
version = "0.12.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1962,7 +1945,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "style"
version = "0.0.1"
dependencies = [
"app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1970,7 +1953,7 @@ dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fallible 0.0.1",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
@ -1992,7 +1975,7 @@ dependencies = [
"parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"servo_arc 0.1.1",
"smallbitvec 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2023,10 +2006,10 @@ dependencies = [
name = "style_traits"
version = "0.0.1"
dependencies = [
"app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"selectors 0.19.0",
@ -2041,12 +2024,11 @@ dependencies = [
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
"geckoservo 0.0.1",
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"size_of_test 0.0.1",
"smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2387,7 +2369,7 @@ dependencies = [
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2559,7 +2541,6 @@ dependencies = [
"checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45"
"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29069a9b483f7780aebb55dafb360c6225eefdc1f98c8d336a65148fd10c37b1"
"checksum app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9dadc668390b373e73e4abbfc1f07238b09a25858f2f39c06cebc6d8e141d774"
"checksum arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0ef4a9820019a0c91d918918c93dc71d469f581a49b47ddc1d285d4270bbe2"
"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2"
@ -2623,7 +2604,6 @@ dependencies = [
"checksum encoding_rs 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88a1b66a0d28af4b03a8c8278c6dcb90e6e600d89c14500a9e7a02e64b9ee3ac"
"checksum env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0561146661ae44c579e993456bc76d11ce1e0c7d745e57b2fa7146b6e49fa2ad"
"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
"checksum euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47d5eb6310c8dd3e79f973952ddcb180bf6a98c01d341add49126a094b5598cc"
"checksum euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70a2ebdf55fb9d6329046e026329a55ef8fbaae5ea833f56e170beb3125a8a5f"
"checksum fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "85cb8fec437468d86dc7c83ca7cfc933341d561873275f22dd5eedefa63a6478"
"checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909"
@ -2704,7 +2684,7 @@ dependencies = [
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum plane-split 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f0a0766225cf828672e97948dfa035bb2eae75110757359ae12fbb46509c8b66"
"checksum plane-split 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3a4fc9e31d70eb6828e9a2d7a401a824d9f281686a39a8fc06f08796edb1bb"
"checksum podio 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e5422a1ee1bc57cc47ae717b0137314258138f38fd5f3cea083f43a9725383a0"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4"

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

@ -9,15 +9,6 @@
* Tab previews utility, produces thumbnails
*/
var tabPreviews = {
init: function tabPreviews_init() {
if (this._selectedTab)
return;
this._selectedTab = gBrowser.selectedTab;
gBrowser.tabContainer.addEventListener("TabSelect", this);
gBrowser.tabContainer.addEventListener("SSTabRestored", this);
},
get aspectRatio() {
let { PageThumbUtils } = ChromeUtils.import("resource://gre/modules/PageThumbUtils.jsm", {});
let [ width, height ] = PageThumbUtils.getThumbnailSize(window);
@ -70,33 +61,6 @@ var tabPreviews = {
});
return canvas;
},
handleEvent: function tabPreviews_handleEvent(event) {
switch (event.type) {
case "TabSelect":
if (this._selectedTab &&
this._selectedTab.parentNode &&
!this._pendingUpdate) {
// Generate a thumbnail for the tab that was selected.
// The timeout keeps the UI snappy and prevents us from generating thumbnails
// for tabs that will be closed. During that timeout, don't generate other
// thumbnails in case multiple TabSelect events occur fast in succession.
this._pendingUpdate = true;
setTimeout(function(self, aTab) {
self._pendingUpdate = false;
if (aTab.parentNode &&
!aTab.hasAttribute("busy") &&
!aTab.hasAttribute("pending"))
self.capture(aTab, true);
}, 2000, this, this._selectedTab);
}
this._selectedTab = event.target;
break;
case "SSTabRestored":
this.capture(event.target, true);
break;
}
}
};
var tabPreviewPanelHelper = {
@ -206,8 +170,6 @@ var ctrlTab = {
init: function ctrlTab_init() {
if (!this._recentlyUsedTabs) {
tabPreviews.init();
this._initRecentlyUsedTabs();
this._init(true);
}

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

@ -18,6 +18,8 @@ registerCleanupFunction(function() {
// offline cache events.
//
function contentTask() {
ChromeUtils.import("resource://gre/modules/Timer.jsm");
let resolve;
let promise = new Promise(r => { resolve = r; });

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

@ -24,6 +24,8 @@ const whitelist = {
]),
modules: new Set([
"chrome://mochikit/content/ShutdownLeaksCollector.jsm",
"resource://specialpowers/specialpowers.js",
"resource://specialpowers/specialpowersAPI.js",
// General utilities
"resource://gre/modules/AppConstants.jsm",

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

@ -92,6 +92,7 @@ add_task(async function test_displayURI_camera() {
add_task(async function test_displayURI_geo_blob() {
await check(async function() {
Cu.importGlobalProperties(["Blob"]);
let text = "<script>navigator.geolocation.getCurrentPosition(() => {})</script>";
let blob = new Blob([text], {type: "text/html"});
let url = content.URL.createObjectURL(blob);
@ -101,6 +102,7 @@ add_task(async function test_displayURI_geo_blob() {
add_task(async function test_displayURI_camera_blob() {
await check(async function() {
Cu.importGlobalProperties(["Blob"]);
let text = "<script>navigator.mediaDevices.getUserMedia({video: true, fake: true})</script>";
let blob = new Blob([text], {type: "text/html"});
let url = content.URL.createObjectURL(blob);

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

@ -3,6 +3,7 @@
/* eslint-env mozilla/frame-script */
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "MediaManagerService",
"@mozilla.org/mediaManagerService;1",

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

@ -65,7 +65,7 @@ test_newtab({
// it should be able to click the topsites edit button to reveal the edit topsites modal and overlay.
test: async function topsites_add() {
let nativeInputValueSetter = Object.getOwnPropertyDescriptor(content.window.HTMLInputElement.prototype, "value").set;
let event = new Event("input", {bubbles: true});
let event = new content.Event("input", {bubbles: true});
// Find the add topsites button
content.document.querySelector(".top-sites .section-top-bar .context-menu-button").click();

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

@ -90,12 +90,12 @@ let PaymentFrameScript = {
},
getDefaultPreferences() {
let prefValues = {
let prefValues = Cu.cloneInto({
saveCreditCardDefaultChecked:
Services.prefs.getBoolPref(SAVE_CREDITCARD_DEFAULT_PREF, false),
saveAddressDefaultChecked:
Services.prefs.getBoolPref(SAVE_ADDRESS_DEFAULT_PREF, false),
};
}, waivedContent);
return prefValues;
},
};

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

@ -323,7 +323,7 @@ function loadUITourTestPage(callback, host = "https://example.org/") {
let callbacksCalled = 0;
let resolveCallbackPromise;
let allCallbacksCalledPromise = new Promise(resolve => resolveCallbackPromise = resolve);
let argumentsWithFunctions = contentArgs.args.map((arg, index) => {
let argumentsWithFunctions = Cu.cloneInto(contentArgs.args.map((arg, index) => {
if (arg === "" && contentArgs.fnIndices.includes(index)) {
return function() {
callbacksCalled++;
@ -334,9 +334,9 @@ function loadUITourTestPage(callback, host = "https://example.org/") {
};
}
return arg;
});
}), content, {cloneFunctions: true});
let rv = contentWin.Mozilla.UITour[contentArgs.methodName].apply(contentWin.Mozilla.UITour,
argumentsWithFunctions);
argumentsWithFunctions);
if (contentArgs.fnIndices.length) {
await allCallbacksCalledPromise;
}

6
config/external/nspr/pr/moz.build поставляемый
Просмотреть файл

@ -93,8 +93,12 @@ elif CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['DO_NOT_WAIT_FOR_CONNECT_OVERLAPPED_OPERATIONS'] = True
if CONFIG['CPU_ARCH'] == 'x86_64':
DEFINES['_AMD64_'] = True
else:
elif CONFIG['CPU_ARCH'] == 'x86':
DEFINES['_X86_'] = True
elif CONFIG['CPU_ARCH'] == 'aarch64':
DEFINES['_ARM64_'] = True
else:
error('Unsupported CPU_ARCH value: %s' % CONFIG['CPU_ARCH'])
else:
error('Not a supported OS_TARGET for NSPR in moz.build: "%s". Use --with-system-nspr' % CONFIG['OS_TARGET'])

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

@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 78
Version 79
Comparison: https://github.com/devtools-html/debugger.html/compare/release-77...release-78
Comparison: https://github.com/devtools-html/debugger.html/compare/release-78...release-79
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.2

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

@ -1,3 +1,6 @@
.A11y-mouse :focus {
outline: 0;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
@ -124,7 +127,6 @@
button {
background: transparent;
outline: none;
border: none;
}
@ -910,10 +912,6 @@ html[dir="rtl"] .tree-node img.arrow {
padding: 0;
}
.close-btn:focus {
outline: none;
}
.close-btn .close {
mask: url("chrome://devtools/skin/images/debugger/close.svg") no-repeat;
mask-size: 100%;
@ -966,10 +964,6 @@ img.close::before {
fill: currentColor;
}
.command-bar-button:focus {
outline: none;
}
.command-bar-button:disabled {
opacity: 0.8;
cursor: default;
@ -1093,10 +1087,6 @@ html .toggle-button.end.vertical svg {
line-height: 40px;
}
.search-field input:focus {
outline: none;
}
.theme-dark .search-field input {
color: var(--theme-body-color-inactive);
}
@ -1395,10 +1385,6 @@ html .toggle-button.end.vertical svg {
overflow: hidden;
}
.sources-list .tree:focus {
outline: none;
}
.sources-list .managed-tree {
flex: 1;
display: flex;
@ -1889,10 +1875,6 @@ menuseparator {
background: var(--theme-toolbar-background-hover);
}
.source-footer > .commands > button.action:focus {
outline: none;
}
:root.theme-dark .source-footer > .commands > .action {
fill: var(--theme-body-color);
}
@ -1974,10 +1956,6 @@ menuseparator {
padding: 0 13px;
}
.search-bottom-bar button:focus {
outline: none;
}
.search-bottom-bar .search-modifiers {
display: flex;
align-items: center;
@ -2011,10 +1989,6 @@ menuseparator {
background: var(--theme-toolbar-background-hover);
}
.search-bottom-bar .search-modifiers button:active {
outline: none;
}
.search-bottom-bar .search-modifiers button.active svg {
fill: var(--theme-selection-background);
}
@ -2037,10 +2011,6 @@ menuseparator {
color: var(--theme-comment);
}
.search-bottom-bar .search-type-toggles .search-type-btn:active {
outline: none;
}
.search-bottom-bar .search-type-toggles .search-type-btn.active {
color: var(--theme-selection-background);
}
@ -3264,7 +3234,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
}
.input-expression:focus {
outline: none;
cursor: text;
}
@ -3345,10 +3314,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
.expression-input {
max-width: 50%;
}
.expressions-list .tree:focus {
outline: none;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
@ -3486,7 +3451,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
.frames ul li:hover,
.frames ul li:focus {
background-color: var(--theme-toolbar-background-alt);
outline: none;
}
.theme-dark .frames ul li:focus {
@ -3671,7 +3635,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
display: flex;
margin-left: auto;
padding-right: 5px;
outline: 0;
}
.accordion .header-buttons .add-button {
@ -3684,7 +3647,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
color: var(--theme-body-color);
border: none;
background: none;
outline: 0;
padding: 0;
width: 16px;
height: 16px;
@ -3886,10 +3848,6 @@ html[dir="rtl"] .object-node {
overflow: auto;
}
.scopes-list .tree:focus {
outline: none;
}
.scopes-list .function-signature {
display: inline-block;
}

1003
devtools/client/debugger/new/dist/vendors.js поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -31,6 +31,13 @@ function loadFromPrefs(actions) {
}
}
async function loadInitialState() {
const pendingBreakpoints = await _prefs.asyncStore.pendingBreakpoints;
return {
pendingBreakpoints
};
}
async function onConnect(connection, {
services,
toolboxActions
@ -41,6 +48,7 @@ async function onConnect(connection, {
}
const commands = firefox.clientCommands;
const initialState = await loadInitialState();
const {
store,
actions,
@ -48,7 +56,7 @@ async function onConnect(connection, {
} = (0, _bootstrap.bootstrapStore)(commands, {
services,
toolboxActions
});
}, initialState);
const workers = (0, _bootstrap.bootstrapWorkers)();
await firefox.onConnect(connection, actions);
await loadFromPrefs(actions);

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

@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require("devtools/client/shared/vendor/react");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
class A11yIntention extends _react2.default.Component {
constructor(...args) {
var _temp;
return _temp = super(...args), this.state = {
keyboard: false
}, this.handleKeyDown = () => {
this.setState({
keyboard: true
});
}, this.handleMouseDown = () => {
this.setState({
keyboard: false
});
}, _temp;
}
render() {
return _react2.default.createElement("div", {
className: this.state.keyboard ? "A11y-keyboard" : "A11y-mouse",
onKeyDown: this.handleKeyDown,
onMouseDown: this.handleMouseDown
}, this.props.children);
}
}
exports.default = A11yIntention;

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

@ -20,6 +20,10 @@ var _actions = require("../actions/index");
var _actions2 = _interopRequireDefault(_actions);
var _A11yIntention = require("./A11yIntention");
var _A11yIntention2 = _interopRequireDefault(_A11yIntention);
var _ShortcutsModal = require("./ShortcutsModal");
var _selectors = require("../selectors/index");
@ -277,10 +281,10 @@ class App extends _react.Component {
} = this.props;
return _react2.default.createElement("div", {
className: "debugger"
}, this.renderLayout(), quickOpenEnabled === true && _react2.default.createElement(_QuickOpenModal2.default, {
}, _react2.default.createElement(_A11yIntention2.default, null, this.renderLayout(), quickOpenEnabled === true && _react2.default.createElement(_QuickOpenModal2.default, {
shortcutsModalEnabled: this.state.shortcutsModalEnabled,
toggleShortcutsModal: () => this.toggleShortcutsModal()
}), this.renderShortcutsModal());
}), this.renderShortcutsModal()));
}
}

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

@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ExceptionOption;
var _react = require("devtools/client/shared/vendor/react");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
function ExceptionOption({
className,
isChecked = false,
label,
onChange
}) {
return _react2.default.createElement("div", {
className: className,
onClick: onChange
}, _react2.default.createElement("input", {
type: "checkbox",
checked: isChecked ? "checked" : "",
onChange: e => e.stopPropagation() && onChange()
}), _react2.default.createElement("div", {
className: "breakpoint-exceptions-label"
}, label));
}

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

@ -14,6 +14,10 @@ var _classnames2 = _interopRequireDefault(_classnames);
var _reactRedux = require("devtools/client/shared/vendor/react-redux");
var _ExceptionOption = require("./ExceptionOption");
var _ExceptionOption2 = _interopRequireDefault(_ExceptionOption);
var _Breakpoint = require("./Breakpoint");
var _Breakpoint2 = _interopRequireDefault(_Breakpoint);
@ -37,19 +41,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
function createExceptionOption(label, value, onChange, className) {
return _react2.default.createElement("div", {
className: className,
onClick: onChange
}, _react2.default.createElement("input", {
type: "checkbox",
checked: value ? "checked" : "",
onChange: e => e.stopPropagation() && onChange()
}), _react2.default.createElement("div", {
className: "breakpoint-exceptions-label"
}, label));
}
class Breakpoints extends _react.Component {
renderExceptionsOptions() {
const {
@ -59,13 +50,21 @@ class Breakpoints extends _react.Component {
pauseOnExceptions
} = this.props;
const isEmpty = breakpointSources.length == 0;
const exceptionsBox = createExceptionOption(L10N.getStr("pauseOnExceptionsItem2"), shouldPauseOnExceptions, () => pauseOnExceptions(!shouldPauseOnExceptions, false), "breakpoints-exceptions");
const ignoreCaughtBox = createExceptionOption(L10N.getStr("pauseOnCaughtExceptionsItem"), shouldPauseOnCaughtExceptions, () => pauseOnExceptions(true, !shouldPauseOnCaughtExceptions), "breakpoints-exceptions-caught");
return _react2.default.createElement("div", {
className: (0, _classnames2.default)("breakpoints-exceptions-options", {
empty: isEmpty
})
}, exceptionsBox, shouldPauseOnExceptions ? ignoreCaughtBox : null);
}, _react2.default.createElement(_ExceptionOption2.default, {
className: "breakpoints-exceptions",
label: L10N.getStr("pauseOnExceptionsItem2"),
isChecked: shouldPauseOnExceptions,
onChange: () => pauseOnExceptions(!shouldPauseOnExceptions, false)
}), shouldPauseOnExceptions && _react2.default.createElement(_ExceptionOption2.default, {
className: "breakpoints-exceptions-caught",
label: L10N.getStr("pauseOnCaughtExceptionsItem"),
isChecked: shouldPauseOnCaughtExceptions,
onChange: () => pauseOnExceptions(true, !shouldPauseOnCaughtExceptions)
}));
}
renderBreakpoints() {

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

@ -10,5 +10,6 @@ DIRS += [
DevToolsModules(
'Breakpoint.js',
'BreakpointsContextMenu.js',
'ExceptionOption.js',
'index.js',
)

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

@ -11,6 +11,7 @@ DIRS += [
]
DevToolsModules(
'A11yIntention.js',
'App.js',
'ProjectSearch.js',
'QuickOpenModal.js',

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

@ -400,9 +400,12 @@ function getSelectedFrameBindings(state) {
let frameBindings = [];
while (currentScope && currentScope.type != "object") {
const bindings = Object.keys(currentScope.bindings.variables);
const args = [].concat(...currentScope.bindings.arguments.map(argument => Object.keys(argument)));
frameBindings = [...frameBindings, ...bindings, ...args];
if (currentScope.bindings) {
const bindings = Object.keys(currentScope.bindings.variables);
const args = [].concat(...currentScope.bindings.arguments.map(argument => Object.keys(argument)));
frameBindings = [...frameBindings, ...bindings, ...args];
}
currentScope = currentScope.parent;
}

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

@ -3,15 +3,12 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.initialPendingBreakpointsState = initialPendingBreakpointsState;
exports.getPendingBreakpoints = getPendingBreakpoints;
exports.getPendingBreakpointList = getPendingBreakpointList;
exports.getPendingBreakpointsForSource = getPendingBreakpointsForSource;
var _breakpoint = require("../utils/breakpoint/index");
var _prefs = require("../utils/prefs");
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
@ -20,11 +17,7 @@ var _prefs = require("../utils/prefs");
* Pending breakpoints reducer
* @module reducers/pending-breakpoints
*/
function initialPendingBreakpointsState() {
return restorePendingBreakpoints();
}
function update(state = initialPendingBreakpointsState(), action) {
function update(state = {}, action) {
switch (action.type) {
case "ADD_BREAKPOINT":
{
@ -172,9 +165,4 @@ function getPendingBreakpointsForSource(state, sourceUrl) {
return getPendingBreakpointList(state).filter(pendingBreakpoint => pendingBreakpoint.location.sourceUrl === sourceUrl);
}
function restorePendingBreakpoints() {
return { ..._prefs.prefs.pendingBreakpoints
};
}
exports.default = update;

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

@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.asyncStoreHelper = asyncStoreHelper;
var _asyncStorage = require("devtools/shared/async-storage");
var _asyncStorage2 = _interopRequireDefault(_asyncStorage);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
/*
* asyncStoreHelper wraps asyncStorage so that it is easy to define project
* specific properties. It is similar to PrefsHelper.
*
* e.g.
* const asyncStore = asyncStoreHelper("r", {a: "_a"})
* asyncStore.a // => asyncStorage.getItem("r._a")
* asyncStore.a = 2 // => asyncStorage.setItem("r._a", 2)
*/
function asyncStoreHelper(root, mappings) {
let store = {};
function getMappingKey(key) {
return Array.isArray(mappings[key]) ? mappings[key][0] : mappings[key];
}
function getMappingDefaultValue(key) {
return Array.isArray(mappings[key]) ? mappings[key][1] : null;
}
Object.keys(mappings).map(key => Object.defineProperty(store, key, {
async get() {
const value = await _asyncStorage2.default.getItem(`${root}.${getMappingKey(key)}`);
return value || getMappingDefaultValue(key);
},
set(value) {
return _asyncStorage2.default.setItem(`${root}.${getMappingKey(key)}`, value);
}
}));
store = new Proxy(store, {
set: function (target, property, value, receiver) {
if (!mappings.hasOwnProperty(property)) {
throw new Error(`AsyncStore: ${property} is not defined in mappings`);
}
Reflect.set(...arguments);
return true;
}
});
return store;
}

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

@ -83,7 +83,7 @@ function renderPanel(component, store) {
function bootstrapStore(client, {
services,
toolboxActions
}) {
}, initialState) {
const createStore = (0, _createStore2.default)({
log: (0, _devtoolsEnvironment.isTesting)(),
timing: (0, _devtoolsEnvironment.isDevelopment)(),
@ -95,7 +95,7 @@ function bootstrapStore(client, {
};
}
});
const store = createStore((0, _redux.combineReducers)(_reducers2.default));
const store = createStore((0, _redux.combineReducers)(_reducers2.default), initialState);
store.subscribe(() => updatePrefs(store.getState()));
const actions = (0, _redux.bindActionCreators)(require("../actions/index").default, store.dispatch);
return {
@ -153,6 +153,6 @@ function updatePrefs(state) {
currentPendingBreakpoints = selectors.getPendingBreakpoints(state);
if (previousPendingBreakpoints && currentPendingBreakpoints !== previousPendingBreakpoints) {
_prefs.prefs.pendingBreakpoints = currentPendingBreakpoints;
_prefs.asyncStore.pendingBreakpoints = currentPendingBreakpoints;
}
}

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

@ -70,6 +70,7 @@ function setupHelper(obj) {
const dbg = { ...obj,
selectors,
prefs: _prefs.prefs,
asyncStore: _prefs.asyncStore,
features: _prefs.features,
timings,
getCM,

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

@ -13,6 +13,7 @@ DIRS += [
DevToolsModules(
'assert.js',
'ast.js',
'asyncStoreHelper.js',
'bootstrap.js',
'build-query.js',
'clipboard.js',

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

@ -208,7 +208,7 @@ function generateClientScope(scopes, originalScopes) {
const thisScope = originalScopes.find(scope => scope.bindings.this);
if (thisScope) {
if (result.bindings && thisScope) {
result.bindings.this = thisScope.generatedBindings.this || null;
}

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

@ -44,7 +44,7 @@ function getScope(scope, selectedFrame, frameScopes, why, scopeIndex) {
vars = vars.concat((0, _utils.getFramePopVariables)(why, key));
let thisDesc_ = selectedFrame.this;
if ("this" in bindings) {
if (bindings && "this" in bindings) {
// The presence of "this" means we're rendering a "this" binding
// generated from mapScopes and this can override the binding
// provided by the current frame.

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

@ -15,6 +15,10 @@ var _lodash = require("devtools/client/shared/vendor/lodash");
// Create the tree nodes representing all the variables and arguments
// for the bindings from a scope.
function getBindingVariables(bindings, parentName) {
if (!bindings) {
return [];
}
const args = bindings.arguments.map(arg => (0, _lodash.toPairs)(arg)[0]);
const variables = (0, _lodash.toPairs)(bindings.variables);
return args.concat(variables).map(binding => {

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

@ -3,24 +3,27 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.asyncStore = exports.features = exports.prefs = undefined;
var _devtoolsModules = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-modules"];
var _devtoolsEnvironment = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-environment"];
var _devtoolsServices = require("Services");
var _devtoolsServices2 = _interopRequireDefault(_devtoolsServices);
var _asyncStoreHelper = require("./asyncStoreHelper");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
const {
isDevelopment
} = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-environment"];
const {
PrefsHelper
} = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-modules"];
const Services = require("Services");
const prefsSchemaVersion = "1.0.3";
const pref = Services.pref;
const pref = _devtoolsServices2.default.pref;
if (isDevelopment()) {
if ((0, _devtoolsEnvironment.isDevelopment)()) {
pref("devtools.debugger.alphabetize-outline", false);
pref("devtools.debugger.auto-pretty-print", false);
pref("devtools.source-map.client-service.enabled", true);
@ -68,7 +71,7 @@ if (isDevelopment()) {
pref("devtools.debugger.features.map-expression-bindings", true);
}
const prefs = exports.prefs = new PrefsHelper("devtools", {
const prefs = exports.prefs = new _devtoolsModules.PrefsHelper("devtools", {
alphabetizeOutline: ["Bool", "debugger.alphabetize-outline"],
autoPrettyPrint: ["Bool", "debugger.auto-pretty-print"],
clientSourceMapsEnabled: ["Bool", "source-map.client-service.enabled"],
@ -96,7 +99,7 @@ const prefs = exports.prefs = new PrefsHelper("devtools", {
projectDirectoryRoot: ["Char", "debugger.project-directory-root", ""],
skipPausing: ["Bool", "debugger.skip-pausing"]
});
const features = exports.features = new PrefsHelper("devtools.debugger.features", {
const features = exports.features = new _devtoolsModules.PrefsHelper("devtools.debugger.features", {
asyncStepping: ["Bool", "async-stepping"],
wasm: ["Bool", "wasm"],
shortcuts: ["Bool", "shortcuts"],
@ -116,6 +119,9 @@ const features = exports.features = new PrefsHelper("devtools.debugger.features"
mapExpressionBindings: ["Bool", "map-expression-bindings"],
componentPane: ["Bool", "component-pane"]
});
const asyncStore = exports.asyncStore = (0, _asyncStoreHelper.asyncStoreHelper)("debugger", {
pendingBreakpoints: ["pending-breakpoints", {}]
});
if (prefs.debuggerPrefsSchemaVersion !== prefsSchemaVersion) {
// clear pending Breakpoints

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

@ -8,6 +8,7 @@
var { Toolbox } = require("devtools/client/framework/toolbox");
var { Task } = require("devtools/shared/task");
var asyncStorage = require("devtools/shared/async-storage");
const sourceUtils = {
isLoaded: source => source.loadedState === "loaded"
@ -481,6 +482,8 @@ function createDebuggerContext(toolbox) {
* Clear all the debugger related preferences.
*/
function clearDebuggerPreferences() {
asyncStorage.clear();
Services.prefs.clearUserPref("devtools.recordreplay.enabled");
Services.prefs.clearUserPref("devtools.debugger.pause-on-exceptions");
Services.prefs.clearUserPref("devtools.debugger.pause-on-caught-exceptions");
Services.prefs.clearUserPref("devtools.debugger.ignore-caught-exceptions");

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

@ -23,7 +23,7 @@ this.call = function (name, args) {
dump("Calling function with name " + name + ".\n");
dump("args " + JSON.stringify(args) + "\n");
return XPCNativeWrapper.unwrap(content)[name].apply(undefined, args);
return XPCNativeWrapper.unwrap(content)[name].apply(undefined, Cu.cloneInto(args, content));
};
this._eval = function (string) {

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

@ -197,6 +197,10 @@ class MenuButton extends PureComponent {
async onClick(e) {
if (e.target === this.buttonRef) {
// On Mac, even after clicking the button it doesn't get focus.
// Force focus to the button so that our keydown handlers get called.
this.buttonRef.focus();
if (this.props.onClick) {
this.props.onClick(e);
}

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

@ -374,15 +374,15 @@ const TEST_DATA = [
offsets: [3, 30], commentOffsets: [0, 33]}]
},
// HTML comments are ignored.
// HTML comments are not special -- they are just ordinary tokens.
{
parseComments: true,
input: "<!-- color: red; --> color: blue;",
expected: [
{name: "color", value: "red", priority: "",
offsets: [5, 16]},
{name: "color", value: "blue", priority: "",
offsets: [21, 33]}]
{name: "<!-- color", value: "red", priority: "",
offsets: [0, 16]},
{name: "--> color", value: "blue", priority: "",
offsets: [17, 33]}]
},
// Don't error on an empty comment.

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

@ -33,15 +33,12 @@ add_task(async function() {
info("Opening a tab while there is a true user setting on split console pref");
toolbox = await openNewTabAndToolbox(TEST_URI, "inspector");
ok(toolbox.splitConsole, "Split console is visible by default.");
ok(isJstermFocused(toolbox.getPanel("webconsole").hud.jsterm),
"Split console input is focused by default");
ok(await doesMenuSayHide(toolbox),
"Split console menu item initially says hide");
is(getHeightPrefValue(), 200, "Height is set based on panel height after closing");
const activeElement = getActiveElement(toolbox.doc);
const inputNode = toolbox.getPanel("webconsole").hud.jsterm.inputNode;
is(activeElement, inputNode, "Split console input is focused by default");
toolbox.webconsolePanel.height = 1;
ok(toolbox.webconsolePanel.clientHeight > 1,
"The actual height of the console is bound with a min height");
@ -70,14 +67,6 @@ add_task(async function() {
await toolbox.destroy();
});
function getActiveElement(doc) {
let activeElement = doc.activeElement;
while (activeElement && activeElement.contentDocument) {
activeElement = activeElement.contentDocument.activeElement;
}
return activeElement;
}
function getVisiblePrefValue() {
return Services.prefs.getBoolPref("devtools.toolbox.splitconsoleEnabled");
}
@ -86,10 +75,11 @@ function getHeightPrefValue() {
return Services.prefs.getIntPref("devtools.toolbox.splitconsoleHeight");
}
function doesMenuSayHide(toolbox) {
async function doesMenuSayHide(toolbox) {
const button = toolbox.doc.getElementById("toolbox-meatball-menu-button");
await waitUntil(() => toolbox.win.getComputedStyle(button).pointerEvents === "auto");
return new Promise(resolve => {
const button = toolbox.doc.getElementById("toolbox-meatball-menu-button");
EventUtils.sendMouseEvent({ type: "click" }, button);
EventUtils.synthesizeMouseAtCenter(button, {}, toolbox.win);
toolbox.doc.addEventListener("popupshown", () => {
const menuItem =

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

@ -318,12 +318,6 @@ function parseDeclarationsInternal(isCssPropertyKnown, inputString,
break;
}
// Ignore HTML comment tokens (but parse anything they might
// happen to surround).
if (token.tokenType === "htmlcomment") {
continue;
}
// Update the start and end offsets of the declaration, but only
// when we see a significant token.
if (token.tokenType !== "whitespace" && token.tokenType !== "comment") {

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

@ -37,7 +37,6 @@ DIRS += [
XPIDL_SOURCES += [
'nsCDefaultURIFixup.idl',
'nsIClipboardCommands.idl',
'nsIContentViewer.idl',
'nsIContentViewerEdit.idl',
'nsIDocShell.idl',
@ -49,7 +48,6 @@ XPIDL_SOURCES += [
'nsIReflowObserver.idl',
'nsIRefreshURI.idl',
'nsIScrollable.idl',
'nsITextScroll.idl',
'nsITooltipListener.idl',
'nsITooltipTextProvider.idl',
'nsIURIFixup.idl',
@ -62,12 +60,12 @@ XPIDL_MODULE = 'docshell'
EXPORTS += [
'nsCTooltipTextProvider.h',
'nsDocShell.h',
'nsDocShellLoadInfo.h',
'nsDocShellLoadTypes.h',
'nsDocShellTreeOwner.h',
'nsILinkHandler.h',
'nsIScrollObserver.h',
'nsIWebShellServices.h',
'SerializedLoadContext.h',
]

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

@ -520,16 +520,13 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocShell)
NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
NS_INTERFACE_MAP_ENTRY(nsITextScroll)
NS_INTERFACE_MAP_ENTRY(nsIRefreshURI)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIWebPageDescriptor)
NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
NS_INTERFACE_MAP_ENTRY(nsILoadContext)
NS_INTERFACE_MAP_ENTRY(nsIWebShellServices)
NS_INTERFACE_MAP_ENTRY(nsILinkHandler)
NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands)
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsINetworkInterceptController,
mInterceptController)
@ -6089,32 +6086,6 @@ nsDocShell::GetScrollbarVisibility(bool* aVerticalVisible,
return NS_OK;
}
//*****************************************************************************
// nsDocShell::nsITextScroll
//*****************************************************************************
NS_IMETHODIMP
nsDocShell::ScrollByLines(int32_t aNumLines)
{
nsIScrollableFrame* sf = GetRootScrollFrame();
NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
sf->ScrollBy(nsIntPoint(0, aNumLines), nsIScrollableFrame::LINES,
nsIScrollableFrame::SMOOTH);
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::ScrollByPages(int32_t aNumPages)
{
nsIScrollableFrame* sf = GetRootScrollFrame();
NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
sf->ScrollBy(nsIntPoint(0, aNumPages), nsIScrollableFrame::PAGES,
nsIScrollableFrame::SMOOTH);
return NS_OK;
}
//*****************************************************************************
// nsDocShell::nsIRefreshURI
//*****************************************************************************
@ -9043,30 +9014,33 @@ nsDocShell::CopyFavicon(nsIURI* aOldURI,
#endif
}
class InternalLoadEvent : public Runnable
struct InternalLoadData
{
public:
InternalLoadEvent(nsDocShell* aDocShell,
nsIURI* aURI,
nsIURI* aOriginalURI,
Maybe<nsCOMPtr<nsIURI>> const& aResultPrincipalURI,
bool aKeepResultPrincipalURIIfSet,
bool aLoadReplace,
nsIURI* aReferrer, uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit,
uint32_t aFlags,
const char* aTypeHint,
nsIInputStream* aPostData,
nsIInputStream* aHeadersData,
uint32_t aLoadType,
nsISHEntry* aSHEntry,
bool aFirstParty,
const nsAString& aSrcdoc,
nsIDocShell* aSourceDocShell,
nsIURI* aBaseURI)
: mozilla::Runnable("InternalLoadEvent")
, mSrcdoc(aSrcdoc)
InternalLoadData(nsDocShell* aDocShell,
nsIURI* aURI,
nsIURI* aOriginalURI,
Maybe<nsCOMPtr<nsIURI>> const& aResultPrincipalURI,
bool aKeepResultPrincipalURIIfSet,
bool aLoadReplace,
nsIURI* aReferrer, uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit,
uint32_t aFlags,
const nsAString& aWindowTarget,
const char* aTypeHint,
const nsAString& aFileName,
nsIInputStream* aPostData,
nsIInputStream* aHeadersData,
uint32_t aLoadType,
nsISHEntry* aSHEntry,
bool aFirstParty,
const nsAString& aSrcdoc,
nsIDocShell* aSourceDocShell,
nsIURI* aBaseURI,
nsIDocShell** aDocShell2,
nsIRequest** aRequest)
: mSrcdoc(aSrcdoc)
, mDocShell(aDocShell)
, mURI(aURI)
, mOriginalURI(aOriginalURI)
@ -9081,10 +9055,14 @@ public:
, mHeadersData(aHeadersData)
, mSHEntry(aSHEntry)
, mFlags(aFlags)
, mWindowTarget(aWindowTarget)
, mFileName(aFileName)
, mLoadType(aLoadType)
, mFirstParty(aFirstParty)
, mSourceDocShell(aSourceDocShell)
, mBaseURI(aBaseURI)
, mDocShell2(aDocShell2)
, mRequest(aRequest)
{
// Make sure to keep null things null as needed
if (aTypeHint) {
@ -9094,8 +9072,7 @@ public:
}
}
NS_IMETHOD
Run() override
nsresult Run()
{
return mDocShell->InternalLoad(mURI, mOriginalURI, mResultPrincipalURI,
mKeepResultPrincipalURIIfSet,
@ -9103,17 +9080,16 @@ public:
mReferrer,
mReferrerPolicy,
mTriggeringPrincipal, mPrincipalToInherit,
mFlags, EmptyString(),
mFlags, mWindowTarget,
mTypeHint.IsVoid() ? nullptr
: mTypeHint.get(),
VoidString(), mPostData,
mFileName, mPostData,
mHeadersData, mLoadType, mSHEntry,
mFirstParty, mSrcdoc, mSourceDocShell,
mBaseURI, nullptr,
nullptr);
mBaseURI, mDocShell2,
mRequest);
}
private:
nsCString mTypeHint;
nsString mSrcdoc;
@ -9131,12 +9107,174 @@ private:
nsCOMPtr<nsIInputStream> mHeadersData;
nsCOMPtr<nsISHEntry> mSHEntry;
uint32_t mFlags;
nsString mWindowTarget;
nsString mFileName;
uint32_t mLoadType;
bool mFirstParty;
nsCOMPtr<nsIDocShell> mSourceDocShell;
nsCOMPtr<nsIURI> mBaseURI;
nsIDocShell** mDocShell2;
nsIRequest** mRequest;
};
class InternalLoadEvent : public Runnable
{
public:
InternalLoadEvent(nsDocShell* aDocShell,
nsIURI* aURI,
nsIURI* aOriginalURI,
Maybe<nsCOMPtr<nsIURI>> const& aResultPrincipalURI,
bool aKeepResultPrincipalURIIfSet,
bool aLoadReplace,
nsIURI* aReferrer,
uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit,
uint32_t aFlags,
const char* aTypeHint,
nsIInputStream* aPostData,
nsIInputStream* aHeadersData,
uint32_t aLoadType,
nsISHEntry* aSHEntry,
bool aFirstParty,
const nsAString& aSrcdoc,
nsIDocShell* aSourceDocShell,
nsIURI* aBaseURI)
: mozilla::Runnable("InternalLoadEvent")
, mLoadData(aDocShell,
aURI,
aOriginalURI,
aResultPrincipalURI,
aKeepResultPrincipalURIIfSet,
aLoadReplace,
aReferrer,
aReferrerPolicy,
aTriggeringPrincipal,
aPrincipalToInherit,
aFlags,
EmptyString(),
aTypeHint,
VoidString(),
aPostData,
aHeadersData,
aLoadType,
aSHEntry,
aFirstParty,
aSrcdoc,
aSourceDocShell,
aBaseURI,
nullptr,
nullptr)
{}
NS_IMETHOD
Run() override
{
return mLoadData.Run();
}
private:
InternalLoadData mLoadData;
};
class LoadURIDelegateHandler final : public PromiseNativeHandler
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(LoadURIDelegateHandler)
LoadURIDelegateHandler(nsDocShell* aDocShell,
nsIURI* aURI,
nsIURI* aOriginalURI,
Maybe<nsCOMPtr<nsIURI>> const& aResultPrincipalURI,
bool aKeepResultPrincipalURIIfSet,
bool aLoadReplace,
nsIURI* aReferrer,
uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit,
uint32_t aFlags,
const nsAString& aWindowTarget,
const char* aTypeHint,
const nsAString& aFileName,
nsIInputStream* aPostData,
nsIInputStream* aHeadersData,
uint32_t aLoadType,
nsISHEntry* aSHEntry,
bool aFirstParty,
const nsAString& aSrcdoc,
nsIDocShell* aSourceDocShell,
nsIURI* aBaseURI,
nsIDocShell** aDocShell2,
nsIRequest** aRequest)
: mLoadData(aDocShell,
aURI,
aOriginalURI,
aResultPrincipalURI,
aKeepResultPrincipalURIIfSet,
aLoadReplace,
aReferrer,
aReferrerPolicy,
aTriggeringPrincipal,
aPrincipalToInherit,
aFlags,
aWindowTarget,
aTypeHint,
aFileName,
aPostData,
aHeadersData,
aLoadType,
aSHEntry,
aFirstParty,
aSrcdoc,
aSourceDocShell,
aBaseURI,
aDocShell2,
aRequest)
{}
void
ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override
{
if (aValue.isBoolean() && !aValue.toBoolean()) {
// Things went fine, not handled by app, let Gecko do its thing
mLoadData.Run();
} else if (!aValue.isBoolean()) {
// If the promise resolves to a non-boolean, let Gecko handle the load
mLoadData.Run();
}
}
void
RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override
{
// In the event of a rejected callback, let Gecko handle the load
mLoadData.Run();
}
private:
~LoadURIDelegateHandler()
{}
InternalLoadData mLoadData;
};
NS_IMPL_CYCLE_COLLECTION(LoadURIDelegateHandler, mLoadData.mDocShell,
mLoadData.mURI, mLoadData.mOriginalURI,
mLoadData.mResultPrincipalURI, mLoadData.mReferrer,
mLoadData.mTriggeringPrincipal,
mLoadData.mPrincipalToInherit,
mLoadData.mPostData, mLoadData.mHeadersData,
mLoadData.mSHEntry, mLoadData.mSourceDocShell,
mLoadData.mBaseURI)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(LoadURIDelegateHandler)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(LoadURIDelegateHandler)
NS_IMPL_CYCLE_COLLECTING_RELEASE(LoadURIDelegateHandler)
/**
* Returns true if we started an asynchronous load (i.e., from the network), but
* the document we're loading there hasn't yet become this docshell's active
@ -9384,7 +9522,10 @@ nsDocShell::InternalLoad(nsIURI* aURI,
const bool isDocumentAuxSandboxed = doc &&
(doc->GetSandboxFlags() & SANDBOXED_AUXILIARY_NAVIGATION);
if (aURI && mLoadURIDelegate &&
const bool checkLoadDelegates = !(aFlags & INTERNAL_LOAD_FLAGS_DELEGATES_CHECKED);
aFlags = aFlags & ~INTERNAL_LOAD_FLAGS_DELEGATES_CHECKED;
if (aURI && mLoadURIDelegate && checkLoadDelegates &&
(!targetDocShell || targetDocShell == static_cast<nsIDocShell*>(this))) {
// Dispatch only load requests for the current or a new window to the
// delegate, e.g., to allow for GeckoView apps to handle the load event
@ -9397,11 +9538,24 @@ nsDocShell::InternalLoad(nsIURI* aURI,
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
}
bool loadURIHandled = false;
RefPtr<dom::Promise> promise;
rv = mLoadURIDelegate->LoadURI(aURI, where, aFlags, aTriggeringPrincipal,
&loadURIHandled);
if (NS_SUCCEEDED(rv) && loadURIHandled) {
// The request has been handled, nothing to do here.
getter_AddRefs(promise));
if (NS_SUCCEEDED(rv) && promise) {
const uint32_t flags = aFlags | INTERNAL_LOAD_FLAGS_DELEGATES_CHECKED;
RefPtr<LoadURIDelegateHandler> handler =
new LoadURIDelegateHandler(this, aURI, aOriginalURI, aResultPrincipalURI,
aKeepResultPrincipalURIIfSet,
aLoadReplace, aReferrer, aReferrerPolicy,
aTriggeringPrincipal, aPrincipalToInherit,
flags, aWindowTarget, aTypeHint, aFileName, aPostData,
aHeadersData, aLoadType, aSHEntry, aFirstParty,
aSrcdoc, aSourceDocShell, aBaseURI, nullptr, nullptr);
promise->AppendNativeHandler(handler);
// Checking for load delegates; InternalLoad will be re-called if needed.
return NS_OK;
}
}
@ -13107,96 +13261,6 @@ nsDocShell::EnsureCommandHandler()
return mCommandManager ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsDocShell::CanCutSelection(bool* aResult)
{
return IsCommandEnabled("cmd_cut", aResult);
}
NS_IMETHODIMP
nsDocShell::CanCopySelection(bool* aResult)
{
return IsCommandEnabled("cmd_copy", aResult);
}
NS_IMETHODIMP
nsDocShell::CanCopyLinkLocation(bool* aResult)
{
return IsCommandEnabled("cmd_copyLink", aResult);
}
NS_IMETHODIMP
nsDocShell::CanCopyImageLocation(bool* aResult)
{
return IsCommandEnabled("cmd_copyImageLocation", aResult);
}
NS_IMETHODIMP
nsDocShell::CanCopyImageContents(bool* aResult)
{
return IsCommandEnabled("cmd_copyImageContents", aResult);
}
NS_IMETHODIMP
nsDocShell::CanPaste(bool* aResult)
{
return IsCommandEnabled("cmd_paste", aResult);
}
NS_IMETHODIMP
nsDocShell::CutSelection(void)
{
return DoCommand("cmd_cut");
}
NS_IMETHODIMP
nsDocShell::CopySelection(void)
{
return DoCommand("cmd_copy");
}
NS_IMETHODIMP
nsDocShell::CopyLinkLocation(void)
{
return DoCommand("cmd_copyLink");
}
NS_IMETHODIMP
nsDocShell::CopyImageLocation(void)
{
return DoCommand("cmd_copyImageLocation");
}
NS_IMETHODIMP
nsDocShell::CopyImageContents(void)
{
return DoCommand("cmd_copyImageContents");
}
NS_IMETHODIMP
nsDocShell::Paste(void)
{
return DoCommand("cmd_paste");
}
NS_IMETHODIMP
nsDocShell::SelectAll(void)
{
return DoCommand("cmd_selectAll");
}
//
// SelectNone
//
// Collapses the current selection, insertion point ends up at beginning
// of previous selection.
//
NS_IMETHODIMP
nsDocShell::SelectNone(void)
{
return DoCommand("cmd_selectNone");
}
// link handling
class OnLinkClickEvent : public Runnable
@ -13601,9 +13665,9 @@ nsDocShell::PluginsAllowedInCurrentDoc()
// Web Shell Services API
// This functions is only called when a new charset is detected in loading a
// document. Its name should be changed to "CharsetReloadDocument"
NS_IMETHODIMP
nsDocShell::ReloadDocument(const char* aCharset, int32_t aSource)
// document.
nsresult
nsDocShell::CharsetChangeReloadDocument(const char* aCharset, int32_t aSource)
{
// XXX hack. keep the aCharset and aSource wait to pick it up
nsCOMPtr<nsIContentViewer> cv;
@ -13635,8 +13699,8 @@ nsDocShell::ReloadDocument(const char* aCharset, int32_t aSource)
return NS_ERROR_DOCSHELL_REQUEST_REJECTED;
}
NS_IMETHODIMP
nsDocShell::StopDocumentLoad(void)
nsresult
nsDocShell::CharsetChangeStopDocumentLoad()
{
if (eCharsetReloadRequested != mCharsetReloadState) {
Stop(nsIWebNavigation::STOP_ALL);

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

@ -22,7 +22,6 @@
#include "nsIAuthPromptProvider.h"
#include "nsIBaseWindow.h"
#include "nsIClipboardCommands.h"
#include "nsIDeprecationWarner.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
@ -35,13 +34,12 @@
#include "nsIRefreshURI.h"
#include "nsIScrollable.h"
#include "nsITabParent.h"
#include "nsITextScroll.h"
#include "nsIWebNavigation.h"
#include "nsIWebPageDescriptor.h"
#include "nsIWebProgressListener.h"
#include "nsIWebShellServices.h"
#include "nsAutoPtr.h"
#include "nsCharsetSource.h"
#include "nsCOMPtr.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
@ -57,9 +55,9 @@
#include "prtime.h"
#include "Units.h"
#include "timeline/ObservedDocShell.h"
#include "timeline/TimelineConsumers.h"
#include "timeline/TimelineMarker.h"
#include "mozilla/ObservedDocShell.h"
#include "mozilla/TimelineConsumers.h"
#include "mozilla/TimelineMarker.h"
// Interfaces Needed
@ -122,15 +120,12 @@ class nsDocShell final
, public nsIWebNavigation
, public nsIBaseWindow
, public nsIScrollable
, public nsITextScroll
, public nsIRefreshURI
, public nsIWebProgressListener
, public nsIWebPageDescriptor
, public nsIAuthPromptProvider
, public nsILoadContext
, public nsIWebShellServices
, public nsILinkHandler
, public nsIClipboardCommands
, public nsIDOMStorageManager
, public nsINetworkInterceptController
, public nsIDeprecationWarner
@ -173,14 +168,11 @@ public:
NS_DECL_NSIWEBNAVIGATION
NS_DECL_NSIBASEWINDOW
NS_DECL_NSISCROLLABLE
NS_DECL_NSITEXTSCROLL
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIREFRESHURI
NS_DECL_NSIWEBPAGEDESCRIPTOR
NS_DECL_NSIAUTHPROMPTPROVIDER
NS_DECL_NSICLIPBOARDCOMMANDS
NS_DECL_NSIWEBSHELLSERVICES
NS_DECL_NSINETWORKINTERCEPTCONTROLLER
NS_DECL_NSIDEPRECATIONWARNER
@ -283,6 +275,11 @@ public:
mozilla::HTMLEditor* GetHTMLEditorInternal();
nsresult SetHTMLEditorInternal(mozilla::HTMLEditor* aHTMLEditor);
// Handle page navigation due to charset changes
nsresult CharsetChangeReloadDocument(const char* aCharset = nullptr,
int32_t aSource = kCharsetUninitialized);
nsresult CharsetChangeStopDocumentLoad();
nsDOMNavigationTiming* GetNavigationTiming() const;
nsresult SetOriginAttributes(const mozilla::OriginAttributes& aAttrs);

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

@ -1,111 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
/**
* An interface for embedding clients who wish to interact with
* the system-wide OS clipboard. Mozilla does not use a private
* clipboard, instead it places its data directly onto the system
* clipboard. The webshell implements this interface.
*/
[scriptable, uuid(b8100c90-73be-11d2-92a5-00105a1b0d64)]
interface nsIClipboardCommands : nsISupports {
/**
* Returns whether there is a selection and it is not read-only.
*
* @return <code>true</code> if the current selection can be cut,
* <code>false</code> otherwise.
*/
boolean canCutSelection();
/**
* Returns whether there is a selection and it is copyable.
*
* @return <code>true</code> if there is a selection,
* <code>false</code> otherwise.
*/
boolean canCopySelection();
/**
* Returns whether we can copy a link location.
*
* @return <code>true</code> if a link is selected,
* <code>false</code> otherwise.
*/
boolean canCopyLinkLocation();
/**
* Returns whether we can copy an image location.
*
* @return <code>true</code> if an image is selected,
<code>false</code> otherwise.
*/
boolean canCopyImageLocation();
/**
* Returns whether we can copy an image's contents.
*
* @return <code>true</code> if an image is selected,
* <code>false</code> otherwise
*/
boolean canCopyImageContents();
/**
* Returns whether the current contents of the clipboard can be
* pasted and if the current selection is not read-only.
*
* @return <code>true</code> there is data to paste on the clipboard
* and the current selection is not read-only,
* <code>false</code> otherwise
*/
boolean canPaste();
/**
* Cut the current selection onto the clipboard.
*/
void cutSelection();
/**
* Copy the current selection onto the clipboard.
*/
void copySelection();
/**
* Copy the link location of the current selection (e.g.,
* the |href| attribute of a selected |a| tag).
*/
void copyLinkLocation();
/**
* Copy the location of the selected image.
*/
void copyImageLocation();
/**
* Copy the contents of the selected image.
*/
void copyImageContents();
/**
* Paste the contents of the clipboard into the current selection.
*/
void paste();
/**
* Select the entire contents.
*/
void selectAll();
/**
* Clear the current selection (if any). Insertion point ends up
* at beginning of current selection.
*/
void selectNone();
};

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

@ -118,6 +118,9 @@ interface nsIDocShell : nsIDocShellTreeItem
// Whether a top-level data URI navigation is allowed for that load
const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x200;
// Whether load delegates have already been checked for this load
const long INTERNAL_LOAD_FLAGS_DELEGATES_CHECKED = 0x400;
// Whether the load was triggered by user interaction.
const long INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED = 0x1000;

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

@ -1,33 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
/**
* The nsITextScroll is an interface that can be implemented by a control that
* supports text scrolling.
*/
[scriptable, uuid(067B28A0-877F-11d3-AF7E-00A024FFC08C)]
interface nsITextScroll : nsISupports
{
/**
* Scroll the view up or down by aNumLines lines. positive
* values move down in the view. Prevents scrolling off the
* end of the view.
* @param numLines number of lines to scroll the view by
*/
void scrollByLines(in long numLines);
/**
* Scroll the view up or down by numPages pages. a page
* is considered to be the amount displayed by the clip view.
* positive values move down in the view. Prevents scrolling
* off the end of the view.
* @param numPages number of pages to scroll the view by
*/
void scrollByPages(in long numPages);
};

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

@ -1,34 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsIWebShellServices_h___
#define nsIWebShellServices_h___
#include "nsISupports.h"
#include "nsCharsetSource.h"
/* 0c628af0-5638-4703-8f99-ed6134c9de18 */
#define NS_IWEB_SHELL_SERVICES_IID \
{ 0x0c628af0, 0x5638, 0x4703, {0x8f, 0x99, 0xed, 0x61, 0x34, 0xc9, 0xde, 0x18} }
class nsIWebShellServices : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWEB_SHELL_SERVICES_IID)
NS_IMETHOD ReloadDocument(const char* aCharset = nullptr,
int32_t aSource = kCharsetUninitialized) = 0;
NS_IMETHOD StopDocumentLoad(void) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIWebShellServices, NS_IWEB_SHELL_SERVICES_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIWEBSHELLSERVICES \
NS_IMETHOD ReloadDocument(const char* aCharset = nullptr, \
int32_t aSource = kCharsetUninitialized) override; \
NS_IMETHOD StopDocumentLoad(void) override;
#endif /* nsIWebShellServices_h___ */

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

@ -9,8 +9,6 @@
title="bug 89419 test">
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"

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

@ -9,7 +9,7 @@
* the two is unified to minimize footprint.
*/
#include "nsAttrAndChildArray.h"
#include "AttrArray.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/MathAlgorithms.h"
@ -24,59 +24,6 @@
using mozilla::CheckedUint32;
/*
CACHE_POINTER_SHIFT indicates how many steps to downshift the |this| pointer.
It should be small enough to not cause collisions between adjecent arrays, and
large enough to make sure that all indexes are used. The size below is based
on the size of the smallest possible element (currently 20[*] bytes) which is
the smallest distance between two nsAttrAndChildArray. 20/(2^_5_) is 0.625.
This means that two adjacent nsAttrAndChildArrays will overlap one in 2.7 times.
However not all elements will have enough children to get cached. And any
allocator that doesn't return addresses aligned to 64 bytes will ensure that
any index will get used.
[*] sizeof(Element). Except is that really 20 bytes? Seems dubious!
*/
#define CACHE_POINTER_SHIFT 5
#define CACHE_NUM_SLOTS 128
#define CACHE_CHILD_LIMIT 10
#define CACHE_GET_INDEX(_array) \
((NS_PTR_TO_INT32(_array) >> CACHE_POINTER_SHIFT) & \
(CACHE_NUM_SLOTS - 1))
struct IndexCacheSlot
{
const nsAttrAndChildArray* array;
int32_t index;
};
// This is inited to all zeroes since it's static. Though even if it wasn't
// the worst thing that'd happen is a small inefficency if you'd get a false
// positive cachehit.
static IndexCacheSlot indexCache[CACHE_NUM_SLOTS];
static
inline
void
AddIndexToCache(const nsAttrAndChildArray* aArray, int32_t aIndex)
{
uint32_t ix = CACHE_GET_INDEX(aArray);
indexCache[ix].array = aArray;
indexCache[ix].index = aIndex;
}
static
inline
int32_t
GetIndexFromCache(const nsAttrAndChildArray* aArray)
{
uint32_t ix = CACHE_GET_INDEX(aArray);
return indexCache[ix].array == aArray ? indexCache[ix].index : -1;
}
/**
* Due to a compiler bug in VisualAge C++ for AIX, we need to return the
* address of the first index into mBuffer here, instead of simply returning
@ -91,12 +38,12 @@ GetIndexFromCache(const nsAttrAndChildArray* aArray)
#define NS_IMPL_EXTRA_SIZE \
((sizeof(Impl) - sizeof(mImpl->mBuffer)) / sizeof(void*))
nsAttrAndChildArray::nsAttrAndChildArray()
AttrArray::AttrArray()
: mImpl(nullptr)
{
}
nsAttrAndChildArray::~nsAttrAndChildArray()
AttrArray::~AttrArray()
{
if (!mImpl) {
return;
@ -108,13 +55,13 @@ nsAttrAndChildArray::~nsAttrAndChildArray()
}
uint32_t
nsAttrAndChildArray::AttrCount() const
AttrArray::AttrCount() const
{
return NonMappedAttrCount() + MappedAttrCount();
}
const nsAttrValue*
nsAttrAndChildArray::GetAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
AttrArray::GetAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
{
uint32_t i, slotCount = AttrSlotCount();
if (aNamespaceID == kNameSpaceID_None) {
@ -141,7 +88,7 @@ nsAttrAndChildArray::GetAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
}
const nsAttrValue*
nsAttrAndChildArray::GetAttr(const nsAString& aLocalName) const
AttrArray::GetAttr(const nsAString& aLocalName) const
{
uint32_t i, slotCount = AttrSlotCount();
for (i = 0; i < slotCount && AttrSlotIsTaken(i); ++i) {
@ -158,8 +105,8 @@ nsAttrAndChildArray::GetAttr(const nsAString& aLocalName) const
}
const nsAttrValue*
nsAttrAndChildArray::GetAttr(const nsAString& aName,
nsCaseTreatment aCaseSensitive) const
AttrArray::GetAttr(const nsAString& aName,
nsCaseTreatment aCaseSensitive) const
{
// Check whether someone is being silly and passing non-lowercase
// attr names.
@ -191,10 +138,10 @@ nsAttrAndChildArray::GetAttr(const nsAString& aName,
}
const nsAttrValue*
nsAttrAndChildArray::AttrAt(uint32_t aPos) const
AttrArray::AttrAt(uint32_t aPos) const
{
NS_ASSERTION(aPos < AttrCount(),
"out-of-bounds access in nsAttrAndChildArray");
"out-of-bounds access in AttrArray");
uint32_t nonmapped = NonMappedAttrCount();
if (aPos < nonmapped) {
@ -205,8 +152,8 @@ nsAttrAndChildArray::AttrAt(uint32_t aPos) const
}
nsresult
nsAttrAndChildArray::SetAndSwapAttr(nsAtom* aLocalName, nsAttrValue& aValue,
bool* aHadValue)
AttrArray::SetAndSwapAttr(nsAtom* aLocalName, nsAttrValue& aValue,
bool* aHadValue)
{
*aHadValue = false;
uint32_t i, slotCount = AttrSlotCount();
@ -218,9 +165,6 @@ nsAttrAndChildArray::SetAndSwapAttr(nsAtom* aLocalName, nsAttrValue& aValue,
}
}
NS_ENSURE_TRUE(i < ATTRCHILD_ARRAY_MAX_ATTR_COUNT,
NS_ERROR_FAILURE);
if (i == slotCount && !AddAttrSlot()) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -233,8 +177,8 @@ nsAttrAndChildArray::SetAndSwapAttr(nsAtom* aLocalName, nsAttrValue& aValue,
}
nsresult
nsAttrAndChildArray::SetAndSwapAttr(mozilla::dom::NodeInfo* aName,
nsAttrValue& aValue, bool* aHadValue)
AttrArray::SetAndSwapAttr(mozilla::dom::NodeInfo* aName,
nsAttrValue& aValue, bool* aHadValue)
{
int32_t namespaceID = aName->NamespaceID();
nsAtom* localName = aName->NameAtom();
@ -253,9 +197,6 @@ nsAttrAndChildArray::SetAndSwapAttr(mozilla::dom::NodeInfo* aName,
}
}
NS_ENSURE_TRUE(i < ATTRCHILD_ARRAY_MAX_ATTR_COUNT,
NS_ERROR_FAILURE);
if (i == slotCount && !AddAttrSlot()) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -267,9 +208,8 @@ nsAttrAndChildArray::SetAndSwapAttr(mozilla::dom::NodeInfo* aName,
return NS_OK;
}
nsresult
nsAttrAndChildArray::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
AttrArray::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
{
NS_ASSERTION(aPos < AttrCount(), "out-of-bounds");
@ -305,10 +245,10 @@ nsAttrAndChildArray::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
}
mozilla::dom::BorrowedAttrInfo
nsAttrAndChildArray::AttrInfoAt(uint32_t aPos) const
AttrArray::AttrInfoAt(uint32_t aPos) const
{
NS_ASSERTION(aPos < AttrCount(),
"out-of-bounds access in nsAttrAndChildArray");
"out-of-bounds access in AttrArray");
uint32_t nonmapped = NonMappedAttrCount();
if (aPos < nonmapped) {
@ -320,10 +260,10 @@ nsAttrAndChildArray::AttrInfoAt(uint32_t aPos) const
}
const nsAttrName*
nsAttrAndChildArray::AttrNameAt(uint32_t aPos) const
AttrArray::AttrNameAt(uint32_t aPos) const
{
NS_ASSERTION(aPos < AttrCount(),
"out-of-bounds access in nsAttrAndChildArray");
"out-of-bounds access in AttrArray");
uint32_t nonmapped = NonMappedAttrCount();
if (aPos < nonmapped) {
@ -334,7 +274,7 @@ nsAttrAndChildArray::AttrNameAt(uint32_t aPos) const
}
const nsAttrName*
nsAttrAndChildArray::GetSafeAttrNameAt(uint32_t aPos) const
AttrArray::GetSafeAttrNameAt(uint32_t aPos) const
{
uint32_t nonmapped = NonMappedAttrCount();
if (aPos < nonmapped) {
@ -354,7 +294,7 @@ nsAttrAndChildArray::GetSafeAttrNameAt(uint32_t aPos) const
}
const nsAttrName*
nsAttrAndChildArray::GetExistingAttrNameFromQName(const nsAString& aName) const
AttrArray::GetExistingAttrNameFromQName(const nsAString& aName) const
{
uint32_t i, slotCount = AttrSlotCount();
for (i = 0; i < slotCount && AttrSlotIsTaken(i); ++i) {
@ -371,7 +311,7 @@ nsAttrAndChildArray::GetExistingAttrNameFromQName(const nsAString& aName) const
}
int32_t
nsAttrAndChildArray::IndexOfAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
AttrArray::IndexOfAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
{
int32_t idx;
if (mImpl && mImpl->mMappedAttrs && aNamespaceID == kNameSpaceID_None) {
@ -409,11 +349,11 @@ nsAttrAndChildArray::IndexOfAttr(nsAtom* aLocalName, int32_t aNamespaceID) const
}
nsresult
nsAttrAndChildArray::SetAndSwapMappedAttr(nsAtom* aLocalName,
nsAttrValue& aValue,
nsMappedAttributeElement* aContent,
nsHTMLStyleSheet* aSheet,
bool* aHadValue)
AttrArray::SetAndSwapMappedAttr(nsAtom* aLocalName,
nsAttrValue& aValue,
nsMappedAttributeElement* aContent,
nsHTMLStyleSheet* aSheet,
bool* aHadValue)
{
bool willAdd = true;
if (mImpl && mImpl->mMappedAttrs) {
@ -429,7 +369,7 @@ nsAttrAndChildArray::SetAndSwapMappedAttr(nsAtom* aLocalName,
}
nsresult
nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
AttrArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
{
MOZ_ASSERT(mImpl && mImpl->mMappedAttrs,
"Should have mapped attrs here!");
@ -446,7 +386,7 @@ nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
}
nsresult
nsAttrAndChildArray::DoUpdateMappedAttrRuleMapper(nsMappedAttributeElement& aElement)
AttrArray::DoUpdateMappedAttrRuleMapper(nsMappedAttributeElement& aElement)
{
MOZ_ASSERT(mImpl && mImpl->mMappedAttrs, "Should have mapped attrs here!");
@ -460,7 +400,7 @@ nsAttrAndChildArray::DoUpdateMappedAttrRuleMapper(nsMappedAttributeElement& aEle
}
void
nsAttrAndChildArray::Compact()
AttrArray::Compact()
{
if (!mImpl) {
return;
@ -489,7 +429,7 @@ nsAttrAndChildArray::Compact()
}
void
nsAttrAndChildArray::Clear()
AttrArray::Clear()
{
if (!mImpl) {
return;
@ -504,11 +444,11 @@ nsAttrAndChildArray::Clear()
ATTRS(mImpl)[i].~InternalAttr();
}
SetAttrSlotAndChildCount(0, 0);
SetAttrSlotCount(0);
}
uint32_t
nsAttrAndChildArray::NonMappedAttrCount() const
AttrArray::NonMappedAttrCount() const
{
if (!mImpl) {
return 0;
@ -523,13 +463,13 @@ nsAttrAndChildArray::NonMappedAttrCount() const
}
uint32_t
nsAttrAndChildArray::MappedAttrCount() const
AttrArray::MappedAttrCount() const
{
return mImpl && mImpl->mMappedAttrs ? (uint32_t)mImpl->mMappedAttrs->Count() : 0;
}
nsresult
nsAttrAndChildArray::ForceMapped(nsMappedAttributeElement* aContent, nsIDocument* aDocument)
AttrArray::ForceMapped(nsMappedAttributeElement* aContent, nsIDocument* aDocument)
{
nsHTMLStyleSheet* sheet = aDocument->GetAttributeStyleSheet();
RefPtr<nsMappedAttributes> mapped = GetModifiableMapped(aContent, sheet, false, 0);
@ -537,17 +477,18 @@ nsAttrAndChildArray::ForceMapped(nsMappedAttributeElement* aContent, nsIDocument
}
void
nsAttrAndChildArray::ClearMappedServoStyle() {
AttrArray::ClearMappedServoStyle()
{
if (mImpl && mImpl->mMappedAttrs) {
mImpl->mMappedAttrs->ClearServoStyle();
}
}
nsMappedAttributes*
nsAttrAndChildArray::GetModifiableMapped(nsMappedAttributeElement* aContent,
nsHTMLStyleSheet* aSheet,
bool aWillAddAttr,
int32_t aAttrCount)
AttrArray::GetModifiableMapped(nsMappedAttributeElement* aContent,
nsHTMLStyleSheet* aSheet,
bool aWillAddAttr,
int32_t aAttrCount)
{
if (mImpl && mImpl->mMappedAttrs) {
return mImpl->mMappedAttrs->Clone(aWillAddAttr);
@ -561,7 +502,7 @@ nsAttrAndChildArray::GetModifiableMapped(nsMappedAttributeElement* aContent,
}
nsresult
nsAttrAndChildArray::MakeMappedUnique(nsMappedAttributes* aAttributes)
AttrArray::MakeMappedUnique(nsMappedAttributes* aAttributes)
{
NS_ASSERTION(aAttributes, "missing attributes");
@ -596,15 +537,16 @@ nsAttrAndChildArray::MakeMappedUnique(nsMappedAttributes* aAttributes)
}
const nsMappedAttributes*
nsAttrAndChildArray::GetMapped() const
AttrArray::GetMapped() const
{
return mImpl ? mImpl->mMappedAttrs : nullptr;
}
nsresult nsAttrAndChildArray::EnsureCapacityToClone(const nsAttrAndChildArray& aOther,
bool aAllocateChildren)
nsresult
AttrArray::EnsureCapacityToClone(const AttrArray& aOther,
bool aAllocateChildren)
{
MOZ_ASSERT(!mImpl, "nsAttrAndChildArray::EnsureCapacityToClone requires the array be empty when called");
MOZ_ASSERT(!mImpl, "AttrArray::EnsureCapacityToClone requires the array be empty when called");
uint32_t attrCount = aOther.NonMappedAttrCount();
@ -613,7 +555,7 @@ nsresult nsAttrAndChildArray::EnsureCapacityToClone(const nsAttrAndChildArray& a
}
// No need to use a CheckedUint32 because we are cloning. We know that we
// have already allocated an nsAttrAndChildArray of this size.
// have already allocated an AttrArray of this size.
uint32_t size = attrCount;
size *= ATTRSIZE;
uint32_t totalSize = size;
@ -629,13 +571,13 @@ nsresult nsAttrAndChildArray::EnsureCapacityToClone(const nsAttrAndChildArray& a
// number of slots for attributes so that children don't get written into
// that part of the array (which will then need to be moved later).
memset(static_cast<void*>(mImpl->mBuffer), 0, sizeof(InternalAttr) * attrCount);
SetAttrSlotAndChildCount(attrCount, 0);
SetAttrSlotCount(attrCount);
return NS_OK;
}
bool
nsAttrAndChildArray::GrowBy(uint32_t aGrowSize)
AttrArray::GrowBy(uint32_t aGrowSize)
{
CheckedUint32 size = 0;
if (mImpl) {
@ -684,7 +626,7 @@ nsAttrAndChildArray::GrowBy(uint32_t aGrowSize)
// Set initial counts if we didn't have a buffer before
if (needToInitialize) {
mImpl->mMappedAttrs = nullptr;
SetAttrSlotAndChildCount(0, 0);
SetAttrSlotCount(0);
}
mImpl->mBufferSize = size.value() - NS_IMPL_EXTRA_SIZE;
@ -693,7 +635,7 @@ nsAttrAndChildArray::GrowBy(uint32_t aGrowSize)
}
bool
nsAttrAndChildArray::AddAttrSlot()
AttrArray::AddAttrSlot()
{
uint32_t slotCount = AttrSlotCount();
@ -719,7 +661,7 @@ nsAttrAndChildArray::AddAttrSlot()
}
size_t
nsAttrAndChildArray::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
AttrArray::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{
size_t n = 0;
if (mImpl) {

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

@ -5,12 +5,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Storage of the children and attributes of a DOM node; storage for
* the two is unified to minimize footprint.
* Storage of the attributes of a DOM node.
*/
#ifndef nsAttrAndChildArray_h___
#define nsAttrAndChildArray_h___
#ifndef AttrArray_h___
#define AttrArray_h___
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
@ -31,26 +30,14 @@ class nsMappedAttributeElement;
#define ATTRCHILD_ARRAY_GROWSIZE 8
#define ATTRCHILD_ARRAY_LINEAR_THRESHOLD 32
#define ATTRCHILD_ARRAY_ATTR_SLOTS_BITS 10
#define ATTRCHILD_ARRAY_MAX_ATTR_COUNT \
((1 << ATTRCHILD_ARRAY_ATTR_SLOTS_BITS) - 1)
#define ATTRCHILD_ARRAY_MAX_CHILD_COUNT \
(~uint32_t(0) >> ATTRCHILD_ARRAY_ATTR_SLOTS_BITS)
#define ATTRCHILD_ARRAY_ATTR_SLOTS_COUNT_MASK \
((1 << ATTRCHILD_ARRAY_ATTR_SLOTS_BITS) - 1)
#define ATTRSIZE (sizeof(InternalAttr) / sizeof(void*))
class nsAttrAndChildArray
class AttrArray
{
typedef mozilla::dom::BorrowedAttrInfo BorrowedAttrInfo;
public:
nsAttrAndChildArray();
~nsAttrAndChildArray();
AttrArray();
~AttrArray();
bool HasAttrs() const
{
@ -121,12 +108,6 @@ public:
void Compact();
bool CanFitMoreAttrs() const
{
return AttrSlotCount() < ATTRCHILD_ARRAY_MAX_ATTR_COUNT ||
!AttrSlotIsTaken(ATTRCHILD_ARRAY_MAX_ATTR_COUNT - 1);
}
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
bool HasMappedAttrs() const
{
@ -145,12 +126,12 @@ public:
// unmapped attributes and children of |aOther|. If |aAllocateChildren| is not
// true, only enough space for unmapped attributes will be reserved.
// It is REQUIRED that this function be called ONLY when the array is empty.
nsresult EnsureCapacityToClone(const nsAttrAndChildArray& aOther,
nsresult EnsureCapacityToClone(const AttrArray& aOther,
bool aAllocateChildren);
private:
nsAttrAndChildArray(const nsAttrAndChildArray& aOther) = delete;
nsAttrAndChildArray& operator=(const nsAttrAndChildArray& aOther) = delete;
AttrArray(const AttrArray& aOther) = delete;
AttrArray& operator=(const AttrArray& aOther) = delete;
void Clear();
@ -172,7 +153,7 @@ private:
uint32_t AttrSlotCount() const
{
return mImpl ? mImpl->mAttrAndChildCount & ATTRCHILD_ARRAY_ATTR_SLOTS_COUNT_MASK : 0;
return mImpl ? mImpl->mAttrCount : 0;
}
bool AttrSlotIsTaken(uint32_t aSlot) const
@ -181,24 +162,9 @@ private:
return mImpl->mBuffer[aSlot * ATTRSIZE];
}
void SetChildCount(uint32_t aCount)
{
mImpl->mAttrAndChildCount =
(mImpl->mAttrAndChildCount & ATTRCHILD_ARRAY_ATTR_SLOTS_COUNT_MASK) |
(aCount << ATTRCHILD_ARRAY_ATTR_SLOTS_BITS);
}
void SetAttrSlotCount(uint32_t aCount)
{
mImpl->mAttrAndChildCount =
(mImpl->mAttrAndChildCount & ~ATTRCHILD_ARRAY_ATTR_SLOTS_COUNT_MASK) |
aCount;
}
void SetAttrSlotAndChildCount(uint32_t aSlotCount, uint32_t aChildCount)
{
mImpl->mAttrAndChildCount = aSlotCount |
(aChildCount << ATTRCHILD_ARRAY_ATTR_SLOTS_BITS);
mImpl->mAttrCount = aCount;
}
bool GrowBy(uint32_t aGrowSize);
@ -221,7 +187,7 @@ private:
};
struct Impl {
uint32_t mAttrAndChildCount;
uint32_t mAttrCount;
uint32_t mBufferSize;
nsMappedAttributes* mMappedAttrs;
void* mBuffer[1];

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

@ -327,7 +327,7 @@ Element::UpdateEditableState(bool aNotify)
int32_t
Element::TabIndex()
{
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::tabindex);
const nsAttrValue* attrVal = mAttrs.GetAttr(nsGkAtoms::tabindex);
if (attrVal && attrVal->Type() == nsAttrValue::eInteger) {
return attrVal->GetIntegerValue();
}
@ -645,9 +645,9 @@ Element::ClassList()
void
Element::GetAttributeNames(nsTArray<nsString>& aResult)
{
uint32_t count = mAttrsAndChildren.AttrCount();
uint32_t count = mAttrs.AttrCount();
for (uint32_t i = 0; i < count; ++i) {
const nsAttrName* name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrName* name = mAttrs.AttrNameAt(i);
name->GetQualifiedName(*aResult.AppendElement());
}
}
@ -1297,9 +1297,9 @@ void
Element::GetAttribute(const nsAString& aName, DOMString& aReturn)
{
const nsAttrValue* val =
mAttrsAndChildren.GetAttr(aName,
IsHTMLElement() && IsInHTMLDocument() ?
eIgnoreCase : eCaseMatters);
mAttrs.GetAttr(aName,
IsHTMLElement() && IsInHTMLDocument() ?
eIgnoreCase : eCaseMatters);
if (val) {
val->ToString(aReturn);
} else {
@ -2156,7 +2156,7 @@ Element::GetInlineStyleDeclaration() const
if (!MayHaveStyle()) {
return nullptr;
}
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::style);
const nsAttrValue* attrVal = mAttrs.GetAttr(nsGkAtoms::style);
if (attrVal && attrVal->Type() == nsAttrValue::eCSSDeclaration) {
return attrVal->GetCSSDeclarationValue();
@ -2168,7 +2168,7 @@ Element::GetInlineStyleDeclaration() const
const nsMappedAttributes*
Element::GetMappedAttributes() const
{
return mAttrsAndChildren.GetMapped();
return mAttrs.GetMapped();
}
void
@ -2408,12 +2408,12 @@ Element::InternalGetAttrNameFromQName(const nsAString& aStr,
nsAutoString lower;
nsAutoString& outStr = aNameToUse ? *aNameToUse : lower;
nsContentUtils::ASCIIToLower(aStr, outStr);
val = mAttrsAndChildren.GetExistingAttrNameFromQName(outStr);
val = mAttrs.GetExistingAttrNameFromQName(outStr);
if (val) {
outStr.Truncate();
}
} else {
val = mAttrsAndChildren.GetExistingAttrNameFromQName(aStr);
val = mAttrs.GetExistingAttrNameFromQName(aStr);
if (!val && aNameToUse) {
*aNameToUse = aStr;
}
@ -2502,10 +2502,6 @@ Element::SetSingleClassFromParser(nsAtom* aSingleClassName)
{
// Keep this in sync with SetAttr and SetParsedAttr below.
if (!mAttrsAndChildren.CanFitMoreAttrs()) {
return NS_ERROR_FAILURE;
}
nsAttrValue value(aSingleClassName);
nsIDocument* document = GetComposedDoc();
@ -2543,10 +2539,6 @@ Element::SetAttr(int32_t aNamespaceID, nsAtom* aName,
NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
"Don't call SetAttr with unknown namespace");
if (!mAttrsAndChildren.CanFitMoreAttrs()) {
return NS_ERROR_FAILURE;
}
uint8_t modType;
bool hasListeners;
// We don't want to spend time preparsing class attributes if the value is not
@ -2610,11 +2602,6 @@ Element::SetParsedAttr(int32_t aNamespaceID, nsAtom* aName,
NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
"Don't call SetAttr with unknown namespace");
if (!mAttrsAndChildren.CanFitMoreAttrs()) {
return NS_ERROR_FAILURE;
}
uint8_t modType;
bool hasListeners;
nsAttrValueOrString value(aParsedValue);
@ -2682,7 +2669,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
// stuff to Element?
if (!IsAttributeMapped(aName) ||
!SetAndSwapMappedAttribute(aName, aParsedValue, &oldValueSet, &rv)) {
rv = mAttrsAndChildren.SetAndSwapAttr(aName, aParsedValue, &oldValueSet);
rv = mAttrs.SetAndSwapAttr(aName, aParsedValue, &oldValueSet);
}
}
else {
@ -2691,7 +2678,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
aNamespaceID,
ATTRIBUTE_NODE);
rv = mAttrsAndChildren.SetAndSwapAttr(ni, aParsedValue, &oldValueSet);
rv = mAttrs.SetAndSwapAttr(ni, aParsedValue, &oldValueSet);
}
NS_ENSURE_SUCCESS(rv, rv);
@ -2945,7 +2932,7 @@ Element::FindAttrValueIn(int32_t aNameSpaceID,
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
NS_ASSERTION(aValues, "Null value array");
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
if (val) {
for (int32_t i = 0; aValues[i]; ++i) {
if (val->Equals(*aValues[i], aCaseSensitive)) {
@ -2963,7 +2950,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsAtom* aName,
{
NS_ASSERTION(nullptr != aName, "must have attribute name");
int32_t index = mAttrsAndChildren.IndexOfAttr(aName, aNameSpaceID);
int32_t index = mAttrs.IndexOfAttr(aName, aNameSpaceID);
if (index < 0) {
return NS_OK;
}
@ -3014,7 +3001,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsAtom* aName,
}
nsAttrValue oldValue;
rv = mAttrsAndChildren.RemoveAttrAt(index, oldValue);
rv = mAttrs.RemoveAttrAt(index, oldValue);
NS_ENSURE_SUCCESS(rv, rv);
PostIdMaybeChange(aNameSpaceID, aName, nullptr);
@ -3086,12 +3073,12 @@ void
Element::DescribeAttribute(uint32_t index, nsAString& aOutDescription) const
{
// name
mAttrsAndChildren.AttrNameAt(index)->GetQualifiedName(aOutDescription);
mAttrs.AttrNameAt(index)->GetQualifiedName(aOutDescription);
// value
aOutDescription.AppendLiteral("=\"");
nsAutoString value;
mAttrsAndChildren.AttrAt(index)->ToString(value);
mAttrs.AttrAt(index)->ToString(value);
for (uint32_t i = value.Length(); i > 0; --i) {
if (value[i - 1] == char16_t('"'))
value.Insert(char16_t('\\'), i - 1);
@ -3104,7 +3091,7 @@ Element::DescribeAttribute(uint32_t index, nsAString& aOutDescription) const
void
Element::ListAttributes(FILE* out) const
{
uint32_t index, count = mAttrsAndChildren.AttrCount();
uint32_t index, count = mAttrs.AttrCount();
for (index = 0; index < count; index++) {
nsAutoString attributeDescription;
DescribeAttribute(index, attributeDescription);
@ -3242,7 +3229,7 @@ Element::Describe(nsAString& aOutDescription) const
aOutDescription.Append(mNodeInfo->QualifiedName());
aOutDescription.AppendPrintf("@%p", (void *)this);
uint32_t index, count = mAttrsAndChildren.AttrCount();
uint32_t index, count = mAttrs.AttrCount();
for (index = 0; index < count; index++) {
aOutDescription.Append(' ');
nsAutoString attributeDescription;
@ -4107,7 +4094,7 @@ Element::GetEnumAttr(nsAtom* aAttr,
const char* aDefaultInvalid,
nsAString& aResult) const
{
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr);
const nsAttrValue* attrVal = mAttrs.GetAttr(aAttr);
aResult.Truncate();

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

@ -21,7 +21,7 @@
#include "nsILinkHandler.h"
#include "nsINodeList.h"
#include "nsNodeUtils.h"
#include "nsAttrAndChildArray.h"
#include "AttrArray.h"
#include "mozilla/FlushType.h"
#include "nsDOMAttributeMap.h"
#include "nsPresContext.h"
@ -320,8 +320,9 @@ public:
*/
const nsMappedAttributes* GetMappedAttributes() const;
void ClearMappedServoStyle() {
mAttrsAndChildren.ClearMappedServoStyle();
void ClearMappedServoStyle()
{
mAttrs.ClearMappedServoStyle();
}
/**
@ -916,7 +917,7 @@ public:
*/
const nsAttrName* GetAttrNameAt(uint32_t aIndex) const
{
return mAttrsAndChildren.GetSafeAttrNameAt(aIndex);
return mAttrs.GetSafeAttrNameAt(aIndex);
}
/**
@ -924,11 +925,11 @@ public:
*/
BorrowedAttrInfo GetAttrInfoAt(uint32_t aIndex) const
{
if (aIndex >= mAttrsAndChildren.AttrCount()) {
if (aIndex >= mAttrs.AttrCount()) {
return BorrowedAttrInfo(nullptr, nullptr);
}
return mAttrsAndChildren.AttrInfoAt(aIndex);
return mAttrs.AttrInfoAt(aIndex);
}
/**
@ -938,7 +939,7 @@ public:
*/
uint32_t GetAttrCount() const
{
return mAttrsAndChildren.AttrCount();
return mAttrs.AttrCount();
}
virtual bool IsNodeOfType(uint32_t aFlags) const override;
@ -1029,7 +1030,7 @@ protected:
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
if (val) {
val->ToString(aResult);
return true;
@ -1039,12 +1040,12 @@ protected:
}
public:
bool HasAttrs() const { return mAttrsAndChildren.HasAttrs(); }
bool HasAttrs() const { return mAttrs.HasAttrs(); }
inline bool GetAttr(const nsAString& aName, DOMString& aResult) const
{
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName);
const nsAttrValue* val = mAttrs.GetAttr(aName);
if (val) {
val->ToString(aResult);
return true;
@ -1462,12 +1463,12 @@ public:
const nsAttrValue* GetParsedAttr(nsAtom* aAttr) const
{
return mAttrsAndChildren.GetAttr(aAttr);
return mAttrs.GetAttr(aAttr);
}
const nsAttrValue* GetParsedAttr(nsAtom* aAttr, int32_t aNameSpaceID) const
{
return mAttrsAndChildren.GetAttr(aAttr, aNameSpaceID);
return mAttrs.GetAttr(aAttr, aNameSpaceID);
}
/**
@ -1492,7 +1493,7 @@ public:
* null. Note that this can only return info on attributes that actually
* live on this element (and is only virtual to handle XUL prototypes). That
* is, this should only be called from methods that only care about attrs
* that effectively live in mAttrsAndChildren.
* that effectively live in mAttrs.
*/
BorrowedAttrInfo GetAttrInfo(int32_t aNamespaceID, nsAtom* aName) const
{
@ -1500,12 +1501,12 @@ public:
NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
int32_t index = mAttrsAndChildren.IndexOfAttr(aName, aNamespaceID);
int32_t index = mAttrs.IndexOfAttr(aName, aNamespaceID);
if (index < 0) {
return BorrowedAttrInfo(nullptr, nullptr);
}
return mAttrsAndChildren.AttrInfoAt(index);
return mAttrs.AttrInfoAt(index);
}
/**
@ -2021,7 +2022,7 @@ Element::HasAttr(int32_t aNameSpaceID, nsAtom* aName) const
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
return mAttrsAndChildren.IndexOfAttr(aName, aNameSpaceID) >= 0;
return mAttrs.IndexOfAttr(aName, aNameSpaceID) >= 0;
}
inline bool
@ -2033,7 +2034,7 @@ Element::AttrValueIs(int32_t aNameSpaceID,
NS_ASSERTION(aName, "Must have attr name");
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
return val && val->Equals(aValue, aCaseSensitive);
}
@ -2047,7 +2048,7 @@ Element::AttrValueIs(int32_t aNameSpaceID,
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
NS_ASSERTION(aValue, "Null value atom");
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
return val && val->Equals(aValue, aCaseSensitive);
}

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

@ -2019,12 +2019,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
// Traverse attribute names.
{
uint32_t i;
uint32_t attrs = tmp->mAttrsAndChildren.AttrCount();
uint32_t attrs = tmp->mAttrs.AttrCount();
for (i = 0; i < attrs; i++) {
const nsAttrName* name = tmp->mAttrsAndChildren.AttrNameAt(i);
const nsAttrName* name = tmp->mAttrs.AttrNameAt(i);
if (!name->IsAtom()) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
"mAttrsAndChildren[i]->NodeInfo()");
"mAttrs[i]->NodeInfo()");
cb.NoteNativeChild(name->NodeInfo(),
NS_CYCLE_COLLECTION_PARTICIPANT(NodeInfo));
}
@ -2043,14 +2043,14 @@ nsresult
FragmentOrElement::CopyInnerTo(FragmentOrElement* aDst,
bool aPreallocateChildren)
{
nsresult rv = aDst->mAttrsAndChildren.EnsureCapacityToClone(mAttrsAndChildren,
aPreallocateChildren);
nsresult rv = aDst->mAttrs.EnsureCapacityToClone(mAttrs,
aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t i, count = mAttrsAndChildren.AttrCount();
uint32_t i, count = mAttrs.AttrCount();
for (i = 0; i < count; ++i) {
const nsAttrName* name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrValue* value = mAttrsAndChildren.AttrAt(i);
const nsAttrName* name = mAttrs.AttrNameAt(i);
const nsAttrValue* value = mAttrs.AttrAt(i);
nsAutoString valStr;
value->ToString(valStr);
rv = aDst->AsElement()->SetAttr(name->NamespaceID(), name->LocalName(),
@ -2323,7 +2323,7 @@ FragmentOrElement::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
{
nsIContent::AddSizeOfExcludingThis(aSizes, aNodeSize);
*aNodeSize +=
mAttrsAndChildren.SizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
mAttrs.SizeOfExcludingThis(aSizes.mState.mMallocSizeOf);
nsDOMSlots* slots = GetExistingDOMSlots();
if (slots) {

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

@ -16,7 +16,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/UniquePtr.h"
#include "nsAttrAndChildArray.h" // member
#include "AttrArray.h" // member
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
#include "nsIContent.h" // base class
#include "nsNodeUtils.h" // class member nsNodeUtils::CloneNodeImpl
@ -328,9 +328,9 @@ protected:
friend class ::ContentUnbinder;
/**
* Array containing all attributes and children for this element
* Array containing all attributes for this element
*/
nsAttrAndChildArray mAttrsAndChildren;
AttrArray mAttrs;
};
} // namespace dom

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

@ -33,13 +33,13 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'dom'
EXPORTS += [
'AttrArray.h',
'AutocompleteFieldList.h',
'Crypto.h',
'HTMLSplitOnSpacesTokenizer.h',
'IframeSandboxKeywordList.h',
'mozAutoDocUpdate.h',
'NodeUbiReporting.h',
'nsAttrAndChildArray.h',
'nsAttrName.h',
'nsAttrValue.h',
'nsAttrValueInlines.h',
@ -238,6 +238,7 @@ if CONFIG['FUZZING']:
UNIFIED_SOURCES += [
'AnonymousContent.cpp',
'Attr.cpp',
'AttrArray.cpp',
'BarProps.cpp',
'BodyUtil.cpp',
'BorrowedAttrInfo.cpp',
@ -289,7 +290,6 @@ UNIFIED_SOURCES += [
'NodeInfo.cpp',
'NodeIterator.cpp',
'NodeUbiReporting.cpp',
'nsAttrAndChildArray.cpp',
'nsAttrValue.cpp',
'nsAttrValueOrString.cpp',
'nsCCUncollectableMarker.cpp',

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

@ -101,7 +101,7 @@ public:
}
// Faster comparison in the case we know the namespace is null
// Note that some callers such as nsAttrAndChildArray::IndexOfAttr() will
// Note that some callers such as AttrArray::IndexOfAttr() will
// call this function on nsAttrName structs with 0 mBits, so no attempt
// must be made to do anything with mBits besides comparing it with the
// incoming aAtom argument.

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

@ -1959,7 +1959,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
// methods.
for (MediaQueryList* mql = tmp->mDOMMediaQueryLists.getFirst(); mql;
mql = static_cast<LinkedListElement<MediaQueryList>*>(mql)->getNext()) {
if (mql->HasListeners()) {
if (mql->HasListeners() &&
NS_SUCCEEDED(mql->CheckInnerWindowCorrectness())) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mDOMMediaQueryLists item");
cb.NoteXPCOMChild(mql);
}

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

@ -7,7 +7,6 @@
#define nsIDocument_h___
#include "mozilla/FlushType.h" // for enum
#include "nsAttrAndChildArray.h"
#include "nsAutoPtr.h" // for member
#include "nsCOMArray.h" // for member
#include "nsCompatibility.h" // for member
@ -4420,9 +4419,6 @@ protected:
// Tracking for plugins in the document.
nsTHashtable<nsPtrHashKey<nsIObjectLoadingContent>> mPlugins;
// Array of owning references to all children
nsAttrAndChildArray mChildren;
RefPtr<mozilla::dom::DocumentTimeline> mDocumentTimeline;
mozilla::LinkedList<mozilla::dom::DocumentTimeline> mTimelines;

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

@ -35,7 +35,7 @@
#endif
#endif
class nsAttrAndChildArray;
class AttrArray;
class nsAttrChildContentList;
class nsDOMAttributeMap;
class nsIAnimationObserver;
@ -367,7 +367,7 @@ public:
friend class nsNodeUtils;
friend class nsNodeWeakReference;
friend class nsNodeSupportsWeakRefTearoff;
friend class nsAttrAndChildArray;
friend class AttrArray;
#ifdef MOZILLA_INTERNAL_API
explicit nsINode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);

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

@ -15,8 +15,8 @@ nsMappedAttributeElement::SetAndSwapMappedAttribute(nsAtom* aName,
nsresult* aRetval)
{
nsHTMLStyleSheet* sheet = OwnerDoc()->GetAttributeStyleSheet();
*aRetval = mAttrsAndChildren.SetAndSwapMappedAttr(aName, aValue,
this, sheet, aValueWasSet);
*aRetval = mAttrs.SetAndSwapMappedAttr(aName, aValue,
this, sheet, aValueWasSet);
return true;
}
@ -36,6 +36,6 @@ void
nsMappedAttributeElement::NodeInfoChanged(nsIDocument* aOldDoc)
{
nsHTMLStyleSheet* sheet = OwnerDoc()->GetAttributeStyleSheet();
mAttrsAndChildren.SetMappedAttrStyleSheet(sheet);
mAttrs.SetMappedAttrStyleSheet(sheet);
nsMappedAttributeElementBase::NodeInfoChanged(aOldDoc);
}

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

@ -12,7 +12,7 @@
#ifndef nsMappedAttributes_h___
#define nsMappedAttributes_h___
#include "nsAttrAndChildArray.h"
#include "AttrArray.h"
#include "nsMappedAttributeElement.h"
#include "mozilla/Attributes.h"
#include "mozilla/ServoBindingTypes.h"

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

@ -164,7 +164,7 @@ nsStyledElement::ReparseStyleAttribute(bool aForceInDataDoc, bool aForceIfAlread
if (!MayHaveStyle()) {
return NS_OK;
}
const nsAttrValue* oldVal = mAttrsAndChildren.GetAttr(nsGkAtoms::style);
const nsAttrValue* oldVal = mAttrs.GetAttr(nsGkAtoms::style);
if (oldVal && (aForceIfAlreadyParsed || oldVal->Type() != nsAttrValue::eCSSDeclaration)) {
nsAttrValue attrValue;
nsAutoString stringValue;
@ -173,8 +173,8 @@ nsStyledElement::ReparseStyleAttribute(bool aForceInDataDoc, bool aForceIfAlread
// Don't bother going through SetInlineStyleDeclaration; we don't
// want to fire off mutation events or document notifications anyway
bool oldValueSet;
nsresult rv = mAttrsAndChildren.SetAndSwapAttr(nsGkAtoms::style, attrValue,
&oldValueSet);
nsresult rv = mAttrs.SetAndSwapAttr(nsGkAtoms::style, attrValue,
&oldValueSet);
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -487,7 +487,6 @@ skip-if = toolkit == 'android' || (verify && !debug && (os == 'linux')) #bug 687
[test_bug605982.html]
[test_bug606729.html]
[test_bug614058.html]
[test_bug614583.html]
[test_bug622088.html]
[test_bug622117.html]
[test_bug622246.html]

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

@ -1,261 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=614583
-->
<head>
<title>Test for Bug 614583</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=614583">Mozilla Bug 614583</a>
<span id="crash1"
attr0 attr1 attr2 attr3 attr4 attr5 attr6 attr7 attr8 attr9
attr10 attr11 attr12 attr13 attr14 attr15 attr16 attr17 attr18 attr19
attr20 attr21 attr22 attr23 attr24 attr25 attr26 attr27 attr28 attr29
attr30 attr31 attr32 attr33 attr34 attr35 attr36 attr37 attr38 attr39
attr40 attr41 attr42 attr43 attr44 attr45 attr46 attr47 attr48 attr49
attr50 attr51 attr52 attr53 attr54 attr55 attr56 attr57 attr58 attr59
attr60 attr61 attr62 attr63 attr64 attr65 attr66 attr67 attr68 attr69
attr70 attr71 attr72 attr73 attr74 attr75 attr76 attr77 attr78 attr79
attr80 attr81 attr82 attr83 attr84 attr85 attr86 attr87 attr88 attr89
attr90 attr91 attr92 attr93 attr94 attr95 attr96 attr97 attr98 attr99
attr100 attr101 attr102 attr103 attr104 attr105 attr106 attr107 attr108 attr109
attr110 attr111 attr112 attr113 attr114 attr115 attr116 attr117 attr118 attr119
attr120 attr121 attr122 attr123 attr124 attr125 attr126 attr127 attr128 attr129
attr130 attr131 attr132 attr133 attr134 attr135 attr136 attr137 attr138 attr139
attr140 attr141 attr142 attr143 attr144 attr145 attr146 attr147 attr148 attr149
attr150 attr151 attr152 attr153 attr154 attr155 attr156 attr157 attr158 attr159
attr160 attr161 attr162 attr163 attr164 attr165 attr166 attr167 attr168 attr169
attr170 attr171 attr172 attr173 attr174 attr175 attr176 attr177 attr178 attr179
attr180 attr181 attr182 attr183 attr184 attr185 attr186 attr187 attr188 attr189
attr190 attr191 attr192 attr193 attr194 attr195 attr196 attr197 attr198 attr199
attr200 attr201 attr202 attr203 attr204 attr205 attr206 attr207 attr208 attr209
attr210 attr211 attr212 attr213 attr214 attr215 attr216 attr217 attr218 attr219
attr220 attr221 attr222 attr223 attr224 attr225 attr226 attr227 attr228 attr229
attr230 attr231 attr232 attr233 attr234 attr235 attr236 attr237 attr238 attr239
attr240 attr241 attr242 attr243 attr244 attr245 attr246 attr247 attr248 attr249
attr250 attr251 attr252 attr253 attr254 attr255 attr256 attr257 attr258 attr259
attr260 attr261 attr262 attr263 attr264 attr265 attr266 attr267 attr268 attr269
attr270 attr271 attr272 attr273 attr274 attr275 attr276 attr277 attr278 attr279
attr280 attr281 attr282 attr283 attr284 attr285 attr286 attr287 attr288 attr289
attr290 attr291 attr292 attr293 attr294 attr295 attr296 attr297 attr298 attr299
attr300 attr301 attr302 attr303 attr304 attr305 attr306 attr307 attr308 attr309
attr310 attr311 attr312 attr313 attr314 attr315 attr316 attr317 attr318 attr319
attr320 attr321 attr322 attr323 attr324 attr325 attr326 attr327 attr328 attr329
attr330 attr331 attr332 attr333 attr334 attr335 attr336 attr337 attr338 attr339
attr340 attr341 attr342 attr343 attr344 attr345 attr346 attr347 attr348 attr349
attr350 attr351 attr352 attr353 attr354 attr355 attr356 attr357 attr358 attr359
attr360 attr361 attr362 attr363 attr364 attr365 attr366 attr367 attr368 attr369
attr370 attr371 attr372 attr373 attr374 attr375 attr376 attr377 attr378 attr379
attr380 attr381 attr382 attr383 attr384 attr385 attr386 attr387 attr388 attr389
attr390 attr391 attr392 attr393 attr394 attr395 attr396 attr397 attr398 attr399
attr400 attr401 attr402 attr403 attr404 attr405 attr406 attr407 attr408 attr409
attr410 attr411 attr412 attr413 attr414 attr415 attr416 attr417 attr418 attr419
attr420 attr421 attr422 attr423 attr424 attr425 attr426 attr427 attr428 attr429
attr430 attr431 attr432 attr433 attr434 attr435 attr436 attr437 attr438 attr439
attr440 attr441 attr442 attr443 attr444 attr445 attr446 attr447 attr448 attr449
attr450 attr451 attr452 attr453 attr454 attr455 attr456 attr457 attr458 attr459
attr460 attr461 attr462 attr463 attr464 attr465 attr466 attr467 attr468 attr469
attr470 attr471 attr472 attr473 attr474 attr475 attr476 attr477 attr478 attr479
attr480 attr481 attr482 attr483 attr484 attr485 attr486 attr487 attr488 attr489
attr490 attr491 attr492 attr493 attr494 attr495 attr496 attr497 attr498 attr499
attr500 attr501 attr502 attr503 attr504 attr505 attr506 attr507 attr508 attr509
attr510 attr511 attr512 attr513 attr514 attr515 attr516 attr517 attr518 attr519
attr520 attr521 attr522 attr523 attr524 attr525 attr526 attr527 attr528 attr529
attr530 attr531 attr532 attr533 attr534 attr535 attr536 attr537 attr538 attr539
attr540 attr541 attr542 attr543 attr544 attr545 attr546 attr547 attr548 attr549
attr550 attr551 attr552 attr553 attr554 attr555 attr556 attr557 attr558 attr559
attr560 attr561 attr562 attr563 attr564 attr565 attr566 attr567 attr568 attr569
attr570 attr571 attr572 attr573 attr574 attr575 attr576 attr577 attr578 attr579
attr580 attr581 attr582 attr583 attr584 attr585 attr586 attr587 attr588 attr589
attr590 attr591 attr592 attr593 attr594 attr595 attr596 attr597 attr598 attr599
attr600 attr601 attr602 attr603 attr604 attr605 attr606 attr607 attr608 attr609
attr610 attr611 attr612 attr613 attr614 attr615 attr616 attr617 attr618 attr619
attr620 attr621 attr622 attr623 attr624 attr625 attr626 attr627 attr628 attr629
attr630 attr631 attr632 attr633 attr634 attr635 attr636 attr637 attr638 attr639
attr640 attr641 attr642 attr643 attr644 attr645 attr646 attr647 attr648 attr649
attr650 attr651 attr652 attr653 attr654 attr655 attr656 attr657 attr658 attr659
attr660 attr661 attr662 attr663 attr664 attr665 attr666 attr667 attr668 attr669
attr670 attr671 attr672 attr673 attr674 attr675 attr676 attr677 attr678 attr679
attr680 attr681 attr682 attr683 attr684 attr685 attr686 attr687 attr688 attr689
attr690 attr691 attr692 attr693 attr694 attr695 attr696 attr697 attr698 attr699
attr700 attr701 attr702 attr703 attr704 attr705 attr706 attr707 attr708 attr709
attr710 attr711 attr712 attr713 attr714 attr715 attr716 attr717 attr718 attr719
attr720 attr721 attr722 attr723 attr724 attr725 attr726 attr727 attr728 attr729
attr730 attr731 attr732 attr733 attr734 attr735 attr736 attr737 attr738 attr739
attr740 attr741 attr742 attr743 attr744 attr745 attr746 attr747 attr748 attr749
attr750 attr751 attr752 attr753 attr754 attr755 attr756 attr757 attr758 attr759
attr760 attr761 attr762 attr763 attr764 attr765 attr766 attr767 attr768 attr769
attr770 attr771 attr772 attr773 attr774 attr775 attr776 attr777 attr778 attr779
attr780 attr781 attr782 attr783 attr784 attr785 attr786 attr787 attr788 attr789
attr790 attr791 attr792 attr793 attr794 attr795 attr796 attr797 attr798 attr799
attr800 attr801 attr802 attr803 attr804 attr805 attr806 attr807 attr808 attr809
attr810 attr811 attr812 attr813 attr814 attr815 attr816 attr817 attr818 attr819
attr820 attr821 attr822 attr823 attr824 attr825 attr826 attr827 attr828 attr829
attr830 attr831 attr832 attr833 attr834 attr835 attr836 attr837 attr838 attr839
attr840 attr841 attr842 attr843 attr844 attr845 attr846 attr847 attr848 attr849
attr850 attr851 attr852 attr853 attr854 attr855 attr856 attr857 attr858 attr859
attr860 attr861 attr862 attr863 attr864 attr865 attr866 attr867 attr868 attr869
attr870 attr871 attr872 attr873 attr874 attr875 attr876 attr877 attr878 attr879
attr880 attr881 attr882 attr883 attr884 attr885 attr886 attr887 attr888 attr889
attr890 attr891 attr892 attr893 attr894 attr895 attr896 attr897 attr898 attr899
attr900 attr901 attr902 attr903 attr904 attr905 attr906 attr907 attr908 attr909
attr910 attr911 attr912 attr913 attr914 attr915 attr916 attr917 attr918 attr919
attr920 attr921 attr922 attr923 attr924 attr925 attr926 attr927 attr928 attr929
attr930 attr931 attr932 attr933 attr934 attr935 attr936 attr937 attr938 attr939
attr940 attr941 attr942 attr943 attr944 attr945 attr946 attr947 attr948 attr949
attr950 attr951 attr952 attr953 attr954 attr955 attr956 attr957 attr958 attr959
attr960 attr961 attr962 attr963 attr964 attr965 attr966 attr967 attr968 attr969
attr970 attr971 attr972 attr973 attr974 attr975 attr976 attr977 attr978 attr979
attr980 attr981 attr982 attr983 attr984 attr985 attr986 attr987 attr988 attr989
attr990 attr991 attr992 attr993 attr994 attr995 attr996 attr997 attr998 attr999
attr1000 attr1001 attr1002 attr1003 attr1004 attr1005 attr1006 attr1007 attr1008 attr1009
attr1010 attr1011 attr1012 attr1013 attr1014 attr1015 attr1016 attr1017 attr1018 attr1019
attr1020 attr1021 attr1022 attr1023 attr1024 attr1025 attr1026 attr1027 attr1028 attr1029
attr1030 attr1031 attr1032 attr1033 attr1034 attr1035 attr1036 attr1037 attr1038 attr1039
attr1040 attr1041 attr1042 attr1043 attr1044 attr1045 attr1046 attr1047 attr1048 attr1049
attr1050 attr1051 attr1052 attr1053 attr1054 attr1055 attr1056 attr1057 attr1058 attr1059
attr1060 attr1061 attr1062 attr1063 attr1064 attr1065 attr1066 attr1067 attr1068 attr1069
attr1070 attr1071 attr1072 attr1073 attr1074 attr1075 attr1076 attr1077 attr1078 attr1079
attr1080 attr1081 attr1082 attr1083 attr1084 attr1085 attr1086 attr1087 attr1088 attr1089
attr1090 attr1091 attr1092 attr1093 attr1094 attr1095 attr1096 attr1097 attr1098 attr1099
>I'm on a boat</span>
<span
attr0 attr1 attr2 attr3 attr4 attr5 attr6 attr7 attr8 attr9
attr10 attr11 attr12 attr13 attr14 attr15 attr16 attr17 attr18 attr19
attr20 attr21 attr22 attr23 attr24 attr25 attr26 attr27 attr28 attr29
attr30 attr31 attr32 attr33 attr34 attr35 attr36 attr37 attr38 attr39
attr40 attr41 attr42 attr43 attr44 attr45 attr46 attr47 attr48 attr49
attr50 attr51 attr52 attr53 attr54 attr55 attr56 attr57 attr58 attr59
attr60 attr61 attr62 attr63 attr64 attr65 attr66 attr67 attr68 attr69
attr70 attr71 attr72 attr73 attr74 attr75 attr76 attr77 attr78 attr79
attr80 attr81 attr82 attr83 attr84 attr85 attr86 attr87 attr88 attr89
attr90 attr91 attr92 attr93 attr94 attr95 attr96 attr97 attr98 attr99
attr100 attr101 attr102 attr103 attr104 attr105 attr106 attr107 attr108 attr109
attr110 attr111 attr112 attr113 attr114 attr115 attr116 attr117 attr118 attr119
attr120 attr121 attr122 attr123 attr124 attr125 attr126 attr127 attr128 attr129
attr130 attr131 attr132 attr133 attr134 attr135 attr136 attr137 attr138 attr139
attr140 attr141 attr142 attr143 attr144 attr145 attr146 attr147 attr148 attr149
attr150 attr151 attr152 attr153 attr154 attr155 attr156 attr157 attr158 attr159
attr160 attr161 attr162 attr163 attr164 attr165 attr166 attr167 attr168 attr169
attr170 attr171 attr172 attr173 attr174 attr175 attr176 attr177 attr178 attr179
attr180 attr181 attr182 attr183 attr184 attr185 attr186 attr187 attr188 attr189
attr190 attr191 attr192 attr193 attr194 attr195 attr196 attr197 attr198 attr199
attr200 attr201 attr202 attr203 attr204 attr205 attr206 attr207 attr208 attr209
attr210 attr211 attr212 attr213 attr214 attr215 attr216 attr217 attr218 attr219
attr220 attr221 attr222 attr223 attr224 attr225 attr226 attr227 attr228 attr229
attr230 attr231 attr232 attr233 attr234 attr235 attr236 attr237 attr238 attr239
attr240 attr241 attr242 attr243 attr244 attr245 attr246 attr247 attr248 attr249
attr250 attr251 attr252 attr253 attr254 attr255 attr256 attr257 attr258 attr259
attr260 attr261 attr262 attr263 attr264 attr265 attr266 attr267 attr268 attr269
attr270 attr271 attr272 attr273 attr274 attr275 attr276 attr277 attr278 attr279
attr280 attr281 attr282 attr283 attr284 attr285 attr286 attr287 attr288 attr289
attr290 attr291 attr292 attr293 attr294 attr295 attr296 attr297 attr298 attr299
attr300 attr301 attr302 attr303 attr304 attr305 attr306 attr307 attr308 attr309
attr310 attr311 attr312 attr313 attr314 attr315 attr316 attr317 attr318 attr319
attr320 attr321 attr322 attr323 attr324 attr325 attr326 attr327 attr328 attr329
attr330 attr331 attr332 attr333 attr334 attr335 attr336 attr337 attr338 attr339
attr340 attr341 attr342 attr343 attr344 attr345 attr346 attr347 attr348 attr349
attr350 attr351 attr352 attr353 attr354 attr355 attr356 attr357 attr358 attr359
attr360 attr361 attr362 attr363 attr364 attr365 attr366 attr367 attr368 attr369
attr370 attr371 attr372 attr373 attr374 attr375 attr376 attr377 attr378 attr379
attr380 attr381 attr382 attr383 attr384 attr385 attr386 attr387 attr388 attr389
attr390 attr391 attr392 attr393 attr394 attr395 attr396 attr397 attr398 attr399
attr400 attr401 attr402 attr403 attr404 attr405 attr406 attr407 attr408 attr409
attr410 attr411 attr412 attr413 attr414 attr415 attr416 attr417 attr418 attr419
attr420 attr421 attr422 attr423 attr424 attr425 attr426 attr427 attr428 attr429
attr430 attr431 attr432 attr433 attr434 attr435 attr436 attr437 attr438 attr439
attr440 attr441 attr442 attr443 attr444 attr445 attr446 attr447 attr448 attr449
attr450 attr451 attr452 attr453 attr454 attr455 attr456 attr457 attr458 attr459
attr460 attr461 attr462 attr463 attr464 attr465 attr466 attr467 attr468 attr469
attr470 attr471 attr472 attr473 attr474 attr475 attr476 attr477 attr478 attr479
attr480 attr481 attr482 attr483 attr484 attr485 attr486 attr487 attr488 attr489
attr490 attr491 attr492 attr493 attr494 attr495 attr496 attr497 attr498 attr499
attr500 attr501 attr502 attr503 attr504 attr505 attr506 attr507 attr508 attr509
attr510 attr511 attr512 attr513 attr514 attr515 attr516 attr517 attr518 attr519
attr520 attr521 attr522 attr523 attr524 attr525 attr526 attr527 attr528 attr529
attr530 attr531 attr532 attr533 attr534 attr535 attr536 attr537 attr538 attr539
attr540 attr541 attr542 attr543 attr544 attr545 attr546 attr547 attr548 attr549
attr550 attr551 attr552 attr553 attr554 attr555 attr556 attr557 attr558 attr559
attr560 attr561 attr562 attr563 attr564 attr565 attr566 attr567 attr568 attr569
attr570 attr571 attr572 attr573 attr574 attr575 attr576 attr577 attr578 attr579
attr580 attr581 attr582 attr583 attr584 attr585 attr586 attr587 attr588 attr589
attr590 attr591 attr592 attr593 attr594 attr595 attr596 attr597 attr598 attr599
attr600 attr601 attr602 attr603 attr604 attr605 attr606 attr607 attr608 attr609
attr610 attr611 attr612 attr613 attr614 attr615 attr616 attr617 attr618 attr619
attr620 attr621 attr622 attr623 attr624 attr625 attr626 attr627 attr628 attr629
attr630 attr631 attr632 attr633 attr634 attr635 attr636 attr637 attr638 attr639
attr640 attr641 attr642 attr643 attr644 attr645 attr646 attr647 attr648 attr649
attr650 attr651 attr652 attr653 attr654 attr655 attr656 attr657 attr658 attr659
attr660 attr661 attr662 attr663 attr664 attr665 attr666 attr667 attr668 attr669
attr670 attr671 attr672 attr673 attr674 attr675 attr676 attr677 attr678 attr679
attr680 attr681 attr682 attr683 attr684 attr685 attr686 attr687 attr688 attr689
attr690 attr691 attr692 attr693 attr694 attr695 attr696 attr697 attr698 attr699
attr700 attr701 attr702 attr703 attr704 attr705 attr706 attr707 attr708 attr709
attr710 attr711 attr712 attr713 attr714 attr715 attr716 attr717 attr718 attr719
attr720 attr721 attr722 attr723 attr724 attr725 attr726 attr727 attr728 attr729
attr730 attr731 attr732 attr733 attr734 attr735 attr736 attr737 attr738 attr739
attr740 attr741 attr742 attr743 attr744 attr745 attr746 attr747 attr748 attr749
attr750 attr751 attr752 attr753 attr754 attr755 attr756 attr757 attr758 attr759
attr760 attr761 attr762 attr763 attr764 attr765 attr766 attr767 attr768 attr769
attr770 attr771 attr772 attr773 attr774 attr775 attr776 attr777 attr778 attr779
attr780 attr781 attr782 attr783 attr784 attr785 attr786 attr787 attr788 attr789
attr790 attr791 attr792 attr793 attr794 attr795 attr796 attr797 attr798 attr799
attr800 attr801 attr802 attr803 attr804 attr805 attr806 attr807 attr808 attr809
attr810 attr811 attr812 attr813 attr814 attr815 attr816 attr817 attr818 attr819
attr820 attr821 attr822 attr823 attr824 attr825 attr826 attr827 attr828 attr829
attr830 attr831 attr832 attr833 attr834 attr835 attr836 attr837 attr838 attr839
attr840 attr841 attr842 attr843 attr844 attr845 attr846 attr847 attr848 attr849
attr850 attr851 attr852 attr853 attr854 attr855 attr856 attr857 attr858 attr859
attr860 attr861 attr862 attr863 attr864 attr865 attr866 attr867 attr868 attr869
attr870 attr871 attr872 attr873 attr874 attr875 attr876 attr877 attr878 attr879
attr880 attr881 attr882 attr883 attr884 attr885 attr886 attr887 attr888 attr889
attr890 attr891 attr892 attr893 attr894 attr895 attr896 attr897 attr898 attr899
attr900 attr901 attr902 attr903 attr904 attr905 attr906 attr907 attr908 attr909
attr910 attr911 attr912 attr913 attr914 attr915 attr916 attr917 attr918 attr919
attr920 attr921 attr922 attr923 attr924 attr925 attr926 attr927 attr928 attr929
attr930 attr931 attr932 attr933 attr934 attr935 attr936 attr937 attr938 attr939
attr940 attr941 attr942 attr943 attr944 attr945 attr946 attr947 attr948 attr949
attr950 attr951 attr952 attr953 attr954 attr955 attr956 attr957 attr958 attr959
attr960 attr961 attr962 attr963 attr964 attr965 attr966 attr967 attr968 attr969
attr970 attr971 attr972 attr973 attr974 attr975 attr976 attr977 attr978 attr979
attr980 attr981 attr982 attr983 attr984 attr985 attr986 attr987 attr988 attr989
attr990 attr991 attr992 attr993 attr994 attr995 attr996 attr997 attr998 attr999
attr1000 attr1001 attr1002 attr1003 attr1004 attr1005 attr1006 attr1007 attr1008 attr1009
attr1010 attr1011 attr1012 attr1013 attr1014 attr1015 attr1016 attr1017 attr1018 attr1019
attr1020 attr1021 attr1022 attr1023 attr1024 attr1025 attr1026 attr1027 attr1028 attr1029
attr1030 attr1031 attr1032 attr1033 attr1034 attr1035 attr1036 attr1037 attr1038 attr1039
attr1040 attr1041 attr1042 attr1043 attr1044 attr1045 attr1046 attr1047 attr1048 attr1049
attr1050 attr1051 attr1052 attr1053 attr1054 attr1055 attr1056 attr1057 attr1058 attr1059
attr1060 attr1061 attr1062 attr1063 attr1064 attr1065 attr1066 attr1067 attr1068 attr1069
attr1070 attr1071 attr1072 attr1073 attr1074 attr1075 attr1076 attr1077 attr1078 attr1079
attr1080 attr1081 attr1082 attr1083 attr1084 attr1085 attr1086 attr1087 attr1088 attr1089
attr1090 attr1091 attr1092 attr1093 attr1094 attr1095 attr1096 attr1097 attr1098 attr1099
id="crash2"
>I'm on a boat</span>
<pre id="test">
<script>
span = document.createElement("span");
try {
var i = 0;
while(1) {
span.setAttribute("attr" + (++i), "foo");
}
}
catch (ex) {}
span.id = "crash3";
document.body.appendChild(span);
var attrCount = span.attributes.length;
var spans = document.getElementsByTagName("span");
for (i = 0; i < spans.length; ++i) {
is(spans[i].attributes.length, attrCount, "didn't have maxed out attrs");
}
while (spans.length) {
spans[0].remove();
}
</script>
</pre>
</body>
</html>

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

@ -72,6 +72,8 @@ function testKeys(browser) {
function testOpen_worker(browser) {
return ContentTask.spawn(browser, {}, function() {
Cu.importGlobalProperties(["Blob"]);
let workerFunctionString = function () {
caches.open("pb-worker-cache").then(function(cacheObject) {
postMessage(cacheObject.toString());

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

@ -297,6 +297,7 @@ class WebGLContext
friend class WebGLExtensionDisjointTimerQuery;
friend class WebGLExtensionDrawBuffers;
friend class WebGLExtensionLoseContext;
friend class WebGLExtensionMOZDebug;
friend class WebGLExtensionVertexArray;
friend class WebGLMemoryTracker;
friend class webgl::AvailabilityRunnable;

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

@ -59,7 +59,7 @@ WebGLExtensionMOZDebug::GetParameter(JSContext* cx, GLenum pname,
return;
}
case 0x10000: // "WSI_INFO"
case dom::MOZ_debug_Binding::WSI_INFO:
{
nsCString info;
gl->GetWSIInfo(&info);
@ -67,6 +67,10 @@ WebGLExtensionMOZDebug::GetParameter(JSContext* cx, GLenum pname,
return;
}
case dom::MOZ_debug_Binding::DOES_INDEX_VALIDATION:
retval.set(JS::BooleanValue(mContext->mNeedsIndexValidation));
return;
default:
mContext->ErrorInvalidEnumArg("MOZ_debug.getParameter", "pname", pname);
retval.set(JS::NullValue());

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

@ -66,6 +66,8 @@ support-files = ../captureStream_common.js
[test_draw.html]
[test_fb_param.html]
[test_fb_param_crash.html]
[test_has_rbab.html]
fail-if = (os == 'linux') || (os == 'mac')
[test_hidden_alpha.html]
[test_hidden_depth_stencil.html]
[test_implicit_color_buffer_float.html]

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

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset='UTF-8'>
<title>Fail without robust_buffer_access_behavior</title>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
</head>
<body>
<script>
function AssertRBAB() {
const c = document.createElement('canvas');
const g = c.getContext('webgl');
const e = g.getExtension('MOZ_debug');
ok(e, 'Should have MOZ_debug.');
const does_index_validation = e.getParameter(e.DOES_INDEX_VALIDATION);
ok(!does_index_validation,
"Should have RBAB. Mark this test as failing on platforms that can't support it.");
SimpleTest.finish();
}
// -
SimpleTest.waitForExplicitFinish();
const prefPairList = [
['webgl.force-enabled', true],
['webgl.enable-privileged-extensions', true],
];
const prefEnv = {'set': prefPairList};
SpecialPowers.pushPrefEnv(prefEnv, AssertRBAB);
</script>
</body>
</html>

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

@ -2017,8 +2017,7 @@ EventStateManager::DetermineDragTargetAndDefaultData(nsPIDOMWindowOuter* aWindow
if (htmlElement->Draggable()) {
break;
}
}
else {
} else {
if (dragContent->IsXULElement()) {
// All XUL elements are draggable, so if a XUL element is
// encountered, stop looking for draggable nodes and just use the
@ -2032,7 +2031,7 @@ EventStateManager::DetermineDragTargetAndDefaultData(nsPIDOMWindowOuter* aWindow
}
// otherwise, it's not an HTML or XUL element, so just keep looking
}
dragContent = dragContent->GetParent();
dragContent = dragContent->GetFlattenedTreeParent();
}
}
@ -2451,7 +2450,7 @@ EventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
return;
while (targetContent->IsText()) {
targetContent = targetContent->GetParent();
targetContent = targetContent->GetFlattenedTreeParent();
}
WidgetMouseScrollEvent event(aEvent->IsTrusted(),
@ -2490,7 +2489,7 @@ EventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
}
while (targetContent->IsText()) {
targetContent = targetContent->GetParent();
targetContent = targetContent->GetFlattenedTreeParent();
}
WidgetMouseScrollEvent event(aEvent->IsTrusted(),
@ -3341,14 +3340,12 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
break;
}
if (activeContent) {
// The nearest enclosing element goes into the :active state. If
// we're not an element (so we're text or something) we need to obtain
// our parent element and put it into :active instead.
if (!activeContent->IsElement()) {
nsIContent* par = activeContent->GetParent();
if (par)
activeContent = par;
// The nearest enclosing element goes into the :active state. If we're
// not an element (so we're text or something) we need to obtain
// our parent element and put it into :active instead.
if (activeContent && !activeContent->IsElement()) {
if (nsIContent* par = activeContent->GetFlattenedTreeParent()) {
activeContent = par;
}
}
}
@ -4297,6 +4294,15 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
return targetFrame;
}
static nsIContent*
FindCommonAncestor(nsIContent* aNode1, nsIContent* aNode2)
{
if (!aNode1 || !aNode2) {
return nullptr;
}
return nsContentUtils::GetCommonFlattenedTreeAncestor(aNode1, aNode2);
}
class EnterLeaveDispatcher
{
public:
@ -4314,11 +4320,7 @@ public:
win && win->HasMouseEnterLeaveEventListeners()) {
mRelatedTarget = aRelatedTarget ?
aRelatedTarget->FindFirstNonChromeOnlyAccessContent() : nullptr;
nsINode* commonParent = nullptr;
if (aTarget && aRelatedTarget) {
commonParent =
nsContentUtils::GetCommonAncestor(aTarget, aRelatedTarget);
}
nsINode* commonParent = FindCommonAncestor(aTarget, aRelatedTarget);
nsIContent* current = aTarget;
// Note, it is ok if commonParent is null!
while (current && current != commonParent) {
@ -4326,7 +4328,7 @@ public:
mTargets.AppendObject(current);
}
// mouseenter/leave is fired only on elements.
current = current->GetParent();
current = current->GetFlattenedTreeParent();
}
}
}
@ -4913,7 +4915,7 @@ EventStateManager::SetClickCount(WidgetMouseEvent* aEvent,
}
if (mouseContent) {
if (mouseContent->IsText()) {
mouseContent = mouseContent->GetParent();
mouseContent = mouseContent->GetFlattenedTreeParent();
}
if (mouseContent && mouseContent->IsRootOfNativeAnonymousSubtree()) {
mouseContentParent = mouseContent->GetParent();
@ -5043,7 +5045,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
// to walk up the closest ancestor element, just like we do in
// nsPresShell::HandleEvent.
while (mouseContent && !mouseContent->IsElement()) {
mouseContent = mouseContent->GetParent();
mouseContent = mouseContent->GetFlattenedTreeParent();
}
if (!mouseContent && !mCurrentTarget && !aOverrideClickTarget) {
@ -5138,15 +5140,6 @@ GetLabelTarget(nsIContent* aPossibleLabel)
return label->GetLabeledElement();
}
static nsIContent*
FindCommonAncestor(nsIContent* aNode1, nsIContent* aNode2)
{
if (!aNode1 || !aNode2) {
return nullptr;
}
return nsContentUtils::GetCommonFlattenedTreeAncestor(aNode1, aNode2);
}
/* static */
void
EventStateManager::SetFullScreenState(Element* aElement, bool aIsFullScreen)
@ -5363,8 +5356,8 @@ EventStateManager::ResetLastOverForContent(
nsIContent* aContent)
{
if (aElemWrapper && aElemWrapper->mLastOverElement &&
nsContentUtils::ContentIsDescendantOf(aElemWrapper->mLastOverElement,
aContent)) {
nsContentUtils::ContentIsFlattenedTreeDescendantOf(
aElemWrapper->mLastOverElement, aContent)) {
aElemWrapper->mLastOverElement = nullptr;
}
}

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

@ -207,3 +207,5 @@ support-files = window_bug1447993.html
skip-if = toolkit == 'android'
[test_dnd_with_modifiers.html]
[test_hover_mouseleave.html]
[test_slotted_mouse_event.html]
[test_slotted_text_click.html]

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

@ -0,0 +1,65 @@
<!doctype html>
<meta charset="utf-8">
<title>Bug 1481500: mouse enter / leave events in slotted content</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script>
function runTests() {
let iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.onload = () => frameLoaded(iframe);
iframe.srcdoc =
`<div id="host"><div id="target"></div></div>`
}
function frameLoaded(iframe) {
let host = iframe.contentDocument.getElementById('host');
let target = iframe.contentDocument.getElementById('target');
let finished = false;
host.attachShadow({ mode: 'open' }).innerHTML = `
<style>
:host {
width: 300px;
height: 300px;
background: purple;
}
::slotted(div) {
width: 100px;
height: 100px;
background: green;
}
</style>
<slot></slot>
`;
host.addEventListener("mouseleave", e => {
if (finished)
return;
ok(false, "Should not fire mouseleave when moving the cursor to the slotted target");
});
target.addEventListener("mouseenter", () => {
if (finished)
return;
ok(true, "Moving the mouse into the target should trigger a mouseenter there");
setTimeout(() => {
finished = true;
SimpleTest.finish()
}, 0);
});
synthesizeMouseAtCenter(host, { type: "mousemove" });
synthesizeMouseAtCenter(target, { type: "mousemove" });
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(() => {
SpecialPowers.pushPrefEnv({
set: [
["dom.webcomponents.shadowdom.enabled", true]
]
}, runTests);
});
</script>

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

@ -0,0 +1,76 @@
<!doctype html>
<meta charset="utf-8">
<title>Bug 1481500: click / activation on text activates the slot it's assigned to</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script>
function generateLotsOfText() {
let text = "Some text. ";
for (let i = 0; i < 10; ++i)
text += text;
return text;
}
function runTests() {
let iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.onload = () => frameLoaded(iframe);
iframe.width = "350"
iframe.height = "350"
iframe.srcdoc =
`<div id="host">${generateLotsOfText()}</div>`
}
function frameLoaded(iframe) {
let host = iframe.contentDocument.getElementById('host');
host.attachShadow({ mode: 'open' }).innerHTML = `
<style>
:host {
width: 300px;
height: 300px;
overflow: hidden;
}
</style>
<slot></slot>
`;
let slot = host.shadowRoot.querySelector('slot');
let mousedownFired = false;
let mouseupFired = false;
slot.addEventListener('mousedown', function() {
ok(true, "Mousedown should fire on the slot when clicking on text");
mousedownFired = true;
});
slot.addEventListener('click', function() {
ok(true, "Click should target the slot");
ok(mousedownFired, "mousedown should've fired");
ok(mouseupFired, "click should've fired");
SimpleTest.finish();
});
slot.addEventListener('mouseup', function() {
// FIXME: When we fix bug 1481517, this check should move to the mousedown listener.
ok(this.matches(":active"), "Slot should become active");
mouseupFired = true;
});
requestAnimationFrame(() => {
requestAnimationFrame(() => {
synthesizeMouseAtPoint(150, 150, { type: "mousedown" });
synthesizeMouseAtPoint(150, 150, { type: "mouseup" });
});
});
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(() => {
SpecialPowers.pushPrefEnv({
set: [
["dom.webcomponents.shadowdom.enabled", true]
]
}, runTests);
});
</script>

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

@ -11,6 +11,7 @@ add_task(async function test_CtoPtoC_big() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blob = await ContentTask.spawn(browser1, null, function() {
Cu.importGlobalProperties(["Blob"]);
let blob = new Blob([new Array(1024*1024).join('123456789ABCDEF')]);
return blob;
});
@ -43,6 +44,7 @@ add_task(async function test_CtoPtoC_small() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blob = await ContentTask.spawn(browser1, null, function() {
Cu.importGlobalProperties(["Blob"]);
let blob = new Blob(["hello world!"]);
return blob;
});
@ -75,6 +77,7 @@ add_task(async function test_CtoPtoC_bc_big() {
let browser1 = gBrowser.getBrowserForTab(tab1);
await ContentTask.spawn(browser1, null, function() {
Cu.importGlobalProperties(["Blob"]);
var bc = new content.BroadcastChannel('test');
bc.onmessage = function() {
bc.postMessage(new Blob([new Array(1024*1024).join('123456789ABCDEF')]));
@ -111,6 +114,7 @@ add_task(async function test_CtoPtoC_bc_small() {
let browser1 = gBrowser.getBrowserForTab(tab1);
await ContentTask.spawn(browser1, null, function() {
Cu.importGlobalProperties(["Blob"]);
var bc = new content.BroadcastChannel('test');
bc.onmessage = function() {
bc.postMessage(new Blob(["hello world!"]));
@ -147,6 +151,7 @@ add_task(async function test_CtoPtoC_bc_small() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blobURL = await ContentTask.spawn(browser1, null, function() {
Cu.importGlobalProperties(["Blob"]);
return content.URL.createObjectURL(new content.Blob(["hello world!"]));
});
@ -177,6 +182,7 @@ add_task(async function test_CtoPtoC_multipart() {
let browser1 = gBrowser.getBrowserForTab(tab1);
let blob = await ContentTask.spawn(browser1, null, function() {
Cu.importGlobalProperties(["Blob"]);
return new Blob(["!"]);
});
@ -189,6 +195,7 @@ add_task(async function test_CtoPtoC_multipart() {
let browser2 = gBrowser.getBrowserForTab(tab2);
let status = await ContentTask.spawn(browser2, newBlob, function(blob) {
Cu.importGlobalProperties(["Blob"]);
return new Promise(resolve => {
let fr = new content.FileReader();
fr.readAsText(new Blob(["hello ", blob]));

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

@ -297,7 +297,7 @@ HTMLBodyElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
aBindingParent);
NS_ENSURE_SUCCESS(rv, rv);
return mAttrsAndChildren.ForceMapped(this, OwnerDoc());
return mAttrs.ForceMapped(this, OwnerDoc());
}
nsresult
@ -314,7 +314,7 @@ HTMLBodyElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
// if the last mapped attribute was removed, don't clear the
// nsMappedAttributes, our style can still depend on the containing frame element
if (!aValue && IsAttributeMapped(aName)) {
nsresult rv = mAttrsAndChildren.ForceMapped(this, OwnerDoc());
nsresult rv = mAttrs.ForceMapped(this, OwnerDoc());
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -4831,7 +4831,7 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
CancelImageRequests(aNotify);
// And we should update our mapped attribute mapping function.
mAttrsAndChildren.UpdateMappedAttrRuleMapper(*this);
mAttrs.UpdateMappedAttrRuleMapper(*this);
} else if (mType == NS_FORM_INPUT_IMAGE) {
if (aNotify) {
// We just got switched to be an image input; we should see
@ -4848,7 +4848,7 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
}
// And we should update our mapped attribute mapping function.
mAttrsAndChildren.UpdateMappedAttrRuleMapper(*this);
mAttrs.UpdateMappedAttrRuleMapper(*this);
}
if (mType == NS_FORM_INPUT_PASSWORD && IsInComposedDoc()) {

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

@ -2545,7 +2545,7 @@ HTMLMediaElement::UpdatePreloadAction()
} else {
// Find the appropriate preload action by looking at the attribute.
const nsAttrValue* val =
mAttrsAndChildren.GetAttr(nsGkAtoms::preload, kNameSpaceID_None);
mAttrs.GetAttr(nsGkAtoms::preload, kNameSpaceID_None);
// MSE doesn't work if preload is none, so it ignores the pref when src is
// from MSE.
uint32_t preloadDefault =

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

@ -72,7 +72,7 @@ HTMLMeterElement::Min() const
* If the attribute min is defined, the minimum is this value.
* Otherwise, the minimum is the default value.
*/
const nsAttrValue* attrMin = mAttrsAndChildren.GetAttr(nsGkAtoms::min);
const nsAttrValue* attrMin = mAttrs.GetAttr(nsGkAtoms::min);
if (attrMin && attrMin->Type() == nsAttrValue::eDoubleValue) {
return attrMin->GetDoubleValue();
}
@ -90,7 +90,7 @@ HTMLMeterElement::Max() const
*/
double max;
const nsAttrValue* attrMax = mAttrsAndChildren.GetAttr(nsGkAtoms::max);
const nsAttrValue* attrMax = mAttrs.GetAttr(nsGkAtoms::max);
if (attrMax && attrMax->Type() == nsAttrValue::eDoubleValue) {
max = attrMax->GetDoubleValue();
} else {
@ -113,7 +113,7 @@ HTMLMeterElement::Value() const
*/
double value;
const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
const nsAttrValue* attrValue = mAttrs.GetAttr(nsGkAtoms::value);
if (attrValue && attrValue->Type() == nsAttrValue::eDoubleValue) {
value = attrValue->GetDoubleValue();
} else {
@ -143,7 +143,7 @@ HTMLMeterElement::Low() const
double min = Min();
const nsAttrValue* attrLow = mAttrsAndChildren.GetAttr(nsGkAtoms::low);
const nsAttrValue* attrLow = mAttrs.GetAttr(nsGkAtoms::low);
if (!attrLow || attrLow->Type() != nsAttrValue::eDoubleValue) {
return min;
}
@ -171,7 +171,7 @@ HTMLMeterElement::High() const
double max = Max();
const nsAttrValue* attrHigh = mAttrsAndChildren.GetAttr(nsGkAtoms::high);
const nsAttrValue* attrHigh = mAttrs.GetAttr(nsGkAtoms::high);
if (!attrHigh || attrHigh->Type() != nsAttrValue::eDoubleValue) {
return max;
}
@ -204,7 +204,7 @@ HTMLMeterElement::Optimum() const
double min = Min();
const nsAttrValue* attrOptimum =
mAttrsAndChildren.GetAttr(nsGkAtoms::optimum);
mAttrs.GetAttr(nsGkAtoms::optimum);
if (!attrOptimum || attrOptimum->Type() != nsAttrValue::eDoubleValue) {
return (min + max) / 2.0;
}

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

@ -366,7 +366,7 @@ HTMLObjectElement::IsHTMLFocusable(bool aWithMouse,
// TODO: this should probably be managed directly by IsHTMLFocusable.
// See bug 597242.
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::tabindex);
const nsAttrValue* attrVal = mAttrs.GetAttr(nsGkAtoms::tabindex);
*aIsFocusable = attrVal && attrVal->Type() == nsAttrValue::eInteger;

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

@ -66,7 +66,7 @@ HTMLProgressElement::ParseAttribute(int32_t aNamespaceID,
double
HTMLProgressElement::Value() const
{
const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
const nsAttrValue* attrValue = mAttrs.GetAttr(nsGkAtoms::value);
if (!attrValue || attrValue->Type() != nsAttrValue::eDoubleValue ||
attrValue->GetDoubleValue() < 0.0) {
return kDefaultValue;
@ -78,7 +78,7 @@ HTMLProgressElement::Value() const
double
HTMLProgressElement::Max() const
{
const nsAttrValue* attrMax = mAttrsAndChildren.GetAttr(nsGkAtoms::max);
const nsAttrValue* attrMax = mAttrs.GetAttr(nsGkAtoms::max);
if (!attrMax || attrMax->Type() != nsAttrValue::eDoubleValue ||
attrMax->GetDoubleValue() <= 0.0) {
return kDefaultMax;
@ -100,7 +100,7 @@ HTMLProgressElement::Position() const
bool
HTMLProgressElement::IsIndeterminate() const
{
const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
const nsAttrValue* attrValue = mAttrs.GetAttr(nsGkAtoms::value);
return !attrValue || attrValue->Type() != nsAttrValue::eDoubleValue;
}

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

@ -1079,7 +1079,7 @@ HTMLTableElement::BuildInheritedAttributes()
document->GetAttributeStyleSheet() : nullptr;
RefPtr<nsMappedAttributes> newAttrs;
if (sheet) {
const nsAttrValue* value = mAttrsAndChildren.GetAttr(nsGkAtoms::cellpadding);
const nsAttrValue* value = mAttrs.GetAttr(nsGkAtoms::cellpadding);
if (value) {
RefPtr<nsMappedAttributes> modifiableMapped = new
nsMappedAttributes(sheet, MapInheritedTableAttributesIntoRule);

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

@ -113,14 +113,14 @@ nsGenericHTMLElement::CopyInnerTo(Element* aDst, bool aPreallocateChildren)
bool reparse = (aDst->OwnerDoc() != OwnerDoc());
rv = static_cast<nsGenericHTMLElement*>(aDst)->mAttrsAndChildren.
EnsureCapacityToClone(mAttrsAndChildren, aPreallocateChildren);
rv = static_cast<nsGenericHTMLElement*>(aDst)->mAttrs.
EnsureCapacityToClone(mAttrs, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
int32_t i, count = GetAttrCount();
for (i = 0; i < count; ++i) {
const nsAttrName *name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrValue *value = mAttrsAndChildren.AttrAt(i);
const nsAttrName *name = mAttrs.AttrNameAt(i);
const nsAttrValue *value = mAttrs.AttrAt(i);
if (name->Equals(nsGkAtoms::style, kNameSpaceID_None) &&
value->Type() == nsAttrValue::eCSSDeclaration) {
@ -1474,7 +1474,7 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsMappedAttributes* aAtt
int32_t
nsGenericHTMLElement::GetIntAttr(nsAtom* aAttr, int32_t aDefault) const
{
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr);
const nsAttrValue* attrVal = mAttrs.GetAttr(aAttr);
if (attrVal && attrVal->Type() == nsAttrValue::eInteger) {
return attrVal->GetIntegerValue();
}
@ -1494,7 +1494,7 @@ uint32_t
nsGenericHTMLElement::GetUnsignedIntAttr(nsAtom* aAttr,
uint32_t aDefault) const
{
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr);
const nsAttrValue* attrVal = mAttrs.GetAttr(aAttr);
if (!attrVal || attrVal->Type() != nsAttrValue::eInteger) {
return aDefault;
}
@ -1529,7 +1529,7 @@ nsGenericHTMLElement::GetURIAttr(nsAtom* aAttr, nsAtom* aBaseAttr, nsIURI** aURI
{
*aURI = nullptr;
const nsAttrValue* attr = mAttrsAndChildren.GetAttr(aAttr);
const nsAttrValue* attr = mAttrs.GetAttr(aAttr);
if (!attr) {
return false;
}
@ -2596,9 +2596,9 @@ nsGenericHTMLElement::SyncEditorsOnSubtree(nsIContent* content)
void
nsGenericHTMLElement::RecompileScriptEventListeners()
{
int32_t i, count = mAttrsAndChildren.AttrCount();
int32_t i, count = mAttrs.AttrCount();
for (i = 0; i < count; ++i) {
const nsAttrName *name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrName *name = mAttrs.AttrNameAt(i);
// Eventlistenener-attributes are always in the null namespace
if (!name->IsAtom()) {

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

@ -303,7 +303,7 @@ public:
bool IsHTMLLink(nsIURI** aURI) const;
// HTML element methods
void Compact() { mAttrsAndChildren.Compact(); }
void Compact() { mAttrs.Compact(); }
virtual void UpdateEditableState(bool aNotify) override;

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

@ -35,7 +35,6 @@
#include "nsDocShellLoadTypes.h"
#include "nsIWebNavigation.h"
#include "nsIBaseWindow.h"
#include "nsIWebShellServices.h"
#include "nsIScriptContext.h"
#include "nsIXPConnect.h"
#include "nsContentList.h"

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

@ -18,7 +18,7 @@ function frameScript() {
});
addMessageListener("Test:DispatchUntrustedKeyEvents", msg => {
var evt = new content.CustomEvent("Test:DispatchKeyEvents", {
detail: { code: msg.data }
detail: Cu.cloneInto({ code: msg.data }, content),
});
content.dispatchEvent(evt);
});

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

@ -79,8 +79,6 @@
#include "nsIURIFixup.h"
#include "nsCDefaultURIFixup.h"
#include "nsIWebBrowser.h"
#include "nsIWebBrowserFocus.h"
#include "nsIWebBrowserSetup.h"
#include "nsIWebProgress.h"
#include "nsIXULRuntime.h"
#include "nsPIDOMWindow.h"
@ -124,6 +122,7 @@
#include "nsISupportsPrimitives.h"
#include "mozilla/Telemetry.h"
#include "nsDocShellLoadInfo.h"
#include "nsWebBrowser.h"
#ifdef XP_WIN
#include "mozilla/plugins/PluginWidgetChild.h"
@ -549,11 +548,10 @@ TabChild::Init()
mTabGroup = TabGroup::GetFromActor(this);
}
nsCOMPtr<nsIWebBrowser> webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
if (!webBrowser) {
NS_ERROR("Couldn't create a nsWebBrowser?");
return NS_ERROR_FAILURE;
}
// Directly create our web browser object and store it, so we can start
// eliminating QIs.
mWebBrowser = new nsWebBrowser();
nsIWebBrowser* webBrowser = mWebBrowser;
webBrowser->SetContainerWindow(this);
webBrowser->SetOriginAttributes(OriginAttributesRef());
@ -589,15 +587,7 @@ TabChild::Init()
// IPC uses a WebBrowser object for which DNS prefetching is turned off
// by default. But here we really want it, so enable it explicitly
nsCOMPtr<nsIWebBrowserSetup> webBrowserSetup =
do_QueryInterface(baseWindow);
if (webBrowserSetup) {
webBrowserSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH,
true);
} else {
NS_WARNING("baseWindow doesn't QI to nsIWebBrowserSetup, skipping "
"DNS prefetching enable step.");
}
mWebBrowser->SetAllowDNSPrefetch(true);
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
MOZ_ASSERT(docShell);
@ -1486,22 +1476,22 @@ TabChild::ZoomToRect(const uint32_t& aPresShellId,
mozilla::ipc::IPCResult
TabChild::RecvActivate()
{
MOZ_ASSERT(mWebBrowser);
// Ensure that the PresShell exists, otherwise focusing
// is definitely not going to work. GetPresShell should
// create a PresShell if one doesn't exist yet.
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
MOZ_ASSERT(presShell);
nsCOMPtr<nsIWebBrowserFocus> browser = do_QueryInterface(WebNavigation());
browser->Activate();
mWebBrowser->FocusActivate();
return IPC_OK();
}
mozilla::ipc::IPCResult
TabChild::RecvDeactivate()
{
nsCOMPtr<nsIWebBrowserFocus> browser = do_QueryInterface(WebNavigation());
browser->Deactivate();
MOZ_ASSERT(mWebBrowser);
mWebBrowser->FocusDeactivate();
return IPC_OK();
}

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

@ -48,6 +48,7 @@
class nsIDOMWindowUtils;
class nsIHttpChannel;
class nsISerialEventTarget;
class nsWebBrowser;
template<typename T> class nsTHashtable;
template<typename T> class nsPtrHashKey;
@ -822,6 +823,7 @@ private:
class DelayedDeleteRunnable;
TextureFactoryIdentifier mTextureFactoryIdentifier;
RefPtr<nsWebBrowser> mWebBrowser;
nsCOMPtr<nsIWebNavigation> mWebNav;
RefPtr<mozilla::dom::TabGroup> mTabGroup;
RefPtr<PuppetWidget> mPuppetWidget;

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

@ -961,8 +961,8 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
}
bool hasHref = false;
const nsAttrValue* href = mAttrsAndChildren.GetAttr(nsGkAtoms::href,
kNameSpaceID_None);
const nsAttrValue* href = mAttrs.GetAttr(nsGkAtoms::href,
kNameSpaceID_None);
if (href) {
// MathML href
// The REC says: "When user agents encounter MathML elements with both href
@ -989,8 +989,7 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
{ &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nullptr };
// Optimization: check for href first for early return
href = mAttrsAndChildren.GetAttr(nsGkAtoms::href,
kNameSpaceID_XLink);
href = mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
if (href &&
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::type,
sTypeVals, eCaseMatters) !=
@ -1023,8 +1022,8 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
void
nsMathMLElement::GetLinkTarget(nsAString& aTarget)
{
const nsAttrValue* target = mAttrsAndChildren.GetAttr(nsGkAtoms::target,
kNameSpaceID_XLink);
const nsAttrValue* target = mAttrs.GetAttr(nsGkAtoms::target,
kNameSpaceID_XLink);
if (target) {
target->ToString(aTarget);
}

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

@ -325,7 +325,7 @@ class RTCStatsReport {
key != "isRemote") {
// id is first prop, a sign of JSON.stringify(), cancel warnings.
if (key != "id") {
warnRemoteNullable.warn();
warnRemoteNullable.warn(key);
}
warnRemoteNullable.warn = null;
}
@ -500,9 +500,9 @@ class RTCPeerConnection {
this.logWarning("Callback-based pc.getStats is deprecated, and will be removed in the near future! Use promise-version! " +
"See http://w3c.github.io/webrtc-pc/#getstats-example for usage.") };
this._warnDeprecatedStatsRemoteAccessNullable = { warn: () =>
this.logWarning("Detected soon-to-break getStats() use! stat.isRemote goes away in Firefox 65, but won't warn there!\
- See https://blog.mozilla.org/webrtc/getstats-isremote-65/") };
this._warnDeprecatedStatsRemoteAccessNullable = { warn: (key) =>
this.logWarning(`Detected soon-to-break getStats() use with key="${key}"! stat.isRemote goes away in Firefox 65, but won't warn there!\
- See https://blog.mozilla.org/webrtc/getstats-isremote-65/`) };
// Add a reference to the PeerConnection to global list (before init).
_globalPCList.addPC(this);

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

@ -2105,7 +2105,8 @@ TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
data.RemoveElementsAt(firstRemovedIndex.ref(),
lastRemovedIndex - firstRemovedIndex.ref() + 1);
if (aIntervals.GetEnd() >= aTrackData.mHighestStartTimestamp) {
if (removedIntervals.GetEnd() >= aTrackData.mHighestStartTimestamp &&
removedIntervals.GetStart() <= aTrackData.mHighestStartTimestamp) {
// The sample with the highest presentation time got removed.
// Rescan the trackbuffer to determine the new one.
TimeUnit highestStartTime;

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

@ -10,10 +10,6 @@
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
async function setupTest() {
await SpecialPowers.pushPrefEnv({"set": [["media.mediasource.experimental.enabled", true]]});
}
setupTest();
runWithMSE(function(ms, el) {
el.controls = true;

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

@ -82,8 +82,7 @@ bool
SVGAnimationElement::GetTargetAttributeName(int32_t *aNamespaceID,
nsAtom **aLocalName) const
{
const nsAttrValue* nameAttr
= mAttrsAndChildren.GetAttr(nsGkAtoms::attributeName);
const nsAttrValue* nameAttr = mAttrs.GetAttr(nsGkAtoms::attributeName);
if (!nameAttr)
return false;
@ -177,8 +176,8 @@ SVGAnimationElement::BindToTree(nsIDocument* aDocument,
}
const nsAttrValue* href =
HasAttr(kNameSpaceID_None, nsGkAtoms::href)
? mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
: mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
? mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
: mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
if (href) {
nsAutoString hrefStr;
href->ToString(hrefStr);
@ -298,7 +297,7 @@ SVGAnimationElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
// After unsetting href, we may still have xlink:href, so we
// should try to add it back.
const nsAttrValue* xlinkHref =
mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
if (xlinkHref) {
UpdateHrefTarget(xlinkHref->GetStringValue());
}

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

@ -93,8 +93,8 @@ SVGMPathElement::BindToTree(nsIDocument* aDocument,
if (aDocument) {
const nsAttrValue* hrefAttrValue =
HasAttr(kNameSpaceID_None, nsGkAtoms::href)
? mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
: mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
? mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
: mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
if (hrefAttrValue) {
UpdateHrefTarget(aParent, hrefAttrValue->GetStringValue());
}
@ -154,7 +154,7 @@ SVGMPathElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
// After unsetting href, we may still have xlink:href, so we should
// try to add it back.
const nsAttrValue* xlinkHref =
mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
if (xlinkHref) {
UpdateHrefTarget(GetParent(), xlinkHref->GetStringValue());
}

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

@ -244,7 +244,7 @@ nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (!MayHaveStyle()) {
return NS_OK;
}
const nsAttrValue* oldVal = mAttrsAndChildren.GetAttr(nsGkAtoms::style);
const nsAttrValue* oldVal = mAttrs.GetAttr(nsGkAtoms::style);
if (oldVal && oldVal->Type() == nsAttrValue::eCSSDeclaration) {
// we need to force a reparse because the baseURI of the document
@ -261,8 +261,7 @@ nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// Don't bother going through SetInlineStyleDeclaration; we don't
// want to fire off mutation events or document notifications anyway
bool oldValueSet;
rv = mAttrsAndChildren.SetAndSwapAttr(nsGkAtoms::style, attrValue,
&oldValueSet);
rv = mAttrs.SetAndSwapAttr(nsGkAtoms::style, attrValue, &oldValueSet);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -280,9 +279,9 @@ nsSVGElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
// need to be very careful because some nsAttrValues used by SVG point to
// member data of SVG elements and if an nsAttrValue outlives the SVG element
// whose data it points to (by virtue of being stored in
// mAttrsAndChildren->mMappedAttributes, meaning it's shared between
// mAttrs->mMappedAttributes, meaning it's shared between
// elements), the pointer will dangle. See bug 724680.
MOZ_ASSERT(!mAttrsAndChildren.HasMappedAttrs(),
MOZ_ASSERT(!mAttrs.HasMappedAttrs(),
"Unexpected use of nsMappedAttributes within SVG");
// If this is an svg presentation attribute we need to map it into
@ -1249,7 +1248,7 @@ nsSVGElement::UpdateContentDeclarationBlock()
NS_ASSERTION(!mContentDeclarationBlock,
"we already have a content declaration block");
uint32_t attrCount = mAttrsAndChildren.AttrCount();
uint32_t attrCount = mAttrs.AttrCount();
if (!attrCount) {
// nothing to do
return;
@ -1260,7 +1259,7 @@ nsSVGElement::UpdateContentDeclarationBlock()
GetBaseURI(), this);
for (uint32_t i = 0; i < attrCount; ++i) {
const nsAttrName* attrName = mAttrsAndChildren.AttrNameAt(i);
const nsAttrName* attrName = mAttrs.AttrNameAt(i);
if (!attrName->IsAtom() || !IsAttributeMapped(attrName->Atom()))
continue;
@ -1293,7 +1292,7 @@ nsSVGElement::UpdateContentDeclarationBlock()
}
nsAutoString value;
mAttrsAndChildren.AttrAt(i)->ToString(value);
mAttrs.AttrAt(i)->ToString(value);
mappedAttrParser.ParseMappedAttrValue(attrName->Atom(), value);
}
mContentDeclarationBlock = mappedAttrParser.GetDeclarationBlock();
@ -1444,7 +1443,7 @@ nsSVGElement::MaybeSerializeAttrBeforeRemoval(nsAtom* aName, bool aNotify)
return;
}
const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(aName);
const nsAttrValue* attrValue = mAttrs.GetAttr(aName);
if (!attrValue)
return;
@ -1452,7 +1451,7 @@ nsSVGElement::MaybeSerializeAttrBeforeRemoval(nsAtom* aName, bool aNotify)
attrValue->ToString(serializedValue);
nsAttrValue oldAttrValue(serializedValue);
bool oldValueSet;
mAttrsAndChildren.SetAndSwapAttr(aName, oldAttrValue, &oldValueSet);
mAttrs.SetAndSwapAttr(aName, oldAttrValue, &oldValueSet);
}
/* static */
@ -2457,9 +2456,9 @@ nsSVGElement::ReportAttributeParseFailure(nsIDocument* aDocument,
void
nsSVGElement::RecompileScriptEventListeners()
{
int32_t i, count = mAttrsAndChildren.AttrCount();
int32_t i, count = mAttrs.AttrCount();
for (i = 0; i < count; ++i) {
const nsAttrName *name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrName *name = mAttrs.AttrNameAt(i);
// Eventlistenener-attributes are always in the null namespace
if (!name->IsAtom()) {

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

@ -160,7 +160,7 @@ async function mutateTabStorage(knownTab, mutations, sentinelValue) {
knownTab.tab.linkedBrowser,
{ mutations, sentinelValue },
function(args) {
return content.wrappedJSObject.mutateStorage(args);
return content.wrappedJSObject.mutateStorage(Cu.cloneInto(args, content));
});
}

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

@ -58,6 +58,6 @@ interface SourceBuffer : EventTarget {
Promise<void> removeAsync(double start, unrestricted double end);
// Experimental function as proposed in:
// https://github.com/w3c/media-source/issues/155
[Throws, Func="mozilla::dom::MediaSource::ExperimentalEnabled"]
[Throws]
void changeType(DOMString type);
};

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

@ -1101,8 +1101,10 @@ interface EXT_disjoint_timer_query {
[NoInterfaceObject]
interface MOZ_debug {
const GLenum EXTENSIONS = 0x1F03;
const GLenum WSI_INFO = 0x10000;
const GLenum UNPACK_REQUIRE_FASTPATH = 0x10001;
const GLenum DOES_INDEX_VALIDATION = 0x10002;
[Throws]
any getParameter(GLenum pname);

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

@ -316,17 +316,17 @@ nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
RefPtr<nsXULElement> element = Construct(ni.forget());
nsresult rv = element->mAttrsAndChildren.EnsureCapacityToClone(mAttrsAndChildren,
aPreallocateChildren);
nsresult rv = element->mAttrs.EnsureCapacityToClone(mAttrs,
aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
// Note that we're _not_ copying mControllers.
uint32_t count = mAttrsAndChildren.AttrCount();
uint32_t count = mAttrs.AttrCount();
rv = NS_OK;
for (uint32_t i = 0; i < count; ++i) {
const nsAttrName* originalName = mAttrsAndChildren.AttrNameAt(i);
const nsAttrValue* originalValue = mAttrsAndChildren.AttrAt(i);
const nsAttrName* originalName = mAttrs.AttrNameAt(i);
const nsAttrValue* originalValue = mAttrs.AttrAt(i);
nsAttrValue attrValue;
// Style rules need to be cloned.
@ -344,13 +344,13 @@ nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool oldValueSet;
if (originalName->IsAtom()) {
rv = element->mAttrsAndChildren.SetAndSwapAttr(originalName->Atom(),
attrValue,
&oldValueSet);
rv = element->mAttrs.SetAndSwapAttr(originalName->Atom(),
attrValue,
&oldValueSet);
} else {
rv = element->mAttrsAndChildren.SetAndSwapAttr(originalName->NodeInfo(),
attrValue,
&oldValueSet);
rv = element->mAttrs.SetAndSwapAttr(originalName->NodeInfo(),
attrValue,
&oldValueSet);
}
NS_ENSURE_SUCCESS(rv, rv);
element->AddListenerFor(*originalName);
@ -1317,11 +1317,11 @@ nsXULElement::MakeHeavyweight(nsXULPrototypeElement* aPrototype)
bool oldValueSet;
// XXX we might wanna have a SetAndTakeAttr that takes an nsAttrName
if (protoattr->mName.IsAtom()) {
rv = mAttrsAndChildren.SetAndSwapAttr(protoattr->mName.Atom(),
attrValue, &oldValueSet);
rv = mAttrs.SetAndSwapAttr(protoattr->mName.Atom(),
attrValue, &oldValueSet);
} else {
rv = mAttrsAndChildren.SetAndSwapAttr(protoattr->mName.NodeInfo(),
attrValue, &oldValueSet);
rv = mAttrs.SetAndSwapAttr(protoattr->mName.NodeInfo(),
attrValue, &oldValueSet);
}
NS_ENSURE_SUCCESS(rv, rv);
}
@ -1513,9 +1513,9 @@ nsXULElement::BoolAttrIsTrue(nsAtom* aName) const
void
nsXULElement::RecompileScriptEventListeners()
{
int32_t i, count = mAttrsAndChildren.AttrCount();
int32_t i, count = mAttrs.AttrCount();
for (i = 0; i < count; ++i) {
const nsAttrName *name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrName *name = mAttrs.AttrNameAt(i);
// Eventlistenener-attributes are always in the null namespace
if (!name->IsAtom()) {

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

@ -21,7 +21,7 @@
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIURI.h"
#include "nsLayoutCID.h"
#include "nsAttrAndChildArray.h"
#include "AttrArray.h"
#include "nsGkAtoms.h"
#include "nsStringFwd.h"
#include "nsStyledElement.h"

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

@ -582,15 +582,16 @@ GLContextEGL::CreateGLContext(CreateContextFlags flags,
robustness_attribs = required_attribs;
robustness_attribs.push_back(LOCAL_EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT);
robustness_attribs.push_back(LOCAL_EGL_LOSE_CONTEXT_ON_RESET_EXT);
// Skip EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, since it doesn't help us.
}
if (egl->IsExtensionSupported(GLLibraryEGL::KHR_create_context) &&
!egl->IsANGLE())
{
rbab_attribs = required_attribs;
rbab_attribs.push_back(LOCAL_EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR);
rbab_attribs.push_back(LOCAL_EGL_LOSE_CONTEXT_ON_RESET_KHR);
rbab_attribs = robustness_attribs;
rbab_attribs.push_back(LOCAL_EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT);
rbab_attribs.push_back(LOCAL_EGL_TRUE);
} else if (egl->IsExtensionSupported(GLLibraryEGL::KHR_create_context)) {
robustness_attribs = required_attribs;
robustness_attribs.push_back(LOCAL_EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR);
robustness_attribs.push_back(LOCAL_EGL_LOSE_CONTEXT_ON_RESET_KHR);
rbab_attribs = robustness_attribs;
rbab_attribs.push_back(LOCAL_EGL_CONTEXT_FLAGS_KHR);
rbab_attribs.push_back(LOCAL_EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR);
}

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

@ -366,8 +366,8 @@ AsyncImagePipelineManager::ApplyAsyncImageForPipeline(const wr::Epoch& aEpoch,
// We may, however, have updated some resources.
// Use transaction of scene builder thread to notify epoch.
// It is for making epoc update consisitent.
aMaybeFastTxn.UpdateEpoch(aPipelineId, aEpoch);
// It is for making epoch update consistent.
aSceneBuilderTxn.UpdateEpoch(aPipelineId, aEpoch);
if (aPipeline->mCurrentTexture) {
HoldExternalImage(aPipelineId, aEpoch, aPipeline->mCurrentTexture->AsWebRenderTextureHost());
}

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

@ -31,7 +31,7 @@ image = { optional = true, version = "0.19" }
lazy_static = "1"
log = "0.4"
num-traits = "0.2"
plane-split = "0.12"
plane-split = "0.12.1"
png = { optional = true, version = "0.12" }
rayon = "1"
ron = { optional = true, version = "0.1.7" }

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

@ -2,13 +2,12 @@
* 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/. */
use api::{AlphaType, ClipMode, DeviceIntRect, DeviceIntSize};
use api::{DeviceUintRect, DeviceUintPoint, ExternalImageType, FilterOp, ImageRendering, LayoutRect};
use api::{DeviceIntPoint, YuvColorSpace, YuvFormat};
use api::{LayoutToWorldTransform, WorldPixel};
use api::{AlphaType, ClipMode, DeviceIntRect, DeviceIntSize, DeviceIntPoint};
use api::{DeviceUintRect, DeviceUintPoint, ExternalImageType, FilterOp, ImageRendering};
use api::{YuvColorSpace, YuvFormat, WorldPixel};
use clip::{ClipSource, ClipStore, ClipWorkItem};
use clip_scroll_tree::{CoordinateSystemId};
use euclid::{TypedTransform3D, vec3};
use euclid::vec3;
use glyph_rasterizer::GlyphFormat;
use gpu_cache::{GpuCache, GpuCacheHandle, GpuCacheAddress};
use gpu_types::{BrushFlags, BrushInstance, PrimitiveHeaders};
@ -17,17 +16,17 @@ use gpu_types::{PrimitiveInstance, RasterizationSpace, GlyphInstance};
use gpu_types::{PrimitiveHeader, PrimitiveHeaderIndex, TransformPaletteId, TransformPalette};
use internal_types::{FastHashMap, SavedTargetIndex, SourceTexture};
use picture::{PictureCompositeMode, PicturePrimitive, PictureSurface};
use plane_split::{BspSplitter, Polygon, Splitter};
use plane_split::{BspSplitter, Clipper, Polygon, Splitter};
use prim_store::{BrushKind, BrushPrimitive, BrushSegmentTaskId, DeferredResolve};
use prim_store::{EdgeAaSegmentMask, ImageSource, PictureIndex, PrimitiveIndex, PrimitiveKind};
use prim_store::{PrimitiveMetadata, PrimitiveRun, PrimitiveStore, VisibleGradientTile};
use prim_store::{BorderSource};
use render_task::{RenderTaskAddress, RenderTaskId, RenderTaskKind, RenderTaskTree};
use renderer::{BlendMode, ImageBufferKind};
use renderer::{BLOCKS_PER_UV_RECT, ShaderColorMode};
use renderer::{BlendMode, ImageBufferKind, ShaderColorMode};
use renderer::BLOCKS_PER_UV_RECT;
use resource_cache::{CacheItem, GlyphFetchResult, ImageRequest, ResourceCache};
use scene::FilterOpHelpers;
use std::{usize, f32, i32};
use std::{f32, i32};
use tiling::{RenderTargetContext};
use util::{TransformedRectKind};
@ -676,19 +675,30 @@ impl AlphaBatchBuilder {
if picture.is_in_3d_context {
// Push into parent plane splitter.
debug_assert!(picture.surface.is_some());
let real_xf = &ctx
.transforms
let transform = &ctx.transforms
.get_transform(picture.reference_frame_index);
match make_polygon(
picture.real_local_rect,
&real_xf.m,
prim_index.0,
) {
Some(polygon) => splitter.add(polygon),
None => {
// this shouldn't happen, the path will ultimately be
// turned into `expect` when the splitting code is fixed
match transform.transform_kind {
TransformedRectKind::AxisAligned => {
let polygon = Polygon::from_transformed_rect(
picture.real_local_rect.cast(),
transform.m.cast(),
prim_index.0,
).unwrap();
splitter.add(polygon);
}
TransformedRectKind::Complex => {
let mut clipper = Clipper::new();
let bounds = (screen_rect.clipped.to_f32() / ctx.device_pixel_scale).to_f64();
let matrix = transform.m.cast();
let results = clipper.clip_transformed(
Polygon::from_rect(picture.real_local_rect.cast(), prim_index.0),
&matrix,
Some(bounds),
);
for poly in results {
splitter.add(poly);
}
}
}
@ -1709,33 +1719,6 @@ pub fn resolve_image(
}
}
/// Construct a polygon from stacking context boundaries.
/// `anchor` here is an index that's going to be preserved in all the
/// splits of the polygon.
fn make_polygon(
rect: LayoutRect,
transform: &LayoutToWorldTransform,
anchor: usize,
) -> Option<Polygon<f64, WorldPixel>> {
let mat = TypedTransform3D::row_major(
transform.m11 as f64,
transform.m12 as f64,
transform.m13 as f64,
transform.m14 as f64,
transform.m21 as f64,
transform.m22 as f64,
transform.m23 as f64,
transform.m24 as f64,
transform.m31 as f64,
transform.m32 as f64,
transform.m33 as f64,
transform.m34 as f64,
transform.m41 as f64,
transform.m42 as f64,
transform.m43 as f64,
transform.m44 as f64);
Polygon::from_transformed_rect(rect.cast(), mat, anchor)
}
/// Batcher managing draw calls into the clip mask (in the RT cache).
#[derive(Debug)]

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

@ -9,9 +9,8 @@ use app_units::Au;
use ellipse::Ellipse;
use display_list_flattener::DisplayListFlattener;
use gpu_types::{BorderInstance, BorderSegment, BrushFlags};
use prim_store::{BrushKind, BrushPrimitive, BrushSegment, VECS_PER_SEGMENT};
use prim_store::{BrushKind, BrushPrimitive, BrushSegment};
use prim_store::{BorderSource, EdgeAaSegmentMask, PrimitiveContainer, ScrollNodeAndClipChain};
use renderer::{MAX_VERTEX_TEXTURE_WIDTH};
use util::{lerp, RectHelpers};
// Using 2048 as the maximum radius in device space before which we
@ -22,6 +21,10 @@ use util::{lerp, RectHelpers};
/// Maximum resolution in device pixels at which borders are rasterized.
pub const MAX_BORDER_RESOLUTION: u32 = 2048;
/// Maximum number of dots or dashes per segment to avoid freezing and filling up
/// memory with unreasonable inputs. It would be better to address this by not building
/// a list of per-dot information in the first place.
pub const MAX_DASH_COUNT: usize = 2048;
trait AuSizeConverter {
fn to_au(&self) -> LayoutSizeAu;
@ -355,11 +358,7 @@ impl BorderCornerClipSource {
1.0 - 2.0 * outer_scale.y,
);
// No point in pushing more clips as it will blow up the maximum amount of
// segments per primitive later down the road.
// See #2915 for a better fix.
let clip_limit = MAX_VERTEX_TEXTURE_WIDTH / VECS_PER_SEGMENT;
let max_clip_count = self.max_clip_count.min(clip_limit);
let max_clip_count = self.max_clip_count.min(MAX_DASH_COUNT);
match self.kind {
BorderCornerClipKind::Dash => {
@ -372,6 +371,7 @@ impl BorderCornerClipSource {
// sophisticated dash placement algorithm that takes into account
// the offset of the dashes along edge segments.
let mut current_arc_length = 0.25 * dash_arc_length;
dot_dash_data.reserve(max_clip_count);
for _ in 0 .. max_clip_count {
let arc_length0 = current_arc_length;
current_arc_length += dash_arc_length;
@ -425,8 +425,8 @@ impl BorderCornerClipSource {
]);
}
BorderCornerClipKind::Dot => {
let mut forward_dots = Vec::new();
let mut back_dots = Vec::new();
let mut forward_dots = Vec::with_capacity(max_clip_count / 2 + 1);
let mut back_dots = Vec::with_capacity(max_clip_count / 2 + 1);
let mut leftover_arc_length = 0.0;
// Alternate between adding dots at the start and end of the
@ -501,6 +501,8 @@ impl BorderCornerClipSource {
[center.x, center.y, radius, 0.0, 0.0, 0.0, 0.0, 0.0]
};
dot_dash_data.reserve(forward_dots.len() + back_dots.len());
for (i, dot) in forward_dots.iter().enumerate() {
let extra_dist = i as f32 * extra_space_per_dot;
let dot_data = create_dot_data(&self.ellipse, dot.arc_pos + extra_dist, 0.5 * dot.diameter);

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