mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Merge m-c to autoland, a=merge CLOSED TREE
MozReview-Commit-ID: HeJwJwwTzhQ
This commit is contained in:
commit
83fd890d27
@ -342,6 +342,10 @@ pref("browser.urlbar.oneOffSearches", true);
|
||||
// human readable (percent-decoded) URL on the clipboard.
|
||||
pref("browser.urlbar.decodeURLsOnCopy", false);
|
||||
|
||||
// Whether or not to move tabs into the active window when using the "Switch to
|
||||
// Tab" feature of the awesomebar.
|
||||
pref("browser.urlbar.switchTabs.adoptIntoActiveWindow", false);
|
||||
|
||||
pref("browser.altClickSave", false);
|
||||
|
||||
// Enable logging downloads operations to the Console.
|
||||
@ -1629,10 +1633,7 @@ pref("browser.esedbreader.loglevel", "Error");
|
||||
|
||||
pref("browser.laterrun.enabled", false);
|
||||
|
||||
// Disable prelaunch in the same way activity-stream is enabled addressing
|
||||
// bug 1381804 memory usage until bug 1376895 is fixed.
|
||||
// Because of frequent crashes on Beta, it is turned off on all channels, see: bug 1363601.
|
||||
pref("dom.ipc.processPrelaunch.enabled", false);
|
||||
pref("dom.ipc.processPrelaunch.enabled", true);
|
||||
|
||||
pref("browser.migrate.automigrate.enabled", false);
|
||||
// 4 here means the suggestion notification will be automatically
|
||||
|
@ -8248,6 +8248,8 @@ var gRemoteTabsUI = {
|
||||
* - 'replaceQueryString' boolean property to be set to true to exclude query string
|
||||
* matching when comparing URIs and overwrite the initial query string with
|
||||
* the one from the new URI.
|
||||
* - 'adoptIntoActiveWindow' boolean property to be set to true to adopt the tab
|
||||
* into the current window.
|
||||
* @return True if an existing tab was found, false otherwise
|
||||
*/
|
||||
function switchToTabHavingURI(aURI, aOpenNew, aOpenParams = {}) {
|
||||
@ -8260,12 +8262,16 @@ function switchToTabHavingURI(aURI, aOpenNew, aOpenParams = {}) {
|
||||
let ignoreFragment = aOpenParams.ignoreFragment;
|
||||
let ignoreQueryString = aOpenParams.ignoreQueryString;
|
||||
let replaceQueryString = aOpenParams.replaceQueryString;
|
||||
let adoptIntoActiveWindow = aOpenParams.adoptIntoActiveWindow;
|
||||
|
||||
// These properties are only used by switchToTabHavingURI and should
|
||||
// not be used as a parameter for the new load.
|
||||
delete aOpenParams.ignoreFragment;
|
||||
delete aOpenParams.ignoreQueryString;
|
||||
delete aOpenParams.replaceQueryString;
|
||||
delete aOpenParams.adoptIntoActiveWindow;
|
||||
|
||||
let isBrowserWindow = !!window.gBrowser;
|
||||
|
||||
// This will switch to the tab in aWindow having aURI, if present.
|
||||
function switchIfURIInWindow(aWindow) {
|
||||
@ -8308,11 +8314,28 @@ function switchToTabHavingURI(aURI, aOpenNew, aOpenParams = {}) {
|
||||
let browserCompare = cleanURL(
|
||||
browser.currentURI.displaySpec, ignoreQueryString || replaceQueryString, ignoreFragmentWhenComparing);
|
||||
if (requestedCompare == browserCompare) {
|
||||
aWindow.focus();
|
||||
// If adoptIntoActiveWindow is set, and this is a cross-window switch,
|
||||
// adopt the tab into the current window, after the active tab.
|
||||
let doAdopt = adoptIntoActiveWindow && isBrowserWindow && aWindow != window;
|
||||
|
||||
if (doAdopt) {
|
||||
window.gBrowser.adoptTab(
|
||||
aWindow.gBrowser.getTabForBrowser(browser),
|
||||
window.gBrowser.tabContainer.selectedIndex + 1,
|
||||
/* aSelectTab = */ true
|
||||
);
|
||||
} else {
|
||||
aWindow.focus();
|
||||
}
|
||||
|
||||
if (ignoreFragment == "whenComparingAndReplace" || replaceQueryString) {
|
||||
browser.loadURI(aURI.spec);
|
||||
}
|
||||
aWindow.gBrowser.tabContainer.selectedIndex = i;
|
||||
|
||||
if (!doAdopt) {
|
||||
aWindow.gBrowser.tabContainer.selectedIndex = i;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -8323,8 +8346,6 @@ function switchToTabHavingURI(aURI, aOpenNew, aOpenParams = {}) {
|
||||
if (!(aURI instanceof Ci.nsIURI))
|
||||
aURI = Services.io.newURI(aURI);
|
||||
|
||||
let isBrowserWindow = !!window.gBrowser;
|
||||
|
||||
// Prioritise this window.
|
||||
if (isBrowserWindow && switchIfURIInWindow(window))
|
||||
return true;
|
||||
|
@ -85,6 +85,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
this.timeout = this._prefs.getIntPref("delay");
|
||||
this._formattingEnabled = this._prefs.getBoolPref("formatting.enabled");
|
||||
this._mayTrimURLs = this._prefs.getBoolPref("trimURLs");
|
||||
this._adoptIntoActiveWindow = this._prefs.getBoolPref("switchTabs.adoptIntoActiveWindow");
|
||||
this.inputField.controllers.insertControllerAt(0, this._copyCutController);
|
||||
this.inputField.addEventListener("paste", this);
|
||||
this.inputField.addEventListener("mousedown", this);
|
||||
@ -625,7 +626,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
if (this.hasAttribute("actiontype")) {
|
||||
this.handleRevert();
|
||||
let prevTab = gBrowser.selectedTab;
|
||||
if (switchToTabHavingURI(url) && isTabEmpty(prevTab)) {
|
||||
let loadOpts = {
|
||||
adoptIntoActiveWindow: this._adoptIntoActiveWindow,
|
||||
};
|
||||
|
||||
if (switchToTabHavingURI(url, false, loadOpts) &&
|
||||
isTabEmpty(prevTab)) {
|
||||
gBrowser.removeTab(prevTab);
|
||||
}
|
||||
return;
|
||||
@ -1123,6 +1129,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
break;
|
||||
case "maxRichResults":
|
||||
this.popup.maxResults = this._prefs.getIntPref(aData);
|
||||
break;
|
||||
case "switchTabs.adoptIntoActiveWindow":
|
||||
this._adoptIntoActiveWindow =
|
||||
this._prefs.getBoolPref("switchTabs.adoptIntoActiveWindow");
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
|
@ -10,7 +10,6 @@
|
||||
# instead of BrandFullName and typically should not be modified.
|
||||
!define BrandFullNameInternal "Firefox Developer Edition"
|
||||
!define BrandShortName "Firefox Developer Edition"
|
||||
!define BrandFullName "Firefox Developer Edition"
|
||||
!define CompanyName "mozilla.org"
|
||||
!define URLInfoAbout "https://www.mozilla.org"
|
||||
!define HelpLink "https://support.mozilla.org"
|
||||
|
@ -9,7 +9,6 @@
|
||||
# BrandFullNameInternal is used for some registry and file system values
|
||||
# instead of BrandFullName and typically should not be modified.
|
||||
!define BrandFullNameInternal "Nightly"
|
||||
!define BrandFullName "Firefox Nightly"
|
||||
!define CompanyName "mozilla.org"
|
||||
!define URLInfoAbout "https://www.mozilla.org"
|
||||
!define HelpLink "https://support.mozilla.org"
|
||||
|
@ -2,4 +2,4 @@
|
||||
# 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/.
|
||||
|
||||
MOZ_APP_DISPLAYNAME=FirefoxNightly
|
||||
MOZ_APP_DISPLAYNAME=Nightly
|
||||
|
@ -3,7 +3,7 @@
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!ENTITY brandShorterName "Nightly">
|
||||
<!ENTITY brandShortName "Firefox Nightly">
|
||||
<!ENTITY brandFullName "Firefox Nightly">
|
||||
<!ENTITY brandShortName "Nightly">
|
||||
<!ENTITY brandFullName "Nightly">
|
||||
<!ENTITY vendorShortName "Mozilla">
|
||||
<!ENTITY trademarkInfo.part1 " ">
|
||||
|
@ -3,8 +3,8 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
brandShorterName=Nightly
|
||||
brandShortName=Firefox Nightly
|
||||
brandFullName=Firefox Nightly
|
||||
brandShortName=Nightly
|
||||
brandFullName=Nightly
|
||||
vendorShortName=Mozilla
|
||||
|
||||
syncBrandShortName=Sync
|
||||
|
@ -9,7 +9,6 @@
|
||||
# BrandFullNameInternal is used for some registry and file system values
|
||||
# instead of BrandFullName and typically should not be modified.
|
||||
!define BrandFullNameInternal "Mozilla Firefox"
|
||||
!define BrandFullName "Mozilla Firefox"
|
||||
!define CompanyName "Mozilla Corporation"
|
||||
!define URLInfoAbout "https://www.mozilla.org"
|
||||
!define URLUpdateInfo "https://www.mozilla.org/firefox/${AppVersion}/releasenotes"
|
||||
|
@ -9,7 +9,6 @@
|
||||
# BrandFullNameInternal is used for some registry and file system values
|
||||
# instead of BrandFullName and typically should not be modified.
|
||||
!define BrandFullNameInternal "Mozilla Developer Preview"
|
||||
!define BrandFullName "Mozilla Developer Preview"
|
||||
!define CompanyName "mozilla.org"
|
||||
!define URLInfoAbout "https://www.mozilla.org"
|
||||
!define HelpLink "https://support.mozilla.org"
|
||||
|
7
browser/config/mozconfigs/linux32/rusttests
Normal file
7
browser/config/mozconfigs/linux32/rusttests
Normal file
@ -0,0 +1,7 @@
|
||||
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
ac_add_options --enable-rust-tests
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux32/nightly"
|
7
browser/config/mozconfigs/linux32/rusttests-debug
Normal file
7
browser/config/mozconfigs/linux32/rusttests-debug
Normal file
@ -0,0 +1,7 @@
|
||||
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
ac_add_options --enable-rust-tests
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux32/debug"
|
7
browser/config/mozconfigs/linux64/rusttests
Normal file
7
browser/config/mozconfigs/linux64/rusttests
Normal file
@ -0,0 +1,7 @@
|
||||
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
ac_add_options --enable-rust-tests
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
|
7
browser/config/mozconfigs/linux64/rusttests-debug
Normal file
7
browser/config/mozconfigs/linux64/rusttests-debug
Normal file
@ -0,0 +1,7 @@
|
||||
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
ac_add_options --enable-rust-tests
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux64/debug"
|
7
browser/config/mozconfigs/win32/rusttests
Normal file
7
browser/config/mozconfigs/win32/rusttests
Normal file
@ -0,0 +1,7 @@
|
||||
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
ac_add_options --enable-rust-tests
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/win32/nightly"
|
7
browser/config/mozconfigs/win64/rusttests
Normal file
7
browser/config/mozconfigs/win64/rusttests
Normal file
@ -0,0 +1,7 @@
|
||||
MOZ_AUTOMATION_BUILD_SYMBOLS=0
|
||||
MOZ_AUTOMATION_PACKAGE_TESTS=0
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
ac_add_options --enable-rust-tests
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/win64/nightly"
|
@ -36,6 +36,7 @@
|
||||
!ifndef DEV_EDITION
|
||||
!define BrandShortName "@MOZ_APP_DISPLAYNAME@"
|
||||
!endif
|
||||
!define BrandFullName "${BrandFullNameInternal}"
|
||||
|
||||
!define CERTIFICATE_NAME "Mozilla Corporation"
|
||||
!define CERTIFICATE_ISSUER "DigiCert SHA2 Assured ID Code Signing CA"
|
||||
|
@ -51,9 +51,7 @@ Var BrandFullName
|
||||
; We keep defines.nsi defined so that we get other things like
|
||||
; the version number, but we redefine BrandFullName
|
||||
!define MaintFullName "Mozilla Maintenance Service"
|
||||
!ifdef BrandFullName
|
||||
!undef BrandFullName
|
||||
!endif
|
||||
!define BrandFullName "${MaintFullName}"
|
||||
|
||||
!include common.nsh
|
||||
|
@ -240,3 +240,10 @@ set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
|
||||
# Until we remove all the other Rust checks in old-configure.
|
||||
add_old_configure_assignment('RUSTC', rustc)
|
||||
add_old_configure_assignment('RUST_TARGET', rust_target_triple)
|
||||
|
||||
# This option is separate from --enable-tests because Rust tests are particularly
|
||||
# expensive in terms of compile time (especially for code in libxul).
|
||||
option('--enable-rust-tests',
|
||||
help='Enable building of Rust tests, and build-time execution of them')
|
||||
|
||||
set_config('MOZ_RUST_TESTS', depends('--enable-rust-tests')(lambda v: bool(v)))
|
||||
|
@ -157,5 +157,12 @@ def NoVisibilityFlags():
|
||||
COMPILE_FLAGS['VISIBILITY'] = []
|
||||
|
||||
|
||||
@template
|
||||
def RustTest(name, features=None):
|
||||
RUST_TEST = name
|
||||
|
||||
if features:
|
||||
RUST_TEST_FEATURES = features
|
||||
|
||||
include('gecko_templates.mozbuild')
|
||||
include('test_templates.mozbuild')
|
||||
|
@ -1008,6 +1008,18 @@ force-cargo-library-check:
|
||||
@true
|
||||
endif # RUST_LIBRARY_FILE
|
||||
|
||||
ifdef RUST_TEST
|
||||
|
||||
ifdef RUST_TEST_FEATURES
|
||||
rust_features_flag := --features "$(RUST_TEST_FEATURES)"
|
||||
endif
|
||||
|
||||
force-cargo-test-run:
|
||||
$(call RUN_CARGO,test $(cargo_target_flag) -p $(RUST_TEST) $(rust_features_flag),$(target_cargo_env_vars))
|
||||
|
||||
check:: force-cargo-test-run
|
||||
endif
|
||||
|
||||
ifdef HOST_RUST_LIBRARY_FILE
|
||||
|
||||
ifdef HOST_RUST_LIBRARY_FEATURES
|
||||
|
@ -507,7 +507,7 @@ var DebuggerView = {
|
||||
return;
|
||||
}
|
||||
else if (textInfo.error) {
|
||||
let msg = L10N.getFormatStr("errorLoadingText2", textInfo.error);
|
||||
let msg = L10N.getFormatStr("errorLoadingText3", textInfo.error);
|
||||
this._setEditorText("error", msg);
|
||||
console.error(new Error(msg));
|
||||
dumpn(msg);
|
||||
|
@ -425,10 +425,10 @@ body {
|
||||
top: 0;
|
||||
height: 230px;
|
||||
width: 500px;
|
||||
background-color: var(--theme-codemirror-gutter-background);
|
||||
background-color: var(--theme-toolbar-background);
|
||||
transform: translateY(-250px);
|
||||
transition: transform 150ms cubic-bezier(0.07, 0.95, 0, 1);
|
||||
box-shadow: 2px 4px 6px var(--popup-shadow-color);
|
||||
box-shadow: 0 0 10px 2px var(--popup-shadow-color);
|
||||
}
|
||||
|
||||
.modal.entering,
|
||||
@ -449,16 +449,36 @@ body {
|
||||
}
|
||||
.shortcuts-content {
|
||||
padding: 15px;
|
||||
-moz-column-width: 250px;
|
||||
-webkit-column-width: 250px;
|
||||
column-width: 250px;
|
||||
}
|
||||
|
||||
.shortcuts-content h2 {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
color: var(--theme-graphs-bluegrey);
|
||||
color: var(--theme-content-color1);
|
||||
}
|
||||
|
||||
.mac .keystroke {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-radius: 3px;
|
||||
border-color: var(--theme-graphs-grey);
|
||||
background-color: var(--theme-selection-color);
|
||||
width: 21px;
|
||||
height: 17px;
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.shortcuts-section {
|
||||
margin-bottom: 20px;
|
||||
display: inline-block;
|
||||
margin: 5px;
|
||||
margin-bottom: 15px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.shortcuts-list {
|
||||
@ -471,16 +491,21 @@ body {
|
||||
|
||||
.shortcuts-modal {
|
||||
height: fit-content;
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.shortcuts-list li {
|
||||
width: 40%;
|
||||
font-size: 12px;
|
||||
color: var(--theme-body-color);
|
||||
padding-top: 5px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
:root {
|
||||
--arrow-width: 10px;
|
||||
}
|
||||
|
||||
:root.theme-light,
|
||||
:root .theme-light {
|
||||
--search-overlays-semitransparent: rgba(221, 225, 228, 0.66);
|
||||
@ -1345,7 +1370,7 @@ html[dir="rtl"] .managed-tree .tree .node > div {
|
||||
height: calc(100% - 31px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
z-index: 200;
|
||||
z-index: 20;
|
||||
background-color: var(--theme-body-background);
|
||||
overflow-y: hidden;
|
||||
}
|
||||
@ -2586,18 +2611,26 @@ html .breakpoints-list .breakpoint.paused {
|
||||
border-color: var(--breakpoint-active-color-hover);
|
||||
}
|
||||
|
||||
.breakpoints-list .breakpoint-checkbox {
|
||||
margin-inline-start: 0;
|
||||
vertical-align: -2px;
|
||||
}
|
||||
|
||||
.breakpoints-list .breakpoint-label {
|
||||
max-width: calc(100% - var(--breakpoint-expression-right-clear-space));
|
||||
display: inline-block;
|
||||
padding-inline-start: 2px;
|
||||
padding-bottom: 4px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.breakpoint-label .breakpoint-checkbox {
|
||||
margin-inline-start: 0;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
.breakpoint-label .location {
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding: 1px 0;
|
||||
}
|
||||
|
||||
.breakpoints-list .pause-indicator {
|
||||
flex: 0 1 content;
|
||||
order: 3;
|
||||
@ -2699,6 +2732,11 @@ html .breakpoints-list .breakpoint.paused {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.expression-content .tree {
|
||||
overflow-x: hidden;
|
||||
max-width: calc(100% - var(--breakpoint-expression-right-clear-space));
|
||||
}
|
||||
|
||||
.expression-content .tree-node {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
@ -2996,10 +3034,6 @@ html .breakpoints-list .breakpoint.paused {
|
||||
background-color: var(--theme-toolbar-background);
|
||||
}
|
||||
|
||||
.command-bar.vertical {
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .command-bar {
|
||||
border-right: 1px solid var(--theme-splitter-color);
|
||||
}
|
||||
@ -3114,6 +3148,7 @@ html .command-bar > button:disabled {
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
--breakpoint-expression-right-clear-space: 36px;
|
||||
}
|
||||
|
||||
/*
|
||||
|
File diff suppressed because one or more lines are too long
@ -28919,6 +28919,8 @@ var _getEmptyLines = __webpack_require__(845);
|
||||
|
||||
var _getEmptyLines2 = _interopRequireDefault(_getEmptyLines);
|
||||
|
||||
var _validate = __webpack_require__(1207);
|
||||
|
||||
var _devtoolsUtils = __webpack_require__(900);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
@ -28939,7 +28941,8 @@ self.onmessage = workerHandler({
|
||||
clearSources: _sources.clearSources,
|
||||
getVariablesInScope: _scopes.getVariablesInScope,
|
||||
getNextStep: _steps.getNextStep,
|
||||
getEmptyLines: _getEmptyLines2.default
|
||||
getEmptyLines: _getEmptyLines2.default,
|
||||
hasSyntaxError: _validate.hasSyntaxError
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
@ -29728,6 +29731,7 @@ function clearSymbols() {
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseExpression = parseExpression;
|
||||
exports.getAst = getAst;
|
||||
exports.clearASTs = clearASTs;
|
||||
exports.traverseAst = traverseAst;
|
||||
@ -29787,6 +29791,10 @@ function htmlParser(_ref) {
|
||||
});
|
||||
}
|
||||
|
||||
function parseExpression(expression, opts) {
|
||||
return babylon.parseExpression(expression, Object.assign({}, opts, { sourceType: "script" }));
|
||||
}
|
||||
|
||||
function getAst(source) {
|
||||
if (!source || !source.text) {
|
||||
return {};
|
||||
@ -33363,6 +33371,48 @@ module.exports = {
|
||||
findScopes
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 1188 */,
|
||||
/* 1189 */,
|
||||
/* 1190 */,
|
||||
/* 1191 */,
|
||||
/* 1192 */,
|
||||
/* 1193 */,
|
||||
/* 1194 */,
|
||||
/* 1195 */,
|
||||
/* 1196 */,
|
||||
/* 1197 */,
|
||||
/* 1198 */,
|
||||
/* 1199 */,
|
||||
/* 1200 */,
|
||||
/* 1201 */,
|
||||
/* 1202 */,
|
||||
/* 1203 */,
|
||||
/* 1204 */,
|
||||
/* 1205 */,
|
||||
/* 1206 */,
|
||||
/* 1207 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.hasSyntaxError = hasSyntaxError;
|
||||
|
||||
var _ast = __webpack_require__(1051);
|
||||
|
||||
function hasSyntaxError(input) {
|
||||
try {
|
||||
(0, _ast.parseExpression)(input);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return `${e.name} : ${e.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
});
|
@ -16,6 +16,9 @@ support-files =
|
||||
examples/wasm-sourcemaps/average.wasm.map
|
||||
examples/wasm-sourcemaps/average.c
|
||||
examples/wasm-sourcemaps/utils.js
|
||||
examples/sum/sum.js
|
||||
examples/sum/sum.min.js
|
||||
examples/sum/sum.min.js.map
|
||||
examples/doc-async.html
|
||||
examples/doc-asm.html
|
||||
examples/doc-scripts.html
|
||||
@ -26,6 +29,7 @@ support-files =
|
||||
examples/doc-frames.html
|
||||
examples/doc-debugger-statements.html
|
||||
examples/doc-minified.html
|
||||
examples/doc-minified2.html
|
||||
examples/doc-sourcemaps.html
|
||||
examples/doc-sourcemaps2.html
|
||||
examples/doc-sourcemap-bogus.html
|
||||
@ -61,7 +65,6 @@ skip-if = true # Bug 1383576
|
||||
[browser_dbg-breakpoints-cond.js]
|
||||
[browser_dbg-call-stack.js]
|
||||
[browser_dbg-expressions.js]
|
||||
[browser_dbg-expressions-error.js]
|
||||
[browser_dbg-scopes.js]
|
||||
[browser_dbg-chrome-create.js]
|
||||
[browser_dbg-chrome-debugging.js]
|
||||
@ -78,6 +81,7 @@ skip-if = os == "linux" # bug 1351952
|
||||
[browser_dbg-pause-exceptions.js]
|
||||
skip-if = true # Bug 1393121
|
||||
[browser_dbg-navigation.js]
|
||||
[browser_dbg-minified.js]
|
||||
[browser_dbg-pretty-print.js]
|
||||
[browser_dbg-pretty-print-console.js]
|
||||
[browser_dbg-pretty-print-paused.js]
|
||||
|
@ -1,74 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* test pausing on an errored watch expression
|
||||
* assert that you can:
|
||||
* 1. resume
|
||||
* 2. still evalutate expressions
|
||||
*/
|
||||
|
||||
const expressionSelectors = {
|
||||
input: "input.input-expression"
|
||||
};
|
||||
|
||||
function getLabel(dbg, index) {
|
||||
return findElement(dbg, "expressionNode", index).innerText;
|
||||
}
|
||||
|
||||
function getValue(dbg, index) {
|
||||
return findElement(dbg, "expressionValue", index).innerText;
|
||||
}
|
||||
|
||||
function assertEmptyValue(dbg, index) {
|
||||
const value = findElement(dbg, "expressionValue", index);
|
||||
if (value) {
|
||||
is(value.innerText, "");
|
||||
return;
|
||||
}
|
||||
|
||||
is(value, null);
|
||||
}
|
||||
|
||||
function toggleExpression(dbg, index) {
|
||||
findElement(dbg, "expressionNode", index).click();
|
||||
}
|
||||
|
||||
async function addExpression(dbg, input) {
|
||||
info("Adding an expression");
|
||||
findElementWithSelector(dbg, expressionSelectors.input).focus();
|
||||
type(dbg, input);
|
||||
pressKey(dbg, "Enter");
|
||||
|
||||
await waitForDispatch(dbg, "EVALUATE_EXPRESSION");
|
||||
}
|
||||
|
||||
async function editExpression(dbg, input) {
|
||||
info("updating the expression");
|
||||
dblClickElement(dbg, "expressionNode", 1);
|
||||
// Position cursor reliably at the end of the text.
|
||||
pressKey(dbg, "End");
|
||||
type(dbg, input);
|
||||
pressKey(dbg, "Enter");
|
||||
await waitForDispatch(dbg, "EVALUATE_EXPRESSION");
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-script-switching.html");
|
||||
|
||||
await togglePauseOnExceptions(dbg, true, false);
|
||||
await addExpression(dbg, "location");
|
||||
|
||||
const paused = waitForPaused(dbg);
|
||||
addExpression(dbg, "foo.bar");
|
||||
await paused;
|
||||
ok(dbg.selectors.hasWatchExpressionErrored(dbg.getState()));
|
||||
|
||||
// Resume, and re-pause in the `foo.bar` exception
|
||||
resume(dbg);
|
||||
await waitForPaused(dbg);
|
||||
|
||||
toggleExpression(dbg, 1);
|
||||
await waitForDispatch(dbg, "LOAD_OBJECT_PROPERTIES");
|
||||
is(findAllElements(dbg, "expressionNodes").length, 18);
|
||||
});
|
@ -0,0 +1,37 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests minfied + source maps.
|
||||
|
||||
async function foo() {
|
||||
return new Promise(r => setTimeout(r, 3000000));
|
||||
}
|
||||
|
||||
function getScopeNodeLabel(dbg, index) {
|
||||
return findElement(dbg, "scopeNode", index).innerText;
|
||||
}
|
||||
|
||||
function getScopeNodeValue(dbg, index) {
|
||||
return findElement(dbg, "scopeValue", index).innerText;
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-minified2.html");
|
||||
|
||||
await waitForSources(dbg, "sum.js");
|
||||
|
||||
await selectSource(dbg, "sum.js");
|
||||
await addBreakpoint(dbg, "sum.js", 2);
|
||||
|
||||
invokeInTab("test");
|
||||
await waitForPaused(dbg);
|
||||
|
||||
is(getScopeNodeLabel(dbg, 1), "sum");
|
||||
is(getScopeNodeLabel(dbg, 2), "<this>");
|
||||
is(getScopeNodeLabel(dbg, 3), "arguments");
|
||||
|
||||
is(getScopeNodeLabel(dbg, 4), "first");
|
||||
is(getScopeNodeValue(dbg, 4), "40");
|
||||
is(getScopeNodeLabel(dbg, 5), "second");
|
||||
is(getScopeNodeValue(dbg, 5), "2");
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Debugger test page</title>
|
||||
<script src="sum/sum.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
function test() {
|
||||
console.log(sum(40, 2));
|
||||
}
|
||||
</script>
|
||||
<button onclick="test()">test</button>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,3 @@
|
||||
function sum(first, second) {
|
||||
return first + second;
|
||||
}
|
2
devtools/client/debugger/new/test/mochitest/examples/sum/sum.min.js
vendored
Normal file
2
devtools/client/debugger/new/test/mochitest/examples/sum/sum.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
function sum(n,u){return n+u}
|
||||
//# sourceMappingURL=sum.min.js.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["sum.js"],"names":["sum","first","second"],"mappings":"AAAA,SAASA,IAAIC,EAAOC,GAClB,OAAOD,EAAQC"}
|
@ -50,7 +50,7 @@ function test() {
|
||||
}
|
||||
|
||||
function testDebuggerLoadingError() {
|
||||
ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText2", "")),
|
||||
ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText3", "")),
|
||||
"The valid error loading message is displayed.");
|
||||
}
|
||||
|
||||
|
@ -47,10 +47,11 @@ var MainToolbar = React.createClass({
|
||||
return (
|
||||
Toolbar({},
|
||||
ToolbarButton({
|
||||
className: "btn refresh",
|
||||
onClick: this.onRefresh},
|
||||
l10n.getStr("dom.refresh")
|
||||
),
|
||||
className: "refresh devtools-button",
|
||||
id: "dom-refresh-button",
|
||||
title: l10n.getStr("dom.refresh"),
|
||||
onClick: this.onRefresh
|
||||
}),
|
||||
SearchBox({
|
||||
delay: 250,
|
||||
onChange: this.onSearch,
|
||||
|
@ -96,6 +96,12 @@ body {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Refresh button */
|
||||
#dom-refresh-button::before {
|
||||
background-image: url("chrome://devtools/skin/images/reload.svg");
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Search box */
|
||||
.devtools-searchbox {
|
||||
|
@ -188,7 +188,7 @@ function evaluateJSAsync(panel, expression) {
|
||||
|
||||
function refreshPanel(panel) {
|
||||
let doc = panel.panelWin.document;
|
||||
let button = doc.querySelector(".btn.refresh");
|
||||
let button = doc.querySelector("#dom-refresh-button");
|
||||
return synthesizeMouseClickSoon(panel, button).then(() => {
|
||||
// Wait till children (properties) are fetched
|
||||
// from the backend.
|
||||
|
@ -24,6 +24,7 @@ add_task(function* () {
|
||||
const service = toolbox.sourceMapURLService;
|
||||
const tab = toolbox.target.tab;
|
||||
|
||||
debugger
|
||||
let sourceSeen = waitForSourceLoad(toolbox, JS_URL);
|
||||
tab.linkedBrowser.loadURI(PAGE_URL);
|
||||
yield sourceSeen;
|
||||
|
@ -1002,7 +1002,7 @@ CssRuleView.prototype = {
|
||||
header.textContent = label;
|
||||
|
||||
let twisty = this.styleDocument.createElementNS(HTML_NS, "span");
|
||||
twisty.className = "theme-twisty";
|
||||
twisty.className = "ruleview-expander theme-twisty";
|
||||
twisty.setAttribute("open", "true");
|
||||
|
||||
header.insertBefore(twisty, header.firstChild);
|
||||
|
@ -39,7 +39,7 @@ function* testTopLeft(inspector, view) {
|
||||
let gutters = assertGutters(view);
|
||||
|
||||
info("Make sure that clicking on the twisty hides pseudo elements");
|
||||
let expander = gutters[0].querySelector(".theme-twisty");
|
||||
let expander = gutters[0].querySelector(".ruleview-expander");
|
||||
ok(!view.element.children[1].hidden, "Pseudo Elements are expanded");
|
||||
|
||||
expander.click();
|
||||
@ -129,7 +129,7 @@ function* testTopRight(inspector, view) {
|
||||
|
||||
let gutters = assertGutters(view);
|
||||
|
||||
let expander = gutters[0].querySelector(".theme-twisty");
|
||||
let expander = gutters[0].querySelector(".ruleview-expander");
|
||||
ok(!view.element.firstChild.classList.contains("show-expandable-container"),
|
||||
"Pseudo Elements remain collapsed after switching element");
|
||||
|
||||
|
@ -19,10 +19,10 @@ collapsePanes=Collapse panes
|
||||
copySource=Copy
|
||||
copySource.accesskey=y
|
||||
|
||||
# LOCALIZATION NOTE (copySourceUrl): This is the text that appears in the
|
||||
# context menu to copy the source URL of file open.
|
||||
copySourceUrl=Copy source url
|
||||
copySourceUrl.accesskey=u
|
||||
# LOCALIZATION NOTE (copySourceUri2): This is the text that appears in the
|
||||
# context menu to copy the source URI of file open.
|
||||
copySourceUri2=Copy source URI
|
||||
copySourceUri2.accesskey=u
|
||||
|
||||
# LOCALIZATION NOTE (copyFunction): This is the text that appears in the
|
||||
# context menu to copy the function the user selected
|
||||
@ -553,9 +553,9 @@ pauseOnExceptions=Pause on all exceptions. Click to ignore exceptions
|
||||
# yet.
|
||||
loadingText=Loading\u2026
|
||||
|
||||
# LOCALIZATION NOTE (errorLoadingText2): The text that is displayed in the debugger
|
||||
# LOCALIZATION NOTE (errorLoadingText3): The text that is displayed in the debugger
|
||||
# viewer when there is an error loading a file
|
||||
errorLoadingText2=Error loading this url: %S
|
||||
errorLoadingText3=Error loading this URI: %S
|
||||
|
||||
# LOCALIZATION NOTE (addWatchExpressionText): The text that is displayed in the
|
||||
# watch expressions list to add a new item.
|
||||
|
@ -246,6 +246,11 @@
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
:root[platform="win"] .ruleview-header,
|
||||
:root[platform="linux"] .ruleview-header {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.ruleview-expandable-header {
|
||||
cursor: pointer;
|
||||
}
|
||||
@ -254,6 +259,7 @@
|
||||
background-color: var(--theme-toolbar-background-hover);
|
||||
}
|
||||
|
||||
|
||||
.ruleview-rule-pseudo-element {
|
||||
padding-left:20px;
|
||||
border-left: solid 10px;
|
||||
@ -378,10 +384,8 @@
|
||||
}
|
||||
|
||||
.ruleview-expander {
|
||||
position: relative;
|
||||
float: left;
|
||||
left: -38px;
|
||||
top: 1px;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.ruleview-rule .ruleview-expander.theme-twisty:dir(rtl) {
|
||||
@ -390,18 +394,8 @@
|
||||
}
|
||||
|
||||
.ruleview-newproperty {
|
||||
margin-inline-start: -10px;
|
||||
}
|
||||
|
||||
.ruleview-enableproperty {
|
||||
position: relative;
|
||||
float: left;
|
||||
left: -38px;
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
.ruleview-namecontainer {
|
||||
margin-left: -38px;
|
||||
/* (enable checkbox width: 12px) + (expander width: 15px) */
|
||||
margin-inline-start: 27px;
|
||||
}
|
||||
|
||||
.ruleview-namecontainer,
|
||||
@ -416,6 +410,10 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ruleview-computed {
|
||||
margin-inline-start: 35px;
|
||||
}
|
||||
|
||||
.ruleview-overridden-items {
|
||||
margin: 0px 0px 0px 5px;
|
||||
list-style: none;
|
||||
@ -540,7 +538,6 @@
|
||||
}
|
||||
|
||||
.ruleview-property {
|
||||
padding-left: 38px;
|
||||
border-left: 3px solid transparent;
|
||||
clear: right;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ CustomElementCallback::Call()
|
||||
extType.IsEmpty() ? nullptr : &extType);
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
nsIDocument::eConnected, mThisObject, nullptr, definition);
|
||||
nsIDocument::eConnected, mThisObject, nullptr, nullptr, definition);
|
||||
}
|
||||
|
||||
static_cast<LifecycleCreatedCallback *>(mCallback.get())->Call(mThisObject, rv);
|
||||
@ -61,6 +61,10 @@ CustomElementCallback::Call()
|
||||
case nsIDocument::eDisconnected:
|
||||
static_cast<LifecycleDisconnectedCallback *>(mCallback.get())->Call(mThisObject, rv);
|
||||
break;
|
||||
case nsIDocument::eAdopted:
|
||||
static_cast<LifecycleAdoptedCallback *>(mCallback.get())->Call(mThisObject,
|
||||
mAdoptedCallbackArgs.mOldDocument, mAdoptedCallbackArgs.mNewDocument, rv);
|
||||
break;
|
||||
case nsIDocument::eAttributeChanged:
|
||||
static_cast<LifecycleAttributeChangedCallback *>(mCallback.get())->Call(mThisObject,
|
||||
mArgs.name, mArgs.oldValue, mArgs.newValue, mArgs.namespaceURI, rv);
|
||||
@ -323,7 +327,9 @@ CustomElementRegistry::SetupCustomElement(Element* aElement,
|
||||
/* static */ UniquePtr<CustomElementCallback>
|
||||
CustomElementRegistry::CreateCustomElementCallback(
|
||||
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs, CustomElementDefinition* aDefinition)
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition)
|
||||
{
|
||||
MOZ_ASSERT(aDefinition, "CustomElementDefinition should not be null");
|
||||
|
||||
@ -351,6 +357,12 @@ CustomElementRegistry::CreateCustomElementCallback(
|
||||
}
|
||||
break;
|
||||
|
||||
case nsIDocument::eAdopted:
|
||||
if (aDefinition->mCallbacks->mAdoptedCallback.WasPassed()) {
|
||||
func = aDefinition->mCallbacks->mAdoptedCallback.Value();
|
||||
}
|
||||
break;
|
||||
|
||||
case nsIDocument::eAttributeChanged:
|
||||
if (aDefinition->mCallbacks->mAttributeChangedCallback.WasPassed()) {
|
||||
func = aDefinition->mCallbacks->mAttributeChangedCallback.Value();
|
||||
@ -379,6 +391,9 @@ CustomElementRegistry::CreateCustomElementCallback(
|
||||
callback->SetArgs(*aArgs);
|
||||
}
|
||||
|
||||
if (aAdoptedCallbackArgs) {
|
||||
callback->SetAdoptedCallbackArgs(*aAdoptedCallbackArgs);
|
||||
}
|
||||
return Move(callback);
|
||||
}
|
||||
|
||||
@ -388,7 +403,7 @@ CustomElementRegistry::SyncInvokeReactions(nsIDocument::ElementCallbackType aTyp
|
||||
CustomElementDefinition* aDefinition)
|
||||
{
|
||||
auto callback = CreateCustomElementCallback(aType, aCustomElement, nullptr,
|
||||
aDefinition);
|
||||
nullptr, aDefinition);
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
@ -407,6 +422,7 @@ CustomElementRegistry::SyncInvokeReactions(nsIDocument::ElementCallbackType aTyp
|
||||
CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition)
|
||||
{
|
||||
CustomElementDefinition* definition = aDefinition;
|
||||
@ -419,7 +435,8 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType
|
||||
}
|
||||
|
||||
auto callback =
|
||||
CreateCustomElementCallback(aType, aCustomElement, aArgs, definition);
|
||||
CreateCustomElementCallback(aType, aCustomElement, aArgs,
|
||||
aAdoptedCallbackArgs, definition);
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
@ -935,7 +952,7 @@ CustomElementRegistry::Upgrade(Element* aElement,
|
||||
};
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
aElement,
|
||||
&args, aDefinition);
|
||||
&args, nullptr, aDefinition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -943,7 +960,7 @@ CustomElementRegistry::Upgrade(Element* aElement,
|
||||
// Step 4.
|
||||
if (aElement->IsInComposedDoc()) {
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, aElement,
|
||||
nullptr, aDefinition);
|
||||
nullptr, nullptr, aDefinition);
|
||||
}
|
||||
|
||||
// Step 5.
|
||||
@ -967,7 +984,8 @@ CustomElementRegistry::Upgrade(Element* aElement,
|
||||
|
||||
// This is for old spec.
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eCreated,
|
||||
aElement, nullptr, aDefinition);
|
||||
aElement, nullptr,
|
||||
nullptr, aDefinition);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
@ -1150,6 +1168,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CustomElementDefinition)
|
||||
cb.NoteXPCOMChild(callbacks->mDisconnectedCallback.Value());
|
||||
}
|
||||
|
||||
if (callbacks->mAdoptedCallback.WasPassed()) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCallbacks->mAdoptedCallback");
|
||||
cb.NoteXPCOMChild(callbacks->mAdoptedCallback.Value());
|
||||
}
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mConstructor");
|
||||
cb.NoteXPCOMChild(tmp->mConstructor);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
@ -40,6 +40,12 @@ struct LifecycleCallbackArgs
|
||||
nsString namespaceURI;
|
||||
};
|
||||
|
||||
struct LifecycleAdoptedCallbackArgs
|
||||
{
|
||||
nsCOMPtr<nsIDocument> mOldDocument;
|
||||
nsCOMPtr<nsIDocument> mNewDocument;
|
||||
};
|
||||
|
||||
class CustomElementCallback
|
||||
{
|
||||
public:
|
||||
@ -56,6 +62,13 @@ public:
|
||||
mArgs = aArgs;
|
||||
}
|
||||
|
||||
void SetAdoptedCallbackArgs(LifecycleAdoptedCallbackArgs& aAdoptedCallbackArgs)
|
||||
{
|
||||
MOZ_ASSERT(mType == nsIDocument::eAdopted,
|
||||
"Arguments are only used by adopted callback.");
|
||||
mAdoptedCallbackArgs = aAdoptedCallbackArgs;
|
||||
}
|
||||
|
||||
private:
|
||||
// The this value to use for invocation of the callback.
|
||||
RefPtr<Element> mThisObject;
|
||||
@ -65,6 +78,7 @@ private:
|
||||
// Arguments to be passed to the callback,
|
||||
// used by the attribute changed callback.
|
||||
LifecycleCallbackArgs mArgs;
|
||||
LifecycleAdoptedCallbackArgs mAdoptedCallbackArgs;
|
||||
// CustomElementData that contains this callback in the
|
||||
// callback queue.
|
||||
CustomElementData* mOwnerData;
|
||||
@ -374,6 +388,7 @@ public:
|
||||
static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition);
|
||||
|
||||
void GetCustomPrototype(nsIAtom* aAtom,
|
||||
@ -394,7 +409,9 @@ private:
|
||||
|
||||
static UniquePtr<CustomElementCallback> CreateCustomElementCallback(
|
||||
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs, CustomElementDefinition* aDefinition);
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition);
|
||||
|
||||
/**
|
||||
* Registers an unresolved custom element that is a candidate for
|
||||
|
@ -2690,8 +2690,8 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
nsIDocument::eAttributeChanged, this, &args, definition);
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2985,8 +2985,8 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
(ns.IsEmpty() ? VoidString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
nsIDocument::eAttributeChanged, this, &args, definition);
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,10 @@
|
||||
#ifndef mozilla_RangeBoundary_h
|
||||
#define mozilla_RangeBoundary_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// This class will maintain a reference to the child immediately
|
||||
@ -52,6 +56,8 @@ public:
|
||||
if (!mRef) {
|
||||
mOffset = mozilla::Some(0);
|
||||
} else {
|
||||
NS_WARNING_ASSERTION(mRef->GetParentNode() == mParent,
|
||||
"Initializing RangeBoundary with invalid value");
|
||||
mOffset.reset();
|
||||
}
|
||||
}
|
||||
@ -67,13 +73,14 @@ public:
|
||||
mRef = aContainer->GetLastChild();
|
||||
} else if (aOffset != 0) {
|
||||
mRef = mParent->GetChildAt(aOffset - 1);
|
||||
MOZ_ASSERT(mRef);
|
||||
}
|
||||
|
||||
MOZ_ASSERT_IF(!mRef, aOffset == 0);
|
||||
NS_WARNING_ASSERTION(mRef || aOffset == 0,
|
||||
"Constructing RangeBoundary with invalid value");
|
||||
}
|
||||
|
||||
MOZ_ASSERT_IF(mRef, mRef->GetParentNode() == mParent);
|
||||
NS_WARNING_ASSERTION(!mRef || mRef->GetParentNode() == mParent,
|
||||
"Constructing RangeBoundary with invalid value");
|
||||
}
|
||||
|
||||
RangeBoundaryBase()
|
||||
@ -110,7 +117,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
if (!mRef) {
|
||||
MOZ_ASSERT(Offset() == 0);
|
||||
MOZ_ASSERT(Offset() == 0, "invalid RangeBoundary");
|
||||
return mParent->GetFirstChild();
|
||||
}
|
||||
MOZ_ASSERT(mParent->GetChildAt(Offset()) == mRef->GetNextSibling());
|
||||
@ -142,7 +149,8 @@ public:
|
||||
MOZ_ASSERT(mParent->IsContainerNode(), "Range is positioned on a text node!");
|
||||
|
||||
if (!mRef) {
|
||||
MOZ_ASSERT(mOffset.isSome() && mOffset.value() == 0);
|
||||
MOZ_ASSERT(mOffset.isSome() && mOffset.value() == 0,
|
||||
"Invalidating offset of invalid RangeBoundary?");
|
||||
return;
|
||||
}
|
||||
mOffset.reset();
|
||||
@ -163,13 +171,16 @@ public:
|
||||
MOZ_ASSERT(mRef);
|
||||
}
|
||||
|
||||
MOZ_ASSERT_IF(!mRef, aOffset == 0);
|
||||
NS_WARNING_ASSERTION(mRef || aOffset == 0,
|
||||
"Setting RangeBoundary to invalid value");
|
||||
} else {
|
||||
mRef = nullptr;
|
||||
}
|
||||
|
||||
mOffset = mozilla::Some(aOffset);
|
||||
MOZ_ASSERT_IF(mRef, mRef->GetParentNode() == mParent);
|
||||
|
||||
NS_WARNING_ASSERTION(!mRef || mRef->GetParentNode() == mParent,
|
||||
"Setting RangeBoundary to invalid value");
|
||||
}
|
||||
|
||||
void
|
||||
@ -203,6 +214,27 @@ public:
|
||||
return Offset() <= Container()->Length();
|
||||
}
|
||||
|
||||
bool
|
||||
IsStartOfContainer() const
|
||||
{
|
||||
// We're at the first point in the container if we don't have a reference,
|
||||
// and our offset is 0. If we don't have a Ref, we should already have an
|
||||
// offset, so we can just directly fetch it.
|
||||
return !Ref() && mOffset.value() == 0;
|
||||
}
|
||||
|
||||
bool
|
||||
IsEndOfContainer() const
|
||||
{
|
||||
// We're at the last point in the container if Ref is a pointer to the last
|
||||
// child in Container(), or our Offset() is the same as the length of our
|
||||
// container. If we don't have a Ref, then we should already have an offset,
|
||||
// so we can just directly fetch it.
|
||||
return Ref()
|
||||
? !Ref()->GetNextSibling()
|
||||
: mOffset.value() == Container()->Length();
|
||||
}
|
||||
|
||||
// Convenience methods for switching between the two types
|
||||
// of RangeBoundary.
|
||||
RangeBoundaryBase<nsINode*, nsIContent*>
|
||||
@ -227,6 +259,12 @@ public:
|
||||
(mRef ? mRef == aOther.mRef : mOffset == aOther.mOffset);
|
||||
}
|
||||
|
||||
template<typename A, typename B>
|
||||
bool operator!=(const RangeBoundaryBase<A, B>& aOther) const
|
||||
{
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
private:
|
||||
ParentType mParent;
|
||||
RefType mRef;
|
||||
|
@ -926,8 +926,9 @@ Selection::FocusOffset()
|
||||
nsIContent*
|
||||
Selection::GetChildAtAnchorOffset()
|
||||
{
|
||||
if (!mAnchorFocusRange)
|
||||
if (!mAnchorFocusRange) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (GetDirection() == eDirNext) {
|
||||
return mAnchorFocusRange->GetChildAtStartOffset();
|
||||
@ -936,6 +937,20 @@ Selection::GetChildAtAnchorOffset()
|
||||
return mAnchorFocusRange->GetChildAtEndOffset();
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
Selection::GetChildAtFocusOffset()
|
||||
{
|
||||
if (!mAnchorFocusRange) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (GetDirection() == eDirNext){
|
||||
return mAnchorFocusRange->GetChildAtEndOffset();
|
||||
}
|
||||
|
||||
return mAnchorFocusRange->GetChildAtStartOffset();
|
||||
}
|
||||
|
||||
static nsresult
|
||||
CompareToRangeStart(nsINode* aCompareNode, int32_t aCompareOffset,
|
||||
nsRange* aRange, int32_t* aCmp)
|
||||
|
@ -178,6 +178,7 @@ public:
|
||||
uint32_t FocusOffset();
|
||||
|
||||
nsIContent* GetChildAtAnchorOffset();
|
||||
nsIContent* GetChildAtFocusOffset();
|
||||
|
||||
/*
|
||||
* IsCollapsed -- is the whole selection just one point, or unset?
|
||||
|
@ -2459,7 +2459,7 @@ WebSocket::Send(Blob& aData, ErrorResult& aRv)
|
||||
AssertIsOnTargetThread();
|
||||
|
||||
nsCOMPtr<nsIInputStream> msgStream;
|
||||
aData.GetInternalStream(getter_AddRefs(msgStream), aRv);
|
||||
aData.CreateInputStream(getter_AddRefs(msgStream), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())){
|
||||
return;
|
||||
}
|
||||
|
@ -18,55 +18,37 @@
|
||||
#include "nsElementTable.h"
|
||||
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::RawRangeBoundary;
|
||||
|
||||
// couple of utility static functs
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// NodeToParentOffset: returns the node's parent and offset.
|
||||
//
|
||||
|
||||
static nsINode*
|
||||
NodeToParentOffset(nsINode* aNode, int32_t* aOffset)
|
||||
{
|
||||
*aOffset = 0;
|
||||
|
||||
nsINode* parent = aNode->GetParentNode();
|
||||
|
||||
if (parent) {
|
||||
*aOffset = parent->IndexOf(aNode);
|
||||
NS_WARNING_ASSERTION(*aOffset >= 0, "bad offset");
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// NodeIsInTraversalRange: returns true if content is visited during
|
||||
// the traversal of the range in the specified mode.
|
||||
//
|
||||
static bool
|
||||
NodeIsInTraversalRange(nsINode* aNode, bool aIsPreMode,
|
||||
nsINode* aStartContainer, int32_t aStartOffset,
|
||||
nsINode* aEndContainer, int32_t aEndOffset)
|
||||
const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd)
|
||||
{
|
||||
if (NS_WARN_IF(!aStartContainer) || NS_WARN_IF(!aEndContainer) ||
|
||||
if (NS_WARN_IF(!aStart.IsSet()) || NS_WARN_IF(!aEnd.IsSet()) ||
|
||||
NS_WARN_IF(!aNode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If a leaf node contains an end point of the traversal range, it is
|
||||
// always in the traversal range.
|
||||
if (aNode == aStartContainer || aNode == aEndContainer) {
|
||||
if (aNode == aStart.Container() || aNode == aEnd.Container()) {
|
||||
if (aNode->IsNodeOfType(nsINode::eDATA_NODE)) {
|
||||
return true; // text node or something
|
||||
}
|
||||
if (!aNode->HasChildren()) {
|
||||
MOZ_ASSERT(aNode != aStartContainer || !aStartOffset,
|
||||
"aStartContainer doesn't have children and not a data node, "
|
||||
"aStartOffset should be 0");
|
||||
MOZ_ASSERT(aNode != aEndContainer || !aEndOffset,
|
||||
"aEndContainer doesn't have children and not a data node, "
|
||||
"aEndOffset should be 0");
|
||||
MOZ_ASSERT(aNode != aStart.Container() || aStart.IsStartOfContainer(),
|
||||
"aStart.Container() doesn't have children and not a data node, "
|
||||
"aStart should be at the beginning of its container");
|
||||
MOZ_ASSERT(aNode != aEnd.Container() || aEnd.IsStartOfContainer(),
|
||||
"aEnd.Container() doesn't have children and not a data node, "
|
||||
"aEnd should be at the beginning of its container");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -76,22 +58,22 @@ NodeIsInTraversalRange(nsINode* aNode, bool aIsPreMode,
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t indx = parent->IndexOf(aNode);
|
||||
NS_WARNING_ASSERTION(indx != -1, "bad indx");
|
||||
|
||||
if (!aIsPreMode) {
|
||||
// aNode should always be content, as we have a parent, but let's just be
|
||||
// extra careful and check.
|
||||
nsIContent* content = NS_WARN_IF(!aNode->IsContent())
|
||||
? nullptr
|
||||
: aNode->AsContent();
|
||||
// Post mode: start < node <= end.
|
||||
return nsContentUtils::ComparePoints(aStartContainer, aStartOffset,
|
||||
parent, indx + 1) < 0 &&
|
||||
nsContentUtils::ComparePoints(aEndContainer, aEndOffset,
|
||||
parent, indx + 1) >= 0;
|
||||
RawRangeBoundary afterNode(parent, content);
|
||||
return nsContentUtils::ComparePoints(aStart, afterNode) < 0 &&
|
||||
nsContentUtils::ComparePoints(aEnd, afterNode) >= 0;
|
||||
}
|
||||
|
||||
// Pre mode: start <= node < end.
|
||||
return nsContentUtils::ComparePoints(aStartContainer, aStartOffset,
|
||||
parent, indx) <= 0 &&
|
||||
nsContentUtils::ComparePoints(aEndContainer, aEndOffset,
|
||||
parent, indx) > 0;
|
||||
RawRangeBoundary beforeNode(parent, aNode->GetPreviousSibling());
|
||||
return nsContentUtils::ComparePoints(aStart, beforeNode) <= 0 &&
|
||||
nsContentUtils::ComparePoints(aEnd, beforeNode) > 0;
|
||||
}
|
||||
|
||||
|
||||
@ -116,6 +98,9 @@ public:
|
||||
virtual nsresult Init(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset) override;
|
||||
|
||||
virtual nsresult Init(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd) override;
|
||||
|
||||
virtual void First() override;
|
||||
|
||||
virtual void Last() override;
|
||||
@ -139,8 +124,8 @@ protected:
|
||||
* - aStartOffset and aEndOffset are valid for its container.
|
||||
* - The start point and the end point are in document order.
|
||||
*/
|
||||
nsresult InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset);
|
||||
nsresult InitInternal(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd);
|
||||
|
||||
// Recursively get the deepest first/last child of aRoot. This will return
|
||||
// aRoot itself if it has no children.
|
||||
@ -323,8 +308,7 @@ nsContentIterator::Init(nsIDOMRange* aDOMRange)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return InitInternal(range->GetStartContainer(), range->StartOffset(),
|
||||
range->GetEndContainer(), range->EndOffset());
|
||||
return InitInternal(range->StartRef().AsRaw(), range->EndRef().AsRaw());
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -338,59 +322,69 @@ nsContentIterator::Init(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return InitInternal(aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset);
|
||||
return InitInternal(RawRangeBoundary(aStartContainer, aStartOffset),
|
||||
RawRangeBoundary(aEndContainer, aEndOffset));
|
||||
}
|
||||
|
||||
// XXX Argument names will be replaced in the following patch.
|
||||
nsresult
|
||||
nsContentIterator::InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset)
|
||||
nsContentIterator::Init(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd)
|
||||
{
|
||||
mIsDone = false;
|
||||
|
||||
|
||||
if (NS_WARN_IF(!nsRange::IsValidPoints(aStart.Container(), aStart.Offset(),
|
||||
aEnd.Container(), aEnd.Offset()))) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return InitInternal(aStart, aEnd);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentIterator::InitInternal(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd)
|
||||
{
|
||||
// get common content parent
|
||||
mCommonParent =
|
||||
nsContentUtils::GetCommonAncestor(aStartContainer, aEndContainer);
|
||||
nsContentUtils::GetCommonAncestor(aStart.Container(), aEnd.Container());
|
||||
if (NS_WARN_IF(!mCommonParent)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool startIsData = aStartContainer->IsNodeOfType(nsINode::eDATA_NODE);
|
||||
bool startIsData = aStart.Container()->IsNodeOfType(nsINode::eDATA_NODE);
|
||||
|
||||
// short circuit when start node == end node
|
||||
if (aStartContainer == aEndContainer) {
|
||||
// Check to see if we have a collapsed range, if so, there is nothing to
|
||||
// iterate over.
|
||||
//
|
||||
// XXX: CharacterDataNodes (text nodes) are currently an exception, since
|
||||
// we always want to be able to iterate text nodes at the end points
|
||||
// of a range.
|
||||
// Check to see if we have a collapsed range, if so, there is nothing to
|
||||
// iterate over.
|
||||
//
|
||||
// XXX: CharacterDataNodes (text nodes) are currently an exception, since
|
||||
// we always want to be able to iterate text nodes at the end points
|
||||
// of a range.
|
||||
|
||||
if (!startIsData && aStartOffset == aEndOffset) {
|
||||
MakeEmpty();
|
||||
return NS_OK;
|
||||
}
|
||||
if (!startIsData && aStart == aEnd) {
|
||||
MakeEmpty();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (startIsData) {
|
||||
// It's a character data node.
|
||||
mFirst = aStartContainer->AsContent();
|
||||
mLast = mFirst;
|
||||
mCurNode = mFirst;
|
||||
// Handle ranges within a single character data node.
|
||||
if (startIsData && aStart.Container() == aEnd.Container()) {
|
||||
mFirst = aStart.Container()->AsContent();
|
||||
mLast = mFirst;
|
||||
mCurNode = mFirst;
|
||||
|
||||
DebugOnly<nsresult> rv = RebuildIndexStack();
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "RebuildIndexStack failed");
|
||||
return NS_OK;
|
||||
}
|
||||
DebugOnly<nsresult> rv = RebuildIndexStack();
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "RebuildIndexStack failed");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Find first node in range.
|
||||
|
||||
nsIContent* cChild = nullptr;
|
||||
|
||||
// Valid start indices are 0 <= aStartOffset <= childCount. That means if
|
||||
// start node has no children, only offset 0 is valid.
|
||||
if (!startIsData && aStartOffset < aStartContainer->GetChildCount()) {
|
||||
cChild = aStartContainer->GetChildAt(aStartOffset);
|
||||
NS_WARNING_ASSERTION(cChild, "GetChildAt returned null");
|
||||
// Try to get the child at our starting point. This might return null if
|
||||
// aStart is immediately after the last node in aStart.Container().
|
||||
if (!startIsData) {
|
||||
cChild = aStart.GetChildAtOffset();
|
||||
}
|
||||
|
||||
if (!cChild) {
|
||||
@ -406,33 +400,31 @@ nsContentIterator::InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
// is a non-container node (e.g. <br>), we don't skip the node in this
|
||||
// case in order to address bug 1215798.
|
||||
bool startIsContainer = true;
|
||||
if (aStartContainer->IsHTMLElement()) {
|
||||
nsIAtom* name = aStartContainer->NodeInfo()->NameAtom();
|
||||
if (aStart.Container()->IsHTMLElement()) {
|
||||
nsIAtom* name = aStart.Container()->NodeInfo()->NameAtom();
|
||||
startIsContainer =
|
||||
nsHTMLElement::IsContainer(nsHTMLTags::AtomTagToId(name));
|
||||
}
|
||||
if (!startIsData && (startIsContainer || aStartOffset)) {
|
||||
mFirst = GetNextSibling(aStartContainer);
|
||||
if (!startIsData && (startIsContainer || !aStart.IsStartOfContainer())) {
|
||||
mFirst = GetNextSibling(aStart.Container());
|
||||
NS_WARNING_ASSERTION(mFirst, "GetNextSibling returned null");
|
||||
|
||||
// Does mFirst node really intersect the range? The range could be
|
||||
// 'degenerate', i.e., not collapsed but still contain no content.
|
||||
if (mFirst &&
|
||||
NS_WARN_IF(!NodeIsInTraversalRange(mFirst, mPre,
|
||||
aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset))) {
|
||||
NS_WARN_IF(!NodeIsInTraversalRange(mFirst, mPre, aStart, aEnd))) {
|
||||
mFirst = nullptr;
|
||||
}
|
||||
} else {
|
||||
mFirst = aStartContainer->AsContent();
|
||||
mFirst = aStart.Container()->AsContent();
|
||||
}
|
||||
} else {
|
||||
// post-order
|
||||
if (NS_WARN_IF(!aStartContainer->IsContent())) {
|
||||
if (NS_WARN_IF(!aStart.Container()->IsContent())) {
|
||||
// What else can we do?
|
||||
mFirst = nullptr;
|
||||
} else {
|
||||
mFirst = aStartContainer->AsContent();
|
||||
mFirst = aStart.Container()->AsContent();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -446,9 +438,7 @@ nsContentIterator::InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
// Does mFirst node really intersect the range? The range could be
|
||||
// 'degenerate', i.e., not collapsed but still contain no content.
|
||||
|
||||
if (mFirst &&
|
||||
!NodeIsInTraversalRange(mFirst, mPre, aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset)) {
|
||||
if (mFirst && !NodeIsInTraversalRange(mFirst, mPre, aStart, aEnd)) {
|
||||
mFirst = nullptr;
|
||||
}
|
||||
}
|
||||
@ -457,11 +447,11 @@ nsContentIterator::InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
|
||||
// Find last node in range.
|
||||
|
||||
bool endIsData = aEndContainer->IsNodeOfType(nsINode::eDATA_NODE);
|
||||
bool endIsData = aEnd.Container()->IsNodeOfType(nsINode::eDATA_NODE);
|
||||
|
||||
if (endIsData || !aEndContainer->HasChildren() || !aEndOffset) {
|
||||
if (endIsData || !aEnd.Container()->HasChildren() || aEnd.IsStartOfContainer()) {
|
||||
if (mPre) {
|
||||
if (NS_WARN_IF(!aEndContainer->IsContent())) {
|
||||
if (NS_WARN_IF(!aEnd.Container()->IsContent())) {
|
||||
// Not much else to do here...
|
||||
mLast = nullptr;
|
||||
} else {
|
||||
@ -469,22 +459,22 @@ nsContentIterator::InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
// the last element should be the previous node (i.e., shouldn't
|
||||
// include the end node in the range).
|
||||
bool endIsContainer = true;
|
||||
if (aEndContainer->IsHTMLElement()) {
|
||||
nsIAtom* name = aEndContainer->NodeInfo()->NameAtom();
|
||||
if (aEnd.Container()->IsHTMLElement()) {
|
||||
nsIAtom* name = aEnd.Container()->NodeInfo()->NameAtom();
|
||||
endIsContainer =
|
||||
nsHTMLElement::IsContainer(nsHTMLTags::AtomTagToId(name));
|
||||
}
|
||||
if (!endIsData && !endIsContainer && !aEndOffset) {
|
||||
mLast = PrevNode(aEndContainer);
|
||||
if (!endIsData && !endIsContainer && aEnd.IsStartOfContainer()) {
|
||||
mLast = PrevNode(aEnd.Container());
|
||||
NS_WARNING_ASSERTION(mLast, "PrevNode returned null");
|
||||
if (mLast && mLast != mFirst &&
|
||||
NS_WARN_IF(!NodeIsInTraversalRange(mLast, mPre,
|
||||
mFirst, 0,
|
||||
aEndContainer, aEndOffset))) {
|
||||
RawRangeBoundary(mFirst, 0),
|
||||
aEnd))) {
|
||||
mLast = nullptr;
|
||||
}
|
||||
} else {
|
||||
mLast = aEndContainer->AsContent();
|
||||
mLast = aEnd.Container()->AsContent();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -494,22 +484,18 @@ nsContentIterator::InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
// cdata node, should we set mLast to the prev sibling?
|
||||
|
||||
if (!endIsData) {
|
||||
mLast = GetPrevSibling(aEndContainer);
|
||||
mLast = GetPrevSibling(aEnd.Container());
|
||||
NS_WARNING_ASSERTION(mLast, "GetPrevSibling returned null");
|
||||
|
||||
if (!NodeIsInTraversalRange(mLast, mPre,
|
||||
aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset)) {
|
||||
if (!NodeIsInTraversalRange(mLast, mPre, aStart, aEnd)) {
|
||||
mLast = nullptr;
|
||||
}
|
||||
} else {
|
||||
mLast = aEndContainer->AsContent();
|
||||
mLast = aEnd.Container()->AsContent();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int32_t indx = aEndOffset;
|
||||
|
||||
cChild = aEndContainer->GetChildAt(--indx);
|
||||
cChild = aEnd.Ref();
|
||||
|
||||
if (NS_WARN_IF(!cChild)) {
|
||||
// No child at offset!
|
||||
@ -521,9 +507,7 @@ nsContentIterator::InitInternal(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
mLast = GetDeepLastChild(cChild);
|
||||
NS_WARNING_ASSERTION(mLast, "GetDeepLastChild returned null");
|
||||
|
||||
if (NS_WARN_IF(!NodeIsInTraversalRange(mLast, mPre,
|
||||
aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset))) {
|
||||
if (NS_WARN_IF(!NodeIsInTraversalRange(mLast, mPre, aStart, aEnd))) {
|
||||
mLast = nullptr;
|
||||
}
|
||||
} else {
|
||||
@ -1067,51 +1051,42 @@ nsContentIterator::PositionAt(nsINode* aCurNode)
|
||||
|
||||
// Check to see if the node falls within the traversal range.
|
||||
|
||||
nsINode* firstNode = mFirst;
|
||||
nsINode* lastNode = mLast;
|
||||
int32_t firstOffset = 0, lastOffset = 0;
|
||||
RawRangeBoundary first(mFirst, 0);
|
||||
RawRangeBoundary last(mLast, 0);
|
||||
|
||||
if (firstNode && lastNode) {
|
||||
if (mFirst && mLast) {
|
||||
if (mPre) {
|
||||
firstNode = NodeToParentOffset(mFirst, &firstOffset);
|
||||
NS_WARNING_ASSERTION(firstNode, "NodeToParentOffset returned null");
|
||||
NS_WARNING_ASSERTION(firstOffset >= 0, "bad firstOffset");
|
||||
// In pre we want to record the point immediately before mFirst, which is
|
||||
// the point immediately after mFirst's previous sibling.
|
||||
first.SetAfterRef(mFirst->GetParentNode(), mFirst->GetPreviousSibling());
|
||||
|
||||
if (lastNode->GetChildCount()) {
|
||||
lastOffset = 0;
|
||||
} else {
|
||||
lastNode = NodeToParentOffset(mLast, &lastOffset);
|
||||
NS_WARNING_ASSERTION(lastNode, "NodeToParentOffset returned null");
|
||||
NS_WARNING_ASSERTION(lastOffset >= 0, "bad lastOffset");
|
||||
++lastOffset;
|
||||
// If mLast has no children, then we want to make sure to include it.
|
||||
if (!mLast->HasChildren()) {
|
||||
last.SetAfterRef(mLast->GetParentNode(), mLast->AsContent());
|
||||
}
|
||||
} else {
|
||||
uint32_t numChildren = firstNode->GetChildCount();
|
||||
|
||||
if (numChildren) {
|
||||
firstOffset = numChildren;
|
||||
NS_WARNING_ASSERTION(firstOffset >= 0, "bad firstOffset");
|
||||
// If the first node has any children, we want to be immediately after the
|
||||
// last. Otherwise we want to be immediately before mFirst.
|
||||
if (mFirst->HasChildren()) {
|
||||
first.SetAfterRef(mFirst, mFirst->GetLastChild());
|
||||
} else {
|
||||
firstNode = NodeToParentOffset(mFirst, &firstOffset);
|
||||
NS_WARNING_ASSERTION(firstNode, "NodeToParentOffset returned null");
|
||||
NS_WARNING_ASSERTION(firstOffset >= 0, "bad firstOffset");
|
||||
first.SetAfterRef(mFirst->GetParentNode(), mFirst->GetPreviousSibling());
|
||||
}
|
||||
|
||||
lastNode = NodeToParentOffset(mLast, &lastOffset);
|
||||
NS_WARNING_ASSERTION(lastNode, "NodeToParentOffset returned null");
|
||||
NS_WARNING_ASSERTION(lastOffset >= 0, "bad lastOffset");
|
||||
++lastOffset;
|
||||
// Set the last point immediately after the final node.
|
||||
last.SetAfterRef(mLast->GetParentNode(), mLast->AsContent());
|
||||
}
|
||||
}
|
||||
|
||||
NS_WARNING_ASSERTION(first.IsSetAndValid(), "first is not valid");
|
||||
NS_WARNING_ASSERTION(last.IsSetAndValid(), "last is not valid");
|
||||
|
||||
// The end positions are always in the range even if it has no parent. We
|
||||
// need to allow that or 'iter->Init(root)' would assert in Last() or First()
|
||||
// for example, bug 327694.
|
||||
if (mFirst != mCurNode && mLast != mCurNode &&
|
||||
(NS_WARN_IF(!firstNode) || NS_WARN_IF(!lastNode) ||
|
||||
NS_WARN_IF(!NodeIsInTraversalRange(mCurNode, mPre,
|
||||
firstNode, firstOffset,
|
||||
lastNode, lastOffset)))) {
|
||||
(NS_WARN_IF(!first.IsSet()) || NS_WARN_IF(!last.IsSet()) ||
|
||||
NS_WARN_IF(!NodeIsInTraversalRange(mCurNode, mPre, first, last)))) {
|
||||
mIsDone = true;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1245,6 +1220,9 @@ public:
|
||||
virtual nsresult Init(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset) override;
|
||||
|
||||
virtual nsresult Init(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd) override;
|
||||
|
||||
virtual void Next() override;
|
||||
|
||||
virtual void Prev() override;
|
||||
@ -1346,22 +1324,26 @@ nsContentSubtreeIterator::Init(nsIDOMRange* aRange)
|
||||
nsresult
|
||||
nsContentSubtreeIterator::Init(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset)
|
||||
{
|
||||
return Init(RawRangeBoundary(aStartContainer, aStartOffset),
|
||||
RawRangeBoundary(aEndContainer, aEndOffset));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentSubtreeIterator::Init(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd)
|
||||
{
|
||||
mIsDone = false;
|
||||
|
||||
RefPtr<nsRange> range;
|
||||
nsresult rv = nsRange::CreateRange(aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset,
|
||||
getter_AddRefs(range));
|
||||
nsresult rv = nsRange::CreateRange(aStart, aEnd, getter_AddRefs(range));
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || NS_WARN_IF(!range) ||
|
||||
NS_WARN_IF(!range->IsPositioned())) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(range->GetStartContainer() != aStartContainer) ||
|
||||
NS_WARN_IF(range->GetEndContainer() != aEndContainer) ||
|
||||
NS_WARN_IF(range->StartOffset() != aStartOffset) ||
|
||||
NS_WARN_IF(range->EndOffset() != aEndOffset)) {
|
||||
if (NS_WARN_IF(range->StartRef() != aStart) ||
|
||||
NS_WARN_IF(range->EndRef() != aEnd)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -801,7 +801,9 @@ nsContentUtils::Init()
|
||||
}
|
||||
uuidGenerator.forget(&sUUIDGenerator);
|
||||
|
||||
AsyncPrecreateStringBundles();
|
||||
if (XRE_IsParentProcess()) {
|
||||
AsyncPrecreateStringBundles();
|
||||
}
|
||||
|
||||
RefPtr<UserInteractionObserver> uio = new UserInteractionObserver();
|
||||
uio->Init();
|
||||
@ -2882,6 +2884,20 @@ nsContentUtils::ComparePoints(nsIDOMNode* aParent1, int32_t aOffset1,
|
||||
return ComparePoints(parent1, aOffset1, parent2, aOffset2);
|
||||
}
|
||||
|
||||
/* static */
|
||||
int32_t
|
||||
nsContentUtils::ComparePoints(const RawRangeBoundary& aFirst,
|
||||
const RawRangeBoundary& aSecond,
|
||||
bool* aDisconnected)
|
||||
{
|
||||
if (NS_WARN_IF(!aFirst.IsSet()) || NS_WARN_IF(!aSecond.IsSet())) {
|
||||
return -1;
|
||||
}
|
||||
return ComparePoints(aFirst.Container(), aFirst.Offset(),
|
||||
aSecond.Container(), aSecond.Offset(),
|
||||
aDisconnected);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsCharInSet(const char* aSet,
|
||||
const char16_t aChar)
|
||||
@ -10178,6 +10194,7 @@ nsContentUtils::EnqueueUpgradeReaction(Element* aElement,
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition)
|
||||
{
|
||||
// No DocGroup means no custom element reactions stack.
|
||||
@ -10186,6 +10203,7 @@ nsContentUtils::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
}
|
||||
|
||||
CustomElementRegistry::EnqueueLifecycleCallback(aType, aCustomElement, aArgs,
|
||||
aAdoptedCallbackArgs,
|
||||
aDefinition);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RangeBoundary.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
@ -136,6 +137,7 @@ class EventTarget;
|
||||
class IPCDataTransfer;
|
||||
class IPCDataTransferItem;
|
||||
struct LifecycleCallbackArgs;
|
||||
struct LifecycleAdoptedCallbackArgs;
|
||||
class NodeInfo;
|
||||
class nsIContentChild;
|
||||
class nsIContentParent;
|
||||
@ -446,6 +448,9 @@ public:
|
||||
static int32_t ComparePoints(nsIDOMNode* aParent1, int32_t aOffset1,
|
||||
nsIDOMNode* aParent2, int32_t aOffset2,
|
||||
bool* aDisconnected = nullptr);
|
||||
static int32_t ComparePoints(const mozilla::RawRangeBoundary& aFirst,
|
||||
const mozilla::RawRangeBoundary& aSecond,
|
||||
bool* aDisconnected = nullptr);
|
||||
|
||||
/**
|
||||
* Brute-force search of the element subtree rooted at aContent for
|
||||
@ -3016,6 +3021,7 @@ public:
|
||||
static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
mozilla::dom::LifecycleCallbackArgs* aArgs = nullptr,
|
||||
mozilla::dom::LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs = nullptr,
|
||||
mozilla::dom::CustomElementDefinition* aDefinition = nullptr);
|
||||
|
||||
static void GetCustomPrototype(nsIDocument* aDoc,
|
||||
@ -3203,11 +3209,12 @@ public:
|
||||
*/
|
||||
static bool IsMessageInputEvent(const IPC::Message& aMsg);
|
||||
|
||||
static void AsyncPrecreateStringBundles();
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
static nsresult EnsureStringBundle(PropertiesFile aFile);
|
||||
static void AsyncPrecreateStringBundles();
|
||||
|
||||
static bool CanCallerAccess(nsIPrincipal* aSubjectPrincipal,
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
@ -274,7 +274,7 @@ nsDOMDataChannel::Send(Blob& aData, ErrorResult& aRv)
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
nsCOMPtr<nsIInputStream> msgStream;
|
||||
aData.GetInternalStream(getter_AddRefs(msgStream), aRv);
|
||||
aData.CreateInputStream(getter_AddRefs(msgStream), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())){
|
||||
return;
|
||||
}
|
||||
|
@ -1664,6 +1664,7 @@ GK_ATOM(shape_rendering, "shape-rendering")
|
||||
GK_ATOM(skewX, "skewX")
|
||||
GK_ATOM(skewY, "skewY")
|
||||
GK_ATOM(slope, "slope")
|
||||
GK_ATOM(slot, "slot")
|
||||
GK_ATOM(softLight, "soft-light")
|
||||
GK_ATOM(spacing, "spacing")
|
||||
GK_ATOM(spacingAndGlyphs, "spacingAndGlyphs")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/RangeBoundary.h"
|
||||
|
||||
class nsINode;
|
||||
class nsIDOMRange;
|
||||
@ -39,6 +40,13 @@ public:
|
||||
virtual nsresult Init(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset) = 0;
|
||||
|
||||
/* Initializes an iterator for the subtree between aStart and aEnd.
|
||||
Callers should guarantee that the start point and end point are in
|
||||
document order.
|
||||
*/
|
||||
virtual nsresult Init(const mozilla::RawRangeBoundary& aStart,
|
||||
const mozilla::RawRangeBoundary& aEnd) = 0;
|
||||
|
||||
/** First will reset the list.
|
||||
*/
|
||||
virtual void First() = 0;
|
||||
|
@ -2744,6 +2744,7 @@ public:
|
||||
eCreated,
|
||||
eConnected,
|
||||
eDisconnected,
|
||||
eAdopted,
|
||||
eAttributeChanged
|
||||
};
|
||||
|
||||
|
@ -527,6 +527,23 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
||||
|
||||
nsIDocument* newDoc = aNode->OwnerDoc();
|
||||
if (newDoc) {
|
||||
if (CustomElementRegistry::IsCustomElementEnabled()) {
|
||||
// Adopted callback must be enqueued whenever a node’s
|
||||
// shadow-including inclusive descendants that is custom.
|
||||
Element* element = aNode->IsElement() ? aNode->AsElement() : nullptr;
|
||||
if (element) {
|
||||
RefPtr<CustomElementData> data = element->GetCustomElementData();
|
||||
if (data && data->mState == CustomElementData::State::eCustom) {
|
||||
LifecycleAdoptedCallbackArgs args = {
|
||||
oldDoc,
|
||||
newDoc
|
||||
};
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAdopted,
|
||||
element, nullptr, &args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX what if oldDoc is null, we don't know if this should be
|
||||
// registered or not! Can that really happen?
|
||||
if (wasRegistered) {
|
||||
|
@ -317,6 +317,21 @@ nsRange::CreateRange(nsIDOMNode* aStartContainer, uint32_t aStartOffset,
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsRange::CreateRange(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd,
|
||||
nsRange** aRange)
|
||||
{
|
||||
RefPtr<nsRange> range = new nsRange(aStart.Container());
|
||||
nsresult rv = range->SetStartAndEnd(aStart, aEnd);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
range.forget(aRange);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* nsISupports
|
||||
******************************************************/
|
||||
@ -1529,6 +1544,63 @@ nsRange::SelectNodesInContainer(nsINode* aContainer,
|
||||
DoSetRange(start, end, newRoot);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRange::SetStartAndEnd(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd)
|
||||
{
|
||||
if (NS_WARN_IF(!aStart.IsSet()) || NS_WARN_IF(!aEnd.IsSet())) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsINode* newStartRoot = IsValidBoundary(aStart.Container());
|
||||
if (!newStartRoot) {
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
if (!aStart.IsSetAndValid()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
if (aStart.Container() == aEnd.Container()) {
|
||||
if (!aEnd.IsSetAndValid()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
// XXX: Offsets - handle this more efficiently.
|
||||
// If the end offset is less than the start offset, this should be
|
||||
// collapsed at the end offset.
|
||||
if (aStart.Offset() > aEnd.Offset()) {
|
||||
DoSetRange(aEnd, aEnd, newStartRoot);
|
||||
} else {
|
||||
DoSetRange(aStart, aEnd, newStartRoot);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsINode* newEndRoot = IsValidBoundary(aEnd.Container());
|
||||
if (!newEndRoot) {
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
if (!aEnd.IsSetAndValid()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
// If they have different root, this should be collapsed at the end point.
|
||||
if (newStartRoot != newEndRoot) {
|
||||
DoSetRange(aEnd, aEnd, newEndRoot);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the end point is before the start point, this should be collapsed at
|
||||
// the end point.
|
||||
if (nsContentUtils::ComparePoints(aStart, aEnd) == 1) {
|
||||
DoSetRange(aEnd, aEnd, newEndRoot);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise, set the range as specified.
|
||||
DoSetRange(aStart, aEnd, newStartRoot);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRange::SetStartAndEnd(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset)
|
||||
@ -1537,60 +1609,8 @@ nsRange::SetStartAndEnd(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsINode* newStartRoot = IsValidBoundary(aStartContainer);
|
||||
if (!newStartRoot) {
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
if (!IsValidOffset(aStartContainer, aStartOffset)) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
if (aStartContainer == aEndContainer) {
|
||||
if (!IsValidOffset(aEndContainer, aEndOffset)) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
// If the end offset is less than the start offset, this should be
|
||||
// collapsed at the end offset.
|
||||
if (aStartOffset > aEndOffset) {
|
||||
DoSetRange(aEndContainer, aEndOffset,
|
||||
aEndContainer, aEndOffset, newStartRoot);
|
||||
} else {
|
||||
DoSetRange(aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset, newStartRoot);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsINode* newEndRoot = IsValidBoundary(aEndContainer);
|
||||
if (!newEndRoot) {
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
if (!IsValidOffset(aEndContainer, aEndOffset)) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
// If they have different root, this should be collapsed at the end point.
|
||||
if (newStartRoot != newEndRoot) {
|
||||
DoSetRange(aEndContainer, aEndOffset,
|
||||
aEndContainer, aEndOffset, newEndRoot);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the end point is before the start point, this should be collapsed at
|
||||
// the end point.
|
||||
if (nsContentUtils::ComparePoints(aStartContainer,
|
||||
static_cast<int32_t>(aStartOffset),
|
||||
aEndContainer,
|
||||
static_cast<int32_t>(aEndOffset)) == 1) {
|
||||
DoSetRange(aEndContainer, aEndOffset,
|
||||
aEndContainer, aEndOffset, newEndRoot);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise, set the range as specified.
|
||||
DoSetRange(aStartContainer, aStartOffset,
|
||||
aEndContainer, aEndOffset, newStartRoot);
|
||||
return NS_OK;
|
||||
return SetStartAndEnd(RawRangeBoundary(aStartContainer, aStartOffset),
|
||||
RawRangeBoundary(aEndContainer, aEndOffset));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
nsINode* aEndContainer,
|
||||
uint32_t aEndOffset,
|
||||
nsRange** aRange);
|
||||
static nsresult CreateRange(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd,
|
||||
nsRange** aRange);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsRange, nsIDOMRange)
|
||||
@ -194,6 +197,8 @@ public:
|
||||
*/
|
||||
nsresult SetStartAndEnd(nsINode* aStartContainer, uint32_t aStartOffset,
|
||||
nsINode* aEndContainer, uint32_t aEndOffset);
|
||||
nsresult SetStartAndEnd(const RawRangeBoundary& aStart,
|
||||
const RawRangeBoundary& aEnd);
|
||||
|
||||
/**
|
||||
* Adds all nodes between |aStartContent| and |aEndContent| to the range.
|
||||
|
@ -1082,7 +1082,7 @@ DecodeBlob(Blob& aBlob)
|
||||
// Get the internal stream of the blob.
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
ErrorResult error;
|
||||
aBlob.Impl()->GetInternalStream(getter_AddRefs(stream), error);
|
||||
aBlob.Impl()->CreateInputStream(getter_AddRefs(stream), error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
error.SuppressException();
|
||||
return nullptr;
|
||||
|
@ -841,8 +841,7 @@ ContentEventHandler::GenerateFlatTextContent(const RawRange& aRawRange,
|
||||
|
||||
nsCOMPtr<nsIContentIterator> iter = NS_NewPreContentIterator();
|
||||
nsresult rv =
|
||||
iter->Init(aRawRange.GetStartContainer(), aRawRange.StartOffset(),
|
||||
aRawRange.GetEndContainer(), aRawRange.EndOffset());
|
||||
iter->Init(aRawRange.Start().AsRaw(), aRawRange.End().AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
@ -1014,8 +1013,7 @@ ContentEventHandler::GenerateFlatFontRanges(const RawRange& aRawRange,
|
||||
int32_t baseOffset = 0;
|
||||
nsCOMPtr<nsIContentIterator> iter = NS_NewPreContentIterator();
|
||||
nsresult rv =
|
||||
iter->Init(aRawRange.GetStartContainer(), aRawRange.StartOffset(),
|
||||
aRawRange.GetEndContainer(), aRawRange.EndOffset());
|
||||
iter->Init(aRawRange.Start().AsRaw(), aRawRange.End().AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
@ -1640,8 +1638,7 @@ ContentEventHandler::GetFirstFrameInRangeForTextRect(const RawRange& aRawRange)
|
||||
NodePosition nodePosition;
|
||||
nsCOMPtr<nsIContentIterator> iter = NS_NewPreContentIterator();
|
||||
nsresult rv =
|
||||
iter->Init(aRawRange.GetStartContainer(), aRawRange.StartOffset(),
|
||||
aRawRange.GetEndContainer(), aRawRange.EndOffset());
|
||||
iter->Init(aRawRange.Start().AsRaw(), aRawRange.End().AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return FrameAndNodeOffset();
|
||||
}
|
||||
@ -1691,8 +1688,7 @@ ContentEventHandler::GetLastFrameInRangeForTextRect(const RawRange& aRawRange)
|
||||
NodePosition nodePosition;
|
||||
nsCOMPtr<nsIContentIterator> iter = NS_NewPreContentIterator();
|
||||
nsresult rv =
|
||||
iter->Init(aRawRange.GetStartContainer(), aRawRange.StartOffset(),
|
||||
aRawRange.GetEndContainer(), aRawRange.EndOffset());
|
||||
iter->Init(aRawRange.Start().AsRaw(), aRawRange.End().AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return FrameAndNodeOffset();
|
||||
}
|
||||
@ -2306,8 +2302,7 @@ ContentEventHandler::OnQueryTextRect(WidgetQueryContentEvent* aEvent)
|
||||
|
||||
// used to iterate over all contents and their frames
|
||||
nsCOMPtr<nsIContentIterator> iter = NS_NewContentIterator();
|
||||
rv = iter->Init(rawRange.GetStartContainer(), rawRange.StartOffset(),
|
||||
rawRange.GetEndContainer(), rawRange.EndOffset());
|
||||
rv = iter->Init(rawRange.Start().AsRaw(), rawRange.End().AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -2934,9 +2929,7 @@ ContentEventHandler::GetFlatTextLengthInRange(
|
||||
return rv;
|
||||
}
|
||||
iter = NS_NewPreContentIterator();
|
||||
rv =
|
||||
iter->Init(prevRawRange.GetStartContainer(), prevRawRange.StartOffset(),
|
||||
prevRawRange.GetEndContainer(), prevRawRange.EndOffset());
|
||||
rv = iter->Init(prevRawRange.Start().AsRaw(), prevRawRange.End().AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
@ -2947,9 +2940,7 @@ ContentEventHandler::GetFlatTextLengthInRange(
|
||||
return rv;
|
||||
}
|
||||
iter = NS_NewPreContentIterator();
|
||||
rv =
|
||||
iter->Init(prevRawRange.GetStartContainer(), prevRawRange.StartOffset(),
|
||||
prevRawRange.GetEndContainer(), prevRawRange.EndOffset());
|
||||
rv = iter->Init(prevRawRange.Start().AsRaw(), prevRawRange.End().AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -70,6 +70,9 @@ private:
|
||||
nsIContent* StartRef() const { return mStart.Ref(); }
|
||||
nsIContent* EndRef() const { return mEnd.Ref(); }
|
||||
|
||||
const RangeBoundary& Start() const { return mStart; }
|
||||
const RangeBoundary& End() const { return mEnd; }
|
||||
|
||||
// XXX: Make these use RangeBoundaries...
|
||||
nsresult CollapseTo(const RawRangeBoundary& aBoundary)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ BaseBlobImpl::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
|
||||
ErrorResult rv;
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
GetInternalStream(getter_AddRefs(stream), rv);
|
||||
CreateInputStream(getter_AddRefs(stream), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) override
|
||||
{
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
@ -287,9 +287,9 @@ Blob::IsMemoryFile() const
|
||||
}
|
||||
|
||||
void
|
||||
Blob::GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
Blob::CreateInputStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
{
|
||||
mImpl->GetInternalStream(aStream, aRv);
|
||||
mImpl->CreateInputStream(aStream, aRv);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
ErrorResult& aRv);
|
||||
|
||||
void
|
||||
GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv);
|
||||
CreateInputStream(nsIInputStream** aStream, ErrorResult& aRv);
|
||||
|
||||
int64_t
|
||||
GetFileId();
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
virtual const nsTArray<RefPtr<BlobImpl>>*
|
||||
GetSubBlobImpls() const = 0;
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) = 0;
|
||||
|
||||
virtual int64_t GetFileId() = 0;
|
||||
|
@ -28,7 +28,7 @@ EmptyBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
}
|
||||
|
||||
void
|
||||
EmptyBlobImpl::GetInternalStream(nsIInputStream** aStream,
|
||||
EmptyBlobImpl::CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (NS_WARN_IF(!aStream)) {
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
mImmutable = true;
|
||||
}
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual already_AddRefed<BlobImpl>
|
||||
|
@ -239,7 +239,7 @@ const uint32_t sFileStreamFlags =
|
||||
nsIFileInputStream::SHARE_DELETE;
|
||||
|
||||
void
|
||||
FileBlobImpl::GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
FileBlobImpl::CreateInputStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
aRv = NS_NewLocalFileInputStream(getter_AddRefs(stream), mFile, -1, -1,
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
virtual void SetLastModified(int64_t aLastModified) override;
|
||||
virtual void GetMozFullPathInternal(nsAString& aFullPath,
|
||||
ErrorResult& aRv) const override;
|
||||
virtual void GetInternalStream(nsIInputStream** aInputStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aInputStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual bool IsDirectory() const override;
|
||||
|
@ -378,7 +378,7 @@ FileReader::ReadFileContent(Blob& aBlob,
|
||||
CopyUTF16toUTF8(aCharset, mCharset);
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
mBlob->GetInternalStream(getter_AddRefs(stream), aRv);
|
||||
mBlob->CreateInputStream(getter_AddRefs(stream), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ MemoryBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
}
|
||||
|
||||
void
|
||||
MemoryBlobImpl::GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
MemoryBlobImpl::CreateInputStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
{
|
||||
if (mLength > INT32_MAX) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
|
||||
}
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual already_AddRefed<BlobImpl>
|
||||
|
@ -57,7 +57,7 @@ MultipartBlobImpl::Create(nsTArray<RefPtr<BlobImpl>>&& aBlobImpls,
|
||||
}
|
||||
|
||||
void
|
||||
MultipartBlobImpl::GetInternalStream(nsIInputStream** aStream,
|
||||
MultipartBlobImpl::CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
*aStream = nullptr;
|
||||
@ -74,7 +74,7 @@ MultipartBlobImpl::GetInternalStream(nsIInputStream** aStream,
|
||||
nsCOMPtr<nsIInputStream> scratchStream;
|
||||
BlobImpl* blobImpl = mBlobImpls.ElementAt(i).get();
|
||||
|
||||
blobImpl->GetInternalStream(getter_AddRefs(scratchStream), aRv);
|
||||
blobImpl->CreateInputStream(getter_AddRefs(scratchStream), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
return mLength;
|
||||
}
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aInputStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aInputStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual const nsTArray<RefPtr<BlobImpl>>* GetSubBlobImpls() const override
|
||||
|
@ -79,7 +79,7 @@ StreamBlobImpl::~StreamBlobImpl()
|
||||
}
|
||||
|
||||
void
|
||||
StreamBlobImpl::GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
StreamBlobImpl::CreateInputStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIInputStream> clonedStream;
|
||||
nsCOMPtr<nsIInputStream> replacementStream;
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
int64_t aLastModifiedDate,
|
||||
uint64_t aLength);
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual already_AddRefed<BlobImpl>
|
||||
|
@ -44,7 +44,7 @@ StringBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
}
|
||||
|
||||
void
|
||||
StringBlobImpl::GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
StringBlobImpl::CreateInputStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
{
|
||||
aRv = NS_NewCStringInputStream(aStream, mData);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
static already_AddRefed<StringBlobImpl>
|
||||
Create(const nsACString& aData, const nsAString& aContentType);
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual already_AddRefed<BlobImpl>
|
||||
|
@ -45,7 +45,7 @@ TemporaryBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
}
|
||||
|
||||
void
|
||||
TemporaryBlobImpl::GetInternalStream(nsIInputStream** aStream,
|
||||
TemporaryBlobImpl::CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIInputStream> stream =
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
TemporaryBlobImpl(PRFileDesc* aFD, uint64_t aStartPos,
|
||||
uint64_t aLength, const nsAString& aContentType);
|
||||
|
||||
virtual void GetInternalStream(nsIInputStream** aStream,
|
||||
virtual void CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual already_AddRefed<BlobImpl>
|
||||
|
@ -221,7 +221,7 @@ SerializeInternal(BlobImpl* aBlobImpl, M* aManager, IPCBlob& aIPCBlob)
|
||||
aIPCBlob.fileId() = aBlobImpl->GetFileId();
|
||||
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
aBlobImpl->GetInternalStream(getter_AddRefs(inputStream), rv);
|
||||
aBlobImpl->CreateInputStream(getter_AddRefs(inputStream), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
* - a generic nsIInputStream: StreamBlobImpl
|
||||
* - an empty blob: EmptyBlobImpl
|
||||
* - more blobs combined together: MultipartBlobImpl
|
||||
* Each one of these implementations has a custom ::GetInternalStream method.
|
||||
* Each one of these implementations has a custom ::CreateInputStream method.
|
||||
* So, basically, each one has a different kind of nsIInputStream (nsFileStream,
|
||||
* nsIStringInputStream, SlicedInputStream, and so on).
|
||||
*
|
||||
|
@ -845,7 +845,7 @@ nsHostObjectProtocolHandler::NewChannel2(nsIURI* uri,
|
||||
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
blobImpl->GetInternalStream(getter_AddRefs(stream), rv);
|
||||
blobImpl->CreateInputStream(getter_AddRefs(stream), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
@ -961,7 +961,7 @@ NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream)
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
blobImpl->GetInternalStream(aStream, rv);
|
||||
blobImpl->CreateInputStream(aStream, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
@ -2538,7 +2538,7 @@ WriteOp::Init(FileHandle* aFileHandle)
|
||||
}
|
||||
|
||||
IgnoredErrorResult rv;
|
||||
blobImpl->GetInternalStream(getter_AddRefs(inputStream), rv);
|
||||
blobImpl->CreateInputStream(getter_AddRefs(inputStream), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ FSMultipartFormData::AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob)
|
||||
nsLinebreakConverter::eLinebreakSpace));
|
||||
|
||||
// Get input stream
|
||||
aBlob->GetInternalStream(getter_AddRefs(fileStream), error);
|
||||
aBlob->CreateInputStream(getter_AddRefs(fileStream), error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
67
dom/html/HTMLSlotElement.cpp
Normal file
67
dom/html/HTMLSlotElement.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/HTMLSlotElement.h"
|
||||
#include "mozilla/dom/HTMLSlotElementBinding.h"
|
||||
#include "mozilla/dom/HTMLUnknownElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsDocument.h"
|
||||
|
||||
nsGenericHTMLElement*
|
||||
NS_NewHTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser)
|
||||
{
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
/* Disabled for now
|
||||
if (nsDocument::IsWebComponentsEnabled(nodeInfo)) {
|
||||
already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
|
||||
return new mozilla::dom::HTMLSlotElement(nodeInfoArg);
|
||||
}
|
||||
*/
|
||||
|
||||
already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
|
||||
return new mozilla::dom::HTMLUnknownElement(nodeInfoArg);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
HTMLSlotElement::HTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
HTMLSlotElement::~HTMLSlotElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLSlotElement, nsGenericHTMLElement)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLSlotElement, nsGenericHTMLElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLSlotElement,
|
||||
nsGenericHTMLElement,
|
||||
mAssignedNodes)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLSlotElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLSlotElement)
|
||||
|
||||
void
|
||||
HTMLSlotElement::AssignedNodes(const AssignedNodesOptions& aOptions,
|
||||
nsTArray<RefPtr<nsINode>>& aNodes)
|
||||
{
|
||||
aNodes = mAssignedNodes;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
HTMLSlotElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return HTMLSlotElementBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
54
dom/html/HTMLSlotElement.h
Normal file
54
dom/html/HTMLSlotElement.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_HTMLSlotElement_h
|
||||
#define mozilla_dom_HTMLSlotElement_h
|
||||
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
struct AssignedNodesOptions;
|
||||
|
||||
class HTMLSlotElement final : public nsGenericHTMLElement
|
||||
{
|
||||
public:
|
||||
explicit HTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLSlotElement, slot)
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSlotElement, nsGenericHTMLElement)
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
|
||||
bool aPreallocateChildren) const override;
|
||||
|
||||
void SetName(const nsAString& aName, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::name, aName, aRv);
|
||||
}
|
||||
|
||||
void GetName(nsAString& aName)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::name, aName);
|
||||
}
|
||||
|
||||
void AssignedNodes(const AssignedNodesOptions& aOptions,
|
||||
nsTArray<RefPtr<nsINode>>& aNodes);
|
||||
|
||||
protected:
|
||||
virtual ~HTMLSlotElement();
|
||||
virtual JSObject*
|
||||
WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
nsTArray<RefPtr<nsINode>> mAssignedNodes;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_HTMLSlotElement_h
|
@ -97,6 +97,7 @@ EXPORTS.mozilla.dom += [
|
||||
'HTMLSelectElement.h',
|
||||
'HTMLSharedElement.h',
|
||||
'HTMLSharedListElement.h',
|
||||
'HTMLSlotElement.h',
|
||||
'HTMLSourceElement.h',
|
||||
'HTMLSpanElement.h',
|
||||
'HTMLStyleElement.h',
|
||||
@ -176,6 +177,7 @@ UNIFIED_SOURCES += [
|
||||
'HTMLSelectElement.cpp',
|
||||
'HTMLSharedElement.cpp',
|
||||
'HTMLSharedListElement.cpp',
|
||||
'HTMLSlotElement.cpp',
|
||||
'HTMLSourceElement.cpp',
|
||||
'HTMLSpanElement.cpp',
|
||||
'HTMLStyleElement.cpp',
|
||||
|
@ -1581,6 +1581,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Select)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Slot)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Source)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Span)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Style)
|
||||
|
@ -3382,14 +3382,14 @@ PreprocessHelper::Init(const nsTArray<StructuredCloneFile>& aFiles)
|
||||
ErrorResult errorResult;
|
||||
|
||||
nsCOMPtr<nsIInputStream> bytecodeStream;
|
||||
bytecodeFile.mBlob->GetInternalStream(getter_AddRefs(bytecodeStream),
|
||||
bytecodeFile.mBlob->CreateInputStream(getter_AddRefs(bytecodeStream),
|
||||
errorResult);
|
||||
if (NS_WARN_IF(errorResult.Failed())) {
|
||||
return errorResult.StealNSResult();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> compiledStream;
|
||||
compiledFile.mBlob->GetInternalStream(getter_AddRefs(compiledStream),
|
||||
compiledFile.mBlob->CreateInputStream(getter_AddRefs(compiledStream),
|
||||
errorResult);
|
||||
if (NS_WARN_IF(errorResult.Failed())) {
|
||||
return errorResult.StealNSResult();
|
||||
|
@ -6826,7 +6826,7 @@ DatabaseFile::GetInputStream(ErrorResult &rv) const
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
mBlobImpl->GetInternalStream(getter_AddRefs(inputStream), rv);
|
||||
mBlobImpl->CreateInputStream(getter_AddRefs(inputStream), rv);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ BlobImplSnapshot::CreateSlice(uint64_t aStart,
|
||||
}
|
||||
|
||||
void
|
||||
BlobImplSnapshot::GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
BlobImplSnapshot::CreateInputStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<EventTarget> et = do_QueryReferent(mFileHandle);
|
||||
RefPtr<IDBFileHandle> fileHandle = static_cast<IDBFileHandle*>(et.get());
|
||||
@ -215,7 +215,7 @@ BlobImplSnapshot::GetInternalStream(nsIInputStream** aStream, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
mBlobImpl->GetInternalStream(getter_AddRefs(stream), aRv);
|
||||
mBlobImpl->CreateInputStream(getter_AddRefs(stream), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ private:
|
||||
}
|
||||
|
||||
virtual void
|
||||
GetInternalStream(nsIInputStream** aStream,
|
||||
CreateInputStream(nsIInputStream** aStream,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
virtual int64_t
|
||||
|
@ -2251,6 +2251,11 @@ ContentChild::RecvRegisterChrome(InfallibleTArray<ChromePackage>&& packages,
|
||||
static_cast<nsChromeRegistryContent*>(registrySvc.get());
|
||||
chromeRegistry->RegisterRemoteChrome(packages, resources, overrides,
|
||||
locale, reset);
|
||||
static bool preloadDone = false;
|
||||
if (!preloadDone) {
|
||||
preloadDone = true;
|
||||
nsContentUtils::AsyncPrecreateStringBundles();
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ BaseMediaResource::Create(MediaResourceCallback* aCallback,
|
||||
IgnoredErrorResult rv;
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
blobImpl->GetInternalStream(getter_AddRefs(stream), rv);
|
||||
blobImpl->CreateInputStream(getter_AddRefs(stream), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ UDPSocket::Send(const StringOrBlobOrArrayBufferOrArrayBufferView& aData,
|
||||
if (aData.IsBlob()) {
|
||||
Blob& blob = aData.GetAsBlob();
|
||||
|
||||
blob.GetInternalStream(getter_AddRefs(stream), aRv);
|
||||
blob.CreateInputStream(getter_AddRefs(stream), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ static NPNetscapeFuncs sBrowserFuncs = {
|
||||
_pushpopupsenabledstate,
|
||||
_poppopupsenabledstate,
|
||||
_enumerate,
|
||||
_pluginthreadasynccall,
|
||||
nullptr, // pluginthreadasynccall, not used
|
||||
_construct,
|
||||
_getvalueforurl,
|
||||
_setvalueforurl,
|
||||
@ -166,9 +166,6 @@ static NPNetscapeFuncs sBrowserFuncs = {
|
||||
_setcurrentasyncsurface
|
||||
};
|
||||
|
||||
static Mutex *sPluginThreadAsyncCallLock = nullptr;
|
||||
static PRCList sPendingAsyncCalls = PR_INIT_STATIC_CLIST(&sPendingAsyncCalls);
|
||||
|
||||
// POST/GET stream type
|
||||
enum eNPPStreamTypeInternal {
|
||||
eNPPStreamTypeInternal_Get,
|
||||
@ -185,21 +182,6 @@ void NS_NotifyPluginCall(NSPluginCallReentry aReentryState)
|
||||
nsNPAPIPluginInstance::EndPluginCall(aReentryState);
|
||||
}
|
||||
|
||||
static void CheckClassInitialized()
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
if (!sPluginThreadAsyncCallLock)
|
||||
sPluginThreadAsyncCallLock = new Mutex("nsNPAPIPlugin.sPluginThreadAsyncCallLock");
|
||||
|
||||
initialized = true;
|
||||
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,("NPN callbacks initialized\n"));
|
||||
}
|
||||
|
||||
nsNPAPIPlugin::nsNPAPIPlugin()
|
||||
{
|
||||
memset((void*)&mPluginFuncs, 0, sizeof(mPluginFuncs));
|
||||
@ -259,8 +241,6 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CheckClassInitialized();
|
||||
|
||||
RefPtr<nsNPAPIPlugin> plugin = new nsNPAPIPlugin();
|
||||
|
||||
PluginLibrary* pluginLib = GetNewPluginLibrary(aPluginTag);
|
||||
@ -443,37 +423,6 @@ namespace {
|
||||
|
||||
static char *gNPPException;
|
||||
|
||||
class nsPluginThreadRunnable : public Runnable,
|
||||
public PRCList
|
||||
{
|
||||
public:
|
||||
nsPluginThreadRunnable(NPP instance, PluginThreadCallback func,
|
||||
void *userData);
|
||||
~nsPluginThreadRunnable() override;
|
||||
|
||||
NS_IMETHOD Run() override;
|
||||
|
||||
bool IsForInstance(NPP instance)
|
||||
{
|
||||
return (mInstance == instance);
|
||||
}
|
||||
|
||||
void Invalidate()
|
||||
{
|
||||
mFunc = nullptr;
|
||||
}
|
||||
|
||||
bool IsValid()
|
||||
{
|
||||
return (mFunc != nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
NPP mInstance;
|
||||
PluginThreadCallback mFunc;
|
||||
void *mUserData;
|
||||
};
|
||||
|
||||
static nsIDocument *
|
||||
GetDocumentFromNPP(NPP npp)
|
||||
{
|
||||
@ -539,118 +488,6 @@ NPPExceptionAutoHolder::~NPPExceptionAutoHolder()
|
||||
gNPPException = mOldException;
|
||||
}
|
||||
|
||||
nsPluginThreadRunnable::nsPluginThreadRunnable(NPP instance,
|
||||
PluginThreadCallback func,
|
||||
void *userData)
|
||||
: Runnable("nsPluginThreadRunnable"),
|
||||
mInstance(instance),
|
||||
mFunc(func),
|
||||
mUserData(userData)
|
||||
{
|
||||
if (!sPluginThreadAsyncCallLock) {
|
||||
// Failed to create lock, not much we can do here then...
|
||||
mFunc = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PR_INIT_CLIST(this);
|
||||
|
||||
{
|
||||
MutexAutoLock lock(*sPluginThreadAsyncCallLock);
|
||||
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
if (!inst || !inst->IsRunning()) {
|
||||
// The plugin was stopped, ignore this async call.
|
||||
mFunc = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PR_APPEND_LINK(this, &sPendingAsyncCalls);
|
||||
}
|
||||
}
|
||||
|
||||
nsPluginThreadRunnable::~nsPluginThreadRunnable()
|
||||
{
|
||||
if (!sPluginThreadAsyncCallLock) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
MutexAutoLock lock(*sPluginThreadAsyncCallLock);
|
||||
|
||||
PR_REMOVE_LINK(this);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginThreadRunnable::Run()
|
||||
{
|
||||
if (mFunc) {
|
||||
PluginDestructionGuard guard(mInstance);
|
||||
|
||||
NS_TRY_SAFE_CALL_VOID(mFunc(mUserData), nullptr,
|
||||
NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
OnPluginDestroy(NPP instance)
|
||||
{
|
||||
if (!sPluginThreadAsyncCallLock) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
MutexAutoLock lock(*sPluginThreadAsyncCallLock);
|
||||
|
||||
if (PR_CLIST_IS_EMPTY(&sPendingAsyncCalls)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsPluginThreadRunnable *r =
|
||||
(nsPluginThreadRunnable *)PR_LIST_HEAD(&sPendingAsyncCalls);
|
||||
|
||||
do {
|
||||
if (r->IsForInstance(instance)) {
|
||||
r->Invalidate();
|
||||
}
|
||||
|
||||
r = (nsPluginThreadRunnable *)PR_NEXT_LINK(r);
|
||||
} while (r != &sPendingAsyncCalls);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OnShutdown()
|
||||
{
|
||||
NS_ASSERTION(PR_CLIST_IS_EMPTY(&sPendingAsyncCalls),
|
||||
"Pending async plugin call list not cleaned up!");
|
||||
|
||||
if (sPluginThreadAsyncCallLock) {
|
||||
delete sPluginThreadAsyncCallLock;
|
||||
|
||||
sPluginThreadAsyncCallLock = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AsyncCallbackAutoLock::AsyncCallbackAutoLock()
|
||||
{
|
||||
if (sPluginThreadAsyncCallLock) {
|
||||
sPluginThreadAsyncCallLock->Lock();
|
||||
}
|
||||
}
|
||||
|
||||
AsyncCallbackAutoLock::~AsyncCallbackAutoLock()
|
||||
{
|
||||
if (sPluginThreadAsyncCallLock) {
|
||||
sPluginThreadAsyncCallLock->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
NPP NPPStack::sCurrentNPP = nullptr;
|
||||
|
||||
const char *
|
||||
@ -2009,22 +1846,6 @@ _poppopupsenabledstate(NPP npp)
|
||||
inst->PopPopupsEnabledState();
|
||||
}
|
||||
|
||||
void
|
||||
_pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,("NPN_pluginthreadasynccall called from the main thread\n"));
|
||||
} else {
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,("NPN_pluginthreadasynccall called from a non main thread\n"));
|
||||
}
|
||||
RefPtr<nsPluginThreadRunnable> evt =
|
||||
new nsPluginThreadRunnable(instance, func, userData);
|
||||
|
||||
if (evt && evt->IsValid()) {
|
||||
NS_DispatchToMainThread(evt);
|
||||
}
|
||||
}
|
||||
|
||||
NPError
|
||||
_getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
char **value, uint32_t *len)
|
||||
|
@ -219,12 +219,6 @@ _pushpopupsenabledstate(NPP npp, NPBool enabled);
|
||||
void
|
||||
_poppopupsenabledstate(NPP npp);
|
||||
|
||||
typedef void(*PluginThreadCallback)(void *);
|
||||
|
||||
void
|
||||
_pluginthreadasynccall(NPP instance, PluginThreadCallback func,
|
||||
void *userData);
|
||||
|
||||
NPError
|
||||
_getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
char **value, uint32_t *len);
|
||||
@ -327,22 +321,6 @@ PeekException();
|
||||
void
|
||||
PopException();
|
||||
|
||||
void
|
||||
OnPluginDestroy(NPP instance);
|
||||
|
||||
void
|
||||
OnShutdown();
|
||||
|
||||
/**
|
||||
* within a lexical scope, locks and unlocks the mutex used to
|
||||
* serialize modifications to plugin async callback state.
|
||||
*/
|
||||
struct MOZ_STACK_CLASS AsyncCallbackAutoLock
|
||||
{
|
||||
AsyncCallbackAutoLock();
|
||||
~AsyncCallbackAutoLock();
|
||||
};
|
||||
|
||||
class NPPStack
|
||||
{
|
||||
public:
|
||||
|
@ -166,15 +166,8 @@ nsresult nsNPAPIPluginInstance::Stop()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Make sure we lock while we're writing to mRunning after we've
|
||||
// started as other threads might be checking that inside a lock.
|
||||
{
|
||||
AsyncCallbackAutoLock lock;
|
||||
mRunning = DESTROYING;
|
||||
mStopTime = TimeStamp::Now();
|
||||
}
|
||||
|
||||
OnPluginDestroy(&mNPP);
|
||||
mRunning = DESTROYING;
|
||||
mStopTime = TimeStamp::Now();
|
||||
|
||||
// clean up open streams
|
||||
while (mStreamListeners.Length() > 0) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user