Compare commits
323
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
451509e2c0 | ||
|
|
7895b8acd9 | ||
|
|
ccff4610c5 | ||
|
|
15a1f78f8b | ||
|
|
8b44473fe6 | ||
|
|
6e0aee959e | ||
|
|
ba5930cc8e | ||
|
|
6376255c0c | ||
|
|
320682148b | ||
|
|
1ed84ac1f8 | ||
|
|
9c9d04e3e0 | ||
|
|
19504d5263 | ||
|
|
533b346f4e | ||
|
|
6afd96c460 | ||
|
|
9858dc03cb | ||
|
|
d21b46fc9c | ||
|
|
55fa46d059 | ||
|
|
b089b365d6 | ||
|
|
0c150945dc | ||
|
|
0fb23389f5 | ||
|
|
7ba07f4a17 | ||
|
|
554183b5dd | ||
|
|
98fe8b0ccb | ||
|
|
519030e688 | ||
|
|
b9531d8e11 | ||
|
|
7605f4b0f8 | ||
|
|
ab0e18135f | ||
|
|
e883ac54e9 | ||
|
|
9cb65e8a77 | ||
|
|
3a3152d54b | ||
|
|
f174801b64 | ||
|
|
3caceeb539 | ||
|
|
216189e6f7 | ||
|
|
bbae11cdd9 | ||
|
|
917447df6e | ||
|
|
244c8ef1f7 | ||
|
|
e1b6493747 | ||
|
|
4e225fc7d1 | ||
|
|
683b1bedea | ||
|
|
11519ee6d2 | ||
|
|
8a343284d9 | ||
|
|
5a34fb5e1d | ||
|
|
16c8dff724 | ||
|
|
3595b9eecf | ||
|
|
594cbca6d1 | ||
|
|
a4ba260904 | ||
|
|
4a8c186eea | ||
|
|
8ff6e8c8a2 | ||
|
|
3652cd0f99 | ||
|
|
b738ccc61b | ||
|
|
1c3a9a40e5 | ||
|
|
0a33733505 | ||
|
|
691878e20f | ||
|
|
bf1fa93b91 | ||
|
|
0ac7481d2e | ||
|
|
168bb31e4f | ||
|
|
ca04b37910 | ||
|
|
f3b26f64fc | ||
|
|
99d23484bb | ||
|
|
376bc050a6 | ||
|
|
9258382b0d | ||
|
|
b6a703907e | ||
|
|
da42871b0e | ||
|
|
c55433ee03 | ||
|
|
d0a2389b43 | ||
|
|
796a14e116 | ||
|
|
ba6e4753b7 | ||
|
|
6d3d69f644 | ||
|
|
fce3132fe8 | ||
|
|
a7da3cf52b | ||
|
|
f5316668a3 | ||
|
|
dc687dbc0b | ||
|
|
216aa2cada | ||
|
|
9d96ad90dd | ||
|
|
b064c95231 | ||
|
|
11eb1f57f4 | ||
|
|
052cb18fff | ||
|
|
d306fe61c5 | ||
|
|
7859a0d693 | ||
|
|
c5d9e1f973 | ||
|
|
2e12bda342 | ||
|
|
9755cd617d | ||
|
|
abaf4d9fb4 | ||
|
|
ae6f407177 | ||
|
|
2a44476795 | ||
|
|
755cf4c7d0 | ||
|
|
47f26a67f4 | ||
|
|
e8aa76713a | ||
|
|
e6ffc4bdb7 | ||
|
|
90bbe7536d | ||
|
|
140750e4e8 | ||
|
|
f2e089d51b | ||
|
|
e1d0ac30ac | ||
|
|
9e8adc25a4 | ||
|
|
7f66e8946a | ||
|
|
c75b8ec714 | ||
|
|
4250d93166 | ||
|
|
37250226d5 | ||
|
|
802a4cfefe | ||
|
|
5641a6d574 | ||
|
|
88d2480356 | ||
|
|
fcb4b997d0 | ||
|
|
79964767f5 | ||
|
|
a4a8d082a3 | ||
|
|
adce88de95 | ||
|
|
974d6ca889 | ||
|
|
e08a4ad1c8 | ||
|
|
39dac57259 | ||
|
|
c2d9ab62f3 | ||
|
|
b9e692af05 | ||
|
|
871e57fdd6 | ||
|
|
03530de64f | ||
|
|
4730da5b27 | ||
|
|
3cb245b749 | ||
|
|
9f5529d1e7 | ||
|
|
26c888208a | ||
|
|
9a52b3b852 | ||
|
|
96afb5250d | ||
|
|
b93afb1ba7 | ||
|
|
277f2116b6 | ||
|
|
d270404436 | ||
|
|
3bec218684 | ||
|
|
6daff43b61 | ||
|
|
eedf9f5ebf | ||
|
|
049dae86d2 | ||
|
|
65ba3cac58 | ||
|
|
1b8788aecb | ||
|
|
747632bd64 | ||
|
|
02327fa745 | ||
|
|
b470422d5a | ||
|
|
449d530a30 | ||
|
|
8bd941d4e3 | ||
|
|
7172fc72a3 | ||
|
|
b977981df6 | ||
|
|
9dc65422ba | ||
|
|
45e8e98031 | ||
|
|
965232ab2f | ||
|
|
980ca14602 | ||
|
|
02519e8575 | ||
|
|
e003547dc5 | ||
|
|
56f8375338 | ||
|
|
2407845ec1 | ||
|
|
3f09b298b0 | ||
|
|
c27830f35c | ||
|
|
99bad1726e | ||
|
|
d86349716a | ||
|
|
64a7c9e2d2 | ||
|
|
514ff21cba | ||
|
|
edb5796d58 | ||
|
|
c23e3b25f8 | ||
|
|
e360caa1a2 | ||
|
|
9eeaeff77b | ||
|
|
a435374873 | ||
|
|
04cfc091da | ||
|
|
b23e7b61c6 | ||
|
|
69b4e77751 | ||
|
|
5657b5c53b | ||
|
|
1037746d00 | ||
|
|
a060401264 | ||
|
|
4e26fc1844 | ||
|
|
2645f9b944 | ||
|
|
88ce149033 | ||
|
|
09655ad6d8 | ||
|
|
4fd0b98c2c | ||
|
|
894b33e53a | ||
|
|
236d425993 | ||
|
|
899e14e945 | ||
|
|
03fda9f0f3 | ||
|
|
3aae828871 | ||
|
|
e7514afc7c | ||
|
|
4adf0d09f7 | ||
|
|
22d0b88e37 | ||
|
|
f7388678bd | ||
|
|
b45f5c435e | ||
|
|
3c73c0805c | ||
|
|
db93b005f5 | ||
|
|
d2aaa74f31 | ||
|
|
702cf42544 | ||
|
|
79a9dc2479 | ||
|
|
ddcc3deddd | ||
|
|
f3b148844a | ||
|
|
51d5d162b7 | ||
|
|
94494805da | ||
|
|
5c7109182c | ||
|
|
68e873ada7 | ||
|
|
a5b05528fe | ||
|
|
ce88d82f4a | ||
|
|
61d3aa9be2 | ||
|
|
a078d9f976 | ||
|
|
3ed2b7a7cc | ||
|
|
9816a810e6 | ||
|
|
9a8068ea3f | ||
|
|
dcd9bbb717 | ||
|
|
ecc0a40688 | ||
|
|
8f40737fc7 | ||
|
|
e7841ab5d7 | ||
|
|
dba09fa5c4 | ||
|
|
afe2b7fa5a | ||
|
|
acaec3f389 | ||
|
|
d2083edba2 | ||
|
|
1ebcc1d7e5 | ||
|
|
cbb61ab832 | ||
|
|
cf288a1847 | ||
|
|
0d1eea2ebf | ||
|
|
af69cb07db | ||
|
|
dc4695406f | ||
|
|
c22a493144 | ||
|
|
d20ca24a07 | ||
|
|
b2ca17a298 | ||
|
|
eb70e6e3d0 | ||
|
|
32ead79529 | ||
|
|
3e59235162 | ||
|
|
7494866cb5 | ||
|
|
19bf63b0ee | ||
|
|
8b539ec9e7 | ||
|
|
ba0011606d | ||
|
|
ec2daa8dc9 | ||
|
|
44c169c9be | ||
|
|
57383be95d | ||
|
|
6ef03f136b | ||
|
|
d6bcaa6491 | ||
|
|
92edec6f58 | ||
|
|
2dea4edfd7 | ||
|
|
54cb1b965e | ||
|
|
a6d1dd183d | ||
|
|
da15aa0fdf | ||
|
|
867737dd4b | ||
|
|
36fc5f674e | ||
|
|
7b30664f59 | ||
|
|
ef71f96a8d | ||
|
|
2b99226680 | ||
|
|
2794f0c48c | ||
|
|
2f23073a3a | ||
|
|
496fbaf738 | ||
|
|
85621ee9b3 | ||
|
|
ee6595e6de | ||
|
|
201be4d8fc | ||
|
|
9e586a1d0e | ||
|
|
009c9dd2f8 | ||
|
|
6407f1abd4 | ||
|
|
28f0155307 | ||
|
|
11ede87242 | ||
|
|
3630fec559 | ||
|
|
d062e7311c | ||
|
|
0313ac74fd | ||
|
|
9612c64265 | ||
|
|
c5d570792d | ||
|
|
10c4e73e56 | ||
|
|
c9fd86cb78 | ||
|
|
550d634ff5 | ||
|
|
bbee80fa1c | ||
|
|
8ffe533b3d | ||
|
|
9670bdb685 | ||
|
|
8fa80e2c8d | ||
|
|
a377d1ecd4 | ||
|
|
1ebbb0af03 | ||
|
|
29b13d3523 | ||
|
|
76476ed75b | ||
|
|
84fc500ff2 | ||
|
|
2560dd2514 | ||
|
|
0e2b0db4d7 | ||
|
|
c4f65de9b2 | ||
|
|
e3148b0a25 | ||
|
|
fe6730c219 | ||
|
|
2e44ddb15e | ||
|
|
da74d1f3f3 | ||
|
|
91be118376 | ||
|
|
2258e09d59 | ||
|
|
30ec922d7e | ||
|
|
1000488a5b | ||
|
|
ffe75592e3 | ||
|
|
0084e71953 | ||
|
|
dbeceecde2 | ||
|
|
9fc28c55c3 | ||
|
|
113a825c1f | ||
|
|
419abfb09f | ||
|
|
4e58dab0a1 | ||
|
|
9e42d9ea2f | ||
|
|
377f54f3fe | ||
|
|
62f39d829d | ||
|
|
28971524e4 | ||
|
|
be37269123 | ||
|
|
8acff5cdbe | ||
|
|
11a4ab0982 | ||
|
|
8c41fcd240 | ||
|
|
27f4e60be8 | ||
|
|
aae1baabe9 | ||
|
|
f620afc446 | ||
|
|
456f4a5891 | ||
|
|
84d99e2996 | ||
|
|
e29301f5d0 | ||
|
|
369ad75fc8 | ||
|
|
37e3135bc5 | ||
|
|
259bd2e977 | ||
|
|
0ebdc99757 | ||
|
|
68d3bc54fb | ||
|
|
2109f36dd4 | ||
|
|
58f10adc97 | ||
|
|
05c68a17a0 | ||
|
|
f78958a020 | ||
|
|
bcd6c96aec | ||
|
|
73289f5389 | ||
|
|
4acc0d58cb | ||
|
|
a1c9dd468d | ||
|
|
0a5acb852a | ||
|
|
c8bbebe59d | ||
|
|
fddc35e438 | ||
|
|
7e4efa4e1f | ||
|
|
84b5515a8d | ||
|
|
6b7fa183dd | ||
|
|
a43d59bcbf | ||
|
|
ac6896b599 | ||
|
|
171053d0b2 | ||
|
|
efd88ee999 | ||
|
|
9a74d53315 | ||
|
|
e2a478072a | ||
|
|
cb06cac81d | ||
|
|
c3d92cd338 | ||
|
|
8ae2267eac | ||
|
|
563dc95cdb | ||
|
|
7e59ac9036 | ||
|
|
f1e40aaa5b | ||
|
|
068372c618 |
No files matched your search
@@ -22,5 +22,5 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Clobber for incremental customElements v1 landing
|
||||
Clobber for NSS Update
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ $(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status $(BUILD_BAC
|
||||
# try and make this not have to happen, we actually want dist/bin to be
|
||||
# completely removed regardless.
|
||||
default alldep all::
|
||||
$(RM) -r $(DIST)/bin
|
||||
@$(RM) -r $(DIST)/bin
|
||||
ifndef JS_STANDALONE
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
$(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
# Security Policy
|
||||
|
||||
## What is or is not a vulnerability?
|
||||
|
||||
In general, vulnerabilities are those bugs that can actually be exploited to perform malicious tasks.
|
||||
Most _crashes_ are not security vulnerabilities. Although important to fix, they don't inherently cause a problem for the
|
||||
browser's security.
|
||||
|
||||
What should be considered vulnerabilities or security hazards by default:
|
||||
- Use-after-free crashes, since those can potentially be used for remote code execution;
|
||||
- Spoofing issues in the UI;
|
||||
- File security issues, like out-of-bounds access to arbitrary files or locations;
|
||||
- Type confusion issues;
|
||||
- Bypass of security measures like CSP or the various mechanisms around HTTPS.
|
||||
|
||||
Generally not security vulnerabilities:
|
||||
- Null dereferencing crashes;
|
||||
- Malware extensions (but please do report those on the forum in the extensions board!);
|
||||
- Denial-of-service (AKA "evil trap sites")
|
||||
- Browser hangs
|
||||
- Issues with non-standard manual configuration (either at build time or by manipulating about:config directly)
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you find an issue in UXP or the applications it builds on that could impact the security or safety of users please **do not**
|
||||
make an issue on GitHub about it. GitHub does not support restricted viewability for security sensitive bugs.
|
||||
|
||||
If you want to report a security-sensitive issue then please go to the [forum](https://forum.palemoon.org) and report the issue
|
||||
via a **private message** to **Moonchild** (the founder and prime responsible for security issues).
|
||||
The forum's private message system is fully secure since your visits are encrypted and private messages are not available to anyone
|
||||
except the recipient (not even moderators!).
|
||||
|
||||
You will be informed via private message if the vulnerability report is accepted or declined, with reasoning.
|
||||
Security updates occur regularly and are given priority over most other development tasks. In general, they can be solved
|
||||
relatively quickly and will be included in the next point release (third digit if not rolled into a more major one).
|
||||
|
||||
Vendored
+8
-5
@@ -381,11 +381,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||
eval $set_cc_for_build
|
||||
SUN_ARCH=i386
|
||||
# If there is a compiler, see if it is configured for 64-bit objects.
|
||||
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
||||
# This test works for both compilers.
|
||||
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
|
||||
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
_ISAINFO=`isainfo -k 2>/dev/null`
|
||||
if [ "$_ISAINFO" = "amd64" ]; then
|
||||
SUN_ARCH=x86_64
|
||||
elif [ "$CC_FOR_BUILD" != no_compiler_found ]; then
|
||||
# If there is a compiler, see if it is configured for 64-bit objects.
|
||||
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
||||
# This test works for both compilers.
|
||||
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
|
||||
@@ -610,7 +610,7 @@ imply_option('--enable-project', application)
|
||||
def default_project(build_env, help):
|
||||
if build_env.topobjdir.endswith('/js/src'):
|
||||
return 'js'
|
||||
return 'browser'
|
||||
return 'application/xulrunner'
|
||||
|
||||
option('--enable-project', nargs=1, default=default_project,
|
||||
help='Project to build')
|
||||
@@ -618,28 +618,22 @@ option('--enable-project', nargs=1, default=default_project,
|
||||
option('--with-external-source-dir', env='EXTERNAL_SOURCE_DIR', nargs=1,
|
||||
help='External directory containing additional build files')
|
||||
|
||||
@depends('--enable-project', '--with-external-source-dir',
|
||||
check_build_environment, '--help')
|
||||
@depends('--enable-project', '--with-external-source-dir', check_build_environment, '--help')
|
||||
@imports(_from='os.path', _import='exists')
|
||||
def include_project_configure(project, external_source_dir, build_env, help):
|
||||
if not project:
|
||||
die('--enable-project is required.')
|
||||
|
||||
base_dir = build_env.topsrcdir
|
||||
|
||||
if external_source_dir:
|
||||
base_dir = os.path.join(base_dir, external_source_dir[0])
|
||||
|
||||
|
||||
build_app = project[0]
|
||||
|
||||
if not external_source_dir and build_app not in ('xulrunner', 'js'):
|
||||
die('Cannot find project %s', build_app)
|
||||
|
||||
path_project_src_dir_root = os.path.join(base_dir, build_app, 'moz.configure')
|
||||
|
||||
if exists(path_project_src_dir_root):
|
||||
return path_project_src_dir_root
|
||||
else:
|
||||
die('Cannot find project %s', build_app)
|
||||
return os.path.join(build_env.topsrcdir, 'toolkit', 'moz.configure')
|
||||
|
||||
@depends('--with-external-source-dir')
|
||||
def external_source_dir(value):
|
||||
@@ -649,12 +643,29 @@ def external_source_dir(value):
|
||||
set_config('EXTERNAL_SOURCE_DIR', external_source_dir)
|
||||
add_old_configure_assignment('EXTERNAL_SOURCE_DIR', external_source_dir)
|
||||
|
||||
@depends('--enable-project', '--with-external-source-dir', check_build_environment, '--help')
|
||||
@imports(_from='os.path', _import='exists')
|
||||
def build_project(project, external_source_dir, build_env, help):
|
||||
if not project:
|
||||
die('--enable-project is required.')
|
||||
|
||||
base_dir = build_env.topsrcdir
|
||||
|
||||
if external_source_dir:
|
||||
base_dir = os.path.join(base_dir, external_source_dir[0])
|
||||
|
||||
build_app = project[0]
|
||||
|
||||
if not external_source_dir and build_app not in ('xulrunner', 'js'):
|
||||
die('Cannot find project %s', build_app)
|
||||
|
||||
build_app_abspath = os.path.join(base_dir, build_app)
|
||||
|
||||
if exists(build_app_abspath):
|
||||
return os.path.relpath(build_app_abspath, build_env.topsrcdir)
|
||||
else:
|
||||
die('Cannot find project %s', build_app)
|
||||
|
||||
@depends(include_project_configure, check_build_environment, '--help')
|
||||
def build_project(include_project_configure, build_env, help):
|
||||
ret = os.path.dirname(os.path.relpath(include_project_configure,
|
||||
build_env.topsrcdir))
|
||||
return ret
|
||||
|
||||
set_config('MOZ_BUILD_APP', build_project)
|
||||
set_define('MOZ_BUILD_APP', build_project)
|
||||
|
||||
@@ -157,6 +157,7 @@ def old_configure_options(*options):
|
||||
'--enable-accessibility',
|
||||
'--enable-address-sanitizer',
|
||||
'--enable-alsa',
|
||||
'--enable-av1',
|
||||
'--enable-b2g-bt',
|
||||
'--enable-b2g-camera',
|
||||
'--enable-b2g-ril',
|
||||
|
||||
@@ -16,11 +16,6 @@ ac_add_options --enable-crashreporter
|
||||
|
||||
ac_add_options --enable-release
|
||||
|
||||
# Disable checking that add-ons are signed by the trusted root
|
||||
MOZ_ADDON_SIGNING=${MOZ_ADDON_SIGNING-0}
|
||||
# Disable enforcing that add-ons are signed by the trusted root
|
||||
MOZ_REQUIRE_SIGNING=${MOZ_REQUIRE_SIGNING-0}
|
||||
|
||||
ac_add_options --enable-js-shell
|
||||
|
||||
. "$topsrcdir/build/mozconfig.automation"
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
import os, sys
|
||||
|
||||
if not len(sys.argv) is 2 or not os.path.exists(sys.argv[1]):
|
||||
print("\nYou did not supply a valid path to check.")
|
||||
exit(1)
|
||||
else:
|
||||
print("\nChecking for un-preprocessed files...", end = ' ')
|
||||
DIST_PATH = sys.argv[1]
|
||||
|
||||
PP_FILE_TYPES = (
|
||||
'.css',
|
||||
'.dtd',
|
||||
'.html',
|
||||
'.js',
|
||||
'.jsm',
|
||||
'.xhtml',
|
||||
'.xml',
|
||||
'.xul',
|
||||
'.manifest',
|
||||
'.properties',
|
||||
'.rdf'
|
||||
)
|
||||
|
||||
PP_SPECIAL_TYPES = ('.css')
|
||||
|
||||
PP_DIRECTIVES = [
|
||||
'define',
|
||||
'if',
|
||||
'ifdef',
|
||||
'ifndef',
|
||||
'elif',
|
||||
'elifdef',
|
||||
'endif',
|
||||
'error',
|
||||
'expand',
|
||||
'filter',
|
||||
'include',
|
||||
'literal',
|
||||
'undef',
|
||||
'unfilter'
|
||||
]
|
||||
|
||||
PP_FILES = []
|
||||
PP_BAD_FILES = []
|
||||
|
||||
for root, directories, filenames in os.walk(DIST_PATH):
|
||||
for filename in filenames:
|
||||
if filename.endswith(PP_FILE_TYPES):
|
||||
PP_FILES += [ os.path.join(root, filename).replace(os.sep, '/') ]
|
||||
|
||||
for file in PP_FILES:
|
||||
with open(file) as fp:
|
||||
marker = '%' if file.endswith(PP_SPECIAL_TYPES) else '#'
|
||||
directives = tuple(marker + directive for directive in PP_DIRECTIVES)
|
||||
for line in fp:
|
||||
if line.startswith(directives):
|
||||
PP_BAD_FILES += [ file.replace(DIST_PATH + '/', '') ]
|
||||
fp.close()
|
||||
|
||||
PP_BAD_FILES = list(dict.fromkeys(PP_BAD_FILES))
|
||||
|
||||
print('Done!')
|
||||
|
||||
if len(PP_BAD_FILES) > 0:
|
||||
print("\nWARNING: The following {0} file(s) in {1} may require preprocessing:\n".format(len(PP_BAD_FILES), DIST_PATH))
|
||||
for file in PP_BAD_FILES:
|
||||
print(file)
|
||||
|
||||
exit(0)
|
||||
@@ -10,4 +10,4 @@
|
||||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
4.5.9
|
||||
4.5.0
|
||||
@@ -91,7 +91,7 @@ const Curl = {
|
||||
if (utils.isUrlEncodedRequest(data) ||
|
||||
["PUT", "POST", "PATCH"].includes(data.method)) {
|
||||
postDataText = data.postDataText;
|
||||
addPostData("--data");
|
||||
addPostData("--data-raw");
|
||||
addPostData(utils.writePostDataTextParams(postDataText));
|
||||
ignoredHeaders.add("content-length");
|
||||
} else if (multipartRequest) {
|
||||
@@ -400,7 +400,12 @@ const CurlUtils = {
|
||||
* Credit: Google DevTools
|
||||
*/
|
||||
escapeStringWin: function (str) {
|
||||
/* Replace quote by double quote (but not by \") because it is
|
||||
/*
|
||||
Replace dollar sign because of commands (e.g $(cmd.exe)) in
|
||||
powershell when using double quotes.
|
||||
Useful details http://www.rlmueller.net/PowerShellEscape.htm
|
||||
|
||||
Replace quote by double quote (but not by \") because it is
|
||||
recognized by both cmd.exe and MS Crt arguments parser.
|
||||
|
||||
Replace % by "%" because it could be expanded to an environment
|
||||
@@ -414,7 +419,8 @@ const CurlUtils = {
|
||||
Replace new line outside of quotes since cmd.exe doesn't let
|
||||
to do it inside.
|
||||
*/
|
||||
return "\"" + str.replace(/"/g, "\"\"")
|
||||
return "\"" + str.replace(/\$/g, "`$")
|
||||
.replace(/"/g, "\"\"")
|
||||
.replace(/%/g, "\"%\"")
|
||||
.replace(/\\/g, "\\\\")
|
||||
.replace(/[\r\n]+/g, "\"^$&\"") + "\"";
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
a {
|
||||
-moz-user-focus: normal;
|
||||
-moz-user-input: enabled;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@@ -1440,6 +1440,8 @@ exports.CSS_PROPERTIES = {
|
||||
"supports": [],
|
||||
"values": [
|
||||
"auto",
|
||||
"disabled",
|
||||
"enabled",
|
||||
"inherit",
|
||||
"initial",
|
||||
"none",
|
||||
|
||||
@@ -126,7 +126,7 @@ switch (variable) {
|
||||
code_for_1;
|
||||
code_for_1;
|
||||
break;
|
||||
case value2:
|
||||
case value2: // Comment describing 2 (alternative)
|
||||
code_for_2;
|
||||
code_for_2;
|
||||
// fallthrough
|
||||
@@ -273,7 +273,7 @@ Applies to `*.js` and `*.jsm`.
|
||||
}
|
||||
}, false);
|
||||
```
|
||||
- Use a single space between `{` `}` braces in empty js objects.
|
||||
- Don't use a space between `{` `}` braces in empty js objects, `{` `}` braces in empty function scopes, or `[` `]` brackets in empty arrays.
|
||||
|
||||
### Flow control
|
||||
Flow control expressions should follow the following guidelines:
|
||||
@@ -343,7 +343,7 @@ switch (variable) {
|
||||
code_for_1;
|
||||
code_for_1;
|
||||
break;
|
||||
case value2:
|
||||
case value2: // Comment describing 2 (alternative)
|
||||
code_for_2;
|
||||
code_for_2;
|
||||
// fallthrough
|
||||
@@ -397,8 +397,7 @@ try {
|
||||
|
||||
try {
|
||||
do_something();
|
||||
} catch(e) {
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
try {
|
||||
do_something();
|
||||
@@ -414,11 +413,6 @@ try {
|
||||
// No error processing
|
||||
do_something_else();
|
||||
}
|
||||
|
||||
// No closing brace on its own line
|
||||
try {
|
||||
do_something();
|
||||
} catch(ex) { }
|
||||
```
|
||||
|
||||
### Long line wrapping
|
||||
|
||||
@@ -860,6 +860,12 @@ nsDocShell::~nsDocShell()
|
||||
shPrivate->SetRootDocShell(nullptr);
|
||||
}
|
||||
|
||||
if (mContentViewer) {
|
||||
mContentViewer->Close(nullptr);
|
||||
mContentViewer->Destroy();
|
||||
mContentViewer = nullptr;
|
||||
}
|
||||
|
||||
if (--gDocShellCount == 0) {
|
||||
NS_IF_RELEASE(sURIFixup);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#ifndef mozilla_AnimationComparator_h
|
||||
#define mozilla_AnimationComparator_h
|
||||
|
||||
#include "mozilla/dom/Animation.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// Although this file is called AnimationComparator, we don't actually
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/AnimationEffectReadOnly.h"
|
||||
#include "mozilla/dom/AnimationEffectReadOnlyBinding.h"
|
||||
#include "mozilla/dom/Animation.h"
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsXPIDLString;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "mozilla/dom/CSSPseudoElement.h"
|
||||
#include "mozilla/dom/CSSPseudoElementBinding.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h" // for ElementOrCSSPseudoElement class
|
||||
#include "mozilla/AnimationComparator.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/AnimationEffectTiming.h"
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/KeyframeEffectReadOnly.h"
|
||||
|
||||
#include "mozilla/dom/Animation.h"
|
||||
#include "mozilla/dom/KeyframeAnimationOptionsBinding.h"
|
||||
// For UnrestrictedDoubleOrKeyframeAnimationOptions;
|
||||
#include "mozilla/dom/CSSPseudoElement.h"
|
||||
@@ -25,6 +26,7 @@
|
||||
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ EXPORTS.mozilla += [
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'KeyframeEffect.cpp',
|
||||
'KeyframeEffectReadOnly.cpp',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'Animation.cpp',
|
||||
'AnimationEffectReadOnly.cpp',
|
||||
'AnimationEffectTiming.cpp',
|
||||
@@ -50,9 +55,7 @@ UNIFIED_SOURCES += [
|
||||
'DocumentTimeline.cpp',
|
||||
'EffectCompositor.cpp',
|
||||
'EffectSet.cpp',
|
||||
'KeyframeEffect.cpp',
|
||||
'KeyframeEffectParams.cpp',
|
||||
'KeyframeEffectReadOnly.cpp',
|
||||
'KeyframeUtils.cpp',
|
||||
'PendingAnimationTracker.cpp',
|
||||
'TimingParams.cpp',
|
||||
|
||||
@@ -8,10 +8,12 @@
|
||||
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/ArchiveRequestBinding.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
USING_ARCHIVEREADER_NAMESPACE
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
USING_ARCHIVEREADER_NAMESPACE
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ EXPORTS.mozilla.dom.archivereader += [
|
||||
'ArchiveZipFile.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
SOURCES += [
|
||||
'ArchiveEvent.cpp',
|
||||
'ArchiveReader.cpp',
|
||||
'ArchiveRequest.cpp',
|
||||
|
||||
@@ -16,14 +16,12 @@ EXPORTS += [
|
||||
'AudioChannelService.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
SOURCES += [
|
||||
'AudioChannelAgent.cpp',
|
||||
'AudioChannelService.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base/',
|
||||
]
|
||||
LOCAL_INCLUDES += ['/dom/base/']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#define mozilla_dom_BlobSet_h
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#ifndef CORSMode_h_
|
||||
#define CORSMode_h_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum CORSMode : uint8_t {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/ChromeUtilsBinding.h"
|
||||
#include "mozilla/dom/ThreadSafeChromeUtilsBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
+335
-670
File diff suppressed because it is too large.
Load diff
@@ -7,16 +7,13 @@
|
||||
#ifndef mozilla_dom_CustomElementRegistry_h
|
||||
#define mozilla_dom_CustomElementRegistry_h
|
||||
|
||||
#include "js/GCHashTable.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "mozilla/dom/WebComponentsBinding.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
|
||||
class nsDocument;
|
||||
|
||||
@@ -25,8 +22,8 @@ namespace dom {
|
||||
|
||||
struct CustomElementData;
|
||||
struct ElementDefinitionOptions;
|
||||
struct LifecycleCallbacks;
|
||||
class CallbackFunction;
|
||||
class CustomElementReaction;
|
||||
class Function;
|
||||
class Promise;
|
||||
|
||||
@@ -35,13 +32,6 @@ struct LifecycleCallbackArgs
|
||||
nsString name;
|
||||
nsString oldValue;
|
||||
nsString newValue;
|
||||
nsString namespaceURI;
|
||||
};
|
||||
|
||||
struct LifecycleAdoptedCallbackArgs
|
||||
{
|
||||
nsCOMPtr<nsIDocument> mOldDocument;
|
||||
nsCOMPtr<nsIDocument> mNewDocument;
|
||||
};
|
||||
|
||||
class CustomElementCallback
|
||||
@@ -49,7 +39,8 @@ class CustomElementCallback
|
||||
public:
|
||||
CustomElementCallback(Element* aThisObject,
|
||||
nsIDocument::ElementCallbackType aCallbackType,
|
||||
CallbackFunction* aCallback);
|
||||
CallbackFunction* aCallback,
|
||||
CustomElementData* aOwnerData);
|
||||
void Traverse(nsCycleCollectionTraversalCallback& aCb) const;
|
||||
void Call();
|
||||
void SetArgs(LifecycleCallbackArgs& aArgs)
|
||||
@@ -59,13 +50,6 @@ 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;
|
||||
@@ -75,19 +59,9 @@ private:
|
||||
// Arguments to be passed to the callback,
|
||||
// used by the attribute changed callback.
|
||||
LifecycleCallbackArgs mArgs;
|
||||
LifecycleAdoptedCallbackArgs mAdoptedCallbackArgs;
|
||||
};
|
||||
|
||||
class CustomElementConstructor final : public CallbackFunction
|
||||
{
|
||||
public:
|
||||
explicit CustomElementConstructor(CallbackFunction* aOther)
|
||||
: CallbackFunction(aOther)
|
||||
{
|
||||
MOZ_ASSERT(JS::IsConstructor(mCallback));
|
||||
}
|
||||
|
||||
already_AddRefed<Element> Construct(const char* aExecutionReason, ErrorResult& aRv);
|
||||
// CustomElementData that contains this callback in the
|
||||
// callback queue.
|
||||
CustomElementData* mOwnerData;
|
||||
};
|
||||
|
||||
// Each custom element has an associated callback queue and an element is
|
||||
@@ -96,299 +70,63 @@ struct CustomElementData
|
||||
{
|
||||
NS_INLINE_DECL_REFCOUNTING(CustomElementData)
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-custom-element-state
|
||||
// CustomElementData is only created on the element which is a custom element
|
||||
// or an upgrade candidate, so the state of an element without
|
||||
// CustomElementData is "uncustomized".
|
||||
enum class State {
|
||||
eUndefined,
|
||||
eFailed,
|
||||
eCustom
|
||||
};
|
||||
|
||||
explicit CustomElementData(nsIAtom* aType);
|
||||
CustomElementData(nsIAtom* aType, State aState);
|
||||
// Objects in this array are transient and empty after each microtask
|
||||
// checkpoint.
|
||||
nsTArray<nsAutoPtr<CustomElementCallback>> mCallbackQueue;
|
||||
// Custom element type, for <button is="x-button"> or <x-button>
|
||||
// this would be x-button.
|
||||
nsCOMPtr<nsIAtom> mType;
|
||||
// The callback that is next to be processed upon calling RunCallbackQueue.
|
||||
int32_t mCurrentCallback;
|
||||
// Element is being created flag as described in the custom elements spec.
|
||||
bool mElementIsBeingCreated;
|
||||
// Flag to determine if the created callback has been invoked, thus it
|
||||
// determines if other callbacks can be enqueued.
|
||||
bool mCreatedCallbackInvoked;
|
||||
// The microtask level associated with the callbacks in the callback queue,
|
||||
// it is used to determine if a new queue needs to be pushed onto the
|
||||
// processing stack.
|
||||
int32_t mAssociatedMicroTask;
|
||||
|
||||
// Custom element state as described in the custom element spec.
|
||||
State mState;
|
||||
// custom element reaction queue as described in the custom element spec.
|
||||
// There is 1 reaction in reaction queue, when 1) it becomes disconnected,
|
||||
// 2) it’s adopted into a new document, 3) its attributes are changed,
|
||||
// appended, removed, or replaced.
|
||||
// There are 3 reactions in reaction queue when doing upgrade operation,
|
||||
// e.g., create an element, insert a node.
|
||||
AutoTArray<UniquePtr<CustomElementReaction>, 3> mReactionQueue;
|
||||
|
||||
void SetCustomElementDefinition(CustomElementDefinition* aDefinition);
|
||||
CustomElementDefinition* GetCustomElementDefinition();
|
||||
nsIAtom* GetCustomElementType();
|
||||
|
||||
void Traverse(nsCycleCollectionTraversalCallback& aCb) const;
|
||||
void Unlink();
|
||||
// Empties the callback queue.
|
||||
void RunCallbackQueue();
|
||||
|
||||
private:
|
||||
virtual ~CustomElementData() {}
|
||||
|
||||
// Custom element type, for <button is="x-button"> or <x-button>
|
||||
// this would be x-button.
|
||||
RefPtr<nsIAtom> mType;
|
||||
RefPtr<CustomElementDefinition> mCustomElementDefinition;
|
||||
};
|
||||
|
||||
#define ALEADY_CONSTRUCTED_MARKER nullptr
|
||||
|
||||
// The required information for a custom element as defined in:
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#custom-element-definition
|
||||
struct CustomElementDefinition
|
||||
{
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CustomElementDefinition)
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CustomElementDefinition)
|
||||
|
||||
CustomElementDefinition(nsIAtom* aType,
|
||||
nsIAtom* aLocalName,
|
||||
Function* aConstructor,
|
||||
nsCOMArray<nsIAtom>&& aObservedAttributes,
|
||||
JSObject* aConstructor,
|
||||
JSObject* aPrototype,
|
||||
mozilla::dom::LifecycleCallbacks* aCallbacks,
|
||||
uint32_t aDocOrder);
|
||||
|
||||
// The type (name) for this custom element, for <button is="x-foo"> or <x-foo>
|
||||
// this would be x-foo.
|
||||
// The type (name) for this custom element.
|
||||
nsCOMPtr<nsIAtom> mType;
|
||||
|
||||
// The localname to (e.g. <button is=type> -- this would be button).
|
||||
nsCOMPtr<nsIAtom> mLocalName;
|
||||
|
||||
// The custom element constructor.
|
||||
RefPtr<CustomElementConstructor> mConstructor;
|
||||
|
||||
// The list of attributes that this custom element observes.
|
||||
nsCOMArray<nsIAtom> mObservedAttributes;
|
||||
JS::Heap<JSObject *> mConstructor;
|
||||
|
||||
// The prototype to use for new custom elements of this type.
|
||||
JS::Heap<JSObject *> mPrototype;
|
||||
|
||||
// The lifecycle callbacks to call for this custom element.
|
||||
UniquePtr<mozilla::dom::LifecycleCallbacks> mCallbacks;
|
||||
nsAutoPtr<mozilla::dom::LifecycleCallbacks> mCallbacks;
|
||||
|
||||
// A construction stack. Use nullptr to represent an "already constructed marker".
|
||||
nsTArray<RefPtr<nsGenericHTMLElement>> mConstructionStack;
|
||||
// A construction stack.
|
||||
// TODO: Bug 1287348 - Implement construction stack for upgrading an element
|
||||
|
||||
// The document custom element order.
|
||||
uint32_t mDocOrder;
|
||||
|
||||
bool IsCustomBuiltIn()
|
||||
{
|
||||
return mType != mLocalName;
|
||||
}
|
||||
|
||||
bool IsInObservedAttributeList(nsIAtom* aName)
|
||||
{
|
||||
if (mObservedAttributes.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mObservedAttributes.Contains(aName);
|
||||
}
|
||||
|
||||
private:
|
||||
~CustomElementDefinition() {}
|
||||
};
|
||||
|
||||
class CustomElementReaction
|
||||
{
|
||||
public:
|
||||
virtual ~CustomElementReaction() = default;
|
||||
virtual void Invoke(Element* aElement, ErrorResult& aRv) = 0;
|
||||
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const
|
||||
{
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
bool IsUpgradeReaction()
|
||||
{
|
||||
return mIsUpgradeReaction;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool mIsUpgradeReaction = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
class CustomElementUpgradeReaction final : public CustomElementReaction
|
||||
{
|
||||
public:
|
||||
explicit CustomElementUpgradeReaction(CustomElementDefinition* aDefinition)
|
||||
: mDefinition(aDefinition)
|
||||
{
|
||||
#if DEBUG
|
||||
mIsUpgradeReaction = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void Invoke(Element* aElement, ErrorResult& aRv) override;
|
||||
|
||||
CustomElementDefinition* mDefinition;
|
||||
};
|
||||
|
||||
class CustomElementCallbackReaction final : public CustomElementReaction
|
||||
{
|
||||
public:
|
||||
explicit CustomElementCallbackReaction(UniquePtr<CustomElementCallback> aCustomElementCallback)
|
||||
: mCustomElementCallback(Move(aCustomElementCallback))
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const override
|
||||
{
|
||||
mCustomElementCallback->Traverse(aCb);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void Invoke(Element* aElement, ErrorResult& aRv) override;
|
||||
UniquePtr<CustomElementCallback> mCustomElementCallback;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reactions-stack
|
||||
class CustomElementReactionsStack
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(CustomElementReactionsStack)
|
||||
|
||||
CustomElementReactionsStack()
|
||||
: mIsBackupQueueProcessing(false)
|
||||
, mRecursionDepth(0)
|
||||
, mIsElementQueuePushedForCurrentRecursionDepth(false)
|
||||
{
|
||||
}
|
||||
|
||||
// Hold a strong reference of Element so that it does not get cycle collected
|
||||
// before the reactions in its reaction queue are invoked.
|
||||
// The element reaction queues are stored in CustomElementData.
|
||||
// We need to lookup ElementReactionQueueMap again to get relevant reaction queue.
|
||||
// The choice of 1 for the auto size here is based on gut feeling.
|
||||
typedef AutoTArray<RefPtr<Element>, 1> ElementQueue;
|
||||
|
||||
/**
|
||||
* Enqueue a custom element upgrade reaction
|
||||
* https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-upgrade-reaction
|
||||
*/
|
||||
void EnqueueUpgradeReaction(Element* aElement,
|
||||
CustomElementDefinition* aDefinition);
|
||||
|
||||
/**
|
||||
* Enqueue a custom element callback reaction
|
||||
* https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction
|
||||
*/
|
||||
void EnqueueCallbackReaction(Element* aElement,
|
||||
UniquePtr<CustomElementCallback> aCustomElementCallback);
|
||||
|
||||
/**
|
||||
* [CEReactions] Before executing the algorithm's steps.
|
||||
* Increase the current recursion depth, and the element queue is pushed
|
||||
* lazily when we really enqueue reactions.
|
||||
*
|
||||
* @return true if the element queue is pushed for "previous" recursion depth.
|
||||
*/
|
||||
bool EnterCEReactions()
|
||||
{
|
||||
bool temp = mIsElementQueuePushedForCurrentRecursionDepth;
|
||||
mRecursionDepth++;
|
||||
// The is-element-queue-pushed flag is initially false when entering a new
|
||||
// recursion level. The original value will be cached in AutoCEReaction
|
||||
// and restored after leaving this recursion level.
|
||||
mIsElementQueuePushedForCurrentRecursionDepth = false;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* [CEReactions] After executing the algorithm's steps.
|
||||
* Pop and invoke the element queue if it is created and pushed for current
|
||||
* recursion depth, then decrease the current recursion depth.
|
||||
*
|
||||
* @param aCx JSContext used for handling exception thrown by algorithm's
|
||||
* steps, this could be a nullptr.
|
||||
* aWasElementQueuePushed used for restoring status after leaving
|
||||
* current recursion.
|
||||
*/
|
||||
void LeaveCEReactions(JSContext* aCx, bool aWasElementQueuePushed)
|
||||
{
|
||||
MOZ_ASSERT(mRecursionDepth);
|
||||
|
||||
if (mIsElementQueuePushedForCurrentRecursionDepth) {
|
||||
Maybe<JS::AutoSaveExceptionState> ases;
|
||||
if (aCx) {
|
||||
ases.emplace(aCx);
|
||||
}
|
||||
PopAndInvokeElementQueue();
|
||||
}
|
||||
mRecursionDepth--;
|
||||
// Restore the is-element-queue-pushed flag cached in AutoCEReaction when
|
||||
// leaving the recursion level.
|
||||
mIsElementQueuePushedForCurrentRecursionDepth = aWasElementQueuePushed;
|
||||
|
||||
MOZ_ASSERT_IF(!mRecursionDepth, mReactionsStack.IsEmpty());
|
||||
}
|
||||
|
||||
private:
|
||||
~CustomElementReactionsStack() {};
|
||||
|
||||
/**
|
||||
* Push a new element queue onto the custom element reactions stack.
|
||||
*/
|
||||
void CreateAndPushElementQueue();
|
||||
|
||||
/**
|
||||
* Pop the element queue from the custom element reactions stack, and invoke
|
||||
* custom element reactions in that queue.
|
||||
*/
|
||||
void PopAndInvokeElementQueue();
|
||||
|
||||
// The choice of 8 for the auto size here is based on gut feeling.
|
||||
AutoTArray<UniquePtr<ElementQueue>, 8> mReactionsStack;
|
||||
ElementQueue mBackupQueue;
|
||||
// https://html.spec.whatwg.org/#enqueue-an-element-on-the-appropriate-element-queue
|
||||
bool mIsBackupQueueProcessing;
|
||||
|
||||
void InvokeBackupQueue();
|
||||
|
||||
/**
|
||||
* Invoke custom element reactions
|
||||
* https://html.spec.whatwg.org/multipage/scripting.html#invoke-custom-element-reactions
|
||||
*/
|
||||
void InvokeReactions(ElementQueue* aElementQueue, nsIGlobalObject* aGlobal);
|
||||
|
||||
void Enqueue(Element* aElement, CustomElementReaction* aReaction);
|
||||
|
||||
// Current [CEReactions] recursion depth.
|
||||
uint32_t mRecursionDepth;
|
||||
// True if the element queue is pushed into reaction stack for current
|
||||
// recursion depth. This will be cached in AutoCEReaction when entering a new
|
||||
// CEReaction recursion and restored after leaving the recursion.
|
||||
bool mIsElementQueuePushedForCurrentRecursionDepth;
|
||||
|
||||
private:
|
||||
class BackupQueueMicroTask final : public mozilla::MicroTaskRunnable {
|
||||
public:
|
||||
explicit BackupQueueMicroTask(CustomElementReactionsStack* aReactionStack)
|
||||
: MicroTaskRunnable()
|
||||
, mReactionStack(aReactionStack)
|
||||
{
|
||||
MOZ_ASSERT(!mReactionStack->mIsBackupQueueProcessing,
|
||||
"mIsBackupQueueProcessing should be initially false");
|
||||
mReactionStack->mIsBackupQueueProcessing = true;
|
||||
}
|
||||
|
||||
virtual void Run(AutoSlowOperation& aAso) override
|
||||
{
|
||||
mReactionStack->InvokeBackupQueue();
|
||||
mReactionStack->mIsBackupQueueProcessing = false;
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<CustomElementReactionsStack> mReactionStack;
|
||||
};
|
||||
};
|
||||
|
||||
class CustomElementRegistry final : public nsISupports,
|
||||
@@ -404,33 +142,36 @@ public:
|
||||
public:
|
||||
static bool IsCustomElementEnabled(JSContext* aCx = nullptr,
|
||||
JSObject* aObject = nullptr);
|
||||
static already_AddRefed<CustomElementRegistry> Create(nsPIDOMWindowInner* aWindow);
|
||||
static void ProcessTopElementQueue();
|
||||
|
||||
explicit CustomElementRegistry(nsPIDOMWindowInner* aWindow);
|
||||
static void XPCOMShutdown();
|
||||
|
||||
/**
|
||||
* Looking up a custom element definition.
|
||||
* https://html.spec.whatwg.org/#look-up-a-custom-element-definition
|
||||
*/
|
||||
CustomElementDefinition* LookupCustomElementDefinition(
|
||||
nsIAtom* aNameAtom, nsIAtom* aTypeAtom) const;
|
||||
const nsAString& aLocalName, const nsAString* aIs = nullptr) const;
|
||||
|
||||
CustomElementDefinition* LookupCustomElementDefinition(
|
||||
JSContext* aCx, JSObject *aConstructor) const;
|
||||
/**
|
||||
* Enqueue created callback or register upgrade candidate for
|
||||
* newly created custom elements, possibly extending an existing type.
|
||||
* ex. <x-button>, <button is="x-button> (type extension)
|
||||
*/
|
||||
void SetupCustomElement(Element* aElement, const nsAString* aTypeExtension);
|
||||
|
||||
static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition);
|
||||
void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
CustomElementDefinition* aDefinition);
|
||||
|
||||
void GetCustomPrototype(nsIAtom* aAtom,
|
||||
JS::MutableHandle<JSObject*> aPrototype);
|
||||
|
||||
/**
|
||||
* Upgrade an element.
|
||||
* https://html.spec.whatwg.org/multipage/scripting.html#upgrades
|
||||
*/
|
||||
static void Upgrade(Element* aElement, CustomElementDefinition* aDefinition, ErrorResult& aRv);
|
||||
private:
|
||||
explicit CustomElementRegistry(nsPIDOMWindowInner* aWindow);
|
||||
~CustomElementRegistry();
|
||||
|
||||
/**
|
||||
* Registers an unresolved custom element that is a candidate for
|
||||
@@ -443,48 +184,23 @@ public:
|
||||
void RegisterUnresolvedElement(Element* aElement,
|
||||
nsIAtom* aTypeName = nullptr);
|
||||
|
||||
/**
|
||||
* Unregister an unresolved custom element that is a candidate for
|
||||
* upgrade when a custom element is removed from tree.
|
||||
*/
|
||||
void UnregisterUnresolvedElement(Element* aElement,
|
||||
nsIAtom* aTypeName = nullptr);
|
||||
private:
|
||||
~CustomElementRegistry();
|
||||
void UpgradeCandidates(JSContext* aCx,
|
||||
nsIAtom* aKey,
|
||||
CustomElementDefinition* aDefinition);
|
||||
|
||||
static UniquePtr<CustomElementCallback> CreateCustomElementCallback(
|
||||
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition);
|
||||
|
||||
void UpgradeCandidates(nsIAtom* aKey,
|
||||
CustomElementDefinition* aDefinition,
|
||||
ErrorResult& aRv);
|
||||
|
||||
typedef nsRefPtrHashtable<nsISupportsHashKey, CustomElementDefinition>
|
||||
typedef nsClassHashtable<nsISupportsHashKey, CustomElementDefinition>
|
||||
DefinitionMap;
|
||||
typedef nsClassHashtable<nsISupportsHashKey, nsTArray<nsWeakPtr>>
|
||||
CandidateMap;
|
||||
typedef JS::GCHashMap<JS::Heap<JSObject*>,
|
||||
nsCOMPtr<nsIAtom>,
|
||||
js::MovableCellHasher<JS::Heap<JSObject*>>,
|
||||
js::SystemAllocPolicy> ConstructorMap;
|
||||
|
||||
// Hashtable for custom element definitions in web components.
|
||||
// Custom prototypes are stored in the compartment where
|
||||
// registerElement was called.
|
||||
DefinitionMap mCustomDefinitions;
|
||||
|
||||
// Hashtable for looking up definitions by using constructor as key.
|
||||
// Custom elements' name are stored here and we need to lookup
|
||||
// mCustomDefinitions again to get definitions.
|
||||
ConstructorMap mConstructors;
|
||||
|
||||
typedef nsRefPtrHashtable<nsISupportsHashKey, Promise>
|
||||
WhenDefinedPromiseMap;
|
||||
WhenDefinedPromiseMap mWhenDefinedPromiseMap;
|
||||
|
||||
// The "upgrade candidates map" from the web components spec. Maps from a
|
||||
// namespace id and local name to a list of elements to upgrade if that
|
||||
// element is registered as a custom element.
|
||||
@@ -492,6 +208,14 @@ private:
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> mWindow;
|
||||
|
||||
// Array representing the processing stack in the custom elements
|
||||
// specification. The processing stack is conceptually a stack of
|
||||
// element queues. Each queue is represented by a sequence of
|
||||
// CustomElementData in this array, separated by nullptr that
|
||||
// represent the boundaries of the items in the stack. The first
|
||||
// queue in the stack is the base element queue.
|
||||
static mozilla::Maybe<nsTArray<RefPtr<CustomElementData>>> sProcessingStack;
|
||||
|
||||
// It is used to prevent reentrant invocations of element definition.
|
||||
bool mIsCustomDefinitionRunning;
|
||||
|
||||
@@ -528,31 +252,6 @@ public:
|
||||
already_AddRefed<Promise> WhenDefined(const nsAString& aName, ErrorResult& aRv);
|
||||
};
|
||||
|
||||
class MOZ_RAII AutoCEReaction final {
|
||||
public:
|
||||
// JSContext is allowed to be a nullptr if we are guaranteeing that we're
|
||||
// not doing something that might throw but not finish reporting a JS
|
||||
// exception during the lifetime of the AutoCEReaction.
|
||||
AutoCEReaction(CustomElementReactionsStack* aReactionsStack, JSContext* aCx)
|
||||
: mReactionsStack(aReactionsStack)
|
||||
, mCx(aCx)
|
||||
{
|
||||
mIsElementQueuePushedForPreviousRecursionDepth =
|
||||
mReactionsStack->EnterCEReactions();
|
||||
}
|
||||
|
||||
~AutoCEReaction()
|
||||
{
|
||||
mReactionsStack->LeaveCEReactions(
|
||||
mCx, mIsElementQueuePushedForPreviousRecursionDepth);
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<CustomElementReactionsStack> mReactionsStack;
|
||||
JSContext* mCx;
|
||||
bool mIsElementQueuePushedForPreviousRecursionDepth;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@@ -46,9 +47,6 @@ DocGroup::DocGroup(TabGroup* aTabGroup, const nsACString& aKey)
|
||||
DocGroup::~DocGroup()
|
||||
{
|
||||
MOZ_ASSERT(mDocuments.IsEmpty());
|
||||
if (!NS_IsMainThread()) {
|
||||
NS_ReleaseOnMainThread(mReactionsStack.forget());
|
||||
}
|
||||
mTabGroup->mDocGroups.RemoveEntry(mKey);
|
||||
}
|
||||
|
||||
|
||||
+1
-10
@@ -7,6 +7,7 @@
|
||||
#ifndef DocGroup_h
|
||||
#define DocGroup_h
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIPrincipal.h"
|
||||
@@ -14,7 +15,6 @@
|
||||
#include "nsString.h"
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/CustomElementRegistry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@@ -53,14 +53,6 @@ public:
|
||||
{
|
||||
return mTabGroup;
|
||||
}
|
||||
mozilla::dom::CustomElementReactionsStack* CustomElementReactionsStack()
|
||||
{
|
||||
if (!mReactionsStack) {
|
||||
mReactionsStack = new mozilla::dom::CustomElementReactionsStack();
|
||||
}
|
||||
|
||||
return mReactionsStack;
|
||||
}
|
||||
void RemoveDocument(nsIDocument* aWindow);
|
||||
|
||||
// Iterators for iterating over every document within the DocGroup
|
||||
@@ -80,7 +72,6 @@ private:
|
||||
nsCString mKey;
|
||||
RefPtr<TabGroup> mTabGroup;
|
||||
nsTArray<nsIDocument*> mDocuments;
|
||||
RefPtr<mozilla::dom::CustomElementReactionsStack> mReactionsStack;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
+44
-114
@@ -479,13 +479,9 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
if (data) {
|
||||
// If this is a registered custom element then fix the prototype.
|
||||
nsContentUtils::GetCustomPrototype(OwnerDoc(), NodeInfo()->NamespaceID(),
|
||||
data->GetCustomElementType(), &customProto);
|
||||
data->mType, &customProto);
|
||||
if (customProto &&
|
||||
NodePrincipal()->SubsumesConsideringDomain(nsContentUtils::ObjectPrincipal(customProto))) {
|
||||
// The custom element prototype could be in different compartment.
|
||||
if (!JS_WrapObject(aCx, &customProto)) {
|
||||
return nullptr;
|
||||
}
|
||||
// Just go ahead and create with the right proto up front. Set
|
||||
// customProto to null to flag that we don't need to do any post-facto
|
||||
// proto fixups here.
|
||||
@@ -1599,7 +1595,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
#endif
|
||||
{
|
||||
if (aBindingParent) {
|
||||
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
nsDOMSlots *slots = DOMSlots();
|
||||
|
||||
slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
|
||||
}
|
||||
@@ -1622,7 +1618,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
}
|
||||
ShadowRoot* parentContainingShadow = aParent->GetContainingShadow();
|
||||
if (parentContainingShadow) {
|
||||
ExtendedDOMSlots()->mContainingShadow = parentContainingShadow;
|
||||
DOMSlots()->mContainingShadow = parentContainingShadow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1688,17 +1684,14 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
SetSubtreeRootPointer(aParent->SubtreeRoot());
|
||||
}
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled() && IsInComposedDoc()) {
|
||||
// Connected callback must be enqueued whenever a custom element becomes
|
||||
// connected.
|
||||
CustomElementData* data = GetCustomElementData();
|
||||
if (data) {
|
||||
if (data->mState == CustomElementData::State::eCustom) {
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, this);
|
||||
} else {
|
||||
// Step 7.7.2.2 https://dom.spec.whatwg.org/#concept-node-insert
|
||||
nsContentUtils::TryToUpgradeElement(this);
|
||||
}
|
||||
nsIDocument* composedDoc = GetComposedDoc();
|
||||
if (composedDoc) {
|
||||
// Attached callback must be enqueued whenever custom element is inserted into a
|
||||
// document and this document has a browsing context.
|
||||
if (GetCustomElementData() && composedDoc->GetDocShell()) {
|
||||
// Enqueue an attached callback for the custom element.
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
composedDoc, nsIDocument::eAttached, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1993,21 +1986,12 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
|
||||
document->ClearBoxObjectFor(this);
|
||||
|
||||
// Disconnected must be enqueued whenever a connected custom element becomes
|
||||
// disconnected.
|
||||
if (CustomElementRegistry::IsCustomElementEnabled()) {
|
||||
CustomElementData* data = GetCustomElementData();
|
||||
if (data) {
|
||||
if (data->mState == CustomElementData::State::eCustom) {
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected,
|
||||
this);
|
||||
} else {
|
||||
// Remove an unresolved custom element that is a candidate for
|
||||
// upgrade when a custom element is disconnected.
|
||||
// We will make sure it's shadow-including tree order in bug 1326028.
|
||||
nsContentUtils::UnregisterUnresolvedElement(this);
|
||||
}
|
||||
}
|
||||
// Detached must be enqueued whenever custom element is removed from
|
||||
// the document and this document has a browsing context.
|
||||
if (GetCustomElementData() && document->GetDocShell()) {
|
||||
// Enqueue a detached callback for the custom element.
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
document, nsIDocument::eDetached, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2023,7 +2007,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
}
|
||||
#endif
|
||||
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots* slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
if (clearBindingParent) {
|
||||
slots->mBindingParent = nullptr;
|
||||
@@ -2071,7 +2055,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
nsICSSDeclaration*
|
||||
Element::GetSMILOverrideStyle()
|
||||
{
|
||||
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
Element::nsDOMSlots *slots = DOMSlots();
|
||||
|
||||
if (!slots->mSMILOverrideStyle) {
|
||||
slots->mSMILOverrideStyle = new nsDOMCSSAttributeDeclaration(this, true);
|
||||
@@ -2083,7 +2067,7 @@ Element::GetSMILOverrideStyle()
|
||||
DeclarationBlock*
|
||||
Element::GetSMILOverrideStyleDeclaration()
|
||||
{
|
||||
Element::nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
Element::nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
return slots ? slots->mSMILOverrideStyleDeclaration.get() : nullptr;
|
||||
}
|
||||
|
||||
@@ -2091,7 +2075,7 @@ nsresult
|
||||
Element::SetSMILOverrideStyleDeclaration(DeclarationBlock* aDeclaration,
|
||||
bool aNotify)
|
||||
{
|
||||
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
Element::nsDOMSlots *slots = DOMSlots();
|
||||
|
||||
slots->mSMILOverrideStyleDeclaration = aDeclaration;
|
||||
|
||||
@@ -2602,32 +2586,19 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||
|
||||
UpdateState(aNotify);
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled()) {
|
||||
if (CustomElementData* data = GetCustomElementData()) {
|
||||
if (CustomElementDefinition* definition =
|
||||
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
|
||||
data->GetCustomElementType(),
|
||||
aName)) {
|
||||
MOZ_ASSERT(data->mState == CustomElementData::State::eCustom,
|
||||
"AttributeChanged callback should fire only if "
|
||||
"custom element state is custom");
|
||||
nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom();
|
||||
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc && GetCustomElementData()) {
|
||||
nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom();
|
||||
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
aModType == nsIDOMMutationEvent::ADDITION ?
|
||||
NullString() : nsDependentAtomString(oldValueAtom),
|
||||
nsDependentAtomString(newValueAtom)
|
||||
};
|
||||
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
aModType == nsIDOMMutationEvent::ADDITION ?
|
||||
NullString() : nsDependentAtomString(oldValueAtom),
|
||||
nsDependentAtomString(newValueAtom),
|
||||
(ns.IsEmpty() ? NullString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
}
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
ownerDoc, nsIDocument::eAttributeChanged, this, &args);
|
||||
}
|
||||
|
||||
if (aCallAfterSetAttr) {
|
||||
@@ -2872,30 +2843,17 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
|
||||
UpdateState(aNotify);
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled()) {
|
||||
if (CustomElementData* data = GetCustomElementData()) {
|
||||
if (CustomElementDefinition* definition =
|
||||
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
|
||||
data->GetCustomElementType(),
|
||||
aName)) {
|
||||
MOZ_ASSERT(data->mState == CustomElementData::State::eCustom,
|
||||
"AttributeChanged callback should fire only if "
|
||||
"custom element state is custom");
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (ownerDoc && GetCustomElementData()) {
|
||||
nsCOMPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom();
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
nsDependentAtomString(oldValueAtom),
|
||||
NullString()
|
||||
};
|
||||
|
||||
nsCOMPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom();
|
||||
LifecycleCallbackArgs args = {
|
||||
nsDependentAtomString(aName),
|
||||
nsDependentAtomString(oldValueAtom),
|
||||
NullString(),
|
||||
(ns.IsEmpty() ? NullString() : ns)
|
||||
};
|
||||
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
this, &args, nullptr, definition);
|
||||
}
|
||||
}
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
ownerDoc, nsIDocument::eAttributeChanged, this, &args);
|
||||
}
|
||||
|
||||
if (aNotify) {
|
||||
@@ -4030,7 +3988,7 @@ Element::ClearDataset()
|
||||
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>*
|
||||
Element::RegisteredIntersectionObservers()
|
||||
{
|
||||
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
nsDOMSlots* slots = DOMSlots();
|
||||
return &slots->mRegisteredIntersectionObservers;
|
||||
}
|
||||
|
||||
@@ -4079,31 +4037,3 @@ Element::UpdateIntersectionObservation(DOMIntersectionObserver* aObserver, int32
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Element::SetCustomElementData(CustomElementData* aData)
|
||||
{
|
||||
nsExtendedDOMSlots *slots = ExtendedDOMSlots();
|
||||
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
|
||||
slots->mCustomElementData = aData;
|
||||
}
|
||||
|
||||
CustomElementDefinition*
|
||||
Element::GetCustomElementDefinition() const
|
||||
{
|
||||
CustomElementData* data = GetCustomElementData();
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return data->GetCustomElementDefinition();
|
||||
}
|
||||
|
||||
void
|
||||
Element::SetCustomElementDefinition(CustomElementDefinition* aDefinition)
|
||||
{
|
||||
CustomElementData* data = GetCustomElementData();
|
||||
MOZ_ASSERT(data);
|
||||
|
||||
data->SetCustomElementDefinition(aDefinition);
|
||||
}
|
||||
+1
-40
@@ -390,45 +390,6 @@ public:
|
||||
|
||||
Directionality GetComputedDirectionality() const;
|
||||
|
||||
/**
|
||||
* Gets the custom element data used by web components custom element.
|
||||
* Custom element data is created at the first attempt to enqueue a callback.
|
||||
*
|
||||
* @return The custom element data or null if none.
|
||||
*/
|
||||
inline CustomElementData* GetCustomElementData() const
|
||||
{
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
if (slots) {
|
||||
return slots->mCustomElementData;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the custom element data, ownership of the
|
||||
* callback data is taken by this element.
|
||||
*
|
||||
* @param aData The custom element data.
|
||||
*/
|
||||
void SetCustomElementData(CustomElementData* aData);
|
||||
|
||||
/**
|
||||
* Gets the custom element definition used by web components custom element.
|
||||
*
|
||||
* @return The custom element definition or null if element is not a custom
|
||||
* element or custom element is not defined yet.
|
||||
*/
|
||||
CustomElementDefinition* GetCustomElementDefinition() const;
|
||||
|
||||
/**
|
||||
* Sets the custom element definition, called when custom element is created
|
||||
* or upgraded.
|
||||
*
|
||||
* @param aDefinition The custom element definition.
|
||||
*/
|
||||
void SetCustomElementDefinition(CustomElementDefinition* aDefinition);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Method to get the _intrinsic_ content state of this element. This is the
|
||||
@@ -853,7 +814,7 @@ public:
|
||||
|
||||
ShadowRoot *FastGetShadowRoot() const
|
||||
{
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots* slots = GetExistingDOMSlots();
|
||||
return slots ? slots->mShadowRoot.get() : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -530,7 +530,8 @@ nsNodeSupportsWeakRefTearoff::GetWeakReference(nsIWeakReference** aInstancePtr)
|
||||
//----------------------------------------------------------------------
|
||||
FragmentOrElement::nsDOMSlots::nsDOMSlots()
|
||||
: nsINode::nsSlots(),
|
||||
mDataset(nullptr)
|
||||
mDataset(nullptr),
|
||||
mBindingParent(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -542,104 +543,84 @@ FragmentOrElement::nsDOMSlots::~nsDOMSlots()
|
||||
}
|
||||
|
||||
void
|
||||
FragmentOrElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||
FragmentOrElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL)
|
||||
{
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mStyle");
|
||||
cb.NoteXPCOMChild(mStyle.get());
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mSMILOverrideStyle");
|
||||
cb.NoteXPCOMChild(mSMILOverrideStyle.get());
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mAttributeMap");
|
||||
cb.NoteXPCOMChild(mAttributeMap.get());
|
||||
|
||||
if (aIsXUL) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mControllers");
|
||||
cb.NoteXPCOMChild(mControllers);
|
||||
}
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mXBLBinding");
|
||||
cb.NoteNativeChild(mXBLBinding, NS_CYCLE_COLLECTION_PARTICIPANT(nsXBLBinding));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mXBLInsertionParent");
|
||||
cb.NoteXPCOMChild(mXBLInsertionParent.get());
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mShadowRoot");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mShadowRoot));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mContainingShadow");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mContainingShadow));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mLabelsList");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mLabelsList));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mClassList");
|
||||
cb.NoteXPCOMChild(mClassList.get());
|
||||
|
||||
if (!mExtendedSlots) {
|
||||
return;
|
||||
if (mCustomElementData) {
|
||||
for (uint32_t i = 0; i < mCustomElementData->mCallbackQueue.Length(); i++) {
|
||||
mCustomElementData->mCallbackQueue[i]->Traverse(cb);
|
||||
}
|
||||
}
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mSMILOverrideStyle");
|
||||
cb.NoteXPCOMChild(mExtendedSlots->mSMILOverrideStyle.get());
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mControllers");
|
||||
cb.NoteXPCOMChild(mExtendedSlots->mControllers);
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mLabelsList");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*,mExtendedSlots-> mLabelsList));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mShadowRoot");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mExtendedSlots->mShadowRoot));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mContainingShadow");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mExtendedSlots->mContainingShadow));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mXBLBinding");
|
||||
cb.NoteNativeChild(mExtendedSlots->mXBLBinding,
|
||||
NS_CYCLE_COLLECTION_PARTICIPANT(nsXBLBinding));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mXBLInsertionParent");
|
||||
cb.NoteXPCOMChild(mExtendedSlots->mXBLInsertionParent.get());
|
||||
|
||||
if (mExtendedSlots->mCustomElementData) {
|
||||
mExtendedSlots->mCustomElementData->Traverse(cb);
|
||||
}
|
||||
|
||||
for (auto iter = mExtendedSlots->mRegisteredIntersectionObservers.Iter();
|
||||
!iter.Done(); iter.Next()) {
|
||||
for (auto iter = mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
|
||||
DOMIntersectionObserver* observer = iter.Key();
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
|
||||
"mExtendedSlots->mRegisteredIntersectionObservers[i]");
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mRegisteredIntersectionObservers[i]");
|
||||
cb.NoteXPCOMChild(observer);
|
||||
}
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mFrameLoaderOrOpener");
|
||||
cb.NoteXPCOMChild(mExtendedSlots->mFrameLoaderOrOpener);
|
||||
}
|
||||
|
||||
void
|
||||
FragmentOrElement::nsDOMSlots::Unlink()
|
||||
FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL)
|
||||
{
|
||||
mStyle = nullptr;
|
||||
mSMILOverrideStyle = nullptr;
|
||||
if (mAttributeMap) {
|
||||
mAttributeMap->DropReference();
|
||||
mAttributeMap = nullptr;
|
||||
}
|
||||
if (aIsXUL)
|
||||
NS_IF_RELEASE(mControllers);
|
||||
|
||||
MOZ_ASSERT(!mXBLBinding);
|
||||
|
||||
mXBLInsertionParent = nullptr;
|
||||
mShadowRoot = nullptr;
|
||||
mContainingShadow = nullptr;
|
||||
mChildrenList = nullptr;
|
||||
mLabelsList = nullptr;
|
||||
mCustomElementData = nullptr;
|
||||
mClassList = nullptr;
|
||||
|
||||
if (!mExtendedSlots) {
|
||||
return;
|
||||
}
|
||||
|
||||
mExtendedSlots->mSMILOverrideStyle = nullptr;
|
||||
mExtendedSlots->mControllers = nullptr;
|
||||
mExtendedSlots->mLabelsList = nullptr;
|
||||
mExtendedSlots->mShadowRoot = nullptr;
|
||||
mExtendedSlots->mContainingShadow = nullptr;
|
||||
MOZ_ASSERT(!(mExtendedSlots->mXBLBinding));
|
||||
mExtendedSlots->mXBLInsertionParent = nullptr;
|
||||
if (mExtendedSlots->mCustomElementData) {
|
||||
mExtendedSlots->mCustomElementData->Unlink();
|
||||
mExtendedSlots->mCustomElementData = nullptr;
|
||||
}
|
||||
mExtendedSlots->mRegisteredIntersectionObservers.Clear();
|
||||
nsCOMPtr<nsIFrameLoader> frameLoader =
|
||||
do_QueryInterface(mExtendedSlots->mFrameLoaderOrOpener);
|
||||
if (frameLoader) {
|
||||
static_cast<nsFrameLoader*>(frameLoader.get())->Destroy();
|
||||
}
|
||||
mExtendedSlots->mFrameLoaderOrOpener = nullptr;
|
||||
mRegisteredIntersectionObservers.Clear();
|
||||
}
|
||||
|
||||
size_t
|
||||
FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
if (mExtendedSlots) {
|
||||
n += aMallocSizeOf(mExtendedSlots.get());
|
||||
}
|
||||
|
||||
if (mAttributeMap) {
|
||||
n += mAttributeMap->SizeOfIncludingThis(aMallocSizeOf);
|
||||
@@ -660,19 +641,6 @@ FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) c
|
||||
return n;
|
||||
}
|
||||
|
||||
FragmentOrElement::nsExtendedDOMSlots::nsExtendedDOMSlots()
|
||||
: mBindingParent(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
FragmentOrElement::nsExtendedDOMSlots::~nsExtendedDOMSlots()
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoader> frameLoader = do_QueryInterface(mFrameLoaderOrOpener);
|
||||
if (frameLoader) {
|
||||
static_cast<nsFrameLoader*>(frameLoader.get())->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
FragmentOrElement::FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsIContent(aNodeInfo)
|
||||
{
|
||||
@@ -994,7 +962,7 @@ FragmentOrElement::IsLink(nsIURI** aURI) const
|
||||
nsIContent*
|
||||
FragmentOrElement::GetBindingParent() const
|
||||
{
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
|
||||
if (slots) {
|
||||
return slots->mBindingParent;
|
||||
@@ -1006,7 +974,7 @@ nsXBLBinding*
|
||||
FragmentOrElement::GetXBLBinding() const
|
||||
{
|
||||
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
return slots->mXBLBinding;
|
||||
}
|
||||
@@ -1041,11 +1009,11 @@ FragmentOrElement::SetXBLBinding(nsXBLBinding* aBinding,
|
||||
|
||||
if (aBinding) {
|
||||
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
|
||||
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
nsDOMSlots *slots = DOMSlots();
|
||||
slots->mXBLBinding = aBinding;
|
||||
bindingManager->AddBoundContent(this);
|
||||
} else {
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
slots->mXBLBinding = nullptr;
|
||||
}
|
||||
@@ -1060,7 +1028,7 @@ nsIContent*
|
||||
FragmentOrElement::GetXBLInsertionParent() const
|
||||
{
|
||||
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
return slots->mXBLInsertionParent;
|
||||
}
|
||||
@@ -1072,7 +1040,7 @@ FragmentOrElement::GetXBLInsertionParent() const
|
||||
ShadowRoot*
|
||||
FragmentOrElement::GetContainingShadow() const
|
||||
{
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
return slots->mContainingShadow;
|
||||
}
|
||||
@@ -1082,21 +1050,21 @@ FragmentOrElement::GetContainingShadow() const
|
||||
void
|
||||
FragmentOrElement::SetShadowRoot(ShadowRoot* aShadowRoot)
|
||||
{
|
||||
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
nsDOMSlots *slots = DOMSlots();
|
||||
slots->mShadowRoot = aShadowRoot;
|
||||
}
|
||||
|
||||
nsTArray<nsIContent*>&
|
||||
FragmentOrElement::DestInsertionPoints()
|
||||
{
|
||||
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
nsDOMSlots *slots = DOMSlots();
|
||||
return slots->mDestInsertionPoints;
|
||||
}
|
||||
|
||||
nsTArray<nsIContent*>*
|
||||
FragmentOrElement::GetExistingDestInsertionPoints() const
|
||||
{
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
return &slots->mDestInsertionPoints;
|
||||
}
|
||||
@@ -1107,17 +1075,35 @@ void
|
||||
FragmentOrElement::SetXBLInsertionParent(nsIContent* aContent)
|
||||
{
|
||||
if (aContent) {
|
||||
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
|
||||
nsDOMSlots *slots = DOMSlots();
|
||||
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
|
||||
slots->mXBLInsertionParent = aContent;
|
||||
} else {
|
||||
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
slots->mXBLInsertionParent = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomElementData*
|
||||
FragmentOrElement::GetCustomElementData() const
|
||||
{
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
return slots->mCustomElementData;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
FragmentOrElement::SetCustomElementData(CustomElementData* aData)
|
||||
{
|
||||
nsDOMSlots *slots = DOMSlots();
|
||||
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
|
||||
slots->mCustomElementData = aData;
|
||||
}
|
||||
|
||||
nsresult
|
||||
FragmentOrElement::InsertChildAt(nsIContent* aKid,
|
||||
uint32_t aIndex,
|
||||
@@ -1380,15 +1366,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
|
||||
{
|
||||
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
if (slots->mExtendedSlots && tmp->IsElement()) {
|
||||
if (tmp->IsElement()) {
|
||||
Element* elem = tmp->AsElement();
|
||||
for (auto iter = slots->mExtendedSlots->mRegisteredIntersectionObservers.Iter();
|
||||
!iter.Done(); iter.Next()) {
|
||||
for (auto iter = slots->mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
|
||||
DOMIntersectionObserver* observer = iter.Key();
|
||||
observer->UnlinkTarget(*elem);
|
||||
}
|
||||
}
|
||||
slots->Unlink();
|
||||
slots->Unlink(tmp->IsXULElement());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1953,7 +1938,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
|
||||
{
|
||||
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
slots->Traverse(cb);
|
||||
slots->Traverse(cb, tmp->IsXULElement());
|
||||
}
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsAttrAndChildArray.h" // member
|
||||
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
|
||||
#include "nsIContent.h" // base class
|
||||
@@ -38,7 +37,6 @@ class nsIURI;
|
||||
namespace mozilla {
|
||||
class DeclarationBlock;
|
||||
namespace dom {
|
||||
struct CustomElementData;
|
||||
class DOMIntersectionObserver;
|
||||
class Element;
|
||||
} // namespace dom
|
||||
@@ -161,6 +159,9 @@ public:
|
||||
virtual void SetXBLInsertionParent(nsIContent* aContent) override;
|
||||
virtual bool IsLink(nsIURI** aURI) const override;
|
||||
|
||||
virtual CustomElementData *GetCustomElementData() const override;
|
||||
virtual void SetCustomElementData(CustomElementData* aData) override;
|
||||
|
||||
virtual void DestroyContent() override;
|
||||
virtual void SaveSubtreeState() override;
|
||||
|
||||
@@ -240,6 +241,8 @@ protected:
|
||||
nsresult CopyInnerTo(FragmentOrElement* aDest);
|
||||
|
||||
public:
|
||||
// Because of a bug in MS C++ compiler nsDOMSlots must be declared public,
|
||||
// otherwise nsXULElement::nsXULSlots doesn't compile.
|
||||
/**
|
||||
* There are a set of DOM- and scripting-specific instance variables
|
||||
* that may only be instantiated when a content object is accessed
|
||||
@@ -248,13 +251,29 @@ public:
|
||||
* in a side structure that's only allocated when the content is
|
||||
* accessed through the DOM.
|
||||
*/
|
||||
|
||||
class nsExtendedDOMSlots
|
||||
class nsDOMSlots : public nsINode::nsSlots
|
||||
{
|
||||
public:
|
||||
nsExtendedDOMSlots();
|
||||
nsDOMSlots();
|
||||
virtual ~nsDOMSlots();
|
||||
|
||||
~nsExtendedDOMSlots();
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL);
|
||||
void Unlink(bool aIsXUL);
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
/**
|
||||
* The .style attribute (an interface that forwards to the actual
|
||||
* style rules)
|
||||
* @see nsGenericHTMLElement::GetStyle
|
||||
*/
|
||||
nsCOMPtr<nsICSSDeclaration> mStyle;
|
||||
|
||||
/**
|
||||
* The .dataset attribute.
|
||||
* @see nsGenericHTMLElement::GetDataset
|
||||
*/
|
||||
nsDOMStringMap* mDataset; // [Weak]
|
||||
|
||||
/**
|
||||
* SMIL Overridde style rules (for SMIL animation of CSS properties)
|
||||
@@ -268,17 +287,35 @@ public:
|
||||
RefPtr<mozilla::DeclarationBlock> mSMILOverrideStyleDeclaration;
|
||||
|
||||
/**
|
||||
* The nearest enclosing content node with a binding that created us.
|
||||
* @see FragmentOrElement::GetBindingParent
|
||||
*/
|
||||
nsIContent* mBindingParent; // [Weak]
|
||||
* An object implementing nsIDOMMozNamedAttrMap for this content (attributes)
|
||||
* @see FragmentOrElement::GetAttributes
|
||||
*/
|
||||
RefPtr<nsDOMAttributeMap> mAttributeMap;
|
||||
|
||||
union {
|
||||
/**
|
||||
* The nearest enclosing content node with a binding that created us.
|
||||
* @see FragmentOrElement::GetBindingParent
|
||||
*/
|
||||
nsIContent* mBindingParent; // [Weak]
|
||||
|
||||
/**
|
||||
* The controllers of the XUL Element.
|
||||
*/
|
||||
nsIControllers* mControllers; // [OWNER]
|
||||
};
|
||||
|
||||
/**
|
||||
* The controllers of the XUL Element.
|
||||
*/
|
||||
nsCOMPtr<nsIControllers> mControllers;
|
||||
* An object implementing the .children property for this element.
|
||||
*/
|
||||
RefPtr<nsContentList> mChildrenList;
|
||||
|
||||
/**
|
||||
* An object implementing the .classList property for this element.
|
||||
*/
|
||||
RefPtr<nsDOMTokenList> mClassList;
|
||||
|
||||
/*
|
||||
* An object implementing the .labels property for this element.
|
||||
*/
|
||||
RefPtr<nsLabelsNodeList> mLabelsList;
|
||||
@@ -319,55 +356,6 @@ public:
|
||||
*/
|
||||
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>
|
||||
mRegisteredIntersectionObservers;
|
||||
|
||||
/**
|
||||
* For XUL to hold either frameloader or opener.
|
||||
*/
|
||||
nsCOMPtr<nsISupports> mFrameLoaderOrOpener;
|
||||
|
||||
};
|
||||
|
||||
class nsDOMSlots : public nsINode::nsSlots
|
||||
{
|
||||
public:
|
||||
nsDOMSlots();
|
||||
virtual ~nsDOMSlots();
|
||||
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
||||
void Unlink();
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
/**
|
||||
* The .style attribute (an interface that forwards to the actual
|
||||
* style rules)
|
||||
* @see nsGenericHTMLElement::GetStyle
|
||||
*/
|
||||
nsCOMPtr<nsICSSDeclaration> mStyle;
|
||||
|
||||
/**
|
||||
* The .dataset attribute.
|
||||
* @see nsGenericHTMLElement::GetDataset
|
||||
*/
|
||||
nsDOMStringMap* mDataset; // [Weak]
|
||||
|
||||
/**
|
||||
* An object implementing nsIDOMMozNamedAttrMap for this content (attributes)
|
||||
* @see FragmentOrElement::GetAttributes
|
||||
*/
|
||||
RefPtr<nsDOMAttributeMap> mAttributeMap;
|
||||
|
||||
/**
|
||||
* An object implementing the .children property for this element.
|
||||
*/
|
||||
RefPtr<nsContentList> mChildrenList;
|
||||
|
||||
/**
|
||||
* An object implementing the .classList property for this element.
|
||||
*/
|
||||
RefPtr<nsDOMTokenList> mClassList;
|
||||
|
||||
mozilla::UniquePtr<nsExtendedDOMSlots> mExtendedSlots;
|
||||
};
|
||||
|
||||
protected:
|
||||
@@ -387,26 +375,6 @@ protected:
|
||||
return static_cast<nsDOMSlots*>(GetExistingSlots());
|
||||
}
|
||||
|
||||
nsExtendedDOMSlots* ExtendedDOMSlots()
|
||||
{
|
||||
nsDOMSlots* slots = DOMSlots();
|
||||
if (!slots->mExtendedSlots) {
|
||||
slots->mExtendedSlots = MakeUnique<nsExtendedDOMSlots>();
|
||||
}
|
||||
|
||||
return slots->mExtendedSlots.get();
|
||||
}
|
||||
|
||||
nsExtendedDOMSlots* GetExistingExtendedDOMSlots() const
|
||||
{
|
||||
nsDOMSlots* slots = GetExistingDOMSlots();
|
||||
if (slots) {
|
||||
return slots->mExtendedSlots.get();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls SetIsElementInStyleScopeFlagOnSubtree for each shadow tree attached
|
||||
* to this node, which is assumed to be an Element.
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#ifndef GroupedSHistory_h
|
||||
#define GroupedSHistory_h
|
||||
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsIGroupedSHistory.h"
|
||||
#include "nsIPartialSHistory.h"
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* animating */
|
||||
|
||||
#include "ImageTracker.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsAppRunner.h" // for XRE_IsContentProcess
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef mozilla_dom_ImageTracker
|
||||
#define mozilla_dom_ImageTracker
|
||||
|
||||
#include "imgIRequest.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#ifndef mozilla_dom_MutableBlobStorage_h
|
||||
#define mozilla_dom_MutableBlobStorage_h
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "prio.h"
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "MutableBlobStreamListener.h"
|
||||
#include "MutableBlobStorage.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define mozilla_dom_Pose_h
|
||||
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@@ -75,8 +75,8 @@ ShadowRoot::ShadowRoot(nsIContent* aContent,
|
||||
|
||||
SetFlags(NODE_IS_IN_SHADOW_TREE);
|
||||
|
||||
ExtendedDOMSlots()->mBindingParent = aContent;
|
||||
ExtendedDOMSlots()->mContainingShadow = this;
|
||||
DOMSlots()->mBindingParent = aContent;
|
||||
DOMSlots()->mContainingShadow = this;
|
||||
|
||||
// Add the ShadowRoot as a mutation observer on the host to watch
|
||||
// for mutations because the insertion points in this ShadowRoot
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
#ifndef TabGroup_h
|
||||
#define TabGroup_h
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "TimeoutHandler.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
#ifndef mozilla_dom_timeout_handler_h
|
||||
#define mozilla_dom_timeout_handler_h
|
||||
|
||||
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsITimeoutHandler.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#ifndef TimerClamping_h___
|
||||
#define TimerClamping_h___
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class TimerClamping
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
var o1 = document.documentElement;
|
||||
var o2 = document.createElement("frame");
|
||||
document.documentElement.appendChild(o2);
|
||||
var o3 = o2.contentWindow;
|
||||
o1.parentNode.removeChild(o1);
|
||||
o3.customElements;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -209,4 +209,3 @@ load 1230422.html
|
||||
load 1251361.html
|
||||
load 1304437.html
|
||||
pref(clipboard.autocopy,true) load 1385272-1.html
|
||||
pref(dom.webcomponents.customelements.enabled,true) load 1341693.html
|
||||
+2
-2
@@ -225,7 +225,7 @@ EXPORTS.mozilla.dom += [
|
||||
'WindowOrientationObserver.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
SOURCES += [
|
||||
'AnonymousContent.cpp',
|
||||
'Attr.cpp',
|
||||
'BarProps.cpp',
|
||||
@@ -376,7 +376,7 @@ UNIFIED_SOURCES += [
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WEBRTC']:
|
||||
UNIFIED_SOURCES += [
|
||||
SOURCES += [
|
||||
'nsDOMDataChannel.cpp',
|
||||
]
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
class NodeInfo;
|
||||
struct CustomElementDefinition;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -42,8 +41,7 @@ nsresult
|
||||
NS_NewHTMLElement(mozilla::dom::Element** aResult,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser,
|
||||
const nsAString* aIs = nullptr,
|
||||
mozilla::dom::CustomElementDefinition* aDefinition = nullptr);
|
||||
const nsAString* aIs = nullptr);
|
||||
|
||||
// First argument should be nsHTMLTag, but that adds dependency to parser
|
||||
// for a bunch of files.
|
||||
|
||||
+87
-103
@@ -227,7 +227,6 @@ extern "C" int MOZ_XMLCheckQName(const char* ptr, const char* end,
|
||||
int ns_aware, const char** colon);
|
||||
|
||||
class imgLoader;
|
||||
class nsIAtom;
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
@@ -259,6 +258,7 @@ nsIWordBreaker *nsContentUtils::sWordBreaker;
|
||||
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nullptr;
|
||||
uint32_t nsContentUtils::sScriptBlockerCount = 0;
|
||||
uint32_t nsContentUtils::sDOMNodeRemovedSuppressCount = 0;
|
||||
uint32_t nsContentUtils::sMicroTaskLevel = 0;
|
||||
AutoTArray<nsCOMPtr<nsIRunnable>, 8>* nsContentUtils::sBlockedScriptRunners = nullptr;
|
||||
uint32_t nsContentUtils::sRunnersCountAtFirstBlocker = 0;
|
||||
nsIInterfaceRequestor* nsContentUtils::sSameOriginChecker = nullptr;
|
||||
@@ -284,8 +284,6 @@ bool nsContentUtils::sIsResourceTimingEnabled = false;
|
||||
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
|
||||
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
|
||||
bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false;
|
||||
bool nsContentUtils::sIsWebComponentsEnabled = false;
|
||||
bool nsContentUtils::sIsCustomElementsEnabled = false;
|
||||
bool nsContentUtils::sEncodeDecodeURLHash = false;
|
||||
bool nsContentUtils::sGettersDecodeURLHash = false;
|
||||
bool nsContentUtils::sPrivacyResistFingerprinting = false;
|
||||
@@ -586,12 +584,6 @@ nsContentUtils::Init()
|
||||
Preferences::AddBoolVarCache(&sIsExperimentalAutocompleteEnabled,
|
||||
"dom.forms.autocomplete.experimental", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsWebComponentsEnabled,
|
||||
"dom.webcomponents.enabled", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
|
||||
"dom.webcomponents.customelements.enabled", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sEncodeDecodeURLHash,
|
||||
"dom.url.encode_decode_hash", false);
|
||||
|
||||
@@ -5302,6 +5294,51 @@ nsContentUtils::RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable)
|
||||
CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable));
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::EnterMicroTask()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
++sMicroTaskLevel;
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::LeaveMicroTask()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (--sMicroTaskLevel == 0) {
|
||||
PerformMainThreadMicroTaskCheckpoint();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::IsInMicroTask()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return sMicroTaskLevel != 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsContentUtils::MicroTaskLevel()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return sMicroTaskLevel;
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::SetMicroTaskLevel(uint32_t aLevel)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
sMicroTaskLevel = aLevel;
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::PerformMainThreadMicroTaskCheckpoint()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsDOMMutationObserver::HandleMutations();
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function for nsContentUtils::ProcessViewportInfo.
|
||||
*
|
||||
@@ -9531,34 +9568,11 @@ nsContentUtils::HttpsStateIsModern(nsIDocument* aDocument)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsContentUtils::TryToUpgradeElement(Element* aElement)
|
||||
{
|
||||
NodeInfo* nodeInfo = aElement->NodeInfo();
|
||||
RefPtr<nsIAtom> typeAtom =
|
||||
aElement->GetCustomElementData()->GetCustomElementType();
|
||||
|
||||
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
|
||||
CustomElementDefinition* definition =
|
||||
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
|
||||
nodeInfo->NameAtom(),
|
||||
nodeInfo->NamespaceID(),
|
||||
typeAtom);
|
||||
if (definition) {
|
||||
nsContentUtils::EnqueueUpgradeReaction(aElement, definition);
|
||||
} else {
|
||||
// Add an unresolved custom element that is a candidate for
|
||||
// upgrade when a custom element is connected to the document.
|
||||
// We will make sure it's shadow-including tree order in bug 1326028.
|
||||
nsContentUtils::RegisterUnresolvedElement(aElement, typeAtom);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ CustomElementDefinition*
|
||||
nsContentUtils::LookupCustomElementDefinition(nsIDocument* aDoc,
|
||||
nsIAtom* aNameAtom,
|
||||
const nsAString& aLocalName,
|
||||
uint32_t aNameSpaceID,
|
||||
nsIAtom* aTypeAtom)
|
||||
const nsAString* aIs)
|
||||
{
|
||||
MOZ_ASSERT(aDoc);
|
||||
|
||||
@@ -9580,16 +9594,30 @@ nsContentUtils::LookupCustomElementDefinition(nsIDocument* aDoc,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return registry->LookupCustomElementDefinition(aNameAtom, aTypeAtom);
|
||||
return registry->LookupCustomElementDefinition(aLocalName, aIs);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsContentUtils::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName)
|
||||
nsContentUtils::SetupCustomElement(Element* aElement,
|
||||
const nsAString* aTypeExtension)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
nsIDocument* doc = aElement->OwnerDoc();
|
||||
nsPIDOMWindowInner* window(doc->GetInnerWindow());
|
||||
nsCOMPtr<nsIDocument> doc = aElement->OwnerDoc();
|
||||
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
// To support imported document.
|
||||
doc = doc->MasterDocument();
|
||||
|
||||
if (aElement->GetNameSpaceID() != kNameSpaceID_XHTML ||
|
||||
!doc->GetDocShell()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> window(doc->GetInnerWindow());
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
@@ -9599,80 +9627,36 @@ nsContentUtils::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName)
|
||||
return;
|
||||
}
|
||||
|
||||
registry->RegisterUnresolvedElement(aElement, aTypeName);
|
||||
return registry->SetupCustomElement(aElement, aTypeExtension);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsContentUtils::UnregisterUnresolvedElement(Element* aElement)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
RefPtr<nsIAtom> typeAtom =
|
||||
aElement->GetCustomElementData()->GetCustomElementType();
|
||||
nsIDocument* doc = aElement->OwnerDoc();
|
||||
nsPIDOMWindowInner* window(doc->GetInnerWindow());
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<CustomElementRegistry> registry(window->CustomElements());
|
||||
if (!registry) {
|
||||
return;
|
||||
}
|
||||
|
||||
registry->UnregisterUnresolvedElement(aElement, typeAtom);
|
||||
}
|
||||
|
||||
/* static */ CustomElementDefinition*
|
||||
nsContentUtils::GetElementDefinitionIfObservingAttr(Element* aCustomElement,
|
||||
nsIAtom* aExtensionType,
|
||||
nsIAtom* aAttrName)
|
||||
{
|
||||
CustomElementDefinition* definition =
|
||||
aCustomElement->GetCustomElementDefinition();
|
||||
|
||||
// Custom element not defined yet or attribute is not in the observed
|
||||
// attribute list.
|
||||
if (!definition || !definition->IsInObservedAttributeList(aAttrName)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsContentUtils::EnqueueUpgradeReaction(Element* aElement,
|
||||
CustomElementDefinition* aDefinition)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
nsIDocument* doc = aElement->OwnerDoc();
|
||||
|
||||
// No DocGroup means no custom element reactions stack.
|
||||
if (!doc->GetDocGroup()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CustomElementReactionsStack* stack =
|
||||
doc->GetDocGroup()->CustomElementReactionsStack();
|
||||
stack->EnqueueUpgradeReaction(aElement, aDefinition);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument* aDoc,
|
||||
nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
|
||||
CustomElementDefinition* aDefinition)
|
||||
{
|
||||
// No DocGroup means no custom element reactions stack.
|
||||
if (!aCustomElement->OwnerDoc()->GetDocGroup()) {
|
||||
MOZ_ASSERT(aDoc);
|
||||
|
||||
// To support imported document.
|
||||
nsCOMPtr<nsIDocument> doc = aDoc->MasterDocument();
|
||||
|
||||
if (!doc->GetDocShell()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CustomElementRegistry::EnqueueLifecycleCallback(aType, aCustomElement, aArgs,
|
||||
aAdoptedCallbackArgs,
|
||||
aDefinition);
|
||||
nsCOMPtr<nsPIDOMWindowInner> window(doc->GetInnerWindow());
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<CustomElementRegistry> registry(window->CustomElements());
|
||||
if (!registry) {
|
||||
return;
|
||||
}
|
||||
|
||||
registry->EnqueueLifecycleCallback(aType, aCustomElement, aArgs, aDefinition);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
@@ -9851,4 +9835,4 @@ nsContentUtils::IsLocalRefURL(const nsString& aString)
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+31
-29
@@ -126,7 +126,6 @@ class EventTarget;
|
||||
class IPCDataTransfer;
|
||||
class IPCDataTransferItem;
|
||||
struct LifecycleCallbackArgs;
|
||||
struct LifecycleAdoptedCallbackArgs;
|
||||
class NodeInfo;
|
||||
class nsIContentChild;
|
||||
class nsIContentParent;
|
||||
@@ -1742,6 +1741,17 @@ public:
|
||||
*/
|
||||
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
|
||||
|
||||
// Call EnterMicroTask when you're entering JS execution.
|
||||
// Usually the best way to do this is to use nsAutoMicroTask.
|
||||
static void EnterMicroTask();
|
||||
static void LeaveMicroTask();
|
||||
|
||||
static bool IsInMicroTask();
|
||||
static uint32_t MicroTaskLevel();
|
||||
static void SetMicroTaskLevel(uint32_t aLevel);
|
||||
|
||||
static void PerformMainThreadMicroTaskCheckpoint();
|
||||
|
||||
/* Process viewport META data. This gives us information for the scale
|
||||
* and zoom of a page on mobile devices. We stick the information in
|
||||
* the document header and use it later on after rendering.
|
||||
@@ -2702,37 +2712,23 @@ public:
|
||||
*/
|
||||
static bool HttpsStateIsModern(nsIDocument* aDocument);
|
||||
|
||||
/**
|
||||
* Try to upgrade an element.
|
||||
* https://html.spec.whatwg.org/multipage/custom-elements.html#concept-try-upgrade
|
||||
*/
|
||||
static void TryToUpgradeElement(Element* aElement);
|
||||
|
||||
/**
|
||||
* Looking up a custom element definition.
|
||||
* https://html.spec.whatwg.org/#look-up-a-custom-element-definition
|
||||
*/
|
||||
static mozilla::dom::CustomElementDefinition*
|
||||
LookupCustomElementDefinition(nsIDocument* aDoc,
|
||||
nsIAtom* aNameAtom,
|
||||
const nsAString& aLocalName,
|
||||
uint32_t aNameSpaceID,
|
||||
nsIAtom* aTypeAtom);
|
||||
const nsAString* aIs = nullptr);
|
||||
|
||||
static void RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName);
|
||||
static void UnregisterUnresolvedElement(Element* aElement);
|
||||
static void SetupCustomElement(Element* aElement,
|
||||
const nsAString* aTypeExtension = nullptr);
|
||||
|
||||
static mozilla::dom::CustomElementDefinition*
|
||||
GetElementDefinitionIfObservingAttr(Element* aCustomElement,
|
||||
nsIAtom* aExtensionType,
|
||||
nsIAtom* aAttrName);
|
||||
|
||||
static void EnqueueUpgradeReaction(Element* aElement,
|
||||
mozilla::dom::CustomElementDefinition* aDefinition);
|
||||
|
||||
static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
static void EnqueueLifecycleCallback(nsIDocument* aDoc,
|
||||
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,
|
||||
@@ -2749,12 +2745,6 @@ public:
|
||||
static bool
|
||||
IsLocalRefURL(const nsString& aString);
|
||||
|
||||
static bool
|
||||
IsWebComponentsEnabled() { return sIsWebComponentsEnabled; }
|
||||
|
||||
static bool
|
||||
IsCustomElementsEnabled() { return sIsCustomElementsEnabled; }
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
@@ -2841,6 +2831,7 @@ private:
|
||||
static bool sInitialized;
|
||||
static uint32_t sScriptBlockerCount;
|
||||
static uint32_t sDOMNodeRemovedSuppressCount;
|
||||
static uint32_t sMicroTaskLevel;
|
||||
// Not an nsCOMArray because removing elements from those is slower
|
||||
static AutoTArray<nsCOMPtr<nsIRunnable>, 8>* sBlockedScriptRunners;
|
||||
static uint32_t sRunnersCountAtFirstBlocker;
|
||||
@@ -2861,8 +2852,6 @@ private:
|
||||
static bool sIsUserTimingLoggingEnabled;
|
||||
static bool sIsFrameTimingPrefEnabled;
|
||||
static bool sIsExperimentalAutocompleteEnabled;
|
||||
static bool sIsWebComponentsEnabled;
|
||||
static bool sIsCustomElementsEnabled;
|
||||
static bool sEncodeDecodeURLHash;
|
||||
static bool sGettersDecodeURLHash;
|
||||
static bool sPrivacyResistFingerprinting;
|
||||
@@ -2918,6 +2907,19 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class MOZ_STACK_CLASS nsAutoMicroTask
|
||||
{
|
||||
public:
|
||||
nsAutoMicroTask()
|
||||
{
|
||||
nsContentUtils::EnterMicroTask();
|
||||
}
|
||||
~nsAutoMicroTask()
|
||||
{
|
||||
nsContentUtils::LeaveMicroTask();
|
||||
}
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "nsDOMMutationObserver.h"
|
||||
|
||||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/OwningNonNull.h"
|
||||
|
||||
@@ -29,9 +30,14 @@ using mozilla::dom::TreeOrderComparator;
|
||||
using mozilla::dom::Animation;
|
||||
using mozilla::dom::Element;
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
AutoTArray<RefPtr<nsDOMMutationObserver>, 4>*
|
||||
nsDOMMutationObserver::sScheduledMutationObservers = nullptr;
|
||||
|
||||
nsDOMMutationObserver* nsDOMMutationObserver::sCurrentObserver = nullptr;
|
||||
|
||||
uint32_t nsDOMMutationObserver::sMutationLevel = 0;
|
||||
uint64_t nsDOMMutationObserver::sCount = 0;
|
||||
|
||||
@@ -595,32 +601,10 @@ nsDOMMutationObserver::ScheduleForRun()
|
||||
RescheduleForRun();
|
||||
}
|
||||
|
||||
class MutationObserverMicroTask final : public MicroTaskRunnable
|
||||
{
|
||||
public:
|
||||
virtual void Run(AutoSlowOperation& aAso) override
|
||||
{
|
||||
nsDOMMutationObserver::HandleMutations(aAso);
|
||||
}
|
||||
|
||||
virtual bool Suppressed() override
|
||||
{
|
||||
return nsDOMMutationObserver::AllScheduledMutationObserversAreSuppressed();
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
nsDOMMutationObserver::RescheduleForRun()
|
||||
{
|
||||
if (!sScheduledMutationObservers) {
|
||||
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||
if (!ccjs) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<MutationObserverMicroTask> momt =
|
||||
new MutationObserverMicroTask();
|
||||
ccjs->DispatchMicroTaskRunnable(momt.forget());
|
||||
sScheduledMutationObservers = new AutoTArray<RefPtr<nsDOMMutationObserver>, 4>;
|
||||
}
|
||||
|
||||
@@ -882,9 +866,36 @@ nsDOMMutationObserver::HandleMutation()
|
||||
mCallback->Call(this, mutations, *this);
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMMutationObserver::HandleMutationsInternal(AutoSlowOperation& aAso)
|
||||
class AsyncMutationHandler : public mozilla::Runnable
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
nsDOMMutationObserver::HandleMutations();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
nsDOMMutationObserver::HandleMutationsInternal()
|
||||
{
|
||||
if (!nsContentUtils::IsSafeToRunScript()) {
|
||||
nsContentUtils::AddScriptRunner(new AsyncMutationHandler());
|
||||
return;
|
||||
}
|
||||
static RefPtr<nsDOMMutationObserver> sCurrentObserver;
|
||||
if (sCurrentObserver && !sCurrentObserver->Suppressed()) {
|
||||
// In normal cases sScheduledMutationObservers will be handled
|
||||
// after previous mutations are handled. But in case some
|
||||
// callback calls a sync API, which spins the eventloop, we need to still
|
||||
// process other mutations happening during that sync call.
|
||||
// This does *not* catch all cases, but should work for stuff running
|
||||
// in separate tabs.
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::AutoSlowOperation aso;
|
||||
|
||||
nsTArray<RefPtr<nsDOMMutationObserver> >* suppressedObservers = nullptr;
|
||||
|
||||
while (sScheduledMutationObservers) {
|
||||
@@ -892,21 +903,20 @@ nsDOMMutationObserver::HandleMutationsInternal(AutoSlowOperation& aAso)
|
||||
sScheduledMutationObservers;
|
||||
sScheduledMutationObservers = nullptr;
|
||||
for (uint32_t i = 0; i < observers->Length(); ++i) {
|
||||
RefPtr<nsDOMMutationObserver> currentObserver =
|
||||
static_cast<nsDOMMutationObserver*>((*observers)[i]);
|
||||
if (!currentObserver->Suppressed()) {
|
||||
currentObserver->HandleMutation();
|
||||
sCurrentObserver = static_cast<nsDOMMutationObserver*>((*observers)[i]);
|
||||
if (!sCurrentObserver->Suppressed()) {
|
||||
sCurrentObserver->HandleMutation();
|
||||
} else {
|
||||
if (!suppressedObservers) {
|
||||
suppressedObservers = new nsTArray<RefPtr<nsDOMMutationObserver> >;
|
||||
}
|
||||
if (!suppressedObservers->Contains(currentObserver)) {
|
||||
suppressedObservers->AppendElement(currentObserver);
|
||||
if (!suppressedObservers->Contains(sCurrentObserver)) {
|
||||
suppressedObservers->AppendElement(sCurrentObserver);
|
||||
}
|
||||
}
|
||||
}
|
||||
delete observers;
|
||||
aAso.CheckForInterrupt();
|
||||
aso.CheckForInterrupt();
|
||||
}
|
||||
|
||||
if (suppressedObservers) {
|
||||
@@ -917,6 +927,7 @@ nsDOMMutationObserver::HandleMutationsInternal(AutoSlowOperation& aAso)
|
||||
delete suppressedObservers;
|
||||
suppressedObservers = nullptr;
|
||||
}
|
||||
sCurrentObserver = nullptr;
|
||||
}
|
||||
|
||||
nsDOMMutationRecord*
|
||||
|
||||
@@ -552,29 +552,13 @@ public:
|
||||
}
|
||||
|
||||
// static methods
|
||||
static void HandleMutations(mozilla::AutoSlowOperation& aAso)
|
||||
static void HandleMutations()
|
||||
{
|
||||
if (sScheduledMutationObservers) {
|
||||
HandleMutationsInternal(aAso);
|
||||
HandleMutationsInternal();
|
||||
}
|
||||
}
|
||||
|
||||
static bool AllScheduledMutationObserversAreSuppressed()
|
||||
{
|
||||
if (sScheduledMutationObservers) {
|
||||
uint32_t len = sScheduledMutationObservers->Length();
|
||||
if (len > 0) {
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
if (!(*sScheduledMutationObservers)[i]->Suppressed()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void EnterMutationHandling();
|
||||
static void LeaveMutationHandling();
|
||||
|
||||
@@ -610,7 +594,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
static void HandleMutationsInternal(mozilla::AutoSlowOperation& aAso);
|
||||
static void HandleMutationsInternal();
|
||||
|
||||
static void AddCurrentlyHandlingObserver(nsDOMMutationObserver* aObserver,
|
||||
uint32_t aMutationLevel);
|
||||
@@ -638,6 +622,7 @@ protected:
|
||||
|
||||
static uint64_t sCount;
|
||||
static AutoTArray<RefPtr<nsDOMMutationObserver>, 4>* sScheduledMutationObservers;
|
||||
static nsDOMMutationObserver* sCurrentObserver;
|
||||
|
||||
static uint32_t sMutationLevel;
|
||||
static AutoTArray<AutoTArray<RefPtr<nsDOMMutationObserver>, 4>, 4>*
|
||||
|
||||
@@ -3577,7 +3577,8 @@ nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
|
||||
while (node) {
|
||||
if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
|
||||
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(node);
|
||||
if (fc && fc->IsDisabledForEvents(eVoidEvent)) {
|
||||
WidgetEvent event(true, eVoidEvent);
|
||||
if (fc && fc->IsDisabledForEvents(&event)) {
|
||||
*aRetVal = true;
|
||||
break;
|
||||
}
|
||||
|
||||
+56
-123
@@ -1328,8 +1328,7 @@ nsIDocument::nsIDocument()
|
||||
mFrameRequestCallbacksScheduled(false),
|
||||
mBidiOptions(IBMBIDI_DEFAULT_BIDI_OPTIONS),
|
||||
mPartID(0),
|
||||
mUserHasInteracted(false),
|
||||
mThrowOnDynamicMarkupInsertionCounter(0)
|
||||
mUserHasInteracted(false)
|
||||
{
|
||||
SetIsInDocument();
|
||||
|
||||
@@ -5395,14 +5394,18 @@ nsDocument::CreateElement(const nsAString& aTagName,
|
||||
}
|
||||
|
||||
const nsString* is = nullptr;
|
||||
if (aOptions.IsElementCreationOptions()) {
|
||||
// Throw NotFoundError if 'is' is not-null and definition is null
|
||||
is = CheckCustomElementName(aOptions.GetAsElementCreationOptions(),
|
||||
needsLowercase ? lcTagName : aTagName, mDefaultElementType, rv);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<Element> elem = CreateElem(
|
||||
needsLowercase ? lcTagName : aTagName, nullptr, mDefaultElementType, is);
|
||||
|
||||
if (is) {
|
||||
elem->SetAttr(kNameSpaceID_None, nsGkAtoms::is, *is, true);
|
||||
}
|
||||
|
||||
return elem.forget();
|
||||
}
|
||||
|
||||
@@ -5439,6 +5442,14 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
|
||||
}
|
||||
|
||||
const nsString* is = nullptr;
|
||||
if (aOptions.IsElementCreationOptions()) {
|
||||
// Throw NotFoundError if 'is' is not-null and definition is null
|
||||
is = CheckCustomElementName(aOptions.GetAsElementCreationOptions(),
|
||||
aQualifiedName, nodeInfo->NamespaceID(), rv);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<Element> element;
|
||||
rv = NS_NewElement(getter_AddRefs(element), nodeInfo.forget(),
|
||||
@@ -5447,10 +5458,6 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (is) {
|
||||
element->SetAttr(kNameSpaceID_None, nsGkAtoms::is, *is, true);
|
||||
}
|
||||
|
||||
return element.forget();
|
||||
}
|
||||
|
||||
@@ -5673,70 +5680,24 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value*
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> typeAtom(NS_Atomize(elemName));
|
||||
CustomElementDefinition* definition =
|
||||
registry->mCustomDefinitions.GetWeak(typeAtom);
|
||||
CustomElementDefinition* definition = registry->mCustomDefinitions.Get(typeAtom);
|
||||
if (!definition) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<Element> element;
|
||||
nsDependentAtomString localName(definition->mLocalName);
|
||||
|
||||
// We integrate with construction stack and do prototype swizzling here, so
|
||||
// that old upgrade behavior could also share the new upgrade steps.
|
||||
// And this old upgrade will be remove at some point (when everything is
|
||||
// switched to latest custom element spec).
|
||||
nsTArray<RefPtr<nsGenericHTMLElement>>& constructionStack =
|
||||
definition->mConstructionStack;
|
||||
if (constructionStack.Length()) {
|
||||
element = constructionStack.LastElement();
|
||||
NS_ENSURE_TRUE(element != ALEADY_CONSTRUCTED_MARKER, false);
|
||||
nsCOMPtr<Element> element =
|
||||
document->CreateElem(localName, nullptr, kNameSpaceID_XHTML);
|
||||
NS_ENSURE_TRUE(element, true);
|
||||
|
||||
// Do prototype swizzling if dom reflector exists.
|
||||
JS::Rooted<JSObject*> reflector(aCx, element->GetWrapper());
|
||||
if (reflector) {
|
||||
Maybe<JSAutoCompartment> ac;
|
||||
JS::Rooted<JSObject*> prototype(aCx, definition->mPrototype);
|
||||
if (element->NodePrincipal()->SubsumesConsideringDomain(nsContentUtils::ObjectPrincipal(prototype))) {
|
||||
ac.emplace(aCx, reflector);
|
||||
if (!JS_WrapObject(aCx, &prototype) ||
|
||||
!JS_SetPrototype(aCx, reflector, prototype)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// We want to set the custom prototype in the compartment where it was
|
||||
// registered. We store the prototype from define() without unwrapped,
|
||||
// hence the prototype's compartment is the compartment where it was
|
||||
// registered.
|
||||
// In the case that |reflector| and |prototype| are in different
|
||||
// compartments, this will set the prototype on the |reflector|'s wrapper
|
||||
// and thus only visible in the wrapper's compartment, since we know
|
||||
// reflector's principal does not subsume prototype's in this case.
|
||||
ac.emplace(aCx, prototype);
|
||||
if (!JS_WrapObject(aCx, &reflector) ||
|
||||
!JS_SetPrototype(aCx, reflector, prototype)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap into current context.
|
||||
if (!JS_WrapObject(aCx, &reflector)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
args.rval().setObject(*reflector);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
nsDependentAtomString localName(definition->mLocalName);
|
||||
element =
|
||||
document->CreateElem(localName, nullptr, kNameSpaceID_XHTML,
|
||||
(definition->mLocalName != typeAtom) ? &elemName
|
||||
: nullptr);
|
||||
NS_ENSURE_TRUE(element, false);
|
||||
if (definition->mLocalName != typeAtom) {
|
||||
// This element is a custom element by extension, thus we need to
|
||||
// do some special setup. For non-extended custom elements, this happens
|
||||
// when the element is created.
|
||||
nsContentUtils::SetupCustomElement(element, &elemName);
|
||||
}
|
||||
|
||||
// The prototype setup happens in Element::WrapObject().
|
||||
|
||||
nsresult rv = nsContentUtils::WrapNative(aCx, element, element, args.rval());
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
|
||||
@@ -5748,7 +5709,7 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(aCx, aObject);
|
||||
|
||||
if (nsContentUtils::IsWebComponentsEnabled()) {
|
||||
if (Preferences::GetBool("dom.webcomponents.enabled")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5764,7 +5725,7 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
|
||||
bool
|
||||
nsDocument::IsWebComponentsEnabled(dom::NodeInfo* aNodeInfo)
|
||||
{
|
||||
if (nsContentUtils::IsWebComponentsEnabled()) {
|
||||
if (Preferences::GetBool("dom.webcomponents.enabled")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5808,8 +5769,6 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
|
||||
return;
|
||||
}
|
||||
|
||||
AutoCEReaction ceReaction(this->GetDocGroup()->CustomElementReactionsStack(),
|
||||
aCx);
|
||||
// Unconditionally convert TYPE to lowercase.
|
||||
nsAutoString lcType;
|
||||
nsContentUtils::ASCIIToLower(aType, lcType);
|
||||
@@ -6576,49 +6535,6 @@ nsIDocument::GetHtmlChildElement(nsIAtom* aTag)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsGenericHTMLElement*
|
||||
nsIDocument::GetBody()
|
||||
{
|
||||
Element* html = GetHtmlElement();
|
||||
if (!html) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (nsIContent* child = html->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::body) ||
|
||||
child->IsHTMLElement(nsGkAtoms::frameset)) {
|
||||
return static_cast<nsGenericHTMLElement*>(child);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv)
|
||||
{
|
||||
nsCOMPtr<Element> root = GetRootElement();
|
||||
|
||||
// The body element must be either a body tag or a frameset tag. And we must
|
||||
// have a root element to be able to add kids to it.
|
||||
if (!newBody ||
|
||||
!newBody->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset) ||
|
||||
!root) {
|
||||
rv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Use DOM methods so that we pass through the appropriate security checks.
|
||||
nsCOMPtr<Element> currentBody = GetBody();
|
||||
if (currentBody) {
|
||||
root->ReplaceChild(*newBody, *currentBody, rv);
|
||||
} else {
|
||||
root->AppendChild(*newBody, rv);
|
||||
}
|
||||
}
|
||||
|
||||
Element*
|
||||
nsDocument::GetTitleElement()
|
||||
{
|
||||
@@ -12602,12 +12518,8 @@ MarkDocumentTreeToBeInSyncOperation(nsIDocument* aDoc, void* aData)
|
||||
|
||||
nsAutoSyncOperation::nsAutoSyncOperation(nsIDocument* aDoc)
|
||||
{
|
||||
mMicroTaskLevel = 0;
|
||||
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||
if (ccjs) {
|
||||
mMicroTaskLevel = ccjs->MicroTaskLevel();
|
||||
ccjs->SetMicroTaskLevel(0);
|
||||
}
|
||||
mMicroTaskLevel = nsContentUtils::MicroTaskLevel();
|
||||
nsContentUtils::SetMicroTaskLevel(0);
|
||||
if (aDoc) {
|
||||
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
|
||||
if (nsCOMPtr<nsPIDOMWindowOuter> top = win->GetTop()) {
|
||||
@@ -12623,10 +12535,7 @@ nsAutoSyncOperation::~nsAutoSyncOperation()
|
||||
for (int32_t i = 0; i < mDocuments.Count(); ++i) {
|
||||
mDocuments[i]->SetIsInSyncOperation(false);
|
||||
}
|
||||
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||
if (ccjs) {
|
||||
ccjs->SetMicroTaskLevel(mMicroTaskLevel);
|
||||
}
|
||||
nsContentUtils::SetMicroTaskLevel(mMicroTaskLevel);
|
||||
}
|
||||
|
||||
gfxUserFontSet*
|
||||
@@ -12796,6 +12705,30 @@ nsIDocument::UpdateStyleBackendType()
|
||||
#endif
|
||||
}
|
||||
|
||||
const nsString*
|
||||
nsDocument::CheckCustomElementName(const ElementCreationOptions& aOptions,
|
||||
const nsAString& aLocalName,
|
||||
uint32_t aNamespaceID,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
// only check aOptions if 'is' is passed and the webcomponents preference
|
||||
// is enabled
|
||||
if (!aOptions.mIs.WasPassed() ||
|
||||
!CustomElementRegistry::IsCustomElementEnabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const nsString* is = &aOptions.mIs.Value();
|
||||
|
||||
// Throw NotFoundError if 'is' is not-null and definition is null
|
||||
if (!nsContentUtils::LookupCustomElementDefinition(this, aLocalName,
|
||||
aNamespaceID, is)) {
|
||||
rv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
Selection*
|
||||
nsIDocument::GetSelection(ErrorResult& aRv)
|
||||
{
|
||||
|
||||
@@ -1388,6 +1388,20 @@ protected:
|
||||
private:
|
||||
static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp);
|
||||
|
||||
/**
|
||||
* Check if the passed custom element name, aOptions.mIs, is a registered
|
||||
* custom element type or not, then return the custom element name for future
|
||||
* usage.
|
||||
*
|
||||
* If there is no existing custom element definition for this name, throw a
|
||||
* NotFoundError.
|
||||
*/
|
||||
const nsString* CheckCustomElementName(
|
||||
const mozilla::dom::ElementCreationOptions& aOptions,
|
||||
const nsAString& aLocalName,
|
||||
uint32_t aNamespaceID,
|
||||
ErrorResult& rv);
|
||||
|
||||
public:
|
||||
virtual already_AddRefed<mozilla::dom::CustomElementRegistry>
|
||||
GetCustomElementRegistry() override;
|
||||
|
||||
@@ -793,6 +793,17 @@ nsGenericDOMDataNode::SetXBLInsertionParent(nsIContent* aContent)
|
||||
}
|
||||
}
|
||||
|
||||
CustomElementData *
|
||||
nsGenericDOMDataNode::GetCustomElementData() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericDOMDataNode::SetCustomElementData(CustomElementData* aData)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
nsGenericDOMDataNode::IsNodeOfType(uint32_t aFlags) const
|
||||
{
|
||||
|
||||
@@ -162,6 +162,9 @@ public:
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
virtual bool IsLink(nsIURI** aURI) const override;
|
||||
|
||||
virtual mozilla::dom::CustomElementData* GetCustomElementData() const override;
|
||||
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) override;
|
||||
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
|
||||
@@ -4241,9 +4241,8 @@ CustomElementRegistry*
|
||||
nsGlobalWindow::CustomElements()
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(IsInnerWindow());
|
||||
|
||||
if (!mCustomElements) {
|
||||
mCustomElements = new CustomElementRegistry(AsInner());
|
||||
mCustomElements = CustomElementRegistry::Create(AsInner());
|
||||
}
|
||||
|
||||
return mCustomElements;
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace mozilla {
|
||||
class EventChainPreVisitor;
|
||||
namespace dom {
|
||||
class ShadowRoot;
|
||||
struct CustomElementData;
|
||||
} // namespace dom
|
||||
namespace widget {
|
||||
struct IMEState;
|
||||
@@ -728,6 +729,22 @@ public:
|
||||
*/
|
||||
nsINode *GetFlattenedTreeParentNodeInternal() const;
|
||||
|
||||
/**
|
||||
* Gets the custom element data used by web components custom element.
|
||||
* Custom element data is created at the first attempt to enqueue a callback.
|
||||
*
|
||||
* @return The custom element data or null if none.
|
||||
*/
|
||||
virtual mozilla::dom::CustomElementData *GetCustomElementData() const = 0;
|
||||
|
||||
/**
|
||||
* Sets the custom element data, ownership of the
|
||||
* callback data is taken by this content.
|
||||
*
|
||||
* @param aCallbackData The custom element data.
|
||||
*/
|
||||
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) = 0;
|
||||
|
||||
/**
|
||||
* API to check if this is a link that's traversed in response to user input
|
||||
* (e.g. a click event). Specializations for HTML/SVG/generic XML allow for
|
||||
|
||||
+3
-47
@@ -61,7 +61,6 @@ class nsFrameLoader;
|
||||
class nsHTMLCSSStyleSheet;
|
||||
class nsHTMLDocument;
|
||||
class nsHTMLStyleSheet;
|
||||
class nsGenericHTMLElement;
|
||||
class nsIAtom;
|
||||
class nsIBFCacheEntry;
|
||||
class nsIChannel;
|
||||
@@ -1037,11 +1036,6 @@ public:
|
||||
Element* GetHeadElement() {
|
||||
return GetHtmlChildElement(nsGkAtoms::head);
|
||||
}
|
||||
// Get the "body" in the sense of document.body: The first <body> or
|
||||
// <frameset> that's a child of a root <html>
|
||||
nsGenericHTMLElement* GetBody();
|
||||
// Set the "body" in the sense of document.body.
|
||||
void SetBody(nsGenericHTMLElement* aBody, mozilla::ErrorResult& rv);
|
||||
|
||||
/**
|
||||
* Accessors to the collection of stylesheets owned by this document.
|
||||
@@ -2579,9 +2573,9 @@ public:
|
||||
}
|
||||
|
||||
enum ElementCallbackType {
|
||||
eConnected,
|
||||
eDisconnected,
|
||||
eAdopted,
|
||||
eCreated,
|
||||
eAttached,
|
||||
eDetached,
|
||||
eAttributeChanged
|
||||
};
|
||||
|
||||
@@ -2878,22 +2872,6 @@ public:
|
||||
virtual void ScheduleIntersectionObserverNotification() = 0;
|
||||
virtual void NotifyIntersectionObservers() = 0;
|
||||
|
||||
bool ShouldThrowOnDynamicMarkupInsertion()
|
||||
{
|
||||
return mThrowOnDynamicMarkupInsertionCounter;
|
||||
}
|
||||
|
||||
void IncrementThrowOnDynamicMarkupInsertionCounter()
|
||||
{
|
||||
++mThrowOnDynamicMarkupInsertionCounter;
|
||||
}
|
||||
|
||||
void DecrementThrowOnDynamicMarkupInsertionCounter()
|
||||
{
|
||||
MOZ_ASSERT(mThrowOnDynamicMarkupInsertionCounter);
|
||||
--mThrowOnDynamicMarkupInsertionCounter;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool GetUseCounter(mozilla::UseCounter aUseCounter)
|
||||
{
|
||||
@@ -3341,11 +3319,6 @@ protected:
|
||||
|
||||
uint32_t mBlockDOMContentLoaded;
|
||||
|
||||
// Used in conjunction with the create-an-element-for-the-token algorithm to
|
||||
// prevent custom element constructors from being able to use document.open(),
|
||||
// document.close(), and document.write() when they are invoked by the parser.
|
||||
uint32_t mThrowOnDynamicMarkupInsertionCounter;
|
||||
|
||||
// Our live MediaQueryLists
|
||||
PRCList mDOMMediaQueryLists;
|
||||
|
||||
@@ -3419,23 +3392,6 @@ private:
|
||||
uint32_t mMicroTaskLevel;
|
||||
};
|
||||
|
||||
class MOZ_RAII AutoSetThrowOnDynamicMarkupInsertionCounter final {
|
||||
public:
|
||||
explicit AutoSetThrowOnDynamicMarkupInsertionCounter(
|
||||
nsIDocument* aDocument)
|
||||
: mDocument(aDocument)
|
||||
{
|
||||
mDocument->IncrementThrowOnDynamicMarkupInsertionCounter();
|
||||
}
|
||||
|
||||
~AutoSetThrowOnDynamicMarkupInsertionCounter() {
|
||||
mDocument->DecrementThrowOnDynamicMarkupInsertionCounter();
|
||||
}
|
||||
|
||||
private:
|
||||
nsIDocument* mDocument;
|
||||
};
|
||||
|
||||
// XXX These belong somewhere else
|
||||
nsresult
|
||||
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData = false);
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "mozilla/dom/ErrorEvent.h"
|
||||
#include "nsAXPCNativeCallContext.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "nsJSPrincipals.h"
|
||||
|
||||
|
||||
@@ -25,12 +25,13 @@
|
||||
#include "xpcpublic.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/Date.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
bool
|
||||
@@ -159,8 +160,7 @@ nsJSUtils::EvaluateString(JSContext* aCx,
|
||||
aEvaluationGlobal);
|
||||
MOZ_ASSERT_IF(aOffThreadToken, aCompileOptions.noScriptRval);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
|
||||
CycleCollectedJSContext::Get()->MicroTaskLevel());
|
||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
||||
|
||||
// Unfortunately, the JS engine actually compiles scripts with a return value
|
||||
// in a different, less efficient way. Furthermore, it can't JIT them in many
|
||||
@@ -294,8 +294,7 @@ nsJSUtils::CompileModule(JSContext* aCx,
|
||||
aEvaluationGlobal);
|
||||
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx) == aEvaluationGlobal);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
|
||||
CycleCollectedJSContext::Get()->MicroTaskLevel());
|
||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
||||
|
||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
|
||||
|
||||
@@ -332,8 +331,7 @@ nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
|
||||
|
||||
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
|
||||
CycleCollectedJSContext::Get()->MicroTaskLevel());
|
||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
||||
|
||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
|
||||
|
||||
|
||||
+15
-49
@@ -301,12 +301,9 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
||||
Element* elem = aNode->AsElement();
|
||||
FragmentOrElement::nsDOMSlots* domSlots =
|
||||
static_cast<FragmentOrElement::nsDOMSlots*>(slots);
|
||||
if (domSlots->mExtendedSlots) {
|
||||
for (auto iter = domSlots->mExtendedSlots->mRegisteredIntersectionObservers.Iter();
|
||||
!iter.Done(); iter.Next()) {
|
||||
DOMIntersectionObserver* observer = iter.Key();
|
||||
observer->UnlinkTarget(*elem);
|
||||
}
|
||||
for (auto iter = domSlots->mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
|
||||
DOMIntersectionObserver* observer = iter.Key();
|
||||
observer->UnlinkTarget(*elem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,33 +476,19 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
||||
rv = aNode->Clone(nodeInfo, getter_AddRefs(clone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (CustomElementRegistry::IsCustomElementEnabled() &&
|
||||
clone->IsHTMLElement()) {
|
||||
if (clone->IsElement()) {
|
||||
// The cloned node may be a custom element that may require
|
||||
// enqueing upgrade reaction.
|
||||
Element* cloneElem = clone->AsElement();
|
||||
RefPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
|
||||
CustomElementData* data = elem->GetCustomElementData();
|
||||
|
||||
// Check if node may be custom element by type extension.
|
||||
// ex. <button is="x-button">
|
||||
nsAutoString extension;
|
||||
if (!data || data->GetCustomElementType() != tagAtom) {
|
||||
cloneElem->GetAttr(kNameSpaceID_None, nsGkAtoms::is, extension);
|
||||
}
|
||||
|
||||
if (data || !extension.IsEmpty()) {
|
||||
RefPtr<nsIAtom> typeAtom = extension.IsEmpty() ? tagAtom : NS_Atomize(extension);
|
||||
cloneElem->SetCustomElementData(new CustomElementData(typeAtom));
|
||||
|
||||
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
|
||||
CustomElementDefinition* definition =
|
||||
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
|
||||
nodeInfo->NameAtom(),
|
||||
nodeInfo->NamespaceID(),
|
||||
typeAtom);
|
||||
if (definition) {
|
||||
nsContentUtils::EnqueueUpgradeReaction(cloneElem, definition);
|
||||
// enqueing created callback and prototype swizzling.
|
||||
Element* elem = clone->AsElement();
|
||||
if (nsContentUtils::IsCustomElementName(nodeInfo->NameAtom())) {
|
||||
nsContentUtils::SetupCustomElement(elem);
|
||||
} else {
|
||||
// Check if node may be custom element by type extension.
|
||||
// ex. <button is="x-button">
|
||||
nsAutoString extension;
|
||||
if (elem->GetAttr(kNameSpaceID_None, nsGkAtoms::is, extension) &&
|
||||
!extension.IsEmpty()) {
|
||||
nsContentUtils::SetupCustomElement(elem, &extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -540,23 +523,6 @@ 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) {
|
||||
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) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var proto = Object.create(HTMLElement.prototype);
|
||||
proto.magicNumber = 42;
|
||||
proto.connectedCallback = function() {
|
||||
proto.createdCallback = function() {
|
||||
finishTest(this.magicNumber === 42);
|
||||
};
|
||||
document.registerElement("x-foo", { prototype: proto });
|
||||
|
||||
document.firstChild.appendChild(document.createElement("x-foo"));
|
||||
document.createElement("x-foo");
|
||||
@@ -21,13 +21,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1130028
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
/** Test for Bug 1130028 **/
|
||||
var connectedCallbackCount = 0;
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Callback should be called only once by element created in content.
|
||||
function connectedCallbackCalled() {
|
||||
connectedCallbackCount++;
|
||||
is(connectedCallbackCount, 1, "Connected callback called, should be called once in test.");
|
||||
var createdCallbackCount = 0;
|
||||
|
||||
// Callback should be called once by element created in chrome,
|
||||
// and once by element created in content.
|
||||
function createdCallbackCalled() {
|
||||
createdCallbackCount++;
|
||||
ok(true, "Created callback called, should be called twice in test.");
|
||||
is(this.magicNumber, 42, "Callback should be able to see the custom prototype.");
|
||||
if (createdCallbackCount == 2) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function startTests() {
|
||||
@@ -39,13 +45,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1130028
|
||||
|
||||
var proto = Object.create(frame.contentWindow.HTMLElement.prototype);
|
||||
proto.magicNumber = 42;
|
||||
proto.connectedCallback = connectedCallbackCalled;
|
||||
|
||||
proto.createdCallback = createdCallbackCalled;
|
||||
frame.contentDocument.registerElement("x-bar", { prototype: proto });
|
||||
is(connectedCallbackCount, 1, "Connected callback should be called by element created in content.");
|
||||
|
||||
var element = frame.contentDocument.createElement("x-bar");
|
||||
is(element.magicNumber, 42, "Should be able to see the custom prototype on created element.");
|
||||
frame.contentDocument.createElement("x-bar");
|
||||
}
|
||||
|
||||
]]></script>
|
||||
|
||||
@@ -26,8 +26,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1130028
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function finishTest(canSeePrototype) {
|
||||
ok(true, "connectedCallback called when reigsterElement was called with an extended principal.");
|
||||
ok(canSeePrototype, "connectedCallback should be able to see custom prototype.");
|
||||
ok(true, "createdCallback called when reigsterElement was called with an extended principal.");
|
||||
ok(canSeePrototype, "createdCallback should be able to see custom prototype.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ function testChildList5() {
|
||||
is(records[5].previousSibling, c3, "");
|
||||
is(records[5].nextSibling, c5, "");
|
||||
observer.disconnect();
|
||||
then(testNestedMutations);
|
||||
then(testAdoptNode);
|
||||
m = null;
|
||||
});
|
||||
m.observe(div, { childList: true, subtree: true });
|
||||
@@ -375,37 +375,6 @@ function testChildList5() {
|
||||
div.appendChild(emptyDF); // empty document shouldn't cause mutation records
|
||||
}
|
||||
|
||||
function testNestedMutations() {
|
||||
div.textContent = null;
|
||||
div.appendChild(document.createTextNode("foo"));
|
||||
var m2WasCalled = false;
|
||||
m = new M(function(records, observer) {
|
||||
is(records[0].type, "characterData", "Should have got characterData");
|
||||
observer.disconnect();
|
||||
m = null;
|
||||
m3 = new M(function(records, observer) {
|
||||
ok(m2WasCalled, "m2 should have been called before m3!");
|
||||
is(records[0].type, "characterData", "Should have got characterData");
|
||||
observer.disconnect();
|
||||
then(testAdoptNode);
|
||||
m3 = null;
|
||||
});
|
||||
m3.observe(div, { characterData: true, subtree: true});
|
||||
div.firstChild.data = "foo";
|
||||
});
|
||||
m2 = new M(function(records, observer) {
|
||||
m2WasCalled = true;
|
||||
is(records[0].type, "characterData", "Should have got characterData");
|
||||
observer.disconnect();
|
||||
m2 = null;
|
||||
});
|
||||
m2.observe(div, { characterData: true, subtree: true});
|
||||
div.appendChild(document.createTextNode("foo"));
|
||||
m.observe(div, { characterData: true, subtree: true });
|
||||
|
||||
div.firstChild.data = "bar";
|
||||
}
|
||||
|
||||
function testAdoptNode() {
|
||||
var d1 = document.implementation.createHTMLDocument(null);
|
||||
var d2 = document.implementation.createHTMLDocument(null);
|
||||
|
||||
@@ -16,16 +16,13 @@
|
||||
#include "mozilla/SizePrintfMacros.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/UseCounter.h"
|
||||
#include "mozilla/dom/DocGroup.h"
|
||||
|
||||
#include "AccessCheck.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIXPConnect.h"
|
||||
@@ -40,7 +37,6 @@
|
||||
#include "nsGlobalWindow.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/CustomElementRegistry.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/DOMErrorBinding.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
@@ -48,7 +44,6 @@
|
||||
#include "mozilla/dom/HTMLObjectElement.h"
|
||||
#include "mozilla/dom/HTMLObjectElementBinding.h"
|
||||
#include "mozilla/dom/HTMLSharedObjectElement.h"
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
#include "mozilla/dom/HTMLEmbedElementBinding.h"
|
||||
#include "mozilla/dom/HTMLAppletElementBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
@@ -67,30 +62,6 @@ namespace dom {
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Forward declare GetConstructorObject methods.
|
||||
#define HTML_TAG(_tag, _classname, _interfacename) \
|
||||
namespace HTML##_interfacename##ElementBinding { \
|
||||
JSObject* GetConstructorObject(JSContext*); \
|
||||
}
|
||||
#define HTML_OTHER(_tag)
|
||||
#include "nsHTMLTagList.h"
|
||||
#undef HTML_TAG
|
||||
#undef HTML_OTHER
|
||||
|
||||
typedef JSObject* (*constructorGetterCallback)(JSContext*);
|
||||
|
||||
// Mapping of html tag and GetConstructorObject methods.
|
||||
#define HTML_TAG(_tag, _classname, _interfacename) HTML##_interfacename##ElementBinding::GetConstructorObject,
|
||||
#define HTML_OTHER(_tag) nullptr,
|
||||
// We use eHTMLTag_foo (where foo is the tag) which is defined in nsHTMLTags.h
|
||||
// to index into this array.
|
||||
static const constructorGetterCallback sConstructorGetterCallback[] = {
|
||||
HTMLUnknownElementBinding::GetConstructorObject,
|
||||
#include "nsHTMLTagList.h"
|
||||
#undef HTML_TAG
|
||||
#undef HTML_OTHER
|
||||
};
|
||||
|
||||
const JSErrorFormatString ErrorFormatString[] = {
|
||||
#define MSG_DEF(_name, _argc, _exn, _str) \
|
||||
{ #_name, _str, _argc, _exn },
|
||||
@@ -3406,189 +3377,6 @@ GetDesiredProto(JSContext* aCx, const JS::CallArgs& aCallArgs,
|
||||
return true;
|
||||
}
|
||||
|
||||
CustomElementReactionsStack*
|
||||
GetCustomElementReactionsStack(JS::Handle<JSObject*> aObj)
|
||||
{
|
||||
// This might not be the right object, if there are wrappers. Unwrap if we can.
|
||||
JSObject* obj = js::CheckedUnwrap(aObj);
|
||||
if (!obj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsGlobalWindow* window = xpc::WindowGlobalOrNull(obj);
|
||||
if (!window) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DocGroup* docGroup = window->AsInner()->GetDocGroup();
|
||||
if (!docGroup) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return docGroup->CustomElementReactionsStack();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor
|
||||
already_AddRefed<nsGenericHTMLElement>
|
||||
CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs,
|
||||
JS::Handle<JSObject*> aGivenProto, ErrorResult& aRv)
|
||||
{
|
||||
// Step 1.
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIDocument* doc = window->GetExtantDoc();
|
||||
if (!doc) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<mozilla::dom::CustomElementRegistry> registry(window->CustomElements());
|
||||
if (!registry) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Step 2 is in the code output by CGClassConstructor.
|
||||
// Step 3.
|
||||
JSContext* cx = aGlobal.Context();
|
||||
JS::Rooted<JSObject*> newTarget(cx, &aCallArgs.newTarget().toObject());
|
||||
CustomElementDefinition* definition =
|
||||
registry->LookupCustomElementDefinition(cx, newTarget);
|
||||
if (!definition) {
|
||||
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The callee might be an Xray. Unwrap it to get actual callee.
|
||||
JS::Rooted<JSObject*> callee(cx, js::CheckedUnwrap(&aCallArgs.callee()));
|
||||
if (!callee) {
|
||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// And the actual callee might be in different compartment, so enter its
|
||||
// compartment before getting the standard constructor object to compare to,
|
||||
// so we get it from the same global as callee itself.
|
||||
JSAutoCompartment ac(cx, callee);
|
||||
int32_t tag = eHTMLTag_userdefined;
|
||||
if (!definition->IsCustomBuiltIn()) {
|
||||
// Step 4.
|
||||
// If the definition is for an autonomous custom element, the active
|
||||
// function should be HTMLElement.
|
||||
JS::Rooted<JSObject*> constructor(cx, HTMLElementBinding::GetConstructorObject(cx));
|
||||
if (!constructor) {
|
||||
aRv.NoteJSContextException(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (callee != constructor) {
|
||||
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
// Step 5.
|
||||
// If the definition is for a customized built-in element, the localName
|
||||
// should be defined in the specification.
|
||||
nsIParserService* parserService = nsContentUtils::GetParserService();
|
||||
if (!parserService) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tag = parserService->HTMLCaseSensitiveAtomTagToId(definition->mLocalName);
|
||||
if (tag == eHTMLTag_userdefined) {
|
||||
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(tag <= NS_HTML_TAG_MAX, "tag is out of bounds");
|
||||
|
||||
// If the definition is for a customized built-in element, the active
|
||||
// function should be the localname's element interface.
|
||||
constructorGetterCallback cb = sConstructorGetterCallback[tag];
|
||||
if (!cb) {
|
||||
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> constructor(cx, cb(cx));
|
||||
if (!constructor) {
|
||||
aRv.NoteJSContextException(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (callee != constructor) {
|
||||
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo =
|
||||
doc->NodeInfoManager()->GetNodeInfo(definition->mLocalName,
|
||||
nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
if (!nodeInfo) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Step 6 and Step 7 are in the code output by CGClassConstructor.
|
||||
// Step 8.
|
||||
nsTArray<RefPtr<nsGenericHTMLElement>>& constructionStack =
|
||||
definition->mConstructionStack;
|
||||
if (constructionStack.IsEmpty()) {
|
||||
RefPtr<nsGenericHTMLElement> newElement;
|
||||
if (tag == eHTMLTag_userdefined) {
|
||||
// Autonomous custom element.
|
||||
newElement = NS_NewHTMLElement(nodeInfo.forget());
|
||||
} else {
|
||||
// Customized built-in element.
|
||||
newElement = CreateHTMLElement(tag, nodeInfo.forget(), NOT_FROM_PARSER);
|
||||
}
|
||||
|
||||
newElement->SetCustomElementData(
|
||||
new CustomElementData(definition->mType, CustomElementData::State::eCustom));
|
||||
|
||||
newElement->SetCustomElementDefinition(definition);
|
||||
|
||||
return newElement.forget();
|
||||
}
|
||||
|
||||
// Step 9.
|
||||
RefPtr<nsGenericHTMLElement>& element = constructionStack.LastElement();
|
||||
|
||||
// Step 10.
|
||||
if (element == ALEADY_CONSTRUCTED_MARKER) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Step 11.
|
||||
// Do prototype swizzling for upgrading a custom element here, for cases when
|
||||
// we have a reflector already. If we don't have one yet, our caller will
|
||||
// create it with the right proto (by calling DoGetOrCreateDOMReflector with
|
||||
// that proto).
|
||||
JS::Rooted<JSObject*> reflector(cx, element->GetWrapper());
|
||||
if (reflector) {
|
||||
// reflector might be in different compartment.
|
||||
JSAutoCompartment ac(cx, reflector);
|
||||
JS::Rooted<JSObject*> givenProto(cx, aGivenProto);
|
||||
if (!JS_WrapObject(cx, &givenProto) ||
|
||||
!JS_SetPrototype(cx, reflector, givenProto)) {
|
||||
aRv.NoteJSContextException(cx);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Step 12 and Step 13.
|
||||
return element.forget();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
namespace binding_detail {
|
||||
void
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
|
||||
class nsGenericHTMLElement;
|
||||
class nsIJSID;
|
||||
|
||||
namespace mozilla {
|
||||
@@ -50,7 +49,6 @@ namespace mozilla {
|
||||
enum UseCounter : int16_t;
|
||||
|
||||
namespace dom {
|
||||
class CustomElementReactionsStack;
|
||||
template<typename KeyType, typename ValueType> class Record;
|
||||
|
||||
nsresult
|
||||
@@ -3422,19 +3420,6 @@ bool
|
||||
GetDesiredProto(JSContext* aCx, const JS::CallArgs& aCallArgs,
|
||||
JS::MutableHandle<JSObject*> aDesiredProto);
|
||||
|
||||
// Get the CustomElementReactionsStack for the docgroup of the global
|
||||
// of the underlying object of aObj. This can be null if aObj can't
|
||||
// be CheckUnwrapped, or if the global of the result has no docgroup
|
||||
// (e.g. because it's not a Window global).
|
||||
CustomElementReactionsStack*
|
||||
GetCustomElementReactionsStack(JS::Handle<JSObject*> aObj);
|
||||
// This function is expected to be called from the constructor function for an
|
||||
// HTML element interface; the global/callargs need to be whatever was passed to
|
||||
// that constructor function.
|
||||
already_AddRefed<nsGenericHTMLElement>
|
||||
CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs,
|
||||
JS::Handle<JSObject*> aGivenProto, ErrorResult& aRv);
|
||||
|
||||
void
|
||||
SetDocumentAndPageUseCounter(JSContext* aCx, JSObject* aObject,
|
||||
UseCounter aUseCounter);
|
||||
|
||||
@@ -1625,15 +1625,6 @@ DOMInterfaces = {
|
||||
'register': False,
|
||||
},
|
||||
|
||||
'TestHTMLConstructorInterface' : {
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
},
|
||||
|
||||
'TestCEReactionsInterface' : {
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
},
|
||||
}
|
||||
|
||||
# These are temporary, until they've been converted to use new DOM bindings
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/CallbackObject.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
@@ -80,10 +79,7 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
||||
, mIsMainThread(NS_IsMainThread())
|
||||
{
|
||||
if (mIsMainThread) {
|
||||
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||
if (ccjs) {
|
||||
ccjs->EnterMicroTask();
|
||||
}
|
||||
nsContentUtils::EnterMicroTask();
|
||||
}
|
||||
|
||||
// Compute the caller's subject principal (if necessary) early, before we
|
||||
@@ -292,10 +288,7 @@ CallbackObject::CallSetup::~CallSetup()
|
||||
// It is important that this is the last thing we do, after leaving the
|
||||
// compartment and undoing all our entry/incumbent script changes
|
||||
if (mIsMainThread) {
|
||||
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||
if (ccjs) {
|
||||
ccjs->LeaveMicroTask();
|
||||
}
|
||||
nsContentUtils::LeaveMicroTask();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
-127
@@ -1753,71 +1753,6 @@ class CGClassConstructor(CGAbstractStaticMethod):
|
||||
else:
|
||||
ctorName = self.descriptor.interface.identifier.name
|
||||
|
||||
# [HTMLConstructor] for custom element
|
||||
# This needs to live in bindings code because it directly examines
|
||||
# newtarget and the callee function to do HTMLConstructor specific things.
|
||||
if self._ctor.isHTMLConstructor():
|
||||
htmlConstructorSanityCheck = dedent("""
|
||||
// The newTarget might be a cross-compartment wrapper. Get the underlying object
|
||||
// so we can do the spec's object-identity checks.
|
||||
JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
|
||||
if (!newTarget) {
|
||||
return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
// Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
|
||||
// Enter the compartment of our underlying newTarget object, so we end
|
||||
// up comparing to the constructor object for our interface from that global.
|
||||
{
|
||||
JSAutoCompartment ac(cx, newTarget);
|
||||
JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
|
||||
if (!constructor) {
|
||||
return false;
|
||||
}
|
||||
if (newTarget == constructor) {
|
||||
return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
|
||||
}
|
||||
}
|
||||
|
||||
""")
|
||||
|
||||
# If we are unable to get desired prototype from newTarget, then we
|
||||
# fall back to the interface prototype object from newTarget's realm.
|
||||
htmlConstructorFallback = dedent("""
|
||||
if (!desiredProto) {
|
||||
// Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
|
||||
// This fallback behavior is designed to match analogous behavior for the
|
||||
// JavaScript built-ins. So we enter the compartment of our underlying
|
||||
// newTarget object and fall back to the prototype object from that global.
|
||||
// XXX The spec says to use GetFunctionRealm(), which is not actually
|
||||
// the same thing as what we have here (e.g. in the case of scripted callable proxies
|
||||
// whose target is not same-compartment with the proxy, or bound functions, etc).
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
|
||||
{
|
||||
JSAutoCompartment ac(cx, newTarget);
|
||||
desiredProto = GetProtoObjectHandle(cx);
|
||||
if (!desiredProto) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// desiredProto is in the compartment of the underlying newTarget object.
|
||||
// Wrap it into the context compartment.
|
||||
if (!JS_WrapObject(cx, &desiredProto)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
""")
|
||||
else:
|
||||
htmlConstructorSanityCheck = ""
|
||||
htmlConstructorFallback = ""
|
||||
|
||||
|
||||
# If we're a constructor, "obj" may not be a function, so calling
|
||||
# XrayAwareCalleeGlobal() on it is not safe. Of course in the
|
||||
# constructor case either "obj" is an Xray or we're already in the
|
||||
# content compartment, not the Xray compartment, so just
|
||||
# constructing the GlobalObject from "obj" is fine.
|
||||
preamble = fill(
|
||||
"""
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
@@ -1828,41 +1763,19 @@ class CGClassConstructor(CGAbstractStaticMethod):
|
||||
// Adding more relocations
|
||||
return ThrowConstructorWithoutNew(cx, "${ctorName}");
|
||||
}
|
||||
|
||||
GlobalObject global(cx, obj);
|
||||
if (global.Failed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$*{htmlConstructorSanityCheck}
|
||||
JS::Rooted<JSObject*> desiredProto(cx);
|
||||
if (!GetDesiredProto(cx, args, &desiredProto)) {
|
||||
return false;
|
||||
}
|
||||
$*{htmlConstructorFallback}
|
||||
""",
|
||||
chromeOnlyCheck=chromeOnlyCheck,
|
||||
ctorName=ctorName,
|
||||
htmlConstructorSanityCheck=htmlConstructorSanityCheck,
|
||||
htmlConstructorFallback=htmlConstructorFallback)
|
||||
ctorName=ctorName)
|
||||
|
||||
if self._ctor.isHTMLConstructor():
|
||||
signatures = self._ctor.signatures()
|
||||
assert len(signatures) == 1
|
||||
# Given that HTMLConstructor takes no args, we can just codegen a
|
||||
# call to CreateHTMLElement() in BindingUtils which reuses the
|
||||
# factory thing in HTMLContentSink. Then we don't have to implement
|
||||
# Constructor on all the HTML elements.
|
||||
callGenerator = CGPerSignatureCall(signatures[0][0], signatures[0][1],
|
||||
"CreateHTMLElement", True,
|
||||
self.descriptor, self._ctor,
|
||||
isConstructor=True)
|
||||
else:
|
||||
name = self._ctor.identifier.name
|
||||
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
|
||||
callGenerator = CGMethodCall(nativeName, True, self.descriptor,
|
||||
self._ctor, isConstructor=True,
|
||||
constructorName=ctorName)
|
||||
name = self._ctor.identifier.name
|
||||
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
|
||||
callGenerator = CGMethodCall(nativeName, True, self.descriptor,
|
||||
self._ctor, isConstructor=True,
|
||||
constructorName=ctorName)
|
||||
return preamble + "\n" + callGenerator.define()
|
||||
|
||||
|
||||
@@ -7479,7 +7392,7 @@ class CGPerSignatureCall(CGThing):
|
||||
def __init__(self, returnType, arguments, nativeMethodName, static,
|
||||
descriptor, idlNode, argConversionStartsAt=0, getter=False,
|
||||
setter=False, isConstructor=False, useCounterName=None,
|
||||
resultVar=None, objectName="obj"):
|
||||
resultVar=None):
|
||||
assert idlNode.isMethod() == (not getter and not setter)
|
||||
assert idlNode.isAttr() == (getter or setter)
|
||||
# Constructors are always static
|
||||
@@ -7533,23 +7446,26 @@ class CGPerSignatureCall(CGThing):
|
||||
|
||||
argsPre = []
|
||||
if idlNode.isStatic():
|
||||
# If we're a constructor, the GlobalObject struct will be created in
|
||||
# CGClassConstructor.
|
||||
if not isConstructor:
|
||||
cgThings.append(CGGeneric(dedent(
|
||||
"""
|
||||
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
|
||||
if (global.Failed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
""")))
|
||||
# If we're a constructor, "obj" may not be a function, so calling
|
||||
# XrayAwareCalleeGlobal() on it is not safe. Of course in the
|
||||
# constructor case either "obj" is an Xray or we're already in the
|
||||
# content compartment, not the Xray compartment, so just
|
||||
# constructing the GlobalObject from "obj" is fine.
|
||||
if isConstructor:
|
||||
objForGlobalObject = "obj"
|
||||
else:
|
||||
objForGlobalObject = "xpc::XrayAwareCalleeGlobal(obj)"
|
||||
cgThings.append(CGGeneric(fill(
|
||||
"""
|
||||
GlobalObject global(cx, ${obj});
|
||||
if (global.Failed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
""",
|
||||
obj=objForGlobalObject)))
|
||||
argsPre.append("global")
|
||||
|
||||
if isConstructor and idlNode.isHTMLConstructor():
|
||||
argsPre.extend(["args", "desiredProto"])
|
||||
|
||||
# For JS-implemented interfaces we do not want to base the
|
||||
# needsCx decision on the types involved, just on our extended
|
||||
# attributes. Also, JSContext is not needed for the static case
|
||||
@@ -7678,17 +7594,6 @@ class CGPerSignatureCall(CGThing):
|
||||
CGIfWrapper(CGList(xraySteps),
|
||||
"objIsXray"))
|
||||
|
||||
if (idlNode.getExtendedAttribute('CEReactions') is not None and
|
||||
not getter):
|
||||
cgThings.append(CGGeneric(fill(
|
||||
"""
|
||||
CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(${obj});
|
||||
Maybe<AutoCEReaction> ceReaction;
|
||||
if (reactionsStack) {
|
||||
ceReaction.emplace(reactionsStack, cx);
|
||||
}
|
||||
""", obj=objectName)))
|
||||
|
||||
# If this is a method that was generated by a maplike/setlike
|
||||
# interface, use the maplike/setlike generator to fill in the body.
|
||||
# Otherwise, use CGCallGenerator to call the native method.
|
||||
@@ -11086,8 +10991,7 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
||||
# CGPerSignatureCall won't do any argument conversion of its own.
|
||||
CGPerSignatureCall.__init__(self, returnType, arguments, nativeName,
|
||||
False, descriptor, operation,
|
||||
len(arguments), resultVar=resultVar,
|
||||
objectName="proxy")
|
||||
len(arguments), resultVar=resultVar)
|
||||
|
||||
if operation.isSetter() or operation.isCreator():
|
||||
# arguments[0] is the index or name of the item that we're setting.
|
||||
@@ -13857,18 +13761,12 @@ class CGBindingRoot(CGThing):
|
||||
iface = desc.interface
|
||||
return any(m.getExtendedAttribute("Deprecated") for m in iface.members + [iface])
|
||||
|
||||
def descriptorHasCEReactions(desc):
|
||||
iface = desc.interface
|
||||
return any(m.getExtendedAttribute("CEReactions") for m in iface.members + [iface])
|
||||
|
||||
bindingHeaders["nsIDocument.h"] = any(
|
||||
descriptorDeprecated(d) for d in descriptors)
|
||||
bindingHeaders["mozilla/Preferences.h"] = any(
|
||||
descriptorRequiresPreferences(d) for d in descriptors)
|
||||
bindingHeaders["mozilla/dom/DOMJSProxyHandler.h"] = any(
|
||||
d.concrete and d.proxy for d in descriptors)
|
||||
bindingHeaders["mozilla/dom/CustomElementRegistry.h"] = any(
|
||||
descriptorHasCEReactions(d) for d in descriptors)
|
||||
|
||||
def descriptorHasChromeOnly(desc):
|
||||
ctor = desc.interface.ctor()
|
||||
|
||||
@@ -1582,7 +1582,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
[self.location])
|
||||
|
||||
self._noInterfaceObject = True
|
||||
elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
|
||||
elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "ChromeConstructor":
|
||||
if identifier == "Constructor" and not self.hasInterfaceObject():
|
||||
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
|
||||
[self.location])
|
||||
@@ -1595,20 +1595,11 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
|
||||
[self.location])
|
||||
|
||||
if identifier == "HTMLConstructor":
|
||||
if not self.hasInterfaceObject():
|
||||
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
|
||||
[self.location])
|
||||
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError(str(identifier) + " must take no arguments",
|
||||
[attr.location])
|
||||
|
||||
args = attr.args() if attr.hasArgs() else []
|
||||
|
||||
retType = IDLWrapperType(self.location, self)
|
||||
|
||||
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
|
||||
if identifier == "Constructor" or identifier == "ChromeConstructor":
|
||||
name = "constructor"
|
||||
allowForbidden = True
|
||||
else:
|
||||
@@ -1619,8 +1610,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
allowForbidden=allowForbidden)
|
||||
|
||||
method = IDLMethod(self.location, methodIdentifier, retType,
|
||||
args, static=True,
|
||||
htmlConstructor=(identifier == "HTMLConstructor"))
|
||||
args, static=True)
|
||||
# Constructors are always NewObject and are always
|
||||
# assumed to be able to throw (since there's no way to
|
||||
# indicate otherwise) and never have any other
|
||||
@@ -1632,7 +1622,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
method.addExtendedAttributes(
|
||||
[IDLExtendedAttribute(self.location, ("ChromeOnly",))])
|
||||
|
||||
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
|
||||
if identifier == "Constructor" or identifier == "ChromeConstructor":
|
||||
method.resolve(self)
|
||||
else:
|
||||
# We need to detect conflicts for NamedConstructors across
|
||||
@@ -4083,11 +4073,6 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
raise WebIDLError("Attribute returns a type that is not exposed "
|
||||
"everywhere where the attribute is exposed",
|
||||
[self.location])
|
||||
if self.getExtendedAttribute("CEReactions"):
|
||||
if self.readonly:
|
||||
raise WebIDLError("[CEReactions] is not allowed on "
|
||||
"readonly attributes",
|
||||
[self.location])
|
||||
|
||||
def handleExtendedAttribute(self, attr):
|
||||
identifier = attr.identifier()
|
||||
@@ -4258,10 +4243,6 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
raise WebIDLError("[Unscopable] is only allowed on non-static "
|
||||
"attributes and operations",
|
||||
[attr.location, self.location])
|
||||
elif identifier == "CEReactions":
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError("[CEReactions] must take no arguments",
|
||||
[attr.location])
|
||||
elif (identifier == "Pref" or
|
||||
identifier == "Deprecated" or
|
||||
identifier == "SetterThrows" or
|
||||
@@ -4556,7 +4537,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
static=False, getter=False, setter=False, creator=False,
|
||||
deleter=False, specialType=NamedOrIndexed.Neither,
|
||||
legacycaller=False, stringifier=False, jsonifier=False,
|
||||
maplikeOrSetlikeOrIterable=None, htmlConstructor=False):
|
||||
maplikeOrSetlikeOrIterable=None):
|
||||
# REVIEW: specialType is NamedOrIndexed -- wow, this is messed up.
|
||||
IDLInterfaceMember.__init__(self, location, identifier,
|
||||
IDLInterfaceMember.Tags.Method)
|
||||
@@ -4586,10 +4567,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
self._jsonifier = jsonifier
|
||||
assert maplikeOrSetlikeOrIterable is None or isinstance(maplikeOrSetlikeOrIterable, IDLMaplikeOrSetlikeOrIterableBase)
|
||||
self.maplikeOrSetlikeOrIterable = maplikeOrSetlikeOrIterable
|
||||
assert isinstance(htmlConstructor, bool)
|
||||
# The identifier of a HTMLConstructor must be 'constructor'.
|
||||
assert not htmlConstructor or identifier.name == "constructor"
|
||||
self._htmlConstructor = htmlConstructor
|
||||
self._specialType = specialType
|
||||
self._unforgeable = False
|
||||
self.dependsOn = "Everything"
|
||||
@@ -4690,9 +4667,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
self.isStringifier() or
|
||||
self.isJsonifier())
|
||||
|
||||
def isHTMLConstructor(self):
|
||||
return self._htmlConstructor
|
||||
|
||||
def hasOverloads(self):
|
||||
return self._hasOverloads
|
||||
|
||||
@@ -4748,8 +4722,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
assert not method.isStringifier()
|
||||
assert not self.isJsonifier()
|
||||
assert not method.isJsonifier()
|
||||
assert not self.isHTMLConstructor()
|
||||
assert not method.isHTMLConstructor()
|
||||
|
||||
return self
|
||||
|
||||
@@ -4992,15 +4964,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
raise WebIDLError("[Unscopable] is only allowed on non-static "
|
||||
"attributes and operations",
|
||||
[attr.location, self.location])
|
||||
elif identifier == "CEReactions":
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError("[CEReactions] must take no arguments",
|
||||
[attr.location])
|
||||
|
||||
if self.isSpecial() and not self.isSetter() and not self.isDeleter():
|
||||
raise WebIDLError("[CEReactions] is only allowed on operation, "
|
||||
"attribute, setter, and deleter",
|
||||
[attr.location, self.location])
|
||||
elif (identifier == "Throws" or
|
||||
identifier == "NewObject" or
|
||||
identifier == "ChromeOnly" or
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions(DOMString a)] void foo(boolean arg2);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions(DOMString b)] readonly attribute boolean bar;
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] attribute boolean bar;
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, e:
|
||||
harness.ok(False, "Shouldn't have thrown for [CEReactions] used on writable attribute. %s" % e)
|
||||
threw = True
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] void foo(boolean arg2);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, e:
|
||||
harness.ok(False, "Shouldn't have thrown for [CEReactions] used on regular operations. %s" % e)
|
||||
threw = True
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] readonly attribute boolean A;
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] used on a readonly attribute")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[CEReactions]
|
||||
interface Foo {
|
||||
}
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] getter any(DOMString name);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown for [CEReactions] used on a named getter")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] creator boolean (DOMString name, boolean value);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown for [CEReactions] used on a named creator")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] legacycaller double compute(double x);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown for [CEReactions] used on a legacycaller")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] stringifier DOMString ();
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown for [CEReactions] used on a stringifier")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] jsonifier;
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] used on a jsonifier")
|
||||
@@ -13,7 +13,7 @@ def WebIDLTest(parser, harness):
|
||||
def checkMethod(method, QName, name, signatures,
|
||||
static=True, getter=False, setter=False, creator=False,
|
||||
deleter=False, legacycaller=False, stringifier=False,
|
||||
chromeOnly=False, htmlConstructor=False):
|
||||
chromeOnly=False):
|
||||
harness.ok(isinstance(method, WebIDL.IDLMethod),
|
||||
"Should be an IDLMethod")
|
||||
harness.ok(method.isMethod(), "Method is a method")
|
||||
@@ -29,7 +29,6 @@ def WebIDLTest(parser, harness):
|
||||
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
|
||||
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
|
||||
harness.check(method.getExtendedAttribute("ChromeOnly") is not None, chromeOnly, "Method has the correct value for ChromeOnly")
|
||||
harness.check(method.isHTMLConstructor(), htmlConstructor, "Method has the correct htmlConstructor value")
|
||||
harness.check(len(method.signatures()), len(signatures), "Method has the correct number of signatures")
|
||||
|
||||
sigpairs = zip(method.signatures(), signatures)
|
||||
@@ -79,21 +78,6 @@ def WebIDLTest(parser, harness):
|
||||
("TestConstructorOverloads (Wrapper)",
|
||||
[("::TestConstructorOverloads::constructor::bar", "bar", "Boolean", False, False)])])
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
[HTMLConstructor]
|
||||
interface TestHTMLConstructor {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
harness.check(len(results), 1, "Should be one production")
|
||||
harness.ok(isinstance(results[0], WebIDL.IDLInterface),
|
||||
"Should be an IDLInterface")
|
||||
|
||||
checkMethod(results[0].ctor(), "::TestHTMLConstructor::constructor",
|
||||
"constructor", [("TestHTMLConstructor (Wrapper)", [])],
|
||||
htmlConstructor=True)
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
[ChromeConstructor()]
|
||||
@@ -123,151 +107,3 @@ def WebIDLTest(parser, harness):
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a Constructor and a ChromeConstructor")
|
||||
|
||||
# Test HTMLConstructor with argument
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor(DOMString a)]
|
||||
interface TestHTMLConstructorWithArgs {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "HTMLConstructor should take no argument")
|
||||
|
||||
# Test HTMLConstructor on a callback interface
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor]
|
||||
callback interface TestHTMLConstructorOnCallbackInterface {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "HTMLConstructor can't be used on a callback interface")
|
||||
|
||||
# Test HTMLConstructor and Constructor
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Constructor,
|
||||
HTMLConstructor]
|
||||
interface TestHTMLConstructorAndConstructor {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a Constructor and a HTMLConstructor")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor,
|
||||
Constructor]
|
||||
interface TestHTMLConstructorAndConstructor {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor,
|
||||
Constructor(DOMString a)]
|
||||
interface TestHTMLConstructorAndConstructor {
|
||||
};
|
||||
""")
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Constructor(DOMString a),
|
||||
HTMLConstructor]
|
||||
interface TestHTMLConstructorAndConstructor {
|
||||
};
|
||||
""")
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
|
||||
|
||||
# Test HTMLConstructor and ChromeConstructor
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[ChromeConstructor,
|
||||
HTMLConstructor]
|
||||
interface TestHTMLConstructorAndChromeConstructor {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor,
|
||||
ChromeConstructor]
|
||||
interface TestHTMLConstructorAndChromeConstructor {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[ChromeConstructor(DOMString a),
|
||||
HTMLConstructor]
|
||||
interface TestHTMLConstructorAndChromeConstructor {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor,
|
||||
ChromeConstructor(DOMString a)]
|
||||
interface TestHTMLConstructorAndChromeConstructor {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
|
||||
@@ -34,36 +34,3 @@ def WebIDLTest(parser, harness):
|
||||
interface TestNamedConstructorNoInterfaceObject {
|
||||
};
|
||||
""")
|
||||
|
||||
# Test HTMLConstructor and NoInterfaceObject
|
||||
parser = parser.reset()
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[NoInterfaceObject, HTMLConstructor]
|
||||
interface TestHTMLConstructorNoInterfaceObject {
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor, NoInterfaceObject]
|
||||
interface TestHTMLConstructorNoInterfaceObject {
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
@@ -939,11 +939,6 @@ public:
|
||||
void NeedsCallerTypeMethod(CallerType);
|
||||
bool NeedsCallerTypeAttr(CallerType);
|
||||
void SetNeedsCallerTypeAttr(bool, CallerType);
|
||||
void CeReactionsMethod();
|
||||
void CeReactionsMethodOverload();
|
||||
void CeReactionsMethodOverload(const nsAString&);
|
||||
bool CeReactionsAttr() const;
|
||||
void SetCeReactionsAttr(bool);
|
||||
int16_t LegacyCall(const JS::Value&, uint32_t, TestInterface&);
|
||||
void PassArgsWithDefaults(JSContext*, const Optional<int32_t>&,
|
||||
TestInterface*, const Dict&, double,
|
||||
@@ -1430,31 +1425,6 @@ public:
|
||||
void SetNeedsCallerTypeAttr(bool, CallerType);
|
||||
};
|
||||
|
||||
class TestHTMLConstructorInterface : public nsGenericHTMLElement
|
||||
{
|
||||
public:
|
||||
virtual nsISupports* GetParentObject();
|
||||
};
|
||||
|
||||
class TestCEReactionsInterface : public nsISupports,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// We need a GetParentObject to make binding codegen happy
|
||||
virtual nsISupports* GetParentObject();
|
||||
|
||||
int32_t Item(uint32_t);
|
||||
uint32_t Length() const;
|
||||
int32_t IndexedGetter(uint32_t, bool &);
|
||||
void IndexedSetter(uint32_t, int32_t);
|
||||
void NamedDeleter(const nsAString&, bool &);
|
||||
void NamedGetter(const nsAString&, bool &, nsString&);
|
||||
void NamedSetter(const nsAString&, const nsAString&);
|
||||
void GetSupportedNames(nsTArray<nsString>&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
@@ -947,10 +947,6 @@ interface TestInterface {
|
||||
[NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr;
|
||||
[NeedsCallerType] void needsCallerTypeMethod();
|
||||
[NeedsCallerType] attribute boolean needsCallerTypeAttr;
|
||||
[CEReactions] void ceReactionsMethod();
|
||||
[CEReactions] void ceReactionsMethodOverload();
|
||||
[CEReactions] void ceReactionsMethodOverload(DOMString bar);
|
||||
[CEReactions] attribute boolean ceReactionsAttr;
|
||||
legacycaller short(unsigned long arg1, TestInterface arg2);
|
||||
void passArgsWithDefaults(optional long arg1,
|
||||
optional TestInterface? arg2 = null,
|
||||
@@ -1266,16 +1262,3 @@ interface TestWorkerExposedInterface {
|
||||
[NeedsCallerType] void needsCallerTypeMethod();
|
||||
[NeedsCallerType] attribute boolean needsCallerTypeAttr;
|
||||
};
|
||||
|
||||
[HTMLConstructor]
|
||||
interface TestHTMLConstructorInterface {
|
||||
};
|
||||
|
||||
interface TestCEReactionsInterface {
|
||||
[CEReactions] setter creator void (unsigned long index, long item);
|
||||
[CEReactions] setter creator void (DOMString name, DOMString item);
|
||||
[CEReactions] deleter void (DOMString name);
|
||||
getter long item(unsigned long index);
|
||||
getter DOMString (DOMString name);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
@@ -777,10 +777,6 @@ interface TestExampleInterface {
|
||||
[NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr;
|
||||
[NeedsCallerType] void needsCallerTypeMethod();
|
||||
[NeedsCallerType] attribute boolean needsCallerTypeAttr;
|
||||
[CEReactions] void ceReactionsMethod();
|
||||
[CEReactions] void ceReactionsMethodOverload();
|
||||
[CEReactions] void ceReactionsMethodOverload(DOMString bar);
|
||||
[CEReactions] attribute boolean ceReactionsAttr;
|
||||
legacycaller short(unsigned long arg1, TestInterface arg2);
|
||||
void passArgsWithDefaults(optional long arg1,
|
||||
optional TestInterface? arg2 = null,
|
||||
|
||||
@@ -794,10 +794,6 @@ interface TestJSImplInterface {
|
||||
[Throws] attribute boolean throwingAttr;
|
||||
[GetterThrows] attribute boolean throwingGetterAttr;
|
||||
[SetterThrows] attribute boolean throwingSetterAttr;
|
||||
[CEReactions] void ceReactionsMethod();
|
||||
[CEReactions] void ceReactionsMethodOverload();
|
||||
[CEReactions] void ceReactionsMethodOverload(DOMString bar);
|
||||
[CEReactions] attribute boolean ceReactionsAttr;
|
||||
// NeedsSubjectPrincipal not supported on JS-implemented things for
|
||||
// now, because we always pass in the caller principal anyway.
|
||||
// [NeedsSubjectPrincipal] void needsSubjectPrincipalMethod();
|
||||
|
||||
@@ -20,12 +20,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=560072
|
||||
|
||||
/** Test for Bug 560072 **/
|
||||
is(document.body,
|
||||
Object.getOwnPropertyDescriptor(Document.prototype, "body").get.call(document),
|
||||
Object.getOwnPropertyDescriptor(HTMLDocument.prototype, "body").get.call(document),
|
||||
"Should get body out of property descriptor");
|
||||
|
||||
is(document.body,
|
||||
Object.getOwnPropertyDescriptor(
|
||||
Object.getPrototypeOf(Object.getPrototypeOf(document)), "body").get.call(document),
|
||||
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(document), "body").get.call(document),
|
||||
"Should get body out of property descriptor this way too");
|
||||
|
||||
</script>
|
||||
|
||||
@@ -8,20 +8,16 @@ EXPORTS.mozilla.dom += [
|
||||
'BroadcastChannel.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
SOURCES += [
|
||||
'BroadcastChannel.cpp',
|
||||
'BroadcastChannelChild.cpp',
|
||||
'BroadcastChannelParent.cpp',
|
||||
'BroadcastChannelService.cpp',
|
||||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
'PBroadcastChannel.ipdl',
|
||||
]
|
||||
IPDL_SOURCES += ['PBroadcastChannel.ipdl']
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
]
|
||||
LOCAL_INCLUDES += ['../workers']
|
||||
|
||||
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
|
||||
BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
|
||||
|
||||
Vendored
+1
@@ -12,6 +12,7 @@
|
||||
#include "mozilla/dom/cache/SavedTypes.h"
|
||||
#include "mozilla/ipc/FileDescriptorSetParent.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||
#include "mozilla/ipc/SendStream.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
Vendored
+3
@@ -7,6 +7,7 @@
|
||||
#include "mozilla/dom/cache/CacheStorage.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/CacheBinding.h"
|
||||
#include "mozilla/dom/CacheStorageBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/Response.h"
|
||||
@@ -29,6 +30,8 @@
|
||||
#include "nsURLParsers.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace cache {
|
||||
|
||||
+1
@@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/cache/CacheTypes.h"
|
||||
#include "mozilla/dom/cache/ReadStream.h"
|
||||
#include "mozilla/ipc/FileDescriptorSetChild.h"
|
||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/ipc/PFileDescriptorSetChild.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
+2
@@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/cache/ReadStream.h"
|
||||
#include "mozilla/dom/cache/StreamList.h"
|
||||
#include "mozilla/ipc/FileDescriptorSetParent.h"
|
||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundParent.h"
|
||||
#include "mozilla/ipc/PFileDescriptorSetParent.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
@@ -20,6 +21,7 @@ namespace dom {
|
||||
namespace cache {
|
||||
|
||||
using mozilla::dom::OptionalFileDescriptorSet;
|
||||
using mozilla::ipc::AutoIPCStream;
|
||||
using mozilla::ipc::FileDescriptor;
|
||||
using mozilla::ipc::FileDescriptorSetParent;
|
||||
using mozilla::ipc::PFileDescriptorSetParent;
|
||||
|
||||
Vendored
+3
@@ -12,9 +12,12 @@
|
||||
#include "nsID.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
class AutoIPCStream;
|
||||
|
||||
Vendored
+1
@@ -14,6 +14,7 @@
|
||||
#include "mozilla/dom/cache/CacheTypes.h"
|
||||
#include "mozilla/dom/cache/ReadStream.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/ipc/PFileDescriptorSetChild.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
|
||||
Vendored
+1
-1
@@ -38,7 +38,7 @@ EXPORTS.mozilla.dom.cache += [
|
||||
'TypeUtils.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
SOURCES += [
|
||||
'Action.cpp',
|
||||
'ActorChild.cpp',
|
||||
'AutoUtils.cpp',
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsExpirationTracker.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsTHashtable.h"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CanvasRenderingContextHelper.h"
|
||||
|
||||
#include "CanvasUtils.h"
|
||||
#include "ImageBitmapRenderingContext.h"
|
||||
#include "ImageEncoder.h"
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
|
||||
@@ -5,19 +5,29 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/ImageBitmap.h"
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/File.h" // for Blob
|
||||
#include "mozilla/dom/HTMLImageElement.h"
|
||||
#include "mozilla/dom/ImageBitmapBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/UnionTypes.h" // for ArrayBufferViewOrArrayBuffer
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "CanvasRenderingContext2D.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "ImageBitmapColorUtils.h"
|
||||
#include "ImageBitmapUtils.h"
|
||||
#include "ImageData.h"
|
||||
#include "ImageLayers.h"
|
||||
#include "ImageUtils.h"
|
||||
#include "imgTools.h"
|
||||
#include "libyuv.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "OffscreenCanvas.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "CanvasRenderingContextHelper.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
|
||||
struct JSContext;
|
||||
struct JSStructuredCloneReader;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#include "ImageBitmapColorUtils.h"
|
||||
|
||||
#include "js/LegacyIntTypes.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
||||
Loaded 100 of 1750 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user