Compare commits
448
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe4b55154b | ||
|
|
d9f4319bfd | ||
|
|
ec7baced6c | ||
|
|
5ed591c3d7 | ||
|
|
32859868d6 | ||
|
|
4ab80fceb4 | ||
|
|
4e25cc130f | ||
|
|
f1b56f6512 | ||
|
|
b5d6c427ad | ||
|
|
9a900503ea | ||
|
|
f6296891bf | ||
|
|
bbd16ed644 | ||
|
|
8f6cd1cfcd | ||
|
|
70a3532f49 | ||
|
|
c160edb49b | ||
|
|
32f0e6d1e6 | ||
|
|
8c6098ed9e | ||
|
|
5f70302bfc | ||
|
|
f1cc25409a | ||
|
|
1bb67f87d1 | ||
|
|
6f89be191d | ||
|
|
f453aac0eb | ||
|
|
abc2e56e6a | ||
|
|
2f2c86599f | ||
|
|
a52e68f04d | ||
|
|
ee256eda09 | ||
|
|
adbedd87a3 | ||
|
|
4f94981ad9 | ||
|
|
fb15e11ef3 | ||
|
|
b0e1570535 | ||
|
|
b370042040 | ||
|
|
60daf77274 | ||
|
|
4f9ed77789 | ||
|
|
c819a0b3c8 | ||
|
|
104f493044 | ||
|
|
ccfb3fc5db | ||
|
|
9fa543c9f4 | ||
|
|
1d18178eda | ||
|
|
8a6b1f309b | ||
|
|
a60ab0def7 | ||
|
|
6276177e20 | ||
|
|
6c4e8f1466 | ||
|
|
19a4ae248b | ||
|
|
744212dbf3 | ||
|
|
a46fbd6ead | ||
|
|
bb39100caf | ||
|
|
a27a4e4b60 | ||
|
|
490cf03fba | ||
|
|
e93191409e | ||
|
|
5cfdaf4ad4 | ||
|
|
7664a83451 | ||
|
|
f449e1fd7d | ||
|
|
bbd4a99be2 | ||
|
|
4ae471baf9 | ||
|
|
4d41b5df11 | ||
|
|
01188c1465 | ||
|
|
7eac3090a5 | ||
|
|
e9bb602131 | ||
|
|
ddc8b21705 | ||
|
|
6209d33f4e | ||
|
|
cbaace24c0 | ||
|
|
051951ef00 | ||
|
|
a9062b8710 | ||
|
|
18c656ebba | ||
|
|
9220d05de2 | ||
|
|
fdd286d190 | ||
|
|
4fa8a8ce1d | ||
|
|
d5e853a25b | ||
|
|
6ea3635847 | ||
|
|
0ea3d42a38 | ||
|
|
a024df6124 | ||
|
|
11a80021f4 | ||
|
|
301873c751 | ||
|
|
90986caee8 | ||
|
|
778d93ac49 | ||
|
|
f9ba08fa11 | ||
|
|
95911aa2ce | ||
|
|
ccbea05142 | ||
|
|
867c957ceb | ||
|
|
0d2ff3ee65 | ||
|
|
5871ce0b85 | ||
|
|
6237c680ca | ||
|
|
facdbf7bc0 | ||
|
|
8f54050907 | ||
|
|
2fbe032ee9 | ||
|
|
a8a68383cb | ||
|
|
e3f67c01a2 | ||
|
|
a1fe345c98 | ||
|
|
a1caa316a7 | ||
|
|
1011058248 | ||
|
|
dc9a5cd350 | ||
|
|
80c7d08eee | ||
|
|
a8c59c38d4 | ||
|
|
9bf46d80f1 | ||
|
|
638c7f07f7 | ||
|
|
8e01b2d181 | ||
|
|
3a4dc8de41 | ||
|
|
18595b01b6 | ||
|
|
f7215fc685 | ||
|
|
08521d4651 | ||
|
|
00b177d75f | ||
|
|
a89a071049 | ||
|
|
f9dc8a091a | ||
|
|
944299ed6c | ||
|
|
0e1441155c | ||
|
|
7bf5dfe4e4 | ||
|
|
d4c34fc9f7 | ||
|
|
6811005551 | ||
|
|
464cefa127 | ||
|
|
c94a1ab5d3 | ||
|
|
8aa5b35605 | ||
|
|
25dd1fb31a | ||
|
|
d8cf2c8b44 | ||
|
|
938c5d08d4 | ||
|
|
7fca2b8de3 | ||
|
|
ef19ad3ffd | ||
|
|
ab88527fe6 | ||
|
|
6c0ff1881a | ||
|
|
1e7f4c8474 | ||
|
|
fdf491d4ec | ||
|
|
1f4cceca43 | ||
|
|
542eaca577 | ||
|
|
1cb6f56418 | ||
|
|
a503e883d9 | ||
|
|
347681c219 | ||
|
|
2984237f4f | ||
|
|
1c4a73de71 | ||
|
|
d27df4d88f | ||
|
|
9562888e77 | ||
|
|
5536b38401 | ||
|
|
c011b271a1 | ||
|
|
c21fb81d3e | ||
|
|
5a3dcf5939 | ||
|
|
1d709fe942 | ||
|
|
e55c16146f | ||
|
|
997a9a3e13 | ||
|
|
008f38579c | ||
|
|
d943e86b28 | ||
|
|
3f2d707a83 | ||
|
|
b145a93ad6 | ||
|
|
3056028db4 | ||
|
|
b4dac14720 | ||
|
|
76694b956f | ||
|
|
9fab5b3e3c | ||
|
|
d54491fdd0 | ||
|
|
00c3c3a546 | ||
|
|
1da5c344be | ||
|
|
76d66b5dad | ||
|
|
e502735eb2 | ||
|
|
edfebe1b99 | ||
|
|
250e4f75da | ||
|
|
53f1bdd9c2 | ||
|
|
ade298d0a7 | ||
|
|
387b01ce14 | ||
|
|
47d2094329 | ||
|
|
43f9a8e1f0 | ||
|
|
77f8cae06e | ||
|
|
14122475be | ||
|
|
d881e7ed56 | ||
|
|
9b0054c55f | ||
|
|
baeae97784 | ||
|
|
0324bfa219 | ||
|
|
b279fd025b | ||
|
|
f31546817a | ||
|
|
f272382a9c | ||
|
|
aa8af9d7f8 | ||
|
|
e1f03ae019 | ||
|
|
f316bc6535 | ||
|
|
82e4c66520 | ||
|
|
3c923e0467 | ||
|
|
866985ac88 | ||
|
|
ba772b40ad | ||
|
|
7a86f0e1b7 | ||
|
|
7e9286f2d8 | ||
|
|
b0d1e365ec | ||
|
|
dbd5a2cbf4 | ||
|
|
d60fb1d5c0 | ||
|
|
29c91fcdba | ||
|
|
fe65674f3f | ||
|
|
a3a6b5ed7e | ||
|
|
d2de8658a7 | ||
|
|
be785b4783 | ||
|
|
70e34941c4 | ||
|
|
545d52572d | ||
|
|
dfa0736b49 | ||
|
|
c7bb5664d9 | ||
|
|
6bbc6f3417 | ||
|
|
631169a312 | ||
|
|
427b3312a6 | ||
|
|
2287b0b57a | ||
|
|
56aaba09b1 | ||
|
|
332938fef3 | ||
|
|
13710f7a06 | ||
|
|
530693099b | ||
|
|
f68aa7ea88 | ||
|
|
5bdaee5e40 | ||
|
|
1b465bc2e2 | ||
|
|
e455021bea | ||
|
|
4fe1246bcc | ||
|
|
59b4ac4d5f | ||
|
|
de641fedfe | ||
|
|
cb99fabcc0 | ||
|
|
f996ea12c2 | ||
|
|
4e7fb3e0ea | ||
|
|
e7cbbbef0f | ||
|
|
a181078981 | ||
|
|
987a662b51 | ||
|
|
77e3e14e55 | ||
|
|
98ddf30155 | ||
|
|
83da5c58a2 | ||
|
|
7136ae45a7 | ||
|
|
97d3d61749 | ||
|
|
9c8bf1fe5d | ||
|
|
d1cc6ff3cb | ||
|
|
db76d74820 | ||
|
|
8fdd9d52f9 | ||
|
|
d42797f587 | ||
|
|
6b9c1f6ab8 | ||
|
|
4aedc96db2 | ||
|
|
234830da1e | ||
|
|
244b95968f | ||
|
|
810cd553b5 | ||
|
|
e52eaa961c | ||
|
|
b7827091b8 | ||
|
|
2e344377b5 | ||
|
|
15335ce39d | ||
|
|
14b03e1f8c | ||
|
|
0968b94e5c | ||
|
|
ba6b2258aa | ||
|
|
1e1715ff11 | ||
|
|
c93381fa79 | ||
|
|
65b0a59757 | ||
|
|
c785639043 | ||
|
|
512c259822 | ||
|
|
90fea6f0d4 | ||
|
|
d892468fd0 | ||
|
|
81ab98b329 | ||
|
|
3f1cacd3e6 | ||
|
|
6e41e01a29 | ||
|
|
9ce81488d4 | ||
|
|
25bc2630d9 | ||
|
|
e5b69418a0 | ||
|
|
229a69be5f | ||
|
|
7f2561312a | ||
|
|
93d11a07f9 | ||
|
|
8e5e24c4c6 | ||
|
|
517ee6754c | ||
|
|
47690c287c | ||
|
|
364b95170e | ||
|
|
407006d673 | ||
|
|
2d60605cc6 | ||
|
|
2d1129eb7e | ||
|
|
495b4980e7 | ||
|
|
ad480be112 | ||
|
|
a06001c022 | ||
|
|
6cbda74aeb | ||
|
|
576fbdf490 | ||
|
|
52b00c38ea | ||
|
|
8ec56f459b | ||
|
|
5cbe423461 | ||
|
|
369fbba750 | ||
|
|
8e3c35efc6 | ||
|
|
b3b852b877 | ||
|
|
d5c6e20e9e | ||
|
|
89b36775fb | ||
|
|
df16df5693 | ||
|
|
aa1fd576ac | ||
|
|
2512188ca7 | ||
|
|
89e88ca6a0 | ||
|
|
2697dd162f | ||
|
|
53a4179c4a | ||
|
|
a120731ddd | ||
|
|
bda611a41a | ||
|
|
5a02a4a1a4 | ||
|
|
e59f358b45 | ||
|
|
90c9535b39 | ||
|
|
ad778bbfdb | ||
|
|
8868552b24 | ||
|
|
66826eb487 | ||
|
|
39127b5ee9 | ||
|
|
80cff816a8 | ||
|
|
e9dda8dafa | ||
|
|
11fc818dfb | ||
|
|
84ed844e3f | ||
|
|
50af804f1c | ||
|
|
82ce93bce9 | ||
|
|
228abc8259 | ||
|
|
1692fa5291 | ||
|
|
bb58c6ae38 | ||
|
|
4f58dc27f9 | ||
|
|
fc5324b9f7 | ||
|
|
561f65aabf | ||
|
|
9acfe36b95 | ||
|
|
ce495cbd85 | ||
|
|
c44020f188 | ||
|
|
35e7a695af | ||
|
|
7a55055d22 | ||
|
|
061900b87f | ||
|
|
abe32f7309 | ||
|
|
7bfd4c7fe7 | ||
|
|
859d6a3e2c | ||
|
|
c2f05f99af | ||
|
|
55b33fb02b | ||
|
|
c247e40d41 | ||
|
|
05c58f159d | ||
|
|
67d5fefcf2 | ||
|
|
aad017be9e | ||
|
|
4543dbf3ff | ||
|
|
b1cb7e0a8f | ||
|
|
1c6d21c97d | ||
|
|
fc42fb38c9 | ||
|
|
618068c15b | ||
|
|
808516a0a8 | ||
|
|
7d6b806040 | ||
|
|
6b4e2c9d73 | ||
|
|
787883f6a4 | ||
|
|
7f02753c04 | ||
|
|
8fa38b3445 | ||
|
|
541c5f9f45 | ||
|
|
4b6bd4976a | ||
|
|
a0843d52b4 | ||
|
|
977a8cbed8 | ||
|
|
1e85085305 | ||
|
|
188f61505f | ||
|
|
a514d7f6a4 | ||
|
|
47c2c75ceb | ||
|
|
7082ec8a9a | ||
|
|
2907a84362 | ||
|
|
b8d1ee05c3 | ||
|
|
0b625e624a | ||
|
|
a4da712f91 | ||
|
|
185f124e87 | ||
|
|
8633077691 | ||
|
|
39a1899045 | ||
|
|
4dc011a187 | ||
|
|
ccb12e1dda | ||
|
|
63f0d3e295 | ||
|
|
09d598c496 | ||
|
|
7e60482d80 | ||
|
|
10b3237e52 | ||
|
|
99af7cc028 | ||
|
|
76b360b5d1 | ||
|
|
4001b58a3e | ||
|
|
134a8aac87 | ||
|
|
3e2e48872a | ||
|
|
622b43cbc5 | ||
|
|
75b44ef620 | ||
|
|
00084ea49c | ||
|
|
b6fae24296 | ||
|
|
13c6b7422d | ||
|
|
24f2e663cd | ||
|
|
f96b155988 | ||
|
|
d5cc24e916 | ||
|
|
8eba271c5f | ||
|
|
19955c82b3 | ||
|
|
80ae8aec7c | ||
|
|
d8441d7c81 | ||
|
|
c2446f2478 | ||
|
|
6efb7a1904 | ||
|
|
fa0b03a10f | ||
|
|
3ae2972950 | ||
|
|
2d48de9998 | ||
|
|
3b029cdfe4 | ||
|
|
ea9077a8a5 | ||
|
|
b4af6b6265 | ||
|
|
ae1d53ceb1 | ||
|
|
c3f4709d5e | ||
|
|
a7bb3fc175 | ||
|
|
6a0203f25f | ||
|
|
b0dfcb147f | ||
|
|
06fd4c9357 | ||
|
|
b9ea7fd9ee | ||
|
|
58308a5c7a | ||
|
|
88c7d54975 | ||
|
|
eadb5678b3 | ||
|
|
54e3e60796 | ||
|
|
2a05494abe | ||
|
|
bc89e58def | ||
|
|
3a009b97f6 | ||
|
|
a105f6d5e9 | ||
|
|
5db241c0c0 | ||
|
|
d38dca10e5 | ||
|
|
54fc723126 | ||
|
|
9b8ca17ee4 | ||
|
|
cddc95b39b | ||
|
|
5676529793 | ||
|
|
ce68156cf4 | ||
|
|
5032ad9593 | ||
|
|
b55f765f2e | ||
|
|
856078d435 | ||
|
|
c74c262d2f | ||
|
|
787e29e374 | ||
|
|
e439896c9b | ||
|
|
15b508f1fb | ||
|
|
5651ebfc76 | ||
|
|
593bfc1ce8 | ||
|
|
28953cda7a | ||
|
|
516f3f545d | ||
|
|
83aff65a42 | ||
|
|
5bd97df957 | ||
|
|
8772711181 | ||
|
|
dc9526f4c6 | ||
|
|
9ab36e7ae0 | ||
|
|
e8d30841e7 | ||
|
|
9faf29374e | ||
|
|
75e4818d36 | ||
|
|
a65144e9e0 | ||
|
|
4f29548526 | ||
|
|
528db2cbd8 | ||
|
|
84e6bcc1e6 | ||
|
|
0dc9ff518d | ||
|
|
a2e3bd44aa | ||
|
|
163a0e7caf | ||
|
|
49a86db5f3 | ||
|
|
2640953d8b | ||
|
|
7eb7d67f7a | ||
|
|
e28860ba7f | ||
|
|
49a96b1d91 | ||
|
|
3130812693 | ||
|
|
71ae69aea8 | ||
|
|
9e34d697c7 | ||
|
|
8fa9125d02 | ||
|
|
4b4488c3e4 | ||
|
|
248db7d301 | ||
|
|
e199f2949b | ||
|
|
456b5450a4 | ||
|
|
d8e629c4a3 | ||
|
|
4898c4f297 | ||
|
|
7cd578bbc6 | ||
|
|
1e91df628a | ||
|
|
b110549cbd | ||
|
|
971047835a | ||
|
|
dd4d9eb032 | ||
|
|
8b94f1e480 | ||
|
|
c89610a5c7 | ||
|
|
217963cbed | ||
|
|
c4f4e18340 | ||
|
|
8a7c0e7345 | ||
|
|
52e304d450 | ||
|
|
cfc0eeca53 | ||
|
|
ebd3dd9228 | ||
|
|
cb40e4e7ef | ||
|
|
662dba55fd | ||
|
|
8760ce023c | ||
|
|
b86e148bb7 | ||
|
|
9e83721e5e | ||
|
|
dc2d6c2e60 | ||
|
|
4ada6f6762 |
No files matched your search
@@ -22,4 +22,4 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Clobber for ICU 78.1
|
||||
Clobber for libvpx changes
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
{
|
||||
explicit IteratorState(Accessible* aParent, IteratorState* mParentState = nullptr);
|
||||
|
||||
Accessible* mParent;
|
||||
RefPtr<Accessible> mParent;
|
||||
int32_t mIndex;
|
||||
IteratorState* mParentState;
|
||||
};
|
||||
|
||||
@@ -127,7 +127,6 @@ def old_configure_options(*options):
|
||||
'--enable-alsa',
|
||||
'--enable-appcompat-guid',
|
||||
'--enable-av1',
|
||||
'--enable-jxl',
|
||||
'--enable-b2g-bt',
|
||||
'--enable-b2g-camera',
|
||||
'--enable-b2g-ril',
|
||||
|
||||
@@ -304,12 +304,18 @@ Element::TabIndex()
|
||||
}
|
||||
|
||||
void
|
||||
Element::Focus(mozilla::ErrorResult& aError)
|
||||
Element::Focus(const FocusOptions& aOptions, ErrorResult& aError)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(this);
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
// Also other browsers seem to have the hack to not re-focus (and flush) when
|
||||
// the element is already focused.
|
||||
// Until https://github.com/whatwg/html/issues/4512 is clarified, we'll
|
||||
// maintain interoperatibility by not re-focusing, independent of aOptions.
|
||||
// I.e., `focus({ preventScroll: true})` followed by `focus( { preventScroll:
|
||||
// false })` won't re-focus.
|
||||
if (fm && domElement) {
|
||||
aError = fm->SetFocus(domElement, 0);
|
||||
aError = fm->SetFocus(domElement, nsFocusManager::FocusOptionsToFocusManagerFlags(aOptions));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ public:
|
||||
/**
|
||||
* Make focus on this element.
|
||||
*/
|
||||
virtual void Focus(mozilla::ErrorResult& aError);
|
||||
virtual void Focus(const FocusOptions& aOptions, ErrorResult& aError);
|
||||
|
||||
/**
|
||||
* Show blur and clear focus.
|
||||
|
||||
@@ -400,6 +400,7 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
|
||||
layers::PlanarYCbCrImage* ycbcrImage = static_cast<layers::PlanarYCbCrImage*> (aImage);
|
||||
gfxImageFormat format = SurfaceFormat::A8R8G8B8_UINT32;
|
||||
uint32_t stride = GetAlignedStride<16>(aSize.width, 4);
|
||||
auto size = stride * aSize.height;
|
||||
size_t length = BufferSizeFromStrideAndHeight(stride, aSize.height);
|
||||
if (length == 0) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
@@ -413,10 +414,10 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
|
||||
stride);
|
||||
|
||||
rv = aEncoder->InitFromData(data.Elements(),
|
||||
aSize.width * aSize.height * 4,
|
||||
size,
|
||||
aSize.width,
|
||||
aSize.height,
|
||||
aSize.width * 4,
|
||||
stride,
|
||||
imgIEncoder::INPUT_FORMAT_HOSTARGB,
|
||||
aOptions);
|
||||
} else {
|
||||
@@ -433,10 +434,10 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
rv = aEncoder->InitFromData(map.mData,
|
||||
aSize.width * aSize.height * 4,
|
||||
map.mStride * aSize.height,
|
||||
aSize.width,
|
||||
aSize.height,
|
||||
aSize.width * 4,
|
||||
map.mStride,
|
||||
imgIEncoder::INPUT_FORMAT_HOSTARGB,
|
||||
aOptions);
|
||||
dataSurface->Unmap();
|
||||
@@ -467,10 +468,10 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
rv = aEncoder->InitFromData(map.mData,
|
||||
aSize.width * aSize.height * 4,
|
||||
map.mStride * aSize.height,
|
||||
aSize.width,
|
||||
aSize.height,
|
||||
aSize.width * 4,
|
||||
map.mStride,
|
||||
imgIEncoder::INPUT_FORMAT_HOSTARGB,
|
||||
aOptions);
|
||||
emptyCanvas->Unmap();
|
||||
|
||||
@@ -523,7 +523,8 @@ nsContentList::NamedItem(const nsAString& aName, bool aDoFlush)
|
||||
}
|
||||
|
||||
void
|
||||
nsContentList::GetSupportedNames(nsTArray<nsString>& aNames)
|
||||
nsContentList::GetSupportedNames(nsTArray<nsString>& aNames,
|
||||
FilterElementWithName aFilter)
|
||||
{
|
||||
BringSelfUpToDate(true);
|
||||
|
||||
@@ -546,7 +547,8 @@ nsContentList::GetSupportedNames(nsTArray<nsString>& aNames)
|
||||
// Note: nsINode::HasName means the name is exposed on the document,
|
||||
// which is false for options, so we don't check it here.
|
||||
const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
|
||||
if (val && val->Type() == nsAttrValue::eAtom) {
|
||||
if (val && val->Type() == nsAttrValue::eAtom &&
|
||||
(!aFilter || aFilter(el))) {
|
||||
nsIAtom* name = val->GetAtomValue();
|
||||
MOZ_ASSERT(name != nsGkAtoms::_empty,
|
||||
"Empty names don't get atomized");
|
||||
|
||||
@@ -295,7 +295,9 @@ public:
|
||||
aFound = !!item;
|
||||
return item;
|
||||
}
|
||||
virtual void GetSupportedNames(nsTArray<nsString>& aNames) override;
|
||||
virtual void GetSupportedNames(nsTArray<nsString>& aNames) override {
|
||||
GetSupportedNames(aNames, nullptr);
|
||||
}
|
||||
|
||||
// nsContentList public methods
|
||||
uint32_t Length(bool aDoFlush);
|
||||
@@ -303,6 +305,12 @@ public:
|
||||
mozilla::dom::Element*
|
||||
NamedItem(const nsAString& aName, bool aDoFlush);
|
||||
|
||||
// Used by HTMLAllCollection to limit the elements whose name attribute is
|
||||
// considered. The filter MUST NOT cause any flushes.
|
||||
using FilterElementWithName = bool (*)(nsIContent*);
|
||||
void GetSupportedNames(nsTArray<nsString>& aNames,
|
||||
FilterElementWithName aFilter);
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
|
||||
@@ -2259,6 +2259,31 @@ nsContentUtils::IsCallerContentXBL()
|
||||
return xpc::IsContentXBLScope(c);
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::IsSystemCaller(JSContext* aCx)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// This is similar to what SubjectPrincipal() does, except we do in fact
|
||||
// assume that we're in a compartment here; anyone who calls this function in
|
||||
// situations where that's not the case is doing it wrong.
|
||||
JSCompartment *compartment = js::GetContextCompartment(aCx);
|
||||
MOZ_ASSERT(compartment);
|
||||
|
||||
JSPrincipals *principals = JS_GetCompartmentPrincipals(compartment);
|
||||
return nsJSPrincipals::get(principals) == sSystemPrincipal;
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::ThreadsafeIsSystemCaller(JSContext* aCx)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return IsSystemCaller(aCx);
|
||||
}
|
||||
|
||||
return workers::GetWorkerPrivateFromContext(aCx)->UsesSystemPrincipal();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
|
||||
@@ -7336,6 +7361,17 @@ nsContentUtils::HasDistributedChildren(nsIContent* aContent)
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
bool nsContentUtils::IsNodeInEditableRegion(nsINode* aNode) {
|
||||
while (aNode) {
|
||||
if (aNode->IsEditable()) {
|
||||
return true;
|
||||
}
|
||||
aNode = aNode->GetParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::IsForbiddenRequestHeader(const nsACString& aHeader,
|
||||
|
||||
@@ -202,6 +202,23 @@ public:
|
||||
static bool ThreadsafeIsCallerChrome();
|
||||
static bool IsCallerContentXBL();
|
||||
|
||||
// The APIs for checking whether the caller is system (in the sense of system
|
||||
// principal) should only be used when the JSContext is known to accurately
|
||||
// represent the caller. In practice, that means you should only use them in
|
||||
// two situations at the moment:
|
||||
//
|
||||
// 1) Functions used in WebIDL Func annotations.
|
||||
// 2) Bindings code.
|
||||
//
|
||||
// Use pretty much anywhere else is almost certainly wrong and should be
|
||||
// replaced with [NeedsCallerType] annotations in bindings.
|
||||
|
||||
// Check whether the caller is system if you know you're on the main thread.
|
||||
static bool IsSystemCaller(JSContext* aCx);
|
||||
|
||||
// Check whether the caller is system if you might be on a worker thread.
|
||||
static bool ThreadsafeIsSystemCaller(JSContext* aCx);
|
||||
|
||||
// In the traditional Gecko architecture, both C++ code and untrusted JS code
|
||||
// needed to rely on the same XPCOM method/getter/setter to get work done.
|
||||
// This required lots of security checks in the various exposed methods, which
|
||||
@@ -2550,6 +2567,13 @@ public:
|
||||
*/
|
||||
static bool GPCEnabled();
|
||||
|
||||
/**
|
||||
* Returns whether a node has an editable ancestor.
|
||||
*
|
||||
* @param aNode The node to test.
|
||||
*/
|
||||
static bool IsNodeInEditableRegion(nsINode* aNode);
|
||||
|
||||
/**
|
||||
* Returns a LogModule that dump calls from content script are logged to.
|
||||
* This can be enabled with the 'Dump' module, and is useful for synchronizing
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ElementBinding.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/dom/HTMLInputElement.h"
|
||||
#include "mozilla/dom/HTMLSlotElement.h"
|
||||
@@ -2999,6 +3000,11 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindowOuter* aWindow,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t nsFocusManager::FocusOptionsToFocusManagerFlags(
|
||||
const mozilla::dom::FocusOptions& aOptions) {
|
||||
return aOptions.mPreventScroll ? nsIFocusManager::FLAG_NOSCROLL : 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsHostOrSlot(nsIContent* aContent)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ class nsIMessageBroadcaster;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
struct FocusOptions;
|
||||
class TabParent;
|
||||
}
|
||||
}
|
||||
@@ -110,6 +111,9 @@ public:
|
||||
static nsIContent* GetFocusedDescendant(nsPIDOMWindowOuter* aWindow, bool aDeep,
|
||||
nsPIDOMWindowOuter** aFocusedWindow);
|
||||
|
||||
static uint32_t FocusOptionsToFocusManagerFlags(
|
||||
const mozilla::dom::FocusOptions& aOptions);
|
||||
|
||||
/**
|
||||
* Returns the content node that focus will be redirected to if aContent was
|
||||
* focused. This is used for the special case of certain XUL elements such
|
||||
|
||||
@@ -7395,9 +7395,10 @@ nsGlobalWindow::Confirm(const nsAString& aMessage,
|
||||
|
||||
already_AddRefed<Promise>
|
||||
nsGlobalWindow::Fetch(const RequestOrUSVString& aInput,
|
||||
const RequestInit& aInit, ErrorResult& aRv)
|
||||
const RequestInit& aInit,
|
||||
CallerType aCallerType, ErrorResult& aRv)
|
||||
{
|
||||
return FetchRequest(this, aInput, aInit, aRv);
|
||||
return FetchRequest(this, aInput, aInit, aCallerType, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -929,6 +929,7 @@ public:
|
||||
already_AddRefed<mozilla::dom::cache::CacheStorage> GetCaches(mozilla::ErrorResult& aRv);
|
||||
already_AddRefed<mozilla::dom::Promise> Fetch(const mozilla::dom::RequestOrUSVString& aInput,
|
||||
const mozilla::dom::RequestInit& aInit,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv);
|
||||
void PrintOuter(mozilla::ErrorResult& aError);
|
||||
void Print(mozilla::ErrorResult& aError);
|
||||
|
||||
@@ -37,7 +37,7 @@ native Visibility(mozilla::Visibility);
|
||||
* observers to check which request they are getting notifications for.
|
||||
*
|
||||
* Please make sure to update the MozImageLoadingContent WebIDL
|
||||
* interface to mirror this interface when changing it.
|
||||
* mixin to mirror this interface when changing it.
|
||||
*/
|
||||
|
||||
[scriptable, builtinclass, uuid(0357123d-9224-4d12-a47e-868c32689777)]
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
@@ -33,17 +33,29 @@ nsWrapperCache::HoldJSObjects(void* aScriptObjectHolder,
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsNurseryWrapper(JSObject* aWrapper) {
|
||||
return aWrapper && !JS::ObjectIsTenured(aWrapper);
|
||||
}
|
||||
|
||||
void
|
||||
nsWrapperCache::SetWrapperJSObject(JSObject* aWrapper)
|
||||
{
|
||||
mWrapper = aWrapper;
|
||||
nsWrapperCache::SetWrapperJSObject(JSObject* aNewWrapper) {
|
||||
JSObject* oldWrapper = mWrapper;
|
||||
mWrapper = aNewWrapper;
|
||||
UnsetWrapperFlags(kWrapperFlagsMask & ~WRAPPER_IS_NOT_DOM_BINDING);
|
||||
|
||||
if (aWrapper && !JS::ObjectIsTenured(aWrapper)) {
|
||||
if (IsNurseryWrapper(aNewWrapper) && !IsNurseryWrapper(oldWrapper)) {
|
||||
CycleCollectedJSContext::Get()->NurseryWrapperAdded(this);
|
||||
}
|
||||
}
|
||||
|
||||
void nsWrapperCache::ClearWrapperOnWrapFailure() {
|
||||
if (IsNurseryWrapper(mWrapper)) {
|
||||
CycleCollectedJSContext::Get()->NurseryWrapperRemovedSlow(this);
|
||||
}
|
||||
ClearWrapper();
|
||||
}
|
||||
|
||||
void
|
||||
nsWrapperCache::ReleaseWrapper(void* aScriptObjectHolder)
|
||||
{
|
||||
|
||||
@@ -131,6 +131,8 @@ public:
|
||||
SetWrapperJSObject(nullptr);
|
||||
}
|
||||
|
||||
void ClearWrapperOnWrapFailure();
|
||||
|
||||
/**
|
||||
* Update the wrapper if the object it contains is moved.
|
||||
*
|
||||
|
||||
@@ -2210,11 +2210,6 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
|
||||
js::GetReservedOrProxyPrivateSlot(aObj, DOM_OBJECT_SLOT));
|
||||
js::SetReservedOrProxyPrivateSlot(aObj, DOM_OBJECT_SLOT, JS::PrivateValue(nullptr));
|
||||
|
||||
aObj = xpc::TransplantObject(aCx, aObj, newobj);
|
||||
if (!aObj) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
nsWrapperCache* cache = nullptr;
|
||||
CallQueryInterface(native, &cache);
|
||||
bool preserving = cache->PreservingWrapper();
|
||||
@@ -2222,6 +2217,20 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
|
||||
cache->SetWrapper(aObj);
|
||||
cache->SetPreservingWrapper(preserving);
|
||||
|
||||
aObj = xpc::TransplantObject(aCx, aObj, newobj);
|
||||
if (!aObj) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
// Update the wrapper cache again if transplanting didn't use newobj but
|
||||
// returned some other object.
|
||||
if (aObj != newobj) {
|
||||
preserving = cache->PreservingWrapper();
|
||||
cache->SetPreservingWrapper(false);
|
||||
cache->SetWrapper(aObj);
|
||||
cache->SetPreservingWrapper(preserving);
|
||||
}
|
||||
|
||||
if (propertyHolder) {
|
||||
JS::Rooted<JSObject*> copyTo(aCx);
|
||||
if (isProxy) {
|
||||
|
||||
+11
-23
@@ -3711,7 +3711,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
|
||||
failureCode = dedent(
|
||||
"""
|
||||
aCache->ReleaseWrapper(aObject);
|
||||
aCache->ClearWrapper();
|
||||
aCache->ClearWrapperOnWrapFailure();
|
||||
return false;
|
||||
""")
|
||||
|
||||
@@ -4464,9 +4464,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||
isOptional=False,
|
||||
invalidEnumValueFatal=True,
|
||||
defaultValue=None,
|
||||
treatNullAs="Default",
|
||||
isEnforceRange=False,
|
||||
isClamp=False,
|
||||
isNullOrUndefined=False,
|
||||
exceptionCode=None,
|
||||
lenientFloatCode=None,
|
||||
@@ -4544,6 +4541,12 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||
# And we can't both be an object and be null or undefined
|
||||
assert not isDefinitelyObject or not isNullOrUndefined
|
||||
|
||||
# Types can also have extended attributes, copy them over
|
||||
isClamp = type.clamp
|
||||
isEnforceRange = type.enforceRange
|
||||
if type.treatNullAsEmpty:
|
||||
treatNullAs = "EmptyString"
|
||||
|
||||
# If exceptionCode is not set, we'll just rethrow the exception we got.
|
||||
# Note that we can't just set failureCode to exceptionCode, because setting
|
||||
# failureCode will prevent pending exceptions from being set in cases when
|
||||
@@ -5648,6 +5651,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||
undefinedBehavior = "eNull"
|
||||
else:
|
||||
undefinedBehavior = "eStringify"
|
||||
if type.treatNullAsEmpty:
|
||||
treatNullAs = "EmptyString"
|
||||
else:
|
||||
treatNullAs = "Default"
|
||||
nullBehavior = treatAs[treatNullAs]
|
||||
|
||||
def getConversionCode(varName):
|
||||
@@ -6297,9 +6304,6 @@ class CGArgumentConverter(CGThing):
|
||||
not self.argument.variadic),
|
||||
invalidEnumValueFatal=self.invalidEnumValueFatal,
|
||||
defaultValue=self.argument.defaultValue,
|
||||
treatNullAs=self.argument.treatNullAs,
|
||||
isEnforceRange=self.argument.enforceRange,
|
||||
isClamp=self.argument.clamp,
|
||||
lenientFloatCode=self.lenientFloatCode,
|
||||
isMember="Variadic" if self.argument.variadic else False,
|
||||
allowTreatNonCallableAsNull=self.argument.allowTreatNonCallableAsNull(),
|
||||
@@ -8370,18 +8374,6 @@ class FakeArgument():
|
||||
self.variadic = False
|
||||
self.defaultValue = None
|
||||
self._allowTreatNonCallableAsNull = allowTreatNonCallableAsNull
|
||||
# For FakeArguments generated by maplike/setlike convenience functions,
|
||||
# we won't have an interfaceMember to pass in.
|
||||
if interfaceMember:
|
||||
self.treatNullAs = interfaceMember.treatNullAs
|
||||
else:
|
||||
self.treatNullAs = "Default"
|
||||
if isinstance(interfaceMember, IDLAttribute):
|
||||
self.enforceRange = interfaceMember.enforceRange
|
||||
self.clamp = interfaceMember.clamp
|
||||
else:
|
||||
self.enforceRange = False
|
||||
self.clamp = False
|
||||
|
||||
self.identifier = FakeIdentifier(name)
|
||||
|
||||
@@ -11063,7 +11055,6 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
||||
argument = arguments[1]
|
||||
info = getJSToNativeConversionInfo(
|
||||
argument.type, descriptor,
|
||||
treatNullAs=argument.treatNullAs,
|
||||
sourceDescription=("value being assigned to %s setter" %
|
||||
descriptor.interface.identifier.name))
|
||||
if argumentHandleValue is None:
|
||||
@@ -12694,8 +12685,6 @@ class CGDictionary(CGThing):
|
||||
getJSToNativeConversionInfo(
|
||||
member.type,
|
||||
descriptorProvider,
|
||||
isEnforceRange=member.enforceRange,
|
||||
isClamp=member.clamp,
|
||||
isMember="Dictionary",
|
||||
isOptional=member.canHaveMissingValue(),
|
||||
defaultValue=member.defaultValue,
|
||||
@@ -15575,7 +15564,6 @@ class CGCallbackInterface(CGCallback):
|
||||
|
||||
class FakeMember():
|
||||
def __init__(self, name=None):
|
||||
self.treatNullAs = "Default"
|
||||
if name is not None:
|
||||
self.identifier = FakeIdentifier(name)
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ class Configuration(DescriptorProvider):
|
||||
# Our build system doesn't support dep build involving
|
||||
# addition/removal of "implements" statements that appear in a
|
||||
# different .webidl file than their LHS interface. Make sure we
|
||||
# don't have any of those.
|
||||
# don't have any of those. See similar block below for partial
|
||||
# interfaces!
|
||||
#
|
||||
# But whitelist a RHS that is LegacyQueryInterface,
|
||||
# since people shouldn't be adding any of those.
|
||||
@@ -66,6 +67,33 @@ class Configuration(DescriptorProvider):
|
||||
if not thing.isInterface() and not thing.isNamespace():
|
||||
continue
|
||||
iface = thing
|
||||
# Our build system doesn't support dep builds involving
|
||||
# addition/removal of partial interfaces that appear in a different
|
||||
# .webidl file than the interface they are extending. Make sure we
|
||||
# don't have any of those. See similar block above for "implements"
|
||||
# statements!
|
||||
if not iface.isExternal():
|
||||
for partialIface in iface.getPartials():
|
||||
if (partialIface.filename() != iface.filename() and
|
||||
# Unfortunately, NavigatorProperty does exactly the
|
||||
# thing we're trying to prevent here. I'm not sure how
|
||||
# to deal with that, short of effectively requiring a
|
||||
# clobber when NavigatorProperty is added/removed and
|
||||
# whitelisting the things it outputs here as
|
||||
# restrictively as I can.
|
||||
(partialIface.identifier.name != "Navigator" or
|
||||
len(partialIface.members) != 1 or
|
||||
partialIface.members[0].location != partialIface.location or
|
||||
partialIface.members[0].identifier.location.filename() !=
|
||||
"<builtin>")):
|
||||
raise TypeError(
|
||||
"The binding build system doesn't really support "
|
||||
"partial interfaces which don't appear in the "
|
||||
"file in which the interface they are extending is "
|
||||
"defined. Don't do this.\n"
|
||||
"%s\n"
|
||||
"%s" %
|
||||
(partialIface.location, iface.location))
|
||||
self.interfaces[iface.identifier.name] = iface
|
||||
if iface.identifier.name not in config:
|
||||
# Completely skip consequential interfaces with no descriptor
|
||||
|
||||
@@ -164,6 +164,7 @@ public:
|
||||
|
||||
void Throw(nsresult rv) {
|
||||
MOZ_ASSERT(NS_FAILED(rv), "Please don't try throwing success");
|
||||
ClearUnionData();
|
||||
AssignErrorCode(rv);
|
||||
}
|
||||
|
||||
@@ -324,6 +325,7 @@ public:
|
||||
// Throw() here because people can easily pass success codes to
|
||||
// this.
|
||||
void operator=(nsresult rv) {
|
||||
ClearUnionData();
|
||||
AssignErrorCode(rv);
|
||||
}
|
||||
|
||||
@@ -393,6 +395,7 @@ private:
|
||||
}
|
||||
|
||||
void AssignErrorCode(nsresult aRv) {
|
||||
MOZ_ASSERT(mUnionState == HasNothing);
|
||||
MOZ_ASSERT(aRv != NS_ERROR_TYPE_ERR, "Use ThrowTypeError()");
|
||||
MOZ_ASSERT(aRv != NS_ERROR_RANGE_ERR, "Use ThrowRangeError()");
|
||||
MOZ_ASSERT(!IsErrorWithMessage(), "Don't overwrite errors with message");
|
||||
|
||||
@@ -13,7 +13,7 @@ from mozbuild import shellutil
|
||||
# (whether camelCase, _underscorePrefixed, etc.) and the given array of
|
||||
# extended attributes.
|
||||
def generateLine(propName, extendedAttrs):
|
||||
return " [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs),
|
||||
return " [%s] attribute [TreatNullAs=EmptyString] DOMString %s;\n" % (", ".join(extendedAttrs),
|
||||
propName)
|
||||
def generate(output, idlFilename, preprocessorHeader):
|
||||
print(idlFilename)
|
||||
@@ -30,7 +30,7 @@ def generate(output, idlFilename, preprocessorHeader):
|
||||
continue
|
||||
# Unfortunately, even some of the getters here are fallible
|
||||
# (e.g. on nsComputedDOMStyle).
|
||||
extendedAttrs = ["Throws", "TreatNullAs=EmptyString"]
|
||||
extendedAttrs = ["Throws"]
|
||||
if pref is not "":
|
||||
extendedAttrs.append('Pref="%s"' % pref)
|
||||
|
||||
|
||||
+692
-299
File diff suppressed because it is too large.
Load diff
Vendored
+7
-5
@@ -311,7 +311,7 @@ Cache::MatchAll(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Cache::Add(JSContext* aContext, const RequestOrUSVString& aRequest,
|
||||
ErrorResult& aRv)
|
||||
CallerType aCallerType, ErrorResult& aRv)
|
||||
{
|
||||
if (NS_WARN_IF(!mActor)) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
@@ -341,12 +341,13 @@ Cache::Add(JSContext* aContext, const RequestOrUSVString& aRequest,
|
||||
}
|
||||
|
||||
requestList.AppendElement(Move(request));
|
||||
return AddAll(global, Move(requestList), aRv);
|
||||
return AddAll(global, Move(requestList), aCallerType, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Cache::AddAll(JSContext* aContext,
|
||||
const Sequence<OwningRequestOrUSVString>& aRequestList,
|
||||
CallerType aCallerType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (NS_WARN_IF(!mActor)) {
|
||||
@@ -390,7 +391,7 @@ Cache::AddAll(JSContext* aContext,
|
||||
requestList.AppendElement(Move(request));
|
||||
}
|
||||
|
||||
return AddAll(global, Move(requestList), aRv);
|
||||
return AddAll(global, Move(requestList), aCallerType, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
@@ -579,7 +580,8 @@ Cache::ExecuteOp(AutoChildOpArgs& aOpArgs, ErrorResult& aRv)
|
||||
|
||||
already_AddRefed<Promise>
|
||||
Cache::AddAll(const GlobalObject& aGlobal,
|
||||
nsTArray<RefPtr<Request>>&& aRequestList, ErrorResult& aRv)
|
||||
nsTArray<RefPtr<Request>>&& aRequestList,
|
||||
CallerType aCallerType, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(mActor);
|
||||
|
||||
@@ -605,7 +607,7 @@ Cache::AddAll(const GlobalObject& aGlobal,
|
||||
RequestOrUSVString requestOrString;
|
||||
requestOrString.SetAsRequest() = aRequestList[i];
|
||||
RefPtr<Promise> fetch = FetchRequest(mGlobal, requestOrString,
|
||||
RequestInit(), aRv);
|
||||
RequestInit(), aCallerType, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Vendored
+5
-3
@@ -28,6 +28,7 @@ class RequestOrUSVString;
|
||||
class Response;
|
||||
template<typename T> class Optional;
|
||||
template<typename T> class Sequence;
|
||||
enum class CallerType : uint32_t;
|
||||
|
||||
namespace cache {
|
||||
|
||||
@@ -50,10 +51,11 @@ public:
|
||||
const CacheQueryOptions& aOptions, ErrorResult& aRv);
|
||||
already_AddRefed<Promise>
|
||||
Add(JSContext* aContext, const RequestOrUSVString& aRequest,
|
||||
ErrorResult& aRv);
|
||||
CallerType aCallerType, ErrorResult& aRv);
|
||||
already_AddRefed<Promise>
|
||||
AddAll(JSContext* aContext,
|
||||
const Sequence<OwningRequestOrUSVString>& aRequests, ErrorResult& aRv);
|
||||
const Sequence<OwningRequestOrUSVString>& aRequests,
|
||||
CallerType aCallerType, ErrorResult& aRv);
|
||||
already_AddRefed<Promise>
|
||||
Put(JSContext* aCx, const RequestOrUSVString& aRequest, Response& aResponse,
|
||||
ErrorResult& aRv);
|
||||
@@ -97,7 +99,7 @@ private:
|
||||
|
||||
already_AddRefed<Promise>
|
||||
AddAll(const GlobalObject& aGlobal, nsTArray<RefPtr<Request>>&& aRequestList,
|
||||
ErrorResult& aRv);
|
||||
CallerType aCallerType, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
PutAll(JSContext* aCx, const nsTArray<RefPtr<Request>>& aRequestList,
|
||||
|
||||
@@ -4356,6 +4356,9 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
||||
textToDraw.Truncate();
|
||||
}
|
||||
|
||||
// This is only needed to know if we can know the drawing bounding box easily.
|
||||
const bool doCalculateBounds = NeedToCalculateBounds();
|
||||
|
||||
// for now, default to ltr if not in doc
|
||||
bool isRTL = false;
|
||||
|
||||
@@ -4376,8 +4379,6 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
||||
isRTL = GET_BIDI_OPTION_DIRECTION(document->GetBidiOptions()) == IBMBIDI_TEXTDIRECTION_RTL;
|
||||
}
|
||||
|
||||
// This is only needed to know if we can know the drawing bounding box easily.
|
||||
const bool doCalculateBounds = NeedToCalculateBounds();
|
||||
if (presShell->IsDestroying()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -890,7 +890,9 @@ protected:
|
||||
* last call to UpdateFilter and now.
|
||||
*/
|
||||
const gfx::FilterDescription& EnsureUpdatedFilter() {
|
||||
bool isWriteOnly = mCanvasElement && mCanvasElement->IsWriteOnly();
|
||||
bool isWriteOnly = IsWriteOnly() ||
|
||||
(mCanvasElement && mCanvasElement->IsWriteOnly()) ||
|
||||
(mOffscreenCanvas && mOffscreenCanvas->IsWriteOnly());
|
||||
if (CurrentState().filterSourceGraphicTainted != isWriteOnly) {
|
||||
UpdateFilter();
|
||||
EnsureTarget();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "WebGLActiveInfo.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLContextUtils.h"
|
||||
#include "WebGLFramebuffer.h"
|
||||
@@ -27,6 +28,30 @@ namespace mozilla {
|
||||
// For a Tegra workaround.
|
||||
static const int MAX_DRAW_CALLS_SINCE_FLUSH = 100;
|
||||
|
||||
static uint8_t
|
||||
NumUsedLocationsByElemTypeForDraw(GLenum elemType)
|
||||
{
|
||||
switch (elemType) {
|
||||
case LOCAL_GL_FLOAT_MAT2:
|
||||
case LOCAL_GL_FLOAT_MAT2x3:
|
||||
case LOCAL_GL_FLOAT_MAT2x4:
|
||||
return 2;
|
||||
|
||||
case LOCAL_GL_FLOAT_MAT3x2:
|
||||
case LOCAL_GL_FLOAT_MAT3:
|
||||
case LOCAL_GL_FLOAT_MAT3x4:
|
||||
return 3;
|
||||
|
||||
case LOCAL_GL_FLOAT_MAT4x2:
|
||||
case LOCAL_GL_FLOAT_MAT4x3:
|
||||
case LOCAL_GL_FLOAT_MAT4:
|
||||
return 4;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
class ScopedResolveTexturesForDraw
|
||||
@@ -331,6 +356,7 @@ class ScopedDrawHelper final
|
||||
{
|
||||
WebGLContext* const mWebGL;
|
||||
bool mDidFake;
|
||||
std::vector<GLuint> mDisabledUnusedAttribs;
|
||||
|
||||
public:
|
||||
ScopedDrawHelper(WebGLContext* webgl, const char* funcName, uint32_t firstVertex,
|
||||
@@ -367,11 +393,43 @@ public:
|
||||
}
|
||||
mDidFake = true;
|
||||
|
||||
const auto& linkInfo = mWebGL->mActiveProgramLinkInfo;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (mWebGL->gl->WorkAroundDriverBugs()) {
|
||||
std::vector<bool> isActiveAttrib(mWebGL->mBoundVertexArray->mAttribs.Length(),
|
||||
false);
|
||||
for (const auto& progAttrib : linkInfo->attribs) {
|
||||
const auto loc = progAttrib.mLoc;
|
||||
if (loc < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto usedLocs =
|
||||
NumUsedLocationsByElemTypeForDraw(progAttrib.mActiveInfo->mElemType);
|
||||
for (uint32_t i = 0; i < usedLocs; ++i) {
|
||||
const auto usedLoc = static_cast<uint32_t>(loc) + i;
|
||||
if (usedLoc < isActiveAttrib.size()) {
|
||||
isActiveAttrib[usedLoc] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < mWebGL->mBoundVertexArray->mAttribs.Length(); ++i) {
|
||||
const auto& attrib = mWebGL->mBoundVertexArray->mAttribs[i];
|
||||
if (!attrib.mEnabled || isActiveAttrib[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mWebGL->gl->fDisableVertexAttribArray(i);
|
||||
mDisabledUnusedAttribs.push_back(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
////
|
||||
// Check UBO sizes.
|
||||
|
||||
const auto& linkInfo = mWebGL->mActiveProgramLinkInfo;
|
||||
|
||||
for (const auto& cur : linkInfo->uniformBlocks) {
|
||||
const auto& dataSize = cur->mDataSize;
|
||||
const auto& binding = cur->mBinding;
|
||||
@@ -477,6 +535,10 @@ public:
|
||||
if (mDidFake) {
|
||||
mWebGL->UndoFakeVertexAttrib0();
|
||||
}
|
||||
|
||||
for (const auto loc : mDisabledUnusedAttribs) {
|
||||
mWebGL->gl->fEnableVertexAttribArray(loc);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -607,12 +669,12 @@ WebGLContext::DrawArraysInstanced(GLenum mode, GLint first, GLsizei vertCount,
|
||||
return;
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
if (vertCount > mMaxVertIdsPerDraw) {
|
||||
ErrorOutOfMemory(
|
||||
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vertCount > mMaxVertIdsPerDraw) {
|
||||
ErrorOutOfMemory(
|
||||
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
|
||||
return;
|
||||
}
|
||||
|
||||
bool error = false;
|
||||
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
|
||||
@@ -855,12 +917,12 @@ WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei vertCount, GLenum type,
|
||||
return;
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
if (vertCount > mMaxVertIdsPerDraw) {
|
||||
ErrorOutOfMemory(
|
||||
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vertCount > mMaxVertIdsPerDraw) {
|
||||
ErrorOutOfMemory(
|
||||
"Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
|
||||
return;
|
||||
}
|
||||
|
||||
bool error = false;
|
||||
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
|
||||
|
||||
@@ -753,6 +753,7 @@ private:
|
||||
}
|
||||
|
||||
Sequence<JS::Value> arguments;
|
||||
SequenceRooter<JS::Value> rooter(aCx, &arguments);
|
||||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
|
||||
@@ -1118,6 +1118,11 @@ public:
|
||||
}
|
||||
|
||||
mSaltLength = params.mSaltLength;
|
||||
// Reject absurdly large salt values.
|
||||
if (mSaltLength > 8192) {
|
||||
mEarlyRv = NS_ERROR_DOM_OPERATION_ERR;
|
||||
return;
|
||||
}
|
||||
} else if (algName.EqualsLiteral(WEBCRYPTO_ALG_ECDSA)) {
|
||||
mAlgorithm = Algorithm::ECDSA;
|
||||
CHECK_KEY_ALGORITHM(aKey.Algorithm(), WEBCRYPTO_ALG_ECDSA);
|
||||
|
||||
@@ -1632,8 +1632,12 @@ EventListenerManager::GetTypedEventHandler(nsIAtom* aEventName,
|
||||
|
||||
JSEventHandler* jsEventHandler = listener->GetJSEventHandler();
|
||||
|
||||
Maybe<RefPtr<JSEventHandler>> pin;
|
||||
if (listener->mHandlerIsString) {
|
||||
CompileEventHandlerInternal(listener, nullptr, nullptr);
|
||||
pin.emplace(jsEventHandler);
|
||||
if (NS_FAILED(CompileEventHandlerInternal(listener, nullptr, nullptr))) {
|
||||
listener = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const TypedEventHandler& typedHandler =
|
||||
|
||||
+4
-5
@@ -21,6 +21,7 @@
|
||||
#include "nsProxyRelease.h"
|
||||
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/BodyUtil.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/Exceptions.h"
|
||||
@@ -317,7 +318,7 @@ public:
|
||||
|
||||
already_AddRefed<Promise>
|
||||
FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
|
||||
const RequestInit& aInit, ErrorResult& aRv)
|
||||
const RequestInit& aInit, CallerType aCallerType, ErrorResult& aRv)
|
||||
{
|
||||
RefPtr<Promise> p = Promise::Create(aGlobal, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
@@ -325,12 +326,10 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
|
||||
}
|
||||
|
||||
// Double check that we have chrome privileges if the Request's content
|
||||
// policy type has been overridden. Note, we must do this before
|
||||
// entering the global below. Otherwise the IsCallerChrome() will
|
||||
// always fail.
|
||||
// policy type has been overridden.
|
||||
MOZ_ASSERT_IF(aInput.IsRequest() &&
|
||||
aInput.GetAsRequest().IsContentPolicyTypeOverridden(),
|
||||
nsContentUtils::IsCallerChrome());
|
||||
aCallerType == CallerType::System);
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (!jsapi.Init(aGlobal)) {
|
||||
|
||||
+3
-1
@@ -35,6 +35,7 @@ class InternalRequest;
|
||||
class OwningBlobOrArrayBufferViewOrArrayBufferOrFormDataOrURLSearchParamsOrUSVString;
|
||||
struct ReadableStream;
|
||||
class RequestOrUSVString;
|
||||
enum class CallerType : uint32_t;
|
||||
|
||||
namespace workers {
|
||||
class WorkerPrivate;
|
||||
@@ -42,7 +43,8 @@ class WorkerPrivate;
|
||||
|
||||
already_AddRefed<Promise>
|
||||
FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
|
||||
const RequestInit& aInit, ErrorResult& aRv);
|
||||
const RequestInit& aInit, CallerType aCallerType,
|
||||
ErrorResult& aRv);
|
||||
|
||||
nsresult
|
||||
UpdateRequestReferrer(nsIGlobalObject* aGlobal, InternalRequest* aRequest);
|
||||
|
||||
@@ -162,42 +162,7 @@ HTMLAllCollection::NamedGetter(const nsAString& aID,
|
||||
void
|
||||
HTMLAllCollection::GetSupportedNames(nsTArray<nsString>& aNames)
|
||||
{
|
||||
// XXXbz this is very similar to nsContentList::GetSupportedNames,
|
||||
// but has to check IsAllNamedElement for the name case.
|
||||
AutoTArray<nsIAtom*, 8> atoms;
|
||||
for (uint32_t i = 0; i < Length(); ++i) {
|
||||
nsIContent *content = Item(i);
|
||||
if (content->HasID()) {
|
||||
nsIAtom* id = content->GetID();
|
||||
MOZ_ASSERT(id != nsGkAtoms::_empty,
|
||||
"Empty ids don't get atomized");
|
||||
if (!atoms.Contains(id)) {
|
||||
atoms.AppendElement(id);
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement* el = nsGenericHTMLElement::FromContent(content);
|
||||
if (el) {
|
||||
// Note: nsINode::HasName means the name is exposed on the document,
|
||||
// which is false for options, so we don't check it here.
|
||||
const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
|
||||
if (val && val->Type() == nsAttrValue::eAtom &&
|
||||
IsAllNamedElement(content)) {
|
||||
nsIAtom* name = val->GetAtomValue();
|
||||
MOZ_ASSERT(name != nsGkAtoms::_empty,
|
||||
"Empty names don't get atomized");
|
||||
if (!atoms.Contains(name)) {
|
||||
atoms.AppendElement(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t atomsLen = atoms.Length();
|
||||
nsString* names = aNames.AppendElements(atomsLen);
|
||||
for (uint32_t i = 0; i < atomsLen; ++i) {
|
||||
atoms[i]->ToString(names[i]);
|
||||
}
|
||||
Collection()->GetSupportedNames(aNames, IsAllNamedElement);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3590,7 +3590,7 @@ HTMLInputElement::Blur(ErrorResult& aError)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::Focus(ErrorResult& aError)
|
||||
HTMLInputElement::Focus(const FocusOptions& aOptions, ErrorResult& aError)
|
||||
{
|
||||
if (mType == NS_FORM_INPUT_NUMBER) {
|
||||
// Focus our anonymous text control, if we have one.
|
||||
@@ -3600,7 +3600,7 @@ HTMLInputElement::Focus(ErrorResult& aError)
|
||||
RefPtr<HTMLInputElement> textControl =
|
||||
numberControlFrame->GetAnonTextControl();
|
||||
if (textControl) {
|
||||
textControl->Focus(aError);
|
||||
textControl->Focus(aOptions, aError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3616,7 +3616,7 @@ HTMLInputElement::Focus(ErrorResult& aError)
|
||||
}
|
||||
|
||||
if (mType != NS_FORM_INPUT_FILE) {
|
||||
nsGenericHTMLElement::Focus(aError);
|
||||
nsGenericHTMLElement::Focus(aOptions, aError);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,8 @@ public:
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
using nsGenericHTMLElement::Focus;
|
||||
virtual void Blur(ErrorResult& aError) override;
|
||||
virtual void Focus(ErrorResult& aError) override;
|
||||
virtual void Focus(const FocusOptions& aOptions,
|
||||
ErrorResult& aError) override;
|
||||
|
||||
// nsINode
|
||||
#if !defined(XP_MACOSX)
|
||||
|
||||
@@ -93,14 +93,15 @@ HTMLLabelElement::GetForm() const
|
||||
}
|
||||
|
||||
void
|
||||
HTMLLabelElement::Focus(ErrorResult& aError)
|
||||
HTMLLabelElement::Focus(const FocusOptions& aOptions,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
// retarget the focus method at the for content
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
nsCOMPtr<nsIDOMElement> elem = do_QueryObject(GetLabeledElement());
|
||||
if (elem)
|
||||
fm->SetFocus(elem, 0);
|
||||
fm->SetFocus(elem, nsFocusManager::FocusOptionsToFocusManagerFlags(aOptions));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ public:
|
||||
}
|
||||
|
||||
using nsGenericHTMLElement::Focus;
|
||||
virtual void Focus(mozilla::ErrorResult& aError) override;
|
||||
virtual void Focus(const FocusOptions& aOptions,
|
||||
ErrorResult& aError) override;
|
||||
|
||||
virtual bool IsDisabled() const override { return false; }
|
||||
|
||||
|
||||
@@ -86,7 +86,8 @@ HTMLLegendElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
}
|
||||
|
||||
void
|
||||
HTMLLegendElement::Focus(ErrorResult& aError)
|
||||
HTMLLegendElement::Focus(const FocusOptions& aOptions,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
@@ -95,7 +96,7 @@ HTMLLegendElement::Focus(ErrorResult& aError)
|
||||
|
||||
int32_t tabIndex;
|
||||
if (frame->IsFocusable(&tabIndex, false)) {
|
||||
nsGenericHTMLElement::Focus(aError);
|
||||
nsGenericHTMLElement::Focus(aOptions, aError);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,7 +109,8 @@ HTMLLegendElement::Focus(ErrorResult& aError)
|
||||
|
||||
nsCOMPtr<nsIDOMElement> result;
|
||||
aError = fm->MoveFocus(nullptr, this, nsIFocusManager::MOVEFOCUS_FORWARD,
|
||||
nsIFocusManager::FLAG_NOPARENTFRAME,
|
||||
nsIFocusManager::FLAG_NOPARENTFRAME |
|
||||
nsFocusManager::FocusOptionsToFocusManagerFlags(aOptions),
|
||||
getter_AddRefs(result));
|
||||
}
|
||||
|
||||
@@ -116,9 +118,10 @@ bool
|
||||
HTMLLegendElement::PerformAccesskey(bool aKeyCausesActivation,
|
||||
bool aIsTrustedEvent)
|
||||
{
|
||||
// just use the same behaviour as the focus method
|
||||
FocusOptions options;
|
||||
ErrorResult rv;
|
||||
Focus(rv);
|
||||
|
||||
Focus(options, rv);
|
||||
return NS_SUCCEEDED(rv.StealNSResult());
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ public:
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLegendElement, legend)
|
||||
|
||||
using nsGenericHTMLElement::Focus;
|
||||
virtual void Focus(ErrorResult& aError) override;
|
||||
virtual void Focus(const FocusOptions& aOptions,
|
||||
ErrorResult& aError) override;
|
||||
|
||||
virtual bool PerformAccesskey(bool aKeyCausesActivation,
|
||||
bool aIsTrustedEvent) override;
|
||||
|
||||
@@ -211,6 +211,7 @@ TextTrackManager::AddCues(TextTrack* aTextTrack)
|
||||
for (uint32_t i = 0; i < cueList->Length(); ++i) {
|
||||
mNewCues->AddCue(*cueList->IndexedGetter(i, dummy));
|
||||
}
|
||||
RefPtr<TextTrackManager> kungFuDeathGrip(this);
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
}
|
||||
@@ -236,6 +237,7 @@ TextTrackManager::RemoveTextTrack(TextTrack* aTextTrack, bool aPendingListOnly)
|
||||
for (uint32_t i = 0; i < removeCueList->Length(); ++i) {
|
||||
mNewCues->RemoveCue(*((*removeCueList)[i]));
|
||||
}
|
||||
RefPtr<TextTrackManager> kungFuDeathGrip(this);
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
}
|
||||
@@ -305,6 +307,7 @@ TextTrackManager::NotifyCueAdded(TextTrackCue& aCue)
|
||||
if (mNewCues) {
|
||||
mNewCues->AddCue(aCue);
|
||||
}
|
||||
RefPtr<TextTrackManager> kungFuDeathGrip(this);
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
|
||||
@@ -315,6 +318,7 @@ TextTrackManager::NotifyCueRemoved(TextTrackCue& aCue)
|
||||
if (mNewCues) {
|
||||
mNewCues->RemoveCue(aCue);
|
||||
}
|
||||
RefPtr<TextTrackManager> kungFuDeathGrip(this);
|
||||
DispatchTimeMarchesOn();
|
||||
if (aCue.GetActive()) {
|
||||
// We remove an active cue, need to update the display.
|
||||
@@ -824,6 +828,7 @@ TextTrackManager::NotifyCueUpdated(TextTrackCue *aCue)
|
||||
{
|
||||
// TODO: Add/Reorder the cue to mNewCues if we have some optimization?
|
||||
WEBVTT_LOG("NotifyCueUpdated");
|
||||
RefPtr<TextTrackManager> kungFuDeathGrip(this);
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
|
||||
|
||||
@@ -150,8 +150,9 @@ public:
|
||||
// If something is focused in the same document, ignore autofocus.
|
||||
if (!fm->GetFocusedContent() ||
|
||||
fm->GetFocusedContent()->OwnerDoc() != document) {
|
||||
mozilla::ErrorResult rv;
|
||||
mElement->Focus(rv);
|
||||
FocusOptions options;
|
||||
ErrorResult rv;
|
||||
mElement->Focus(options, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
|
||||
@@ -434,8 +434,9 @@ public:
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
NS_IMETHOD Focus() final override {
|
||||
mozilla::dom::FocusOptions options;
|
||||
mozilla::ErrorResult rv;
|
||||
Focus(rv);
|
||||
Focus(options, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
NS_IMETHOD GetDraggable(bool* aDraggable) final override {
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsMathMLElement.h"
|
||||
#include "mozilla/dom/MathMLElement.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
|
||||
#include "nsCRT.h"
|
||||
#include "nsLayoutStylesheetCache.h"
|
||||
@@ -26,7 +28,8 @@
|
||||
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/dom/ElementBinding.h"
|
||||
#include "mozilla/EventListenerManager.h" // for EventListenerManager
|
||||
#include "mozilla/dom/MathMLElementBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@@ -34,7 +37,7 @@ using namespace mozilla::dom;
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsMathMLElement, nsMathMLElementBase,
|
||||
NS_IMPL_ISUPPORTS_INHERITED(MathMLElement, MathMLElementBase,
|
||||
nsIDOMElement, nsIDOMNode, Link)
|
||||
|
||||
static nsresult
|
||||
@@ -75,28 +78,28 @@ ReportParseErrorNoTag(const nsString& aValue,
|
||||
"AttributeParsingErrorNoTag", argv, 2);
|
||||
}
|
||||
|
||||
nsMathMLElement::nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsMathMLElementBase(aNodeInfo),
|
||||
MathMLElement::MathMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: MathMLElementBase(aNodeInfo),
|
||||
ALLOW_THIS_IN_INITIALIZER_LIST(Link(this)),
|
||||
mIncrementScriptLevel(false)
|
||||
{
|
||||
}
|
||||
|
||||
nsMathMLElement::nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
||||
: nsMathMLElementBase(aNodeInfo),
|
||||
MathMLElement::MathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
||||
: MathMLElementBase(aNodeInfo),
|
||||
ALLOW_THIS_IN_INITIALIZER_LIST(Link(this)),
|
||||
mIncrementScriptLevel(false)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
MathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
{
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsresult rv = nsMathMLElementBase::BindToTree(aDocument, aParent,
|
||||
nsresult rv = MathMLElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -130,7 +133,7 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
}
|
||||
|
||||
void
|
||||
nsMathMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
MathMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
// If this link is ever reinserted into a document, it might
|
||||
// be under a different xml:base, so forget the cached state now.
|
||||
@@ -141,14 +144,14 @@ nsMathMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
doc->UnregisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
||||
nsMathMLElementBase::UnbindFromTree(aDeep, aNullParent);
|
||||
MathMLElementBase::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
MathMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
MOZ_ASSERT(IsMathMLElement());
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
@@ -166,6 +169,9 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||
aAttribute == nsGkAtoms::mathbackground_) {
|
||||
return aResult.ParseColor(aValue);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::tabindex) {
|
||||
return aResult.ParseIntValue(aValue);
|
||||
}
|
||||
if (mNodeInfo->Equals(nsGkAtoms::mtd_)) {
|
||||
if (aAttribute == nsGkAtoms::columnspan_) {
|
||||
aResult.ParseClampedNonNegativeInt(aValue, 1, 1, MAX_COLSPAN);
|
||||
@@ -178,8 +184,8 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||
}
|
||||
}
|
||||
|
||||
return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute,
|
||||
aValue, aResult);
|
||||
return MathMLElementBase::ParseAttribute(aNamespaceID, aAttribute,
|
||||
aValue, aResult);
|
||||
}
|
||||
|
||||
static Element::MappedAttributeEntry sMtableStyles[] = {
|
||||
@@ -218,7 +224,7 @@ static Element::MappedAttributeEntry sDirStyles[] = {
|
||||
};
|
||||
|
||||
bool
|
||||
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
MathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
MOZ_ASSERT(IsMathMLElement());
|
||||
|
||||
@@ -287,7 +293,7 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
}
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
nsMathMLElement::GetAttributeMappingFunction() const
|
||||
MathMLElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
// It doesn't really matter what our tag is here, because only attributes
|
||||
// that satisfy IsAttributeMapped will be stored in the mapped attributes
|
||||
@@ -296,9 +302,9 @@ nsMathMLElement::GetAttributeMappingFunction() const
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsMathMLElement::ParseNamedSpaceValue(const nsString& aString,
|
||||
nsCSSValue& aCSSValue,
|
||||
uint32_t aFlags)
|
||||
MathMLElement::ParseNamedSpaceValue(const nsString& aString,
|
||||
nsCSSValue& aCSSValue,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
int32_t i = 0;
|
||||
// See if it is one of the 'namedspace' (ranging -7/18em, -6/18, ... 7/18em)
|
||||
@@ -378,10 +384,10 @@ nsMathMLElement::ParseNamedSpaceValue(const nsString& aString,
|
||||
// number)"
|
||||
//
|
||||
/* static */ bool
|
||||
nsMathMLElement::ParseNumericValue(const nsString& aString,
|
||||
nsCSSValue& aCSSValue,
|
||||
uint32_t aFlags,
|
||||
nsIDocument* aDocument)
|
||||
MathMLElement::ParseNumericValue(const nsString& aString,
|
||||
nsCSSValue& aCSSValue,
|
||||
uint32_t aFlags,
|
||||
nsIDocument* aDocument)
|
||||
{
|
||||
nsAutoString str(aString);
|
||||
str.CompressWhitespace(); // aString is const in this code...
|
||||
@@ -429,6 +435,13 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
|
||||
number.Append(c);
|
||||
}
|
||||
|
||||
if (gotDot && str[i - 1] == '.') {
|
||||
if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
|
||||
ReportLengthParseError(aString, aDocument);
|
||||
}
|
||||
return false; // Number ending with a dot.
|
||||
}
|
||||
|
||||
// Convert number to floating point
|
||||
nsresult errorCode;
|
||||
float floatValue = number.ToFloat(&errorCode);
|
||||
@@ -499,8 +512,8 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
|
||||
}
|
||||
|
||||
void
|
||||
nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
MathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
|
||||
// scriptsizemultiplier
|
||||
@@ -918,7 +931,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
MathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
nsresult rv = Element::GetEventTargetParent(aVisitor);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -927,30 +940,30 @@ nsMathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMathMLElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
MathMLElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
return PostHandleEventForLinks(aVisitor);
|
||||
}
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsMathMLElement)
|
||||
NS_IMPL_ELEMENT_CLONE(MathMLElement)
|
||||
|
||||
EventStates
|
||||
nsMathMLElement::IntrinsicState() const
|
||||
MathMLElement::IntrinsicState() const
|
||||
{
|
||||
return Link::LinkState() | nsMathMLElementBase::IntrinsicState() |
|
||||
return Link::LinkState() | MathMLElementBase::IntrinsicState() |
|
||||
(mIncrementScriptLevel ?
|
||||
NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL : EventStates());
|
||||
}
|
||||
|
||||
bool
|
||||
nsMathMLElement::IsNodeOfType(uint32_t aFlags) const
|
||||
MathMLElement::IsNodeOfType(uint32_t aFlags) const
|
||||
{
|
||||
return !(aFlags & ~eCONTENT);
|
||||
}
|
||||
|
||||
void
|
||||
nsMathMLElement::SetIncrementScriptLevel(bool aIncrementScriptLevel,
|
||||
bool aNotify)
|
||||
MathMLElement::SetIncrementScriptLevel(bool aIncrementScriptLevel,
|
||||
bool aNotify)
|
||||
{
|
||||
if (aIncrementScriptLevel == mIncrementScriptLevel)
|
||||
return;
|
||||
@@ -961,26 +974,55 @@ nsMathMLElement::SetIncrementScriptLevel(bool aIncrementScriptLevel,
|
||||
UpdateState(true);
|
||||
}
|
||||
|
||||
bool
|
||||
nsMathMLElement::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse)
|
||||
int32_t
|
||||
MathMLElement::TabIndexDefault()
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (IsLink(getter_AddRefs(uri))) {
|
||||
return IsLink(getter_AddRefs(uri)) ? 0 : -1;
|
||||
}
|
||||
|
||||
// XXX Bug 1586011: Share logic with other element classes.
|
||||
bool
|
||||
MathMLElement::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse)
|
||||
{
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
|
||||
// In designMode documents we only allow focusing the document.
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = ((sTabFocusModel & eTabFocus_linksMask) == 0 ? -1 : 0);
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t tabIndex = TabIndex();
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = tabIndex;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (!IsLink(getter_AddRefs(uri))) {
|
||||
// If a tabindex is specified at all we're focusable
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex);
|
||||
}
|
||||
|
||||
// Links that are in an editable region should never be focusable, even if
|
||||
// they are in a contenteditable="false" region.
|
||||
if (nsContentUtils::IsNodeInEditableRegion(this)) {
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aTabIndex && (sTabFocusModel & eTabFocus_linksMask) == 0) {
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsMathMLElement::IsLink(nsIURI** aURI) const
|
||||
MathMLElement::IsLink(nsIURI** aURI) const
|
||||
{
|
||||
// http://www.w3.org/TR/2010/REC-MathML3-20101021/chapter6.html#interf.link
|
||||
// The REC says that the following elements should not be linking elements:
|
||||
@@ -1051,7 +1093,7 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
|
||||
}
|
||||
|
||||
void
|
||||
nsMathMLElement::GetLinkTarget(nsAString& aTarget)
|
||||
MathMLElement::GetLinkTarget(nsAString& aTarget)
|
||||
{
|
||||
const nsAttrValue* target = mAttrsAndChildren.GetAttr(nsGkAtoms::target,
|
||||
kNameSpaceID_XLink);
|
||||
@@ -1077,14 +1119,59 @@ nsMathMLElement::GetLinkTarget(nsAString& aTarget)
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsMathMLElement::GetHrefURI() const
|
||||
MathMLElement::GetHrefURI() const
|
||||
{
|
||||
nsCOMPtr<nsIURI> hrefURI;
|
||||
return IsLink(getter_AddRefs(hrefURI)) ? hrefURI.forget() : nullptr;
|
||||
}
|
||||
|
||||
// XXX Bug 1586014: Share logic with other element classes.
|
||||
void
|
||||
MathMLElement::RecompileScriptEventListeners() {
|
||||
int32_t i, count = mAttrsAndChildren.AttrCount();
|
||||
for (i = 0; i < count; ++i) {
|
||||
const nsAttrName* name = mAttrsAndChildren.AttrNameAt(i);
|
||||
|
||||
// Eventlistenener-attributes are always in the null namespace
|
||||
if (!name->IsAtom()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsIAtom* attr = name->Atom();
|
||||
if (!IsEventAttributeName(attr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
GetAttr(kNameSpaceID_None, attr, value);
|
||||
SetEventHandler(attr, value, true);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MathMLElement::IsEventAttributeNameInternal(nsIAtom* aName) {
|
||||
// The intent is to align MathML event attributes on HTML5, so the flag
|
||||
// EventNameType_HTML is used here.
|
||||
return nsContentUtils::IsEventAttributeName(aName, EventNameType_HTML);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
MathMLElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (!aValue && IsEventAttributeName(aName)) {
|
||||
if (EventListenerManager* manager = GetExistingListenerManager()) {
|
||||
manager->RemoveEventHandler(aName, EmptyString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return MathMLElementBase::BeforeSetAttr(aNamespaceID, aName, aValue, aNotify);
|
||||
}
|
||||
|
||||
nsresult
|
||||
MathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
@@ -1105,13 +1192,22 @@ nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
Link::ResetLinkState(aNotify, aValue || Link::ElementHasHref());
|
||||
}
|
||||
|
||||
return nsMathMLElementBase::AfterSetAttr(aNameSpaceID, aName, aValue,
|
||||
aOldValue, aSubjectPrincipal,
|
||||
aNotify);
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (IsEventAttributeName(aName) && aValue) {
|
||||
MOZ_ASSERT(aValue->Type() == nsAttrValue::eString,
|
||||
"Expected string value for script body");
|
||||
nsresult rv = SetEventHandler(aName, aValue->GetStringValue());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
return MathMLElementBase::AfterSetAttr(aNameSpaceID, aName, aValue,
|
||||
aOldValue, aSubjectPrincipal,
|
||||
aNotify);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
nsMathMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
MathMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return ElementBinding::Wrap(aCx, this, aGivenProto);
|
||||
return MathMLElementBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsMathMLElement_h
|
||||
#define nsMathMLElement_h
|
||||
#ifndef mozilla_dom_MathMLElement_h_
|
||||
#define mozilla_dom_MathMLElement_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/ElementInlines.h"
|
||||
@@ -15,28 +15,30 @@
|
||||
|
||||
class nsCSSValue;
|
||||
|
||||
typedef nsMappedAttributeElement nsMathMLElementBase;
|
||||
|
||||
namespace mozilla {
|
||||
class EventChainPostVisitor;
|
||||
class EventChainPreVisitor;
|
||||
} // namespace mozilla
|
||||
namespace dom {
|
||||
|
||||
typedef nsMappedAttributeElement MathMLElementBase;
|
||||
|
||||
/*
|
||||
* The base class for MathML elements.
|
||||
*/
|
||||
class nsMathMLElement final : public nsMathMLElementBase,
|
||||
public nsIDOMElement,
|
||||
public mozilla::dom::Link
|
||||
class MathMLElement final : public MathMLElementBase,
|
||||
public nsIDOMElement,
|
||||
public mozilla::dom::Link
|
||||
{
|
||||
public:
|
||||
explicit nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
explicit nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
explicit MathMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
explicit MathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
||||
// Implementation of nsISupports is inherited from nsMathMLElementBase
|
||||
// Implementation of nsISupports is inherited from MathMLElementBase
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Forward implementations of parent interfaces of nsMathMLElement to
|
||||
NS_IMPL_FROMCONTENT(MathMLElement, kNameSpaceID_MathML)
|
||||
|
||||
// Forward implementations of parent interfaces of MathMLElement to
|
||||
// our base class
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
@@ -88,6 +90,7 @@ public:
|
||||
return mIncrementScriptLevel;
|
||||
}
|
||||
|
||||
int32_t TabIndexDefault() final;
|
||||
virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
|
||||
virtual bool IsLink(nsIURI** aURI) const override;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) override;
|
||||
@@ -95,11 +98,16 @@ public:
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() override { return this; }
|
||||
|
||||
void RecompileScriptEventListeners() override;
|
||||
bool IsEventAttributeNameInternal(nsIAtom* aName);
|
||||
|
||||
protected:
|
||||
virtual ~nsMathMLElement() {}
|
||||
virtual ~MathMLElement() {}
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) override;
|
||||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
@@ -110,4 +118,7 @@ private:
|
||||
bool mIncrementScriptLevel;
|
||||
};
|
||||
|
||||
#endif // nsMathMLElement_h
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_MathMLElement_h_
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsMathMLElement.h"
|
||||
#include "mozilla/dom/MathMLElement.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@@ -13,6 +13,6 @@ using namespace mozilla::dom;
|
||||
nsresult
|
||||
NS_NewMathMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
||||
{
|
||||
NS_ADDREF(*aResult = new nsMathMLElement(aNodeInfo));
|
||||
NS_ADDREF(*aResult = new MathMLElement(aNodeInfo));
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -3,9 +3,13 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'MathMLElement.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsMathMLElement.cpp',
|
||||
'nsMathMLElementFactory.cpp',
|
||||
'MathMLElement.cpp',
|
||||
'MathMLElementFactory.cpp',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
@@ -1547,26 +1547,29 @@ void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground) {
|
||||
|
||||
void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags)
|
||||
{
|
||||
RefPtr<BaseMediaResource> kungFuDeathGrip(this);
|
||||
nsCOMPtr<nsIChannel> channel = mChannel;
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsresult rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
nsresult rv = channel->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "GetLoadGroup() failed!");
|
||||
|
||||
nsresult status;
|
||||
mChannel->GetStatus(&status);
|
||||
channel->GetStatus(&status);
|
||||
|
||||
bool inLoadGroup = false;
|
||||
if (loadGroup) {
|
||||
rv = loadGroup->RemoveRequest(mChannel, nullptr, status);
|
||||
rv = loadGroup->RemoveRequest(channel, nullptr, status);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
inLoadGroup = true;
|
||||
}
|
||||
}
|
||||
|
||||
rv = mChannel->SetLoadFlags(aFlags);
|
||||
rv = channel->SetLoadFlags(aFlags);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "SetLoadFlags() failed!");
|
||||
|
||||
if (inLoadGroup) {
|
||||
rv = loadGroup->AddRequest(mChannel, nullptr);
|
||||
rv = loadGroup->AddRequest(channel, nullptr);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "AddRequest() failed!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ CopyAndPackAudio(AVFrame* aFrame, uint32_t aNumChannels, uint32_t aNumAFrames)
|
||||
} else if (aFrame->format == AV_SAMPLE_FMT_FLTP) {
|
||||
// Planar audio data. Pack it into something we can understand.
|
||||
AudioDataValue* tmp = audio.get();
|
||||
AudioDataValue** data = reinterpret_cast<AudioDataValue**>(aFrame->data);
|
||||
AudioDataValue** data = reinterpret_cast<AudioDataValue**>(aFrame->extended_data);
|
||||
for (uint32_t frame = 0; frame < aNumAFrames; frame++) {
|
||||
for (uint32_t channel = 0; channel < aNumChannels; channel++) {
|
||||
*tmp++ = data[channel][frame];
|
||||
@@ -86,7 +86,7 @@ CopyAndPackAudio(AVFrame* aFrame, uint32_t aNumChannels, uint32_t aNumAFrames)
|
||||
// Planar audio data. Convert it from S16 to 32 bits float
|
||||
// and pack it into something we can understand.
|
||||
AudioDataValue* tmp = audio.get();
|
||||
int16_t** data = reinterpret_cast<int16_t**>(aFrame->data);
|
||||
int16_t** data = reinterpret_cast<int16_t**>(aFrame->extended_data);
|
||||
for (uint32_t frame = 0; frame < aNumAFrames; frame++) {
|
||||
for (uint32_t channel = 0; channel < aNumChannels; channel++) {
|
||||
*tmp++ = AudioSampleToFloat(data[channel][frame]);
|
||||
@@ -105,7 +105,7 @@ CopyAndPackAudio(AVFrame* aFrame, uint32_t aNumChannels, uint32_t aNumAFrames)
|
||||
// Planar audio data. Convert it from S32 to 32 bits float
|
||||
// and pack it into something we can understand.
|
||||
AudioDataValue* tmp = audio.get();
|
||||
int32_t** data = reinterpret_cast<int32_t**>(aFrame->data);
|
||||
int32_t** data = reinterpret_cast<int32_t**>(aFrame->extended_data);
|
||||
for (uint32_t frame = 0; frame < aNumAFrames; frame++) {
|
||||
for (uint32_t channel = 0; channel < aNumChannels; channel++) {
|
||||
*tmp++ = AudioSampleToFloat(data[channel][frame]);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "DXVA2Manager.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "Layers.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "MediaInfo.h"
|
||||
@@ -760,6 +761,10 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
stride = mVideoStride;
|
||||
}
|
||||
if (stride <= 0) {
|
||||
LOG("CreateBasicVideoFrame: invalid stride %ld", stride);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// YV12, planar format: [YYYY....][VVVV....][UUUU....]
|
||||
// i.e., Y, then V, then U.
|
||||
@@ -782,9 +787,16 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
|
||||
if (videoHeight % 16 != 0) {
|
||||
padding = 16 - (videoHeight % 16);
|
||||
}
|
||||
uint32_t y_size = stride * (videoHeight + padding);
|
||||
uint32_t v_size = stride * (videoHeight + padding) / 4;
|
||||
uint32_t halfStride = (stride + 1) / 2;
|
||||
mozilla::CheckedInt<uint32_t> y_size_checked =
|
||||
mozilla::CheckedInt<uint32_t>(static_cast<uint32_t>(stride)) *
|
||||
(videoHeight + padding);
|
||||
if (!y_size_checked.isValid()) {
|
||||
LOG("CreateBasicVideoFrame: plane size too large");
|
||||
return E_FAIL;
|
||||
}
|
||||
uint32_t y_size = y_size_checked.value();
|
||||
uint32_t v_size = y_size / 4;
|
||||
uint32_t halfStride = static_cast<uint32_t>((static_cast<int64_t>(stride) + 1) / 2);
|
||||
uint32_t halfHeight = (videoHeight + 1) / 2;
|
||||
uint32_t halfWidth = (videoWidth + 1) / 2;
|
||||
|
||||
|
||||
@@ -181,9 +181,13 @@ public:
|
||||
if (mResamplerOutRate == aOutRate) {
|
||||
return;
|
||||
}
|
||||
if (speex_resampler_set_rate(mResampler, mBufferSampleRate, aOutRate) != RESAMPLER_ERR_SUCCESS) {
|
||||
NS_ASSERTION(false, "speex_resampler_set_rate failed");
|
||||
return;
|
||||
int result = speex_resampler_set_rate(mResampler, mBufferSampleRate, aOutRate);
|
||||
if (result != RESAMPLER_ERR_SUCCESS) {
|
||||
WEB_AUDIO_API_LOG("speex_resampler_set_rate failed: %i", result);
|
||||
// mResampler den_rate and num_rate might have been updated, despite
|
||||
// the error, in which case the resampler will output zeros but
|
||||
// still consume input. Continue below to update mBeginProcessing
|
||||
// for any change in resampler behavior.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -751,7 +751,7 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
|
||||
WEBM_DEBUG("push sample tstamp: %ld next_tstamp: %ld length: %ld kf: %d",
|
||||
tstamp, next_tstamp, length, isKeyframe);
|
||||
RefPtr<MediaRawData> sample;
|
||||
if (mInfo.mVideo.HasAlpha() && alphaLength != 0) {
|
||||
if (mInfo.mVideo.HasAlpha() && alphaData != 0) {
|
||||
sample = new MediaRawData(data, length, alphaData, alphaLength);
|
||||
if (length && !sample->Data() || (alphaLength && !sample->AlphaData())) {
|
||||
// OOM.
|
||||
|
||||
@@ -172,6 +172,8 @@ UDPSocket::CloseWithReason(nsresult aReason)
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<UDPSocket> kungFuDeathGrip(this);
|
||||
|
||||
if (mOpened) {
|
||||
if (mReadyState == SocketReadyState::Opening) {
|
||||
// reject openedPromise with AbortError if socket is closed without error
|
||||
|
||||
@@ -613,14 +613,6 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
|
||||
|
||||
nsresult rv;
|
||||
{
|
||||
// Update our current script.
|
||||
Maybe<AutoCurrentScriptUpdater> masterScriptUpdater;
|
||||
nsCOMPtr<nsIDocument> master = mDocument->MasterDocument();
|
||||
if (master != mDocument) {
|
||||
masterScriptUpdater.emplace(master->ScriptLoader(),
|
||||
aRequest->Element());
|
||||
}
|
||||
|
||||
JSContext* cx = aes.cx();
|
||||
JS::Rooted<JSObject*> module(cx);
|
||||
|
||||
@@ -2323,8 +2315,14 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Update our current script.
|
||||
// This must be destroyed after destroying nsAutoMicroTask.
|
||||
nsIScriptElement* currentScript =
|
||||
aRequest->IsModuleRequest() ? nullptr : aRequest->Element();
|
||||
AutoCurrentScriptUpdater scriptUpdater(this, currentScript);
|
||||
|
||||
// New script entry point required, due to the "Create a script" sub-step of
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-block
|
||||
// http://html.spec.whatwg.org/multipage/#execute-the-script-block
|
||||
nsAutoMicroTask mt;
|
||||
AutoEntryScript aes(globalObject, "<script> element", true);
|
||||
JSContext* cx = aes.cx();
|
||||
@@ -2382,9 +2380,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||
FinishDynamicImport(cx, request, rv);
|
||||
}
|
||||
} else {
|
||||
// Update our current script.
|
||||
AutoCurrentScriptUpdater scriptUpdater(this, aRequest->Element());
|
||||
|
||||
JS::CompileOptions options(cx);
|
||||
rv = FillCompileOptionsForRequest(aes, aRequest, global, &options);
|
||||
|
||||
|
||||
@@ -324,7 +324,9 @@ class ScriptLoader final : public nsISupports
|
||||
: mOldScript(aScriptLoader->mCurrentScript)
|
||||
, mScriptLoader(aScriptLoader)
|
||||
{
|
||||
mScriptLoader->mCurrentScript = aCurrentScript;
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentScript);
|
||||
mScriptLoader->mCurrentScript =
|
||||
node && !node->IsInShadowTree() ? aCurrentScript : nullptr;
|
||||
}
|
||||
~AutoCurrentScriptUpdater()
|
||||
{
|
||||
|
||||
+85
-23
@@ -57,7 +57,84 @@ CreateObjectURLInternal(const GlobalObject& aGlobal, T aObject,
|
||||
CopyASCIItoUTF16(url, aResult);
|
||||
}
|
||||
|
||||
// The URL implementation for the main-thread
|
||||
bool
|
||||
IsRootRelativePathInput(const nsAString& aURL)
|
||||
{
|
||||
return !aURL.IsEmpty() && aURL.CharAt(0) == '/' &&
|
||||
(aURL.Length() == 1 || aURL.CharAt(1) != '/');
|
||||
}
|
||||
|
||||
bool
|
||||
BuildRootRelativeFallbackSpec(const nsAString& aURL, nsIURI* aBase,
|
||||
nsACString& aFallbackSpec)
|
||||
{
|
||||
MOZ_ASSERT(aBase);
|
||||
MOZ_ASSERT(IsRootRelativePathInput(aURL));
|
||||
|
||||
nsAutoCString baseSpec;
|
||||
if (NS_FAILED(aBase->GetSpec(baseSpec)) || baseSpec.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t colon = baseSpec.FindChar(':');
|
||||
if (colon <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t afterColon = static_cast<uint32_t>(colon + 1);
|
||||
if (afterColon >= baseSpec.Length() || baseSpec.CharAt(afterColon) != '/') {
|
||||
// Opaque paths (for example mailto:test@example.com) are not valid bases
|
||||
// for root-relative URL input.
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString input;
|
||||
if (!AppendUTF16toUTF8(aURL, input, fallible)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Preserve authority when present (scheme://authority/path -> scheme://authority/input)
|
||||
if (afterColon + 1 < baseSpec.Length() && baseSpec.CharAt(afterColon + 1) == '/') {
|
||||
uint32_t authorityEnd = afterColon + 2;
|
||||
while (authorityEnd < baseSpec.Length()) {
|
||||
char c = baseSpec.CharAt(authorityEnd);
|
||||
if (c == '/' || c == '?' || c == '#') {
|
||||
break;
|
||||
}
|
||||
++authorityEnd;
|
||||
}
|
||||
|
||||
aFallbackSpec.Assign(Substring(baseSpec, 0, authorityEnd));
|
||||
aFallbackSpec.Append(input);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Single-slash hierarchical base (scheme:/path -> scheme:/input)
|
||||
aFallbackSpec.Assign(Substring(baseSpec, 0, afterColon));
|
||||
aFallbackSpec.Append(input);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TryResolveRootRelativeAgainstBase(const nsAString& aURL, nsIURI* aBase,
|
||||
nsIURI** aOutURI)
|
||||
{
|
||||
MOZ_ASSERT(aOutURI);
|
||||
|
||||
if (!aBase || !IsRootRelativePathInput(aURL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString fallbackSpec;
|
||||
if (!BuildRootRelativeFallbackSpec(aURL, aBase, fallbackSpec)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewURI(aOutURI, fallbackSpec, nullptr, nullptr,
|
||||
nsContentUtils::GetIOService());
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
class URLMainThread final : public URL
|
||||
{
|
||||
public:
|
||||
@@ -229,7 +306,8 @@ URLMainThread::Constructor(nsISupports* aParent, const nsAString& aURL,
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, aBase,
|
||||
nsContentUtils::GetIOService());
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_FAILED(rv) &&
|
||||
!TryResolveRootRelativeAgainstBase(aURL, aBase, getter_AddRefs(uri))) {
|
||||
// No need to warn in this case. It's common to use the URL constructor
|
||||
// to determine if a URL is valid and an exception will be propagated.
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aURL);
|
||||
@@ -1714,30 +1792,14 @@ URL::IsValidURL(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
bool
|
||||
URL::CanParse(const GlobalObject& aGlobal, const nsAString& aURL,
|
||||
const Optional<nsAString>& aBase) {
|
||||
nsCOMPtr<nsIURI> baseUri;
|
||||
if (aBase.WasPassed()) {
|
||||
// Don't use NS_ConvertUTF16toUTF8 because that doesn't let us handle OOM.
|
||||
nsAutoCString base;
|
||||
if (!AppendUTF16toUTF8(aBase.Value(), base, fallible)) {
|
||||
// Just return false with OOM errors as no ErrorResult.
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(baseUri), base);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Invalid base URL, return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoCString urlStr;
|
||||
if (!AppendUTF16toUTF8(aURL, urlStr, fallible)) {
|
||||
// Just return false with OOM errors as no ErrorResult.
|
||||
ErrorResult rv;
|
||||
RefPtr<URL> parsed = URL::Constructor(aGlobal, aURL, aBase, rv);
|
||||
if (rv.Failed() || !parsed) {
|
||||
rv.SuppressException();
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
return NS_SUCCEEDED(NS_NewURI(getter_AddRefs(uri), urlStr, nullptr, baseUri));
|
||||
return true;
|
||||
}
|
||||
|
||||
URLSearchParams*
|
||||
|
||||
+414
-412
@@ -1,460 +1,462 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test URL API</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887364">Mozilla Bug 887364</a>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=991471">Mozilla Bug 991471</a>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=996055">Mozilla Bug 996055</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe name="x" id="x"></iframe>
|
||||
<iframe name="y" id="y"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<script type="application/javascript">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Test URL API</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887364">Mozilla Bug 887364</a>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=991471">Mozilla Bug 991471</a>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=996055">Mozilla Bug 996055</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe name="x" id="x"></iframe>
|
||||
<iframe name="y" id="y"></iframe>
|
||||
</div>
|
||||
<pre id="test"></pre>
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 887364 **/
|
||||
ok("URL" in window, "window.URL exists");
|
||||
|
||||
/** Test for Bug 887364 **/
|
||||
ok("URL" in window, "window.URL exists");
|
||||
var tests = [
|
||||
{
|
||||
url: "http://www.abc.com",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "http://www.abc.com/",
|
||||
origin: "http://www.abc.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "www.abc.com",
|
||||
hostname: "www.abc.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "",
|
||||
hash: "",
|
||||
},
|
||||
{
|
||||
url: "ftp://auser:apw@www.abc.com",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "ftp://auser:apw@www.abc.com/",
|
||||
origin: "ftp://www.abc.com",
|
||||
protocol: "ftp:",
|
||||
username: "auser",
|
||||
password: "apw",
|
||||
host: "www.abc.com",
|
||||
hostname: "www.abc.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "",
|
||||
hash: "",
|
||||
},
|
||||
{
|
||||
url: "http://www.abc.com:90/apath/",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "http://www.abc.com:90/apath/",
|
||||
origin: "http://www.abc.com:90",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "www.abc.com:90",
|
||||
hostname: "www.abc.com",
|
||||
port: "90",
|
||||
pathname: "/apath/",
|
||||
search: "",
|
||||
hash: "",
|
||||
},
|
||||
{
|
||||
url: "http://www.abc.com/apath/afile.txt#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "http://www.abc.com/apath/afile.txt#ahash",
|
||||
origin: "http://www.abc.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "www.abc.com",
|
||||
hostname: "www.abc.com",
|
||||
port: "",
|
||||
pathname: "/apath/afile.txt",
|
||||
search: "",
|
||||
hash: "#ahash",
|
||||
},
|
||||
{
|
||||
url: "http://example.com/?test#hash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "http://example.com/?test#hash",
|
||||
origin: "http://example.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "example.com",
|
||||
hostname: "example.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "?test",
|
||||
hash: "#hash",
|
||||
},
|
||||
{
|
||||
url: "http://example.com/?test",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "http://example.com/?test",
|
||||
origin: "http://example.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "example.com",
|
||||
hostname: "example.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "?test",
|
||||
hash: "",
|
||||
},
|
||||
{ url: "http://example.com/carrot#question%3f", base: undefined, error: false, hash: "#question%3f" },
|
||||
{
|
||||
url: "https://example.com:4443?",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: "https:",
|
||||
port: "4443",
|
||||
pathname: "/",
|
||||
hash: "",
|
||||
search: "",
|
||||
},
|
||||
{
|
||||
url: "http://www.abc.com/apath/afile.txt#ahash?asearch",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "http://www.abc.com/apath/afile.txt#ahash?asearch",
|
||||
protocol: "http:",
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash?asearch",
|
||||
search: "",
|
||||
},
|
||||
{
|
||||
url: "http://www.abc.com/apath/afile.txt?asearch#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: "http://www.abc.com/apath/afile.txt?asearch#ahash",
|
||||
protocol: "http:",
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash",
|
||||
search: "?asearch",
|
||||
},
|
||||
{
|
||||
url: "http://abc.com/apath/afile.txt?#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash",
|
||||
search: "",
|
||||
},
|
||||
{
|
||||
url: "http://auser:apassword@www.abc.com:90/apath/afile.txt?asearch#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: "http:",
|
||||
username: "auser",
|
||||
password: "apassword",
|
||||
host: "www.abc.com:90",
|
||||
hostname: "www.abc.com",
|
||||
port: "90",
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash",
|
||||
search: "?asearch",
|
||||
origin: "http://www.abc.com:90",
|
||||
},
|
||||
|
||||
var tests = [
|
||||
{ url: 'http://www.abc.com',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/',
|
||||
origin: 'http://www.abc.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'www.abc.com',
|
||||
hostname: 'www.abc.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '',
|
||||
hash: ''
|
||||
},
|
||||
{ url: 'ftp://auser:apw@www.abc.com',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'ftp://auser:apw@www.abc.com/',
|
||||
origin: 'ftp://www.abc.com',
|
||||
protocol: 'ftp:',
|
||||
username: 'auser',
|
||||
password: 'apw',
|
||||
host: 'www.abc.com',
|
||||
hostname: 'www.abc.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '',
|
||||
hash: ''
|
||||
},
|
||||
{ url: 'http://www.abc.com:90/apath/',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com:90/apath/',
|
||||
origin: 'http://www.abc.com:90',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'www.abc.com:90',
|
||||
hostname: 'www.abc.com',
|
||||
port: '90',
|
||||
pathname: '/apath/',
|
||||
search: '',
|
||||
hash: ''
|
||||
},
|
||||
{ url: 'http://www.abc.com/apath/afile.txt#ahash',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/apath/afile.txt#ahash',
|
||||
origin: 'http://www.abc.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'www.abc.com',
|
||||
hostname: 'www.abc.com',
|
||||
port: '',
|
||||
pathname: '/apath/afile.txt',
|
||||
search: '',
|
||||
hash: '#ahash'
|
||||
},
|
||||
{ url: 'http://example.com/?test#hash',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://example.com/?test#hash',
|
||||
origin: 'http://example.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'example.com',
|
||||
hostname: 'example.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '?test',
|
||||
hash: '#hash'
|
||||
},
|
||||
{ url: 'http://example.com/?test',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://example.com/?test',
|
||||
origin: 'http://example.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'example.com',
|
||||
hostname: 'example.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '?test',
|
||||
hash: ''
|
||||
},
|
||||
{ url: 'http://example.com/carrot#question%3f',
|
||||
base: undefined,
|
||||
error: false,
|
||||
hash: '#question%3f'
|
||||
},
|
||||
{ url: 'https://example.com:4443?',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'https:',
|
||||
port: '4443',
|
||||
pathname: '/',
|
||||
hash: '',
|
||||
search: ''
|
||||
},
|
||||
{ url: 'http://www.abc.com/apath/afile.txt#ahash?asearch',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/apath/afile.txt#ahash?asearch',
|
||||
protocol: 'http:',
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash?asearch',
|
||||
search: ''
|
||||
},
|
||||
{ url: 'http://www.abc.com/apath/afile.txt?asearch#ahash',
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/apath/afile.txt?asearch#ahash',
|
||||
protocol: 'http:',
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash',
|
||||
search: '?asearch'
|
||||
},
|
||||
{ url: 'http://abc.com/apath/afile.txt?#ahash',
|
||||
base: undefined,
|
||||
error: false,
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash',
|
||||
search: ''
|
||||
},
|
||||
{ url: 'http://auser:apassword@www.abc.com:90/apath/afile.txt?asearch#ahash',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'http:',
|
||||
username: 'auser',
|
||||
password: 'apassword',
|
||||
host: 'www.abc.com:90',
|
||||
hostname: 'www.abc.com',
|
||||
port: '90',
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash',
|
||||
search: '?asearch',
|
||||
origin: 'http://www.abc.com:90'
|
||||
},
|
||||
{ url: "/foo#bar", base: "www.test.org", error: true },
|
||||
{ url: "/foo#bar", base: null, error: true },
|
||||
{ url: "/foo#bar", base: 42, error: true },
|
||||
{ url: "ftp://ftp.something.net", base: undefined, error: false, protocol: "ftp:" },
|
||||
{ url: "file:///tmp/file", base: undefined, error: false, protocol: "file:" },
|
||||
{ url: "gopher://gopher.something.net", base: undefined, error: false, protocol: "gopher:" },
|
||||
{ url: "ws://ws.something.net", base: undefined, error: false, protocol: "ws:" },
|
||||
{ url: "wss://ws.something.net", base: undefined, error: false, protocol: "wss:" },
|
||||
{ url: "foo://foo.something.net", base: undefined, error: false, protocol: "foo:" },
|
||||
|
||||
{ url: '/foo#bar',
|
||||
base: 'www.test.org',
|
||||
error: true,
|
||||
},
|
||||
{ url: '/foo#bar',
|
||||
base: null,
|
||||
error: true,
|
||||
},
|
||||
{ url: '/foo#bar',
|
||||
base: 42,
|
||||
error: true,
|
||||
},
|
||||
{ url: 'ftp://ftp.something.net',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'ftp:',
|
||||
},
|
||||
{ url: 'file:///tmp/file',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'file:',
|
||||
},
|
||||
{ url: 'gopher://gopher.something.net',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'gopher:',
|
||||
},
|
||||
{ url: 'ws://ws.something.net',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'ws:',
|
||||
},
|
||||
{ url: 'wss://ws.something.net',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'wss:',
|
||||
},
|
||||
{ url: 'foo://foo.something.net',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'foo:',
|
||||
},
|
||||
{
|
||||
url: "about:blank",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: "about:",
|
||||
pathname: "blank",
|
||||
skip_setters: false,
|
||||
},
|
||||
|
||||
{ url: 'about:blank',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'about:',
|
||||
pathname: 'blank',
|
||||
skip_setters: false,
|
||||
},
|
||||
{
|
||||
url: "foo:bar?what#yeah",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: "foo:",
|
||||
pathname: "bar",
|
||||
search: "?what",
|
||||
hash: "#yeah",
|
||||
skip_setters: false,
|
||||
},
|
||||
];
|
||||
|
||||
{ url: 'foo:bar?what#yeah',
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'foo:',
|
||||
pathname: 'bar',
|
||||
search: '?what',
|
||||
hash: '#yeah',
|
||||
skip_setters: false,
|
||||
},
|
||||
];
|
||||
while (tests.length) {
|
||||
var test = tests.shift();
|
||||
|
||||
while(tests.length) {
|
||||
var test = tests.shift();
|
||||
var error = false;
|
||||
var url;
|
||||
try {
|
||||
if (test.base) {
|
||||
url = new URL(test.url, test.base);
|
||||
} else {
|
||||
url = new URL(test.url);
|
||||
}
|
||||
} catch (e) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
var error = false;
|
||||
var url;
|
||||
try {
|
||||
if (test.base) {
|
||||
url = new URL(test.url, test.base);
|
||||
} else {
|
||||
url = new URL(test.url);
|
||||
}
|
||||
} catch(e) {
|
||||
error = true;
|
||||
}
|
||||
is(test.error, error, "Error creating URL");
|
||||
if (test.error) {
|
||||
continue;
|
||||
}
|
||||
|
||||
is(test.error, error, "Error creating URL");
|
||||
if (test.error) {
|
||||
continue;
|
||||
}
|
||||
if ("href" in test) is(url.href, test.href, "href");
|
||||
if ("origin" in test) is(url.origin, test.origin, "origin");
|
||||
if ("protocol" in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ("username" in test) is(url.username, test.username, "username");
|
||||
if ("password" in test) is(url.password, test.password, "password");
|
||||
if ("host" in test) is(url.host, test.host, "host");
|
||||
if ("hostname" in test) is(url.hostname, test.hostname, "hostname");
|
||||
if ("port" in test) is(url.port, test.port, "port");
|
||||
if ("pathname" in test) is(url.pathname, test.pathname, "pathname");
|
||||
if ("search" in test) is(url.search, test.search, "search");
|
||||
if ("hash" in test) is(url.hash, test.hash, "hash");
|
||||
|
||||
if ('href' in test) is(url.href, test.href, "href");
|
||||
if ('origin' in test) is(url.origin, test.origin, "origin");
|
||||
if ('protocol' in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ('username' in test) is(url.username, test.username, "username");
|
||||
if ('password' in test) is(url.password, test.password, "password");
|
||||
if ('host' in test) is(url.host, test.host, "host");
|
||||
if ('hostname' in test) is(url.hostname, test.hostname, "hostname");
|
||||
if ('port' in test) is(url.port, test.port, "port");
|
||||
if ('pathname' in test) is(url.pathname, test.pathname, "pathname");
|
||||
if ('search' in test) is(url.search, test.search, "search");
|
||||
if ('hash' in test) is(url.hash, test.hash, "hash");
|
||||
if ("skip_setters" in test && test.skip_setters == false) {
|
||||
info("Skip setter methods for URL: " + test);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ('skip_setters' in test && test.skip_setters == false) {
|
||||
info("Skip setter methods for URL: " + test);
|
||||
continue;
|
||||
}
|
||||
url = new URL("https://www.example.net/what#foo?bar");
|
||||
ok(url, "Url exists!");
|
||||
|
||||
url = new URL('https://www.example.net/what#foo?bar');
|
||||
ok(url, "Url exists!");
|
||||
if ("href" in test) url.href = test.href;
|
||||
if ("protocol" in test) url.protocol = test.protocol;
|
||||
if ("username" in test && test.username) url.username = test.username;
|
||||
if ("password" in test && test.password) url.password = test.password;
|
||||
if ("host" in test) url.host = test.host;
|
||||
if ("hostname" in test) url.hostname = test.hostname;
|
||||
if ("port" in test) url.port = test.port;
|
||||
if ("pathname" in test) url.pathname = test.pathname;
|
||||
if ("search" in test) url.search = test.search;
|
||||
if ("hash" in test) url.hash = test.hash;
|
||||
|
||||
if ('href' in test) url.href = test.href;
|
||||
if ('protocol' in test) url.protocol = test.protocol;
|
||||
if ('username' in test && test.username) url.username = test.username;
|
||||
if ('password' in test && test.password) url.password = test.password;
|
||||
if ('host' in test) url.host = test.host;
|
||||
if ('hostname' in test) url.hostname = test.hostname;
|
||||
if ('port' in test) url.port = test.port;
|
||||
if ('pathname' in test) url.pathname = test.pathname;
|
||||
if ('search' in test) url.search = test.search;
|
||||
if ('hash' in test) url.hash = test.hash;
|
||||
if ("href" in test) is(url.href, test.href, "href");
|
||||
if ("origin" in test) is(url.origin, test.origin, "origin");
|
||||
if ("protocol" in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ("username" in test) is(url.username, test.username, "username");
|
||||
if ("password" in test) is(url.password, test.password, "password");
|
||||
if ("host" in test) is(url.host, test.host, "host");
|
||||
if ("hostname" in test) is(test.hostname, url.hostname, "hostname");
|
||||
if ("port" in test) is(test.port, url.port, "port");
|
||||
if ("pathname" in test) is(test.pathname, url.pathname, "pathname");
|
||||
if ("search" in test) is(test.search, url.search, "search");
|
||||
if ("hash" in test) is(test.hash, url.hash, "hash");
|
||||
|
||||
if ('href' in test) is(url.href, test.href, "href");
|
||||
if ('origin' in test) is(url.origin, test.origin, "origin");
|
||||
if ('protocol' in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ('username' in test) is(url.username, test.username, "username");
|
||||
if ('password' in test) is(url.password, test.password, "password");
|
||||
if ('host' in test) is(url.host, test.host, "host");
|
||||
if ('hostname' in test) is(test.hostname, url.hostname, "hostname");
|
||||
if ('port' in test) is(test.port, url.port, "port");
|
||||
if ('pathname' in test) is(test.pathname, url.pathname, "pathname");
|
||||
if ('search' in test) is(test.search, url.search, "search");
|
||||
if ('hash' in test) is(test.hash, url.hash, "hash");
|
||||
if ("href" in test) is(test.href, url + "", "stringify works");
|
||||
}
|
||||
</script>
|
||||
|
||||
if ('href' in test) is (test.href, url + '', 'stringify works');
|
||||
}
|
||||
<script>
|
||||
/** Test for Bug 991471 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "";
|
||||
url.username = "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt";
|
||||
url.hostname = "www.mozilla.org";
|
||||
url.username = "";
|
||||
url.hostname = "www.mozilla.org";
|
||||
is(url.href, "http://www.mozilla.org/", "No parsing error with empty host");
|
||||
</script>
|
||||
|
||||
</script>
|
||||
<script>
|
||||
/** Test for Bug 996055 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "";
|
||||
is(url.href, "http://localhost/", "Empty hostname is ignored");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/** Test for Bug 991471 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "";
|
||||
url.username = "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt";
|
||||
url.hostname = "www.mozilla.org";
|
||||
url.username = "";
|
||||
url.hostname = "www.mozilla.org";
|
||||
is(url.href, "http://www.mozilla.org/", "No parsing error with empty host");
|
||||
</script>
|
||||
<script>
|
||||
/** Test for Bug 960014 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "[2001::1]";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.href, "http://[2001::1]/");
|
||||
|
||||
<script>
|
||||
/** Test for Bug 996055 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "";
|
||||
is(url.href, "http://localhost/", "Empty hostname is ignored");
|
||||
</script>
|
||||
url.hostname = "[::192.9.5.5]";
|
||||
is(url.hostname, "[::192.9.5.5]", "IPv6 hostname");
|
||||
is(url.href, "http://[::192.9.5.5]/");
|
||||
|
||||
<script>
|
||||
/** Test for Bug 960014 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "[2001::1]";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.href, "http://[2001::1]/");
|
||||
url = new URL("http://localhost/");
|
||||
url.hostname = "[::]";
|
||||
is(url.hostname, "[::]", "IPv6 hostname");
|
||||
|
||||
url.hostname = "[::192.9.5.5]";
|
||||
is(url.hostname, "[::192.9.5.5]", "IPv6 hostname");
|
||||
is(url.href, "http://[::192.9.5.5]/");
|
||||
url = new URL("http://localhost/");
|
||||
url.host = "[2001::1]:30";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.port, "30", "Port");
|
||||
is(url.host, "[2001::1]:30", "IPv6 host");
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
url.hostname = "[::]";
|
||||
is(url.hostname, "[::]", "IPv6 hostname");
|
||||
url = new URL("http://localhost/");
|
||||
// This should silently fail since it's missing the brackets
|
||||
url.hostname = "2001::1";
|
||||
is(url.hostname, "localhost", "Setting bad hostname fails");
|
||||
</script>
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
url.host = "[2001::1]:30";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.port, "30", "Port");
|
||||
is(url.host, "[2001::1]:30", "IPv6 host");
|
||||
<script>
|
||||
var blob = new Blob(["a"]);
|
||||
var url = URL.createObjectURL(blob);
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
// This should silently fail since it's missing the brackets
|
||||
url.hostname = "2001::1";
|
||||
is(url.hostname, "localhost", "Setting bad hostname fails");
|
||||
</script>
|
||||
var u = new URL(url);
|
||||
ok(u.origin, "http://mochi.test:8888", "The URL generated from a blob URI has an origin");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var blob = new Blob(['a']);
|
||||
var url = URL.createObjectURL(blob);
|
||||
<script>
|
||||
var blob = new Blob(["a"]);
|
||||
var url = URL.createObjectURL(blob);
|
||||
|
||||
var u = new URL(url);
|
||||
ok(u.origin, 'http://mochi.test:8888', "The URL generated from a blob URI has an origin");
|
||||
</script>
|
||||
var a = document.createElement("A");
|
||||
a.href = url;
|
||||
ok(a.origin, "http://mochi.test:8888", "The 'a' element has the correct origin");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var blob = new Blob(['a']);
|
||||
var url = URL.createObjectURL(blob);
|
||||
<script>
|
||||
var blob = new Blob(["a"]);
|
||||
var url = URL.createObjectURL(blob);
|
||||
URL.revokeObjectURL(url);
|
||||
URL.revokeObjectURL(url);
|
||||
ok(true, "Calling revokeObjectURL twice should be ok");
|
||||
</script>
|
||||
|
||||
var a = document.createElement('A');
|
||||
a.href = url;
|
||||
ok(a.origin, 'http://mochi.test:8888', "The 'a' element has the correct origin");
|
||||
</script>
|
||||
<script>
|
||||
URL.revokeObjectURL("blob:something");
|
||||
ok(true, "This should not throw.");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var blob = new Blob(['a']);
|
||||
var url = URL.createObjectURL(blob);
|
||||
URL.revokeObjectURL(url);
|
||||
URL.revokeObjectURL(url);
|
||||
ok(true, "Calling revokeObjectURL twice should be ok");
|
||||
</script>
|
||||
<script>
|
||||
var base = new URL("http:\\\\test.com\\path/to\\file?query\\backslash#hash\\");
|
||||
is(base.href, "http://test.com/path/to/file?query\\backslash#hash\\");
|
||||
|
||||
<script>
|
||||
URL.revokeObjectURL('blob:something');
|
||||
ok(true, "This should not throw.");
|
||||
</script>
|
||||
var url = new URL("..\\", base);
|
||||
is(url.href, "http://test.com/path/");
|
||||
|
||||
<script>
|
||||
var base = new URL("http:\\\\test.com\\path/to\\file?query\\backslash#hash\\");
|
||||
is(base.href, "http://test.com/path/to/file?query\\backslash#hash\\");
|
||||
url = new URL("\\test", base);
|
||||
is(url.href, "http://test.com/test");
|
||||
|
||||
var url = new URL("..\\", base);
|
||||
is(url.href, "http://test.com/path/");
|
||||
url = new URL("\\test\\", base);
|
||||
is(url.href, "http://test.com/test/");
|
||||
|
||||
url = new URL("\\test", base);
|
||||
is(url.href, "http://test.com/test");
|
||||
url = new URL("http://example.org/test", base);
|
||||
is(url.href, "http://example.org/test");
|
||||
|
||||
url = new URL("\\test\\", base);
|
||||
is(url.href, "http://test.com/test/");
|
||||
url = new URL("ftp://tmp/test", base);
|
||||
is(url.href, "ftp://tmp/test");
|
||||
|
||||
url = new URL("http://example.org/test", base);
|
||||
is(url.href, "http://example.org/test");
|
||||
url = new URL("ftp:\\\\tmp\\test", base);
|
||||
is(url.href, "ftp://tmp/test");
|
||||
|
||||
url = new URL("ftp://tmp/test", base);
|
||||
is(url.href, "ftp://tmp/test");
|
||||
url = new URL("scheme://tmp\\test", base);
|
||||
is(url.href, "scheme://tmp\\test");
|
||||
</script>
|
||||
|
||||
url = new URL("ftp:\\\\tmp\\test", base);
|
||||
is(url.href, "ftp://tmp/test");
|
||||
<script>
|
||||
/** Test for Bug 1275746 **/
|
||||
SimpleTest.doesThrow(() => {
|
||||
var url = new URL("http:");
|
||||
}, "http: is not a valid URL");
|
||||
SimpleTest.doesThrow(() => {
|
||||
var url = new URL("http:///");
|
||||
}, "http: is not a valid URL");
|
||||
|
||||
url = new URL("scheme://tmp\\test", base);
|
||||
is(url.href, "scheme://tmp\\test");
|
||||
</script>
|
||||
var url = new URL("file:");
|
||||
is(url.href, "file:///", "Parsing file: should work.");
|
||||
|
||||
<script>
|
||||
/** Test for Bug 1275746 **/
|
||||
SimpleTest.doesThrow(() => { var url = new URL("http:"); }, "http: is not a valid URL");
|
||||
SimpleTest.doesThrow(() => { var url = new URL("http:///"); }, "http: is not a valid URL");
|
||||
url = new URL("file:///");
|
||||
is(url.href, "file:///", "Parsing file:/// should work.");
|
||||
</script>
|
||||
|
||||
var url = new URL("file:");
|
||||
is(url.href, "file:///", "Parsing file: should work.");
|
||||
<script>
|
||||
var url = new URL("scheme:path/to/file?query#hash");
|
||||
is(url.href, "scheme:path/to/file?query#hash");
|
||||
is(url.pathname, "path/to/file");
|
||||
is(url.search, "?query");
|
||||
is(url.hash, "#hash");
|
||||
|
||||
url = new URL("file:///");
|
||||
is(url.href, "file:///", "Parsing file:/// should work.");
|
||||
</script>
|
||||
// pathname cannot be overwritten.
|
||||
url.pathname = "new/path?newquery#newhash";
|
||||
is(url.href, "scheme:path/to/file?query#hash");
|
||||
|
||||
<script>
|
||||
var url = new URL("scheme:path/to/file?query#hash");
|
||||
is(url.href, "scheme:path/to/file?query#hash");
|
||||
is(url.pathname, "path/to/file");
|
||||
is(url.search, "?query");
|
||||
is(url.hash, "#hash");
|
||||
// don't escape '#' until we implement a spec-compliant parser.
|
||||
url.search = "?newquery#newhash";
|
||||
is(url.href, "scheme:path/to/file?newquery#newhash#hash");
|
||||
|
||||
// pathname cannot be overwritten.
|
||||
url.pathname = "new/path?newquery#newhash";
|
||||
is(url.href, "scheme:path/to/file?query#hash");
|
||||
// nulls get encoded, whitespace gets stripped
|
||||
url = new URL("scheme:pa\0\nth/to/fi\0\nle?qu\0\nery#ha\0\nsh");
|
||||
is(url.href, "scheme:pa%00th/to/fi%00le?qu%00ery#ha%00sh");
|
||||
|
||||
// don't escape '#' until we implement a spec-compliant parser.
|
||||
url.search = "?newquery#newhash";
|
||||
is(url.href, "scheme:path/to/file?newquery#newhash#hash");
|
||||
url.search = "new\0\nquery";
|
||||
is(url.href, "scheme:pa%00th/to/fi%00le?new%00%0Aquery#ha%00sh");
|
||||
url.hash = "new\0\nhash";
|
||||
is(url.href, "scheme:pa%00th/to/fi%00le?new%00%0Aquery#new%00%0Ahash");
|
||||
|
||||
// nulls get encoded, whitespace gets stripped
|
||||
url = new URL("scheme:pa\0\nth/to/fi\0\nle?qu\0\nery#ha\0\nsh");
|
||||
is(url.href, "scheme:pa%00th/to/fi%00le?qu%00ery#ha%00sh");
|
||||
url = new URL("scheme:path#hash");
|
||||
is(url.href, "scheme:path#hash");
|
||||
url.search = "query";
|
||||
is(url.href, "scheme:path?query#hash");
|
||||
url.hash = "";
|
||||
is(url.href, "scheme:path?query");
|
||||
url.hash = "newhash";
|
||||
is(url.href, "scheme:path?query#newhash");
|
||||
url.search = "";
|
||||
is(url.href, "scheme:path#newhash");
|
||||
|
||||
url.search = "new\0\nquery";
|
||||
is(url.href, "scheme:pa%00th/to/fi%00le?new%00%0Aquery#ha%00sh");
|
||||
url.hash = "new\0\nhash";
|
||||
is(url.href, "scheme:pa%00th/to/fi%00le?new%00%0Aquery#new%00%0Ahash");
|
||||
// we don't implement a spec-compliant parser yet.
|
||||
// make sure we are bug compatible with existing implementations.
|
||||
url = new URL('data:text/html,<a href="http://example.org/?q">Link</a>');
|
||||
is(url.href, 'data:text/html,<a%20href="http://example.org/?q">Link</a>');
|
||||
</script>
|
||||
|
||||
url = new URL("scheme:path#hash");
|
||||
is(url.href, "scheme:path#hash");
|
||||
url.search = "query";
|
||||
is(url.href, "scheme:path?query#hash");
|
||||
url.hash = "";
|
||||
is(url.href, "scheme:path?query");
|
||||
url.hash = "newhash";
|
||||
is(url.href, "scheme:path?query#newhash");
|
||||
url.search = "";
|
||||
is(url.href, "scheme:path#newhash");
|
||||
<script>
|
||||
is(
|
||||
new URL("/static/client/runtime.js", "x:/").href,
|
||||
"x:/static/client/runtime.js",
|
||||
"URL constructor accepts root-relative input with x:/ base",
|
||||
);
|
||||
ok("canParse" in URL, "URL.canParse exists");
|
||||
ok(
|
||||
URL.canParse("/static/client/runtime.js", "x:/"),
|
||||
"URL.canParse accepts root-relative input with x:/ base",
|
||||
);
|
||||
ok(
|
||||
URL.canParse("/static/client/runtime.js", document.baseURI),
|
||||
"URL.canParse accepts root-relative input with document base",
|
||||
);
|
||||
ok(!URL.canParse("/static/client/runtime.js"), "URL.canParse rejects root-relative input without base");
|
||||
ok(
|
||||
!URL.canParse("/static/client/runtime.js", "mailto:test@example.com"),
|
||||
"URL.canParse rejects root-relative input against opaque mailto: base",
|
||||
);
|
||||
SimpleTest.doesThrow(() => {
|
||||
new URL("/static/client/runtime.js", "mailto:test@example.com");
|
||||
}, "constructor rejects root-relative input against opaque mailto: base");
|
||||
</script>
|
||||
|
||||
// we don't implement a spec-compliant parser yet.
|
||||
// make sure we are bug compatible with existing implementations.
|
||||
url = new URL("data:text/html,<a href=\"http://example.org/?q\">Link</a>");
|
||||
is(url.href, "data:text/html,<a%20href=\"http://example.org/?q\">Link</a>");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var u = new URL('http://www.example.org');
|
||||
ok(u.toJSON(), 'http://www.example.org', "URL.toJSON()");
|
||||
is(JSON.stringify(u), "\"http://www.example.org/\"", "JSON.stringify(u) works");
|
||||
</script>
|
||||
</body>
|
||||
<script>
|
||||
var u = new URL("http://www.example.org");
|
||||
ok(u.toJSON(), "http://www.example.org", "URL.toJSON()");
|
||||
is(JSON.stringify(u), '"http://www.example.org/"', "JSON.stringify(u) works");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+220
-176
@@ -1,212 +1,224 @@
|
||||
function ok(a, msg) {
|
||||
dump("OK: " + !!a + " => " + a + " " + msg + "\n");
|
||||
postMessage({type: 'status', status: !!a, msg: a + ": " + msg });
|
||||
postMessage({ type: "status", status: !!a, msg: a + ": " + msg });
|
||||
}
|
||||
|
||||
function is(a, b, msg) {
|
||||
dump("IS: " + (a===b) + " => " + a + " | " + b + " " + msg + "\n");
|
||||
postMessage({type: 'status', status: a === b, msg: a + " === " + b + ": " + msg });
|
||||
dump("IS: " + (a === b) + " => " + a + " | " + b + " " + msg + "\n");
|
||||
postMessage({
|
||||
type: "status",
|
||||
status: a === b,
|
||||
msg: a + " === " + b + ": " + msg,
|
||||
});
|
||||
}
|
||||
|
||||
onmessage = function() {
|
||||
onmessage = function () {
|
||||
status = false;
|
||||
try {
|
||||
if ((URL instanceof Object)) {
|
||||
if (URL instanceof Object) {
|
||||
status = true;
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
var tests = [
|
||||
{ url: 'http://www.abc.com',
|
||||
{
|
||||
url: "http://www.abc.com",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/',
|
||||
origin: 'http://www.abc.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'www.abc.com',
|
||||
hostname: 'www.abc.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '',
|
||||
hash: ''
|
||||
href: "http://www.abc.com/",
|
||||
origin: "http://www.abc.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "www.abc.com",
|
||||
hostname: "www.abc.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "",
|
||||
hash: "",
|
||||
},
|
||||
{ url: 'ftp://auser:apw@www.abc.com',
|
||||
{
|
||||
url: "ftp://auser:apw@www.abc.com",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'ftp://auser:apw@www.abc.com/',
|
||||
origin: 'ftp://www.abc.com',
|
||||
protocol: 'ftp:',
|
||||
username: 'auser',
|
||||
password: 'apw',
|
||||
host: 'www.abc.com',
|
||||
hostname: 'www.abc.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '',
|
||||
hash: ''
|
||||
href: "ftp://auser:apw@www.abc.com/",
|
||||
origin: "ftp://www.abc.com",
|
||||
protocol: "ftp:",
|
||||
username: "auser",
|
||||
password: "apw",
|
||||
host: "www.abc.com",
|
||||
hostname: "www.abc.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "",
|
||||
hash: "",
|
||||
},
|
||||
{ url: 'http://www.abc.com:90/apath/',
|
||||
{
|
||||
url: "http://www.abc.com:90/apath/",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com:90/apath/',
|
||||
origin: 'http://www.abc.com:90',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'www.abc.com:90',
|
||||
hostname: 'www.abc.com',
|
||||
port: '90',
|
||||
pathname: '/apath/',
|
||||
search: '',
|
||||
hash: ''
|
||||
href: "http://www.abc.com:90/apath/",
|
||||
origin: "http://www.abc.com:90",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "www.abc.com:90",
|
||||
hostname: "www.abc.com",
|
||||
port: "90",
|
||||
pathname: "/apath/",
|
||||
search: "",
|
||||
hash: "",
|
||||
},
|
||||
{ url: 'http://www.abc.com/apath/afile.txt#ahash',
|
||||
{
|
||||
url: "http://www.abc.com/apath/afile.txt#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/apath/afile.txt#ahash',
|
||||
origin: 'http://www.abc.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'www.abc.com',
|
||||
hostname: 'www.abc.com',
|
||||
port: '',
|
||||
pathname: '/apath/afile.txt',
|
||||
search: '',
|
||||
hash: '#ahash'
|
||||
href: "http://www.abc.com/apath/afile.txt#ahash",
|
||||
origin: "http://www.abc.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "www.abc.com",
|
||||
hostname: "www.abc.com",
|
||||
port: "",
|
||||
pathname: "/apath/afile.txt",
|
||||
search: "",
|
||||
hash: "#ahash",
|
||||
},
|
||||
{ url: 'http://example.com/?test#hash',
|
||||
{
|
||||
url: "http://example.com/?test#hash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://example.com/?test#hash',
|
||||
origin: 'http://example.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'example.com',
|
||||
hostname: 'example.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '?test',
|
||||
hash: '#hash'
|
||||
href: "http://example.com/?test#hash",
|
||||
origin: "http://example.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "example.com",
|
||||
hostname: "example.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "?test",
|
||||
hash: "#hash",
|
||||
},
|
||||
{ url: 'http://example.com/?test',
|
||||
{
|
||||
url: "http://example.com/?test",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://example.com/?test',
|
||||
origin: 'http://example.com',
|
||||
protocol: 'http:',
|
||||
username: '',
|
||||
password: '',
|
||||
host: 'example.com',
|
||||
hostname: 'example.com',
|
||||
port: '',
|
||||
pathname: '/',
|
||||
search: '?test',
|
||||
hash: ''
|
||||
href: "http://example.com/?test",
|
||||
origin: "http://example.com",
|
||||
protocol: "http:",
|
||||
username: "",
|
||||
password: "",
|
||||
host: "example.com",
|
||||
hostname: "example.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
search: "?test",
|
||||
hash: "",
|
||||
},
|
||||
{ url: 'http://example.com/carrot#question%3f',
|
||||
{
|
||||
url: "http://example.com/carrot#question%3f",
|
||||
base: undefined,
|
||||
error: false,
|
||||
hash: '#question%3f'
|
||||
hash: "#question%3f",
|
||||
},
|
||||
{ url: 'https://example.com:4443?',
|
||||
{
|
||||
url: "https://example.com:4443?",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'https:',
|
||||
port: '4443',
|
||||
pathname: '/',
|
||||
hash: '',
|
||||
search: ''
|
||||
protocol: "https:",
|
||||
port: "4443",
|
||||
pathname: "/",
|
||||
hash: "",
|
||||
search: "",
|
||||
},
|
||||
{ url: 'http://www.abc.com/apath/afile.txt#ahash?asearch',
|
||||
{
|
||||
url: "http://www.abc.com/apath/afile.txt#ahash?asearch",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/apath/afile.txt#ahash?asearch',
|
||||
protocol: 'http:',
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash?asearch',
|
||||
search: ''
|
||||
href: "http://www.abc.com/apath/afile.txt#ahash?asearch",
|
||||
protocol: "http:",
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash?asearch",
|
||||
search: "",
|
||||
},
|
||||
{ url: 'http://www.abc.com/apath/afile.txt?asearch#ahash',
|
||||
{
|
||||
url: "http://www.abc.com/apath/afile.txt?asearch#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
href: 'http://www.abc.com/apath/afile.txt?asearch#ahash',
|
||||
protocol: 'http:',
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash',
|
||||
search: '?asearch'
|
||||
href: "http://www.abc.com/apath/afile.txt?asearch#ahash",
|
||||
protocol: "http:",
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash",
|
||||
search: "?asearch",
|
||||
},
|
||||
{ url: 'http://abc.com/apath/afile.txt?#ahash',
|
||||
{
|
||||
url: "http://abc.com/apath/afile.txt?#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash',
|
||||
search: ''
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash",
|
||||
search: "",
|
||||
},
|
||||
{ url: 'http://auser:apassword@www.abc.com:90/apath/afile.txt?asearch#ahash',
|
||||
{
|
||||
url: "http://auser:apassword@www.abc.com:90/apath/afile.txt?asearch#ahash",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'http:',
|
||||
username: 'auser',
|
||||
password: 'apassword',
|
||||
host: 'www.abc.com:90',
|
||||
hostname: 'www.abc.com',
|
||||
port: '90',
|
||||
pathname: '/apath/afile.txt',
|
||||
hash: '#ahash',
|
||||
search: '?asearch',
|
||||
origin: 'http://www.abc.com:90'
|
||||
protocol: "http:",
|
||||
username: "auser",
|
||||
password: "apassword",
|
||||
host: "www.abc.com:90",
|
||||
hostname: "www.abc.com",
|
||||
port: "90",
|
||||
pathname: "/apath/afile.txt",
|
||||
hash: "#ahash",
|
||||
search: "?asearch",
|
||||
origin: "http://www.abc.com:90",
|
||||
},
|
||||
|
||||
{ url: '/foo#bar',
|
||||
base: 'www.test.org',
|
||||
error: true,
|
||||
},
|
||||
{ url: '/foo#bar',
|
||||
base: null,
|
||||
error: true,
|
||||
},
|
||||
{ url: '/foo#bar',
|
||||
base: 42,
|
||||
error: true,
|
||||
},
|
||||
{ url: 'ftp://ftp.something.net',
|
||||
{ url: "/foo#bar", base: "www.test.org", error: true },
|
||||
{ url: "/foo#bar", base: null, error: true },
|
||||
{ url: "/foo#bar", base: 42, error: true },
|
||||
{
|
||||
url: "ftp://ftp.something.net",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'ftp:',
|
||||
protocol: "ftp:",
|
||||
},
|
||||
{ url: 'file:///tmp/file',
|
||||
{
|
||||
url: "file:///tmp/file",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'file:',
|
||||
protocol: "file:",
|
||||
},
|
||||
{ url: 'gopher://gopher.something.net',
|
||||
{
|
||||
url: "gopher://gopher.something.net",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'gopher:',
|
||||
protocol: "gopher:",
|
||||
},
|
||||
{ url: 'ws://ws.something.net',
|
||||
{
|
||||
url: "ws://ws.something.net",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'ws:',
|
||||
protocol: "ws:",
|
||||
},
|
||||
{ url: 'wss://ws.something.net',
|
||||
{
|
||||
url: "wss://ws.something.net",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'wss:',
|
||||
protocol: "wss:",
|
||||
},
|
||||
{ url: 'foo://foo.something.net',
|
||||
{
|
||||
url: "foo://foo.something.net",
|
||||
base: undefined,
|
||||
error: false,
|
||||
protocol: 'foo:',
|
||||
protocol: "foo:",
|
||||
},
|
||||
];
|
||||
|
||||
while(tests.length) {
|
||||
while (tests.length) {
|
||||
var test = tests.shift();
|
||||
|
||||
var error = false;
|
||||
@@ -217,7 +229,7 @@ onmessage = function() {
|
||||
} else {
|
||||
url = new URL(test.url);
|
||||
}
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
@@ -226,47 +238,79 @@ onmessage = function() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ('href' in test) is(url.href, test.href, "href");
|
||||
if ('origin' in test) is(url.origin, test.origin, "origin");
|
||||
if ('protocol' in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ('username' in test) is(url.username, test.username, "username");
|
||||
if ('password' in test) is(url.password, test.password, "password");
|
||||
if ('host' in test) is(url.host, test.host, "host");
|
||||
if ('hostname' in test) is(url.hostname, test.hostname, "hostname");
|
||||
if ('port' in test) is(url.port, test.port, "port");
|
||||
if ('pathname' in test) is(url.pathname, test.pathname, "pathname");
|
||||
if ('search' in test) is(url.search, test.search, "search");
|
||||
if ('hash' in test) is(url.hash, test.hash, "hash");
|
||||
if ("href" in test) is(url.href, test.href, "href");
|
||||
if ("origin" in test) is(url.origin, test.origin, "origin");
|
||||
if ("protocol" in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ("username" in test) is(url.username, test.username, "username");
|
||||
if ("password" in test) is(url.password, test.password, "password");
|
||||
if ("host" in test) is(url.host, test.host, "host");
|
||||
if ("hostname" in test) is(url.hostname, test.hostname, "hostname");
|
||||
if ("port" in test) is(url.port, test.port, "port");
|
||||
if ("pathname" in test) is(url.pathname, test.pathname, "pathname");
|
||||
if ("search" in test) is(url.search, test.search, "search");
|
||||
if ("hash" in test) is(url.hash, test.hash, "hash");
|
||||
|
||||
url = new URL('https://www.example.net/what#foo?bar');
|
||||
url = new URL("https://www.example.net/what#foo?bar");
|
||||
ok(url, "Url exists!");
|
||||
|
||||
if ('href' in test) url.href = test.href;
|
||||
if ('protocol' in test) url.protocol = test.protocol;
|
||||
if ('username' in test && test.username) url.username = test.username;
|
||||
if ('password' in test && test.password) url.password = test.password;
|
||||
if ('host' in test) url.host = test.host;
|
||||
if ('hostname' in test) url.hostname = test.hostname;
|
||||
if ('port' in test) url.port = test.port;
|
||||
if ('pathname' in test) url.pathname = test.pathname;
|
||||
if ('search' in test) url.search = test.search;
|
||||
if ('hash' in test) url.hash = test.hash;
|
||||
if ("href" in test) url.href = test.href;
|
||||
if ("protocol" in test) url.protocol = test.protocol;
|
||||
if ("username" in test && test.username) url.username = test.username;
|
||||
if ("password" in test && test.password) url.password = test.password;
|
||||
if ("host" in test) url.host = test.host;
|
||||
if ("hostname" in test) url.hostname = test.hostname;
|
||||
if ("port" in test) url.port = test.port;
|
||||
if ("pathname" in test) url.pathname = test.pathname;
|
||||
if ("search" in test) url.search = test.search;
|
||||
if ("hash" in test) url.hash = test.hash;
|
||||
|
||||
if ('href' in test) is(url.href, test.href, "href");
|
||||
if ('origin' in test) is(url.origin, test.origin, "origin");
|
||||
if ('protocol' in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ('username' in test) is(url.username, test.username, "username");
|
||||
if ('password' in test) is(url.password, test.password, "password");
|
||||
if ('host' in test) is(url.host, test.host, "host");
|
||||
if ('hostname' in test) is(test.hostname, url.hostname, "hostname");
|
||||
if ('port' in test) is(test.port, url.port, "port");
|
||||
if ('pathname' in test) is(test.pathname, url.pathname, "pathname");
|
||||
if ('search' in test) is(test.search, url.search, "search");
|
||||
if ('hash' in test) is(test.hash, url.hash, "hash");
|
||||
if ("href" in test) is(url.href, test.href, "href");
|
||||
if ("origin" in test) is(url.origin, test.origin, "origin");
|
||||
if ("protocol" in test) is(url.protocol, test.protocol, "protocol");
|
||||
if ("username" in test) is(url.username, test.username, "username");
|
||||
if ("password" in test) is(url.password, test.password, "password");
|
||||
if ("host" in test) is(url.host, test.host, "host");
|
||||
if ("hostname" in test) is(test.hostname, url.hostname, "hostname");
|
||||
if ("port" in test) is(test.port, url.port, "port");
|
||||
if ("pathname" in test) is(test.pathname, url.pathname, "pathname");
|
||||
if ("search" in test) is(test.search, url.search, "search");
|
||||
if ("hash" in test) is(test.hash, url.hash, "hash");
|
||||
|
||||
if ('href' in test) is (test.href, url + '', 'stringify works');
|
||||
if ("href" in test) is(test.href, url + "", "stringify works");
|
||||
}
|
||||
|
||||
postMessage({type: 'finish' });
|
||||
}
|
||||
is(
|
||||
new URL("/static/client/runtime.js", "x:/").href,
|
||||
"x:/static/client/runtime.js",
|
||||
"URL constructor accepts root-relative input with x:/ base",
|
||||
);
|
||||
ok("canParse" in URL, "URL.canParse exists");
|
||||
ok(
|
||||
URL.canParse("/static/client/runtime.js", "x:/"),
|
||||
"URL.canParse accepts root-relative input with x:/ base",
|
||||
);
|
||||
ok(
|
||||
URL.canParse("/static/client/runtime.js", self.location.href),
|
||||
"URL.canParse accepts root-relative input with worker location base",
|
||||
);
|
||||
ok(
|
||||
!URL.canParse("/static/client/runtime.js"),
|
||||
"URL.canParse rejects root-relative input without base",
|
||||
);
|
||||
ok(
|
||||
!URL.canParse("/static/client/runtime.js", "mailto:test@example.com"),
|
||||
"URL.canParse rejects root-relative input against opaque mailto: base",
|
||||
);
|
||||
let mailtoRelativeFailed = false;
|
||||
try {
|
||||
new URL("/static/client/runtime.js", "mailto:test@example.com");
|
||||
} catch (e) {
|
||||
mailtoRelativeFailed = true;
|
||||
}
|
||||
ok(
|
||||
mailtoRelativeFailed,
|
||||
"constructor rejects root-relative input against opaque mailto: base",
|
||||
);
|
||||
|
||||
postMessage({ type: "finish" });
|
||||
};
|
||||
@@ -4,7 +4,7 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker,System)]
|
||||
interface AbstractWorker {
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin AbstractWorker {
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
@@ -45,4 +45,4 @@ interface AnalyserNode : AudioNode {
|
||||
};
|
||||
|
||||
// Mozilla extension
|
||||
AnalyserNode implements AudioNodePassThrough;
|
||||
AnalyserNode includes AudioNodePassThrough;
|
||||
@@ -18,8 +18,7 @@ dictionary AnimationFilter {
|
||||
boolean subtree = false;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface Animatable {
|
||||
interface mixin Animatable {
|
||||
[Func="nsDocument::IsElementAnimateEnabled", Throws]
|
||||
Animation animate(object? keyframes,
|
||||
optional UnrestrictedDoubleOrKeyframeAnimationOptions options);
|
||||
|
||||
@@ -42,4 +42,4 @@ interface AudioBufferSourceNode : AudioNode {
|
||||
};
|
||||
|
||||
// Mozilla extensions
|
||||
AudioBufferSourceNode implements AudioNodePassThrough;
|
||||
AudioBufferSourceNode includes AudioNodePassThrough;
|
||||
@@ -67,8 +67,7 @@ partial interface AudioNode {
|
||||
[ChromeOnly]
|
||||
readonly attribute unsigned long id;
|
||||
};
|
||||
[NoInterfaceObject]
|
||||
interface AudioNodePassThrough {
|
||||
interface mixin AudioNodePassThrough {
|
||||
[ChromeOnly]
|
||||
attribute boolean passThrough;
|
||||
};
|
||||
|
||||
@@ -46,5 +46,5 @@ interface BiquadFilterNode : AudioNode {
|
||||
};
|
||||
|
||||
// Mozilla extension
|
||||
BiquadFilterNode implements AudioNodePassThrough;
|
||||
BiquadFilterNode includes AudioNodePassThrough;
|
||||
|
||||
@@ -27,8 +27,8 @@ interface Blob {
|
||||
//slice Blob into byte-ranged chunks
|
||||
|
||||
[Throws]
|
||||
Blob slice([Clamp] optional long long start,
|
||||
[Clamp] optional long long end,
|
||||
Blob slice(optional [Clamp] long long start,
|
||||
optional [Clamp] long long end,
|
||||
optional DOMString contentType = "");
|
||||
|
||||
// void close(); TODO bug 1048325
|
||||
|
||||
@@ -19,15 +19,7 @@ dictionary BrowserElementExecuteScriptOptions {
|
||||
DOMString? origin;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface BrowserElement {
|
||||
};
|
||||
|
||||
BrowserElement implements BrowserElementCommon;
|
||||
BrowserElement implements BrowserElementPrivileged;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface BrowserElementCommon {
|
||||
interface mixin BrowserElementCommon {
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
@@ -60,7 +52,7 @@ interface BrowserElementCommon {
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface BrowserElementPrivileged {
|
||||
interface BrowserElement {
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
@@ -176,3 +168,6 @@ interface BrowserElementPrivileged {
|
||||
DOMRequest getWebManifest();
|
||||
|
||||
};
|
||||
|
||||
BrowserElement includes BrowserElementCommon;
|
||||
|
||||
@@ -29,7 +29,7 @@ interface BrowserElementAudioChannel : EventTarget {
|
||||
DOMRequest isActive();
|
||||
};
|
||||
|
||||
partial interface BrowserElementPrivileged {
|
||||
interface mixin BrowserElementPrivileged {
|
||||
[Pure, Cached, Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
ChromeOnly]
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
ChromeOnly]
|
||||
interface BrowserElementProxy : EventTarget {
|
||||
};
|
||||
BrowserElementProxy implements BrowserElementCommon;
|
||||
BrowserElementProxy implements BrowserElementPrivileged;
|
||||
BrowserElementProxy includes BrowserElementCommon;
|
||||
BrowserElementProxy includes BrowserElementPrivileged;
|
||||
@@ -22,4 +22,4 @@ interface CSSPseudoElement {
|
||||
};
|
||||
|
||||
// https://w3c.github.io/web-animations/#extensions-to-the-pseudoelement-interface
|
||||
CSSPseudoElement implements Animatable;
|
||||
CSSPseudoElement includes Animatable;
|
||||
@@ -21,7 +21,7 @@ interface CSSStyleDeclaration {
|
||||
CSSValue? getPropertyCSSValue(DOMString property);
|
||||
DOMString getPropertyPriority(DOMString property);
|
||||
[CEReactions, Throws]
|
||||
void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
|
||||
void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, optional [TreatNullAs=EmptyString] DOMString priority = "");
|
||||
[CEReactions, Throws]
|
||||
DOMString removeProperty(DOMString property);
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ interface Cache {
|
||||
Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
|
||||
[NewObject]
|
||||
Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
|
||||
[NewObject]
|
||||
[NewObject, NeedsCallerType]
|
||||
Promise<void> add(RequestInfo request);
|
||||
[NewObject]
|
||||
[NewObject, NeedsCallerType]
|
||||
Promise<void> addAll(sequence<RequestInfo> requests);
|
||||
[NewObject]
|
||||
Promise<void> put(RequestInfo request, Response response);
|
||||
|
||||
@@ -59,7 +59,7 @@ interface CanvasRenderingContext2D {
|
||||
DOMMatrix getTransform();
|
||||
[Throws, LenientFloat]
|
||||
void setTransform(double a, double b, double c, double d, double e, double f);
|
||||
[Throws, LenientFloat]
|
||||
[Throws]
|
||||
void setTransform(optional DOMMatrix2DInit transform);
|
||||
[Throws]
|
||||
void resetTransform();
|
||||
@@ -239,11 +239,10 @@ interface CanvasRenderingContext2D {
|
||||
[ChromeOnly]
|
||||
void demote();
|
||||
};
|
||||
CanvasRenderingContext2D implements CanvasDrawingStyles;
|
||||
CanvasRenderingContext2D implements CanvasPathMethods;
|
||||
CanvasRenderingContext2D includes CanvasDrawingStyles;
|
||||
CanvasRenderingContext2D includes CanvasPathMethods;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface CanvasDrawingStyles {
|
||||
interface mixin CanvasDrawingStyles {
|
||||
// line caps/joins
|
||||
[LenientFloat]
|
||||
attribute double lineWidth; // (default 1)
|
||||
@@ -265,8 +264,7 @@ interface CanvasDrawingStyles {
|
||||
attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface CanvasPathMethods {
|
||||
interface mixin CanvasPathMethods {
|
||||
// shared path API methods
|
||||
void closePath();
|
||||
[LenientFloat]
|
||||
@@ -342,4 +340,4 @@ interface Path2D
|
||||
{
|
||||
[Throws] void addPath(Path2D path, optional DOMMatrix2DInit transformation);
|
||||
};
|
||||
Path2D implements CanvasPathMethods;
|
||||
Path2D includes CanvasPathMethods;
|
||||
@@ -11,8 +11,8 @@
|
||||
*/
|
||||
|
||||
interface CharacterData : Node {
|
||||
[TreatNullAs=EmptyString, Pure, SetterThrows]
|
||||
attribute DOMString data;
|
||||
[Pure, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString data;
|
||||
[Pure]
|
||||
readonly attribute unsigned long length;
|
||||
[Throws]
|
||||
@@ -27,5 +27,5 @@ interface CharacterData : Node {
|
||||
void replaceData(unsigned long offset, unsigned long count, DOMString data);
|
||||
};
|
||||
|
||||
CharacterData implements ChildNode;
|
||||
CharacterData implements NonDocumentTypeChildNode;
|
||||
CharacterData includes ChildNode;
|
||||
CharacterData includes NonDocumentTypeChildNode;
|
||||
@@ -7,8 +7,7 @@
|
||||
* http://dom.spec.whatwg.org/#interface-childnode
|
||||
*/
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface ChildNode {
|
||||
interface mixin ChildNode {
|
||||
[CEReactions, Throws, Unscopable]
|
||||
void before((Node or DOMString)... nodes);
|
||||
[CEReactions, Throws, Unscopable]
|
||||
@@ -19,8 +18,7 @@ interface ChildNode {
|
||||
void remove();
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface NonDocumentTypeChildNode {
|
||||
interface mixin NonDocumentTypeChildNode {
|
||||
[Pure]
|
||||
readonly attribute Element? previousElementSibling;
|
||||
[Pure]
|
||||
|
||||
@@ -26,5 +26,5 @@ interface ConvolverNode : AudioNode {
|
||||
};
|
||||
|
||||
// Mozilla extension
|
||||
ConvolverNode implements AudioNodePassThrough;
|
||||
ConvolverNode includes AudioNodePassThrough;
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#crypto-interface
|
||||
*/
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface GlobalCrypto {
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin GlobalCrypto {
|
||||
[Throws] readonly attribute Crypto crypto;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,4 +10,4 @@ interface DOMCursor : EventTarget {
|
||||
void continue();
|
||||
};
|
||||
|
||||
DOMCursor implements DOMRequestShared;
|
||||
DOMCursor includes DOMRequestShared;
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
interface StackFrame;
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=(Window,Worker)]
|
||||
interface ExceptionMembers
|
||||
interface mixin ExceptionMembers
|
||||
{
|
||||
// A custom message set by the thrower. LenientThis so it can be
|
||||
// gotten on the prototype, which Error.prototype.toString will do
|
||||
@@ -68,7 +66,7 @@ interface Exception {
|
||||
stringifier;
|
||||
};
|
||||
|
||||
Exception implements ExceptionMembers;
|
||||
Exception includes ExceptionMembers;
|
||||
|
||||
// XXXkhuey this is an 'exception', not an interface, but we don't have any
|
||||
// parser or codegen mechanisms for dealing with exceptions.
|
||||
@@ -107,4 +105,4 @@ interface DOMException {
|
||||
|
||||
// XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave
|
||||
// the prototype chain sane.
|
||||
DOMException implements ExceptionMembers;
|
||||
DOMException includes ExceptionMembers;
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
enum DOMRequestReadyState { "pending", "done" };
|
||||
|
||||
[Exposed=(Window,Worker,System), NoInterfaceObject]
|
||||
interface DOMRequestShared {
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin DOMRequestShared {
|
||||
readonly attribute DOMRequestReadyState readyState;
|
||||
|
||||
readonly attribute any result;
|
||||
@@ -26,4 +26,4 @@ interface DOMRequest : EventTarget {
|
||||
[TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null);
|
||||
};
|
||||
|
||||
DOMRequest implements DOMRequestShared;
|
||||
DOMRequest includes DOMRequestShared;
|
||||
@@ -24,5 +24,5 @@ interface DelayNode : AudioNode {
|
||||
};
|
||||
|
||||
// Mozilla extension
|
||||
DelayNode implements AudioNodePassThrough;
|
||||
DelayNode includes AudioNodePassThrough;
|
||||
|
||||
@@ -155,9 +155,6 @@ partial interface Document {
|
||||
|
||||
// Gecko extensions?
|
||||
attribute EventHandler onwheel;
|
||||
attribute EventHandler oncopy;
|
||||
attribute EventHandler oncut;
|
||||
attribute EventHandler onpaste;
|
||||
attribute EventHandler onbeforescriptexecute;
|
||||
attribute EventHandler onafterscriptexecute;
|
||||
|
||||
@@ -440,11 +437,12 @@ partial interface Document {
|
||||
[Func="IsChromeOrXBL"] readonly attribute boolean inlineScriptAllowedByCSP;
|
||||
};
|
||||
|
||||
Document implements XPathEvaluator;
|
||||
Document implements GlobalEventHandlers;
|
||||
Document implements TouchEventHandlers;
|
||||
Document implements ParentNode;
|
||||
Document implements OnErrorEventHandlerForNodes;
|
||||
Document implements GeometryUtils;
|
||||
Document implements FontFaceSource;
|
||||
Document implements DocumentOrShadowRoot;
|
||||
Document includes XPathEvaluatorMixin;
|
||||
Document includes GlobalEventHandlers;
|
||||
Document includes DocumentAndElementEventHandlers;
|
||||
Document includes TouchEventHandlers;
|
||||
Document includes ParentNode;
|
||||
Document includes OnErrorEventHandlerForNodes;
|
||||
Document includes GeometryUtils;
|
||||
Document includes FontFaceSource;
|
||||
Document includes DocumentOrShadowRoot;
|
||||
@@ -24,4 +24,4 @@ partial interface DocumentFragment {
|
||||
NodeList querySelectorAll(DOMString selectors);
|
||||
};
|
||||
|
||||
DocumentFragment implements ParentNode;
|
||||
DocumentFragment includes ParentNode;
|
||||
@@ -8,8 +8,7 @@
|
||||
* http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin
|
||||
*/
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface DocumentOrShadowRoot {
|
||||
interface mixin DocumentOrShadowRoot {
|
||||
// Not implemented yet: bug 1430308.
|
||||
// Selection? getSelection();
|
||||
Element? elementFromPoint (float x, float y);
|
||||
|
||||
@@ -16,4 +16,4 @@ interface DocumentType : Node {
|
||||
readonly attribute DOMString systemId;
|
||||
};
|
||||
|
||||
DocumentType implements ChildNode;
|
||||
DocumentType includes ChildNode;
|
||||
@@ -32,5 +32,5 @@ interface DynamicsCompressorNode : AudioNode {
|
||||
};
|
||||
|
||||
// Mozilla extension
|
||||
DynamicsCompressorNode implements AudioNodePassThrough;
|
||||
DynamicsCompressorNode includes AudioNodePassThrough;
|
||||
|
||||
@@ -163,6 +163,29 @@ interface Element : Node {
|
||||
sequence<Grid> getGridFragments();
|
||||
};
|
||||
|
||||
// https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-mixin
|
||||
interface mixin ElementCSSInlineStyle {
|
||||
[SameObject, PutForwards=cssText]
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/#focus-management-apis
|
||||
dictionary FocusOptions {
|
||||
boolean preventScroll = false;
|
||||
};
|
||||
|
||||
interface mixin HTMLOrForeignElement {
|
||||
[SameObject] readonly attribute DOMStringMap dataset;
|
||||
// See bug 1389421
|
||||
// attribute DOMString nonce; // intentionally no [CEReactions]
|
||||
|
||||
// See bug 1575154
|
||||
// [CEReactions] attribute boolean autofocus;
|
||||
[CEReactions, SetterThrows, Pure] attribute long tabIndex;
|
||||
[Throws] void focus(optional FocusOptions options);
|
||||
[Throws] void blur();
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/cssom-view/
|
||||
enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
|
||||
dictionary ScrollIntoViewOptions : ScrollOptions {
|
||||
@@ -212,10 +235,10 @@ partial interface Element {
|
||||
|
||||
// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
|
||||
partial interface Element {
|
||||
[CEReactions, Pure,SetterThrows,TreatNullAs=EmptyString]
|
||||
attribute DOMString innerHTML;
|
||||
[CEReactions, Pure,SetterThrows,TreatNullAs=EmptyString]
|
||||
attribute DOMString outerHTML;
|
||||
[CEReactions, Pure, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString innerHTML;
|
||||
[CEReactions, Pure, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString outerHTML;
|
||||
[CEReactions, Throws]
|
||||
void insertAdjacentHTML(DOMString position, DOMString text);
|
||||
};
|
||||
@@ -246,11 +269,11 @@ partial interface Element {
|
||||
attribute DOMString slot;
|
||||
};
|
||||
|
||||
Element implements ChildNode;
|
||||
Element implements NonDocumentTypeChildNode;
|
||||
Element implements ParentNode;
|
||||
Element implements Animatable;
|
||||
Element implements GeometryUtils;
|
||||
Element includes ChildNode;
|
||||
Element includes NonDocumentTypeChildNode;
|
||||
Element includes ParentNode;
|
||||
Element includes Animatable;
|
||||
Element includes GeometryUtils;
|
||||
|
||||
// https://fullscreen.spec.whatwg.org/#api
|
||||
partial interface Element {
|
||||
|
||||
@@ -24,8 +24,7 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
|
||||
callback OnErrorEventHandlerNonNull = boolean ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
|
||||
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface GlobalEventHandlers {
|
||||
interface mixin GlobalEventHandlers {
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onblur;
|
||||
// We think the spec is wrong here. See OnErrorEventHandlerForNodes/Window
|
||||
@@ -147,8 +146,7 @@ interface GlobalEventHandlers {
|
||||
attribute EventHandler onwebkittransitionend;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface WindowEventHandlers {
|
||||
interface mixin WindowEventHandlers {
|
||||
attribute EventHandler onafterprint;
|
||||
attribute EventHandler onbeforeprint;
|
||||
attribute OnBeforeUnloadEventHandler onbeforeunload;
|
||||
@@ -166,17 +164,21 @@ interface WindowEventHandlers {
|
||||
attribute EventHandler onunload;
|
||||
};
|
||||
|
||||
interface mixin DocumentAndElementEventHandlers {
|
||||
attribute EventHandler oncopy;
|
||||
attribute EventHandler oncut;
|
||||
attribute EventHandler onpaste;
|
||||
};
|
||||
|
||||
// The spec has |attribute OnErrorEventHandler onerror;| on
|
||||
// GlobalEventHandlers, and calls the handler differently depending on
|
||||
// whether an ErrorEvent was fired. We don't do that, and until we do we'll
|
||||
// need to distinguish between onerror on Window or on nodes.
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface OnErrorEventHandlerForNodes {
|
||||
interface mixin OnErrorEventHandlerForNodes {
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface OnErrorEventHandlerForWindow {
|
||||
interface mixin OnErrorEventHandlerForWindow {
|
||||
attribute OnErrorEventHandler onerror;
|
||||
};
|
||||
@@ -10,8 +10,7 @@
|
||||
typedef object JSON;
|
||||
typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit;
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface Body {
|
||||
interface mixin Body {
|
||||
readonly attribute boolean bodyUsed;
|
||||
[Throws]
|
||||
Promise<ArrayBuffer> arrayBuffer();
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface FontFaceSource {
|
||||
interface mixin FontFaceSource {
|
||||
|
||||
[Pref="layout.css.font-loading-api.enabled"]
|
||||
readonly attribute FontFaceSet fonts;
|
||||
|
||||
@@ -23,5 +23,5 @@ interface GainNode : AudioNode {
|
||||
};
|
||||
|
||||
// Mozilla extension
|
||||
GainNode implements AudioNodePassThrough;
|
||||
GainNode includes AudioNodePassThrough;
|
||||
|
||||
@@ -21,8 +21,7 @@ dictionary ConvertCoordinateOptions {
|
||||
CSSBoxType toBox = "border";
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface GeometryUtils {
|
||||
interface mixin GeometryUtils {
|
||||
[Throws, Func="nsINode::HasBoxQuadsSupport"]
|
||||
sequence<DOMQuad> getBoxQuads(optional BoxQuadOptions options);
|
||||
[Throws, Pref="layout.css.convertFromNode.enabled"]
|
||||
@@ -33,6 +32,6 @@ interface GeometryUtils {
|
||||
DOMPoint convertPointFromNode(DOMPointInit point, GeometryNode from, optional ConvertCoordinateOptions options);
|
||||
};
|
||||
|
||||
// PseudoElement implements GeometryUtils;
|
||||
// PseudoElement includes GeometryUtils;
|
||||
|
||||
typedef (Text or Element /* or PseudoElement */ or Document) GeometryNode;
|
||||
@@ -35,7 +35,7 @@ interface HTMLAnchorElement : HTMLElement {
|
||||
attribute DOMString text;
|
||||
};
|
||||
|
||||
HTMLAnchorElement implements HTMLHyperlinkElementUtils;
|
||||
HTMLAnchorElement includes HTMLHyperlinkElementUtils;
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
||||
partial interface HTMLAnchorElement {
|
||||
|
||||
@@ -38,6 +38,6 @@ interface HTMLAppletElement : HTMLElement {
|
||||
attribute DOMString width;
|
||||
};
|
||||
|
||||
HTMLAppletElement implements MozImageLoadingContent;
|
||||
HTMLAppletElement implements MozFrameLoaderOwner;
|
||||
HTMLAppletElement implements MozObjectLoadingContent;
|
||||
HTMLAppletElement includes MozImageLoadingContent;
|
||||
HTMLAppletElement includes MozFrameLoaderOwner;
|
||||
HTMLAppletElement includes MozObjectLoadingContent;
|
||||
@@ -35,7 +35,7 @@ interface HTMLAreaElement : HTMLElement {
|
||||
readonly attribute DOMTokenList relList;
|
||||
};
|
||||
|
||||
HTMLAreaElement implements HTMLHyperlinkElementUtils;
|
||||
HTMLAreaElement includes HTMLHyperlinkElementUtils;
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
||||
partial interface HTMLAreaElement {
|
||||
|
||||
@@ -16,18 +16,18 @@ interface HTMLBodyElement : HTMLElement {
|
||||
};
|
||||
|
||||
partial interface HTMLBodyElement {
|
||||
[CEReactions, TreatNullAs=EmptyString, SetterThrows]
|
||||
attribute DOMString text;
|
||||
[CEReactions, TreatNullAs=EmptyString, SetterThrows]
|
||||
attribute DOMString link;
|
||||
[CEReactions, TreatNullAs=EmptyString, SetterThrows]
|
||||
attribute DOMString vLink;
|
||||
[CEReactions, TreatNullAs=EmptyString, SetterThrows]
|
||||
attribute DOMString aLink;
|
||||
[CEReactions, TreatNullAs=EmptyString, SetterThrows]
|
||||
attribute DOMString bgColor;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString text;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString link;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString vLink;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString aLink;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute [TreatNullAs=EmptyString] DOMString bgColor;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute DOMString background;
|
||||
};
|
||||
|
||||
HTMLBodyElement implements WindowEventHandlers;
|
||||
HTMLBodyElement includes WindowEventHandlers;
|
||||
@@ -57,11 +57,11 @@ interface HTMLDocument : Document {
|
||||
[Throws]
|
||||
DOMString queryCommandValue(DOMString commandId);
|
||||
|
||||
[CEReactions, TreatNullAs=EmptyString] attribute DOMString fgColor;
|
||||
[CEReactions, TreatNullAs=EmptyString] attribute DOMString linkColor;
|
||||
[CEReactions, TreatNullAs=EmptyString] attribute DOMString vlinkColor;
|
||||
[CEReactions, TreatNullAs=EmptyString] attribute DOMString alinkColor;
|
||||
[CEReactions, TreatNullAs=EmptyString] attribute DOMString bgColor;
|
||||
[CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor;
|
||||
[CEReactions] attribute [TreatNullAs=EmptyString] DOMString linkColor;
|
||||
[CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor;
|
||||
[CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor;
|
||||
[CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
|
||||
|
||||
[Pure]
|
||||
readonly attribute HTMLCollection anchors;
|
||||
|
||||
@@ -22,22 +22,14 @@ interface HTMLElement : Element {
|
||||
// attribute boolean translate;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute DOMString dir;
|
||||
[Constant]
|
||||
readonly attribute DOMStringMap dataset;
|
||||
|
||||
[CEReactions, GetterThrows, Pure, TreatNullAs=EmptyString]
|
||||
attribute DOMString innerText;
|
||||
[CEReactions, GetterThrows, Pure]
|
||||
attribute [TreatNullAs=EmptyString] DOMString innerText;
|
||||
|
||||
// user interaction
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute boolean hidden;
|
||||
void click();
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute long tabIndex;
|
||||
[Throws]
|
||||
void focus();
|
||||
[Throws]
|
||||
void blur();
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute DOMString accessKey;
|
||||
[Pure]
|
||||
@@ -61,15 +53,6 @@ interface HTMLElement : Element {
|
||||
//readonly attribute boolean? commandHidden;
|
||||
//readonly attribute boolean? commandDisabled;
|
||||
//readonly attribute boolean? commandChecked;
|
||||
|
||||
// styling
|
||||
[PutForwards=cssText, Constant]
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
|
||||
// Mozilla specific stuff
|
||||
attribute EventHandler oncopy;
|
||||
attribute EventHandler oncut;
|
||||
attribute EventHandler onpaste;
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface
|
||||
@@ -89,8 +72,7 @@ partial interface HTMLElement {
|
||||
attribute boolean scrollgrab;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface TouchEventHandlers {
|
||||
interface mixin TouchEventHandlers {
|
||||
[Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
attribute EventHandler ontouchstart;
|
||||
[Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
@@ -101,8 +83,11 @@ interface TouchEventHandlers {
|
||||
attribute EventHandler ontouchcancel;
|
||||
};
|
||||
|
||||
HTMLElement implements GlobalEventHandlers;
|
||||
HTMLElement implements TouchEventHandlers;
|
||||
HTMLElement implements OnErrorEventHandlerForNodes;
|
||||
HTMLElement includes GlobalEventHandlers;
|
||||
HTMLElement includes HTMLOrForeignElement;
|
||||
HTMLElement includes DocumentAndElementEventHandlers;
|
||||
HTMLElement includes ElementCSSInlineStyle;
|
||||
HTMLElement includes TouchEventHandlers;
|
||||
HTMLElement includes OnErrorEventHandlerForNodes;
|
||||
|
||||
interface HTMLUnknownElement : HTMLElement {};
|
||||
@@ -41,6 +41,6 @@ partial interface HTMLEmbedElement {
|
||||
Document? getSVGDocument();
|
||||
};
|
||||
|
||||
HTMLEmbedElement implements MozImageLoadingContent;
|
||||
HTMLEmbedElement implements MozFrameLoaderOwner;
|
||||
HTMLEmbedElement implements MozObjectLoadingContent;
|
||||
HTMLEmbedElement includes MozImageLoadingContent;
|
||||
HTMLEmbedElement includes MozFrameLoaderOwner;
|
||||
HTMLEmbedElement includes MozObjectLoadingContent;
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
[HTMLConstructor]
|
||||
interface HTMLFontElement : HTMLElement {
|
||||
[CEReactions, TreatNullAs=EmptyString, SetterThrows] attribute DOMString color;
|
||||
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString color;
|
||||
[CEReactions, SetterThrows] attribute DOMString face;
|
||||
[CEReactions, SetterThrows] attribute DOMString size;
|
||||
};
|
||||
Loaded 100 of 495 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user