+
+
+
+
+ Test for Bug 902350
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_bug902350_frame.html b/dom/base/test/file_bug902350_frame.html
new file mode 100644
index 0000000000..183dabe255
--- /dev/null
+++ b/dom/base/test/file_bug902350_frame.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+ Tests for Mixed Content Frame Navigation
+
+
+Go to http site
+
+
diff --git a/dom/base/test/file_bug907892.html b/dom/base/test/file_bug907892.html
new file mode 100644
index 0000000000..9f5948661c
--- /dev/null
+++ b/dom/base/test/file_bug907892.html
@@ -0,0 +1,12 @@
+
+
diff --git a/dom/base/test/file_bug945152.jar b/dom/base/test/file_bug945152.jar
new file mode 100644
index 0000000000..eb732980d9
Binary files /dev/null and b/dom/base/test/file_bug945152.jar differ
diff --git a/dom/base/test/file_bug945152_worker.js b/dom/base/test/file_bug945152_worker.js
new file mode 100644
index 0000000000..9664045b6d
--- /dev/null
+++ b/dom/base/test/file_bug945152_worker.js
@@ -0,0 +1,99 @@
+var gData1 = "TEST_DATA_1:ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+var gData2 = "TEST_DATA_2:1234567890";
+var gPaddingChar = ".";
+var gPaddingSize = 10000;
+var gPadding = "";
+
+for (var i = 0; i < gPaddingSize; i++) {
+ gPadding += gPaddingChar;
+}
+
+function ok(a, msg) {
+ postMessage({ type: "status", status: !!a, msg });
+}
+
+function is(a, b, msg) {
+ postMessage({ type: "status", status: a === b, msg });
+}
+
+function checkData(response, data_head, cb) {
+ ok(response, "Data is non-null");
+ var str = String.fromCharCode.apply(null, new Uint8Array(response));
+ ok(str.length == data_head.length + gPaddingSize, "Data size is correct");
+ ok(str.slice(0, data_head.length) == data_head, "Data head is correct");
+ ok(str.slice(data_head.length) == gPadding, "Data padding is correct");
+ cb();
+}
+
+self.onmessage = function onmessage(event) {
+ var jar = event.data;
+
+ function makeJarURL(entry) {
+ return "jar:" + jar + "!/" + entry;
+ }
+
+ function test_mapped_sync() {
+ var xhr = new XMLHttpRequest({ mozAnon: true, mozSystem: true });
+ xhr.open("GET", makeJarURL("data_1.txt"), false);
+ xhr.responseType = "arraybuffer";
+ xhr.send();
+ if (xhr.status) {
+ ok(xhr.status == 200, "Status is 200");
+ var ct = xhr.getResponseHeader("Content-Type");
+ ok(ct.includes("mem-mapped"), "Data is memory-mapped");
+ checkData(xhr.response, gData1, runTests);
+ }
+ }
+
+ function test_mapped_async() {
+ var xhr = new XMLHttpRequest({ mozAnon: true, mozSystem: true });
+ xhr.open("GET", makeJarURL("data_1.txt"));
+ xhr.responseType = "arraybuffer";
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState !== xhr.DONE) {
+ return;
+ }
+ if (xhr.status) {
+ ok(xhr.status == 200, "Status is 200");
+ var ct = xhr.getResponseHeader("Content-Type");
+ ok(ct.includes("mem-mapped"), "Data is memory-mapped");
+ checkData(xhr.response, gData1, runTests);
+ }
+ };
+ xhr.send();
+ }
+
+ // Make sure array buffer retrieved from compressed file in package is
+ // handled by memory allocation instead of memory mapping.
+ function test_non_mapped() {
+ var xhr = new XMLHttpRequest({ mozAnon: true, mozSystem: true });
+ xhr.open("GET", makeJarURL("data_2.txt"));
+ xhr.responseType = "arraybuffer";
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState !== xhr.DONE) {
+ return;
+ }
+ if (xhr.status) {
+ ok(xhr.status == 200, "Status is 200");
+ var ct = xhr.getResponseHeader("Content-Type");
+ ok(!ct.includes("mem-mapped"), "Data is not memory-mapped");
+ checkData(xhr.response, gData2, runTests);
+ }
+ };
+ xhr.send();
+ }
+
+ var tests = [test_mapped_sync, test_mapped_async, test_non_mapped];
+
+ function runTests() {
+ if (!tests.length) {
+ postMessage({ type: "finish" });
+ return;
+ }
+
+ var test = tests.shift();
+ test();
+ }
+
+ runTests();
+};
diff --git a/dom/base/test/file_change_policy_redirect.html b/dom/base/test/file_change_policy_redirect.html
new file mode 100644
index 0000000000..e48386d97c
--- /dev/null
+++ b/dom/base/test/file_change_policy_redirect.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_current_inner_window.html b/dom/base/test/file_current_inner_window.html
new file mode 100644
index 0000000000..8156e29000
--- /dev/null
+++ b/dom/base/test/file_current_inner_window.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_delazification_strategy.html b/dom/base/test/file_delazification_strategy.html
new file mode 100644
index 0000000000..a8f58c60f1
--- /dev/null
+++ b/dom/base/test/file_delazification_strategy.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Add a tag script to check delazification strategy
+
+
+
+
+
diff --git a/dom/base/test/file_delazification_strategy.js b/dom/base/test/file_delazification_strategy.js
new file mode 100644
index 0000000000..5afcbeed53
--- /dev/null
+++ b/dom/base/test/file_delazification_strategy.js
@@ -0,0 +1,91 @@
+function baz() {}
+function bar() {}
+function foo() {
+ bar();
+}
+foo();
+
+// For testing, we require the script to be parsed off-htread. To schedule a
+// script off-thread, we require the script to be at least 5 KB. Thus, here is
+// one comment which is used to trick this heuristics:
+//
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWX0Oxoc;,.... ....,;coxO0XWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0kdlc;'.. ..';:ldk0XWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKkoc,.. ..,cok0NWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKko:'. .':okKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKkl,. .,lkKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOo;. .;oONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXkl'. 'lkXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOl' 'lONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMWKo, ,oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMNk:. .:kNMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMXx, ,xXMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMWXd' 'dXWMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMXd' 'dXMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMNx' 'xNMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMWO; ;OWMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMKl. .lXMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMWk, ,kWMMMMMMMMMMMMM
+// MMMMMMMMMMMMXo. .lXMMMMMMMMMMMM
+// MMMMMMMMMMW0; ...... ;0WMMMMMMMMMM
+// MMMMMMMMMWk' ..,:loxxkOOkxdo:,. 'kWMMMMMMMMM
+// MMMMMMMMWx. .':lxO000000000000000ko;. .xWMMMMMMMM
+// MMMMMMMNd. .'cdk00000000000000000000000x;. ..',;ccloodddddddollc:;,'.. .dNMMMMMMM
+// MMMMMMNd. ,dO000000000000000000000000000Oo' ..;coxk00000000000000000000000Okdlc;'. .dNMMMMMM
+// MMMMMNd. .cO000000000000000000000000000000k; .;lxO0000000000000000000000000000000000Okoc,. .dWMMMMM
+// MMMMWx. .'cO0000000000000000000000000000Oc. .;ok0000K00000000000000000000000000000000000000ko, .kWMMMM
+// MMMMO' ,kK0000000000000000000000000000Oc. .:x000000000000000OkdoollcccllodxkO0000K00000000000k' 'OMMMM
+// MMMK; .'lO000000000000000000000000000000Ol'... 'd000000000000Odl;'.. ..',:ldkO00000000KO, ;KMMM
+// MMNo ,dkO0K00000000000000000000000000000000OOkxdoc;,,ck0000000000Oo;. .'ck000000KO; oNMM
+// MMk. .o0000000000000000000000000000000000000000000000000000000000d, .o000000K0: .OMM
+// MX: .o00000000000000000000000000000000000000000000000000000000Oc. c000000K0l. :XM
+// Wx. .c00000000000000000000000000000000000000000000000000000000x, :OK000000o. .xW
+// X: .:dxO00000000000000000000000000000000000000000000000000000Oo' ,k0000000d. :X
+// O. .:xOO0000000000000000000000000000000000000000000000000000Ol. .x000000Kd. .O
+// o ..'''''''',,:lx000000000000000000000000000000000000000000x, .lOOOOkkko. o
+// ; .:x00000000000000000000000000000000000000000O:. ......... ;
+// . 'd00000000000000000000000000000000000000000Ol. .
+// . ,k000000000000000000000000000000000000000000o. .
+// .o0000000000000000000000000000000000000000000d.
+// c00000000000000000000000000000000000000000000o.
+// ;OK0000000000000000000000000000000000000000000o.
+// ,kK00000000000000000000000000000000000000000000xoc:,'..
+// .x00000000000000000000000000000000000000000000000000Okxolc;,'..
+// .d000000000000000K000000000000000000000000000000000000000000OOxdl:,..
+// . .o00000000000000OO0000000000000000000000000000000000000000000000000Oxo:'. .
+// . .l0000000000000Oc:k0000000000000000000000000000000000000000000000000000Oxl,. .
+// ; c000000000000Kk, ,x000000000000000000000000000000xodkO00000000000000000000xc. ;
+// o ..''.. :000000000000Kx' ,k0000000000000000000000000000Oc. ..';codkO000000000000000k:. o
+// O. .,lxO00Okxl:,. :O000000000000d. ;k0000000000000000000000000000l. ..,cok0000000000000d' .O
+// X: ,d000000000000kdc;. :O000000000000l. .c0000000000000000000000000000o. .;oO00000000000k; :X
+// Wx. 'x00000000000000000Oxl;..:O00000000000O: .x000000000000000000000000000d. 'oO00000K0000k, .kW
+// MX: c0000000000000000000000Oxk00000000000Kk, cO00000000000000000000000000d. ;k0000000000d. :XM
+// MMO. :O000000000000000000000000000000000000x. cO00000000000000000000000000d. ,k000000000O: .OMM
+// MMNo .d000000000000000000000000000000000000l. .d000000000000000000000000000o. cO000000000o. .oNMM
+// MMMK; 'd00000000000000000000000000000000000c ,k000000000000000000000000000l. 'x000000000d. ;KMMM
+// MMMMO' .lO000000000000000000000000000000000kl;. .o00000000000000000000000000K0c .d000000000d. 'OMMMM
+// MMMMWx. ;x00000000000000000000000000000000000ko:lO000000000000000000000000000O; .x000000000d. .xWMMMM
+// MMMMMWd. .ck00000000000000000000000000000000000000000000000000000000000000000k, ;kK00000000l. .dWMMMMM
+// MMMMMMNd. .:x000000000000000000000000000000000000000000000000000000000000000d. .o000000000O; .dNMMMMMM
+// MMMMMMMNd. .;dO000000000000000000000000000000000000000000000000000000000000l. .o0000000000d. .dNMMMMMMM
+// MMMMMMMMWx. .,,'.. 'cx00000000000000000000000000000000000000000000000000000000KO: .;d0000000000x, .xWMMMMMMMM
+// MMMMMMMMMWk' 'd00Oxdl;'. .,lx000000000000000000000000000000000000000000000000000000k' .:dO0000000000x, 'kWMMMMMMMMM
+// MMMMMMMMMMW0; .:x000000kd:'. .,lk000000000000000000000000000000000000000000000000000d. ..,cdk0K000000000Oo. :0WMMMMMMMMMM
+// MMMMMMMMMMMMXo. .,ok000000Odc. ,x000000000000000000000000000000000000000000000000000d,...'',;:cldxO000000000000K0d;. .oXMMMMMMMMMMMM
+// MMMMMMMMMMMMMWk, .:x0000000Oo;.. .,oO000000000000000000000000000000000000000000000000000000OOOO00000000000000000000Od;. ,kWMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMXl. .;dO0000000Oxdoooxk0000000000OxxO0000000000000000000000000000000000000000000000000000000000000000Oxc' .lXMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMWO; 'lk00000000000000000000Oxc' ..:oxO0K000000000000000000000000000000000000000000000000000000Oko:'. ;OWMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMNx, .;ok00000000000000kdc'. ..;cdxO00000000000000000000000000000000000000000000Okxdoc;'. ,xNMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMXd' .,:ldxkkkkxdl:,. ..,:cldxkkkO000000000000Okkxdlc:;;;:::::;;;,,'... 'dXMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMXd' ...... ....'',,,,,,,,'.... 'dXWMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMXx,. ,xXMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMNk:. .:kNMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMWKo,. .,oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOl' 'lONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXkl'. .'lkXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOo;. .;oONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKkl;. .,lkKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKko:'. .':okKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKkoc,.. ..,cok0NWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0kdlc;'.. ..';:ldk0XWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
+// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWX0Oxoc;,.... ....,;coxO0XNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
diff --git a/dom/base/test/file_domwindowutils_animation.html b/dom/base/test/file_domwindowutils_animation.html
new file mode 100644
index 0000000000..c8b6f2a99d
--- /dev/null
+++ b/dom/base/test/file_domwindowutils_animation.html
@@ -0,0 +1,233 @@
+
+
+
+
+ DOMWindowUtils test with animation
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_domwindowutils_dynamic_toolbar.html b/dom/base/test/file_domwindowutils_dynamic_toolbar.html
new file mode 100644
index 0000000000..becb4bf08f
--- /dev/null
+++ b/dom/base/test/file_domwindowutils_dynamic_toolbar.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_empty.html b/dom/base/test/file_empty.html
new file mode 100644
index 0000000000..495c23ec8a
--- /dev/null
+++ b/dom/base/test/file_empty.html
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/file_explicit_user_agent.sjs b/dom/base/test/file_explicit_user_agent.sjs
new file mode 100644
index 0000000000..33b9a5c505
--- /dev/null
+++ b/dom/base/test/file_explicit_user_agent.sjs
@@ -0,0 +1,6 @@
+function handleRequest(request, response) {
+ if (request.hasHeader("User-Agent")) {
+ response.setHeader("Result-User-Agent", request.getHeader("User-Agent"));
+ }
+ response.write("");
+}
diff --git a/dom/base/test/file_external_script.html b/dom/base/test/file_external_script.html
new file mode 100644
index 0000000000..16f059d558
--- /dev/null
+++ b/dom/base/test/file_external_script.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+ Hello Mochitest
+
+
diff --git a/dom/base/test/file_external_script.xhtml b/dom/base/test/file_external_script.xhtml
new file mode 100644
index 0000000000..4327c499cb
--- /dev/null
+++ b/dom/base/test/file_external_script.xhtml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+ Hello Mochitest
+
+
diff --git a/dom/base/test/file_focus_design_mode_inner.html b/dom/base/test/file_focus_design_mode_inner.html
new file mode 100644
index 0000000000..43e24652ab
--- /dev/null
+++ b/dom/base/test/file_focus_design_mode_inner.html
@@ -0,0 +1,32 @@
+
+
+
+
+ activeElement design-mode inner document
+
+
+Inner
+
+
+
diff --git a/dom/base/test/file_focus_display_none_xorigin_iframe_inner.html b/dom/base/test/file_focus_display_none_xorigin_iframe_inner.html
new file mode 100644
index 0000000000..5831df882c
--- /dev/null
+++ b/dom/base/test/file_focus_display_none_xorigin_iframe_inner.html
@@ -0,0 +1,15 @@
+
+
+Inner
+
+
diff --git a/dom/base/test/file_focus_shadow_dom.html b/dom/base/test/file_focus_shadow_dom.html
new file mode 100644
index 0000000000..6fa9d1b88e
--- /dev/null
+++ b/dom/base/test/file_focus_shadow_dom.html
@@ -0,0 +1,999 @@
+
+
+ Test for Bug 1453693
+
+
+
+
+
+
+
component
+
/component
+
+
+
+
+
+
diff --git a/dom/base/test/file_general_document.html b/dom/base/test/file_general_document.html
new file mode 100644
index 0000000000..2539669de9
--- /dev/null
+++ b/dom/base/test/file_general_document.html
@@ -0,0 +1,10 @@
+
+
+
+
+General document for testing
+
+
+Hello mochitest!
+
+
diff --git a/dom/base/test/file_history_document_open.html b/dom/base/test/file_history_document_open.html
new file mode 100644
index 0000000000..b9f05f7c2c
--- /dev/null
+++ b/dom/base/test/file_history_document_open.html
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/file_htmlserializer_1.html b/dom/base/test/file_htmlserializer_1.html
new file mode 100644
index 0000000000..9576b5d7d6
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1.html
@@ -0,0 +1,44 @@
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_bodyonly.html b/dom/base/test/file_htmlserializer_1_bodyonly.html
new file mode 100644
index 0000000000..848167c62a
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_bodyonly.html
@@ -0,0 +1,43 @@
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_format.html b/dom/base/test/file_htmlserializer_1_format.html
new file mode 100644
index 0000000000..09f80467e4
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_format.html
@@ -0,0 +1,57 @@
+
+
+
+
+ Test for html serializer
+
+
+ Hello world
+ Lorem ipsum dolor sit amet, consectetuer
+ adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis
+ ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent
+ taciti sociosqu ad litora torquent per conubia
+ nostra, per inceptos hymenaeos.
+
+ Nam tellus massa,éà èçù
+ fringilla aliquam,
+ fermentum sit amet,
+ posuere ac,
+ est.
+
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+ Fusce a ipsum
+ non lacus posuere aliquet.
+ Sed fermentum posuere nulla
+ Donec tempor.
+
+ Donec sollicitudin tortor
+
+ lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+ Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
+ aliquet lectus. Nunc vitae eros. Class aptent taciti
+
+
diff --git a/dom/base/test/file_htmlserializer_1_linebreak.html b/dom/base/test/file_htmlserializer_1_linebreak.html
new file mode 100644
index 0000000000..8194b8b415
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_linebreak.html
@@ -0,0 +1,47 @@
+
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_links.html b/dom/base/test/file_htmlserializer_1_links.html
new file mode 100644
index 0000000000..f0864c940c
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_links.html
@@ -0,0 +1,47 @@
+
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
diff --git a/dom/base/test/file_htmlserializer_1_nested_body.html b/dom/base/test/file_htmlserializer_1_nested_body.html
new file mode 100644
index 0000000000..94f67547e3
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_nested_body.html
@@ -0,0 +1,47 @@
+
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
this is an other body element
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_no_body.html b/dom/base/test/file_htmlserializer_1_no_body.html
new file mode 100644
index 0000000000..9c749721b1
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_no_body.html
@@ -0,0 +1,5 @@
+
+
+ Test for html serializer
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_noflag.html b/dom/base/test/file_htmlserializer_1_noflag.html
new file mode 100644
index 0000000000..8194b8b415
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_noflag.html
@@ -0,0 +1,47 @@
+
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_noformatpre.html b/dom/base/test/file_htmlserializer_1_noformatpre.html
new file mode 100644
index 0000000000..aba95b62c8
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_noformatpre.html
@@ -0,0 +1,51 @@
+
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+
+ Cras quis
+
+ nisi at odio
+
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_raw.html b/dom/base/test/file_htmlserializer_1_raw.html
new file mode 100644
index 0000000000..c646f26963
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_raw.html
@@ -0,0 +1,45 @@
+
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_sibling_body.html b/dom/base/test/file_htmlserializer_1_sibling_body.html
new file mode 100644
index 0000000000..f533e6679a
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_sibling_body.html
@@ -0,0 +1,47 @@
+
+
+ Test for html serializer
+
+this is an other body element
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_sibling_body_only_body.html b/dom/base/test/file_htmlserializer_1_sibling_body_only_body.html
new file mode 100644
index 0000000000..97c1625156
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_sibling_body_only_body.html
@@ -0,0 +1,43 @@
+this is an other body element
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_1_wrap.html b/dom/base/test/file_htmlserializer_1_wrap.html
new file mode 100644
index 0000000000..4552e9cba5
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_1_wrap.html
@@ -0,0 +1,52 @@
+
+
+ Test for html serializer
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
+ ad
+ litora torquent per
+ conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum
+posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
+aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_2.html b/dom/base/test/file_htmlserializer_2.html
new file mode 100644
index 0000000000..2156b1610c
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_2.html
@@ -0,0 +1,22 @@
+Test for html serializer with entities
+
+
+The basic set is just & < > " for interoperability with older products that don't support α and friends.
+
+latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´
+µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ
+Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø
+Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê
+ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý
+þ ÿ
+symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ
+Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς
+σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ⁄ ℘ ℑ ℜ
+™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
+∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥
+⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ ◊ ♠ ♣ ♥ ♦
+
+ others
+Œ œ Š š Ÿ ˆ ˜ –— ‘ ’
+‚“ ” „ † ‡ ‰ ‹ › €
+
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_2_basic.html b/dom/base/test/file_htmlserializer_2_basic.html
new file mode 100644
index 0000000000..56ac95dfdd
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_2_basic.html
@@ -0,0 +1,24 @@
+
+
+Test for html serializer with entities
+
+
+The basic set is just & < > " for interoperability with older products that don't support α and friends.
+
+latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬  ® ¯ ° ± ² ³ ´
+µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À à Â Ã Ä Å Æ
+Ç È É Ê Ë Ì à Î à à Ñ Ò Ó Ô Õ Ö × Ø
+Ù Ú Û Ü à Þ ß à á â ã ä å æ ç è é ê
+ë ì à î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý
+þ ÿ
+symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ ΠΞ Ο ΠΡ Σ Τ Υ
+Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο Ï€ Ï Ï‚
+σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ℠℘ ℑ ℜ
+™ ℵ ↠↑ → ↓ ↔ ↵ ⇠⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
+∋ ∠∑ − ∗ √ ∠∞ ∠∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠≡ ≤ ≥
+⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ ◊ ♠♣ ♥ ♦
+
+ others
+Å’ Å“ Å Å¡ Ÿ ˆ Ëœ       ‌ †‎ â€â€“— ‘ ’
+‚“ †„ †‡ ‰ ‹ › €
+
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_ipv6.html b/dom/base/test/file_htmlserializer_ipv6.html
new file mode 100644
index 0000000000..298493e718
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_ipv6.html
@@ -0,0 +1,5 @@
+
+ Testcase for IPv6 addresses
+
+ Test
+
\ No newline at end of file
diff --git a/dom/base/test/file_htmlserializer_ipv6_out.html b/dom/base/test/file_htmlserializer_ipv6_out.html
new file mode 100644
index 0000000000..675a406d85
--- /dev/null
+++ b/dom/base/test/file_htmlserializer_ipv6_out.html
@@ -0,0 +1,6 @@
+
+
+ Testcase for IPv6 addresses
+
+ Test
+
\ No newline at end of file
diff --git a/dom/base/test/file_inline_script.html b/dom/base/test/file_inline_script.html
new file mode 100644
index 0000000000..838c70f946
--- /dev/null
+++ b/dom/base/test/file_inline_script.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+ Hello Mochitest
+
+
diff --git a/dom/base/test/file_inline_script.xhtml b/dom/base/test/file_inline_script.xhtml
new file mode 100644
index 0000000000..525daf29fe
--- /dev/null
+++ b/dom/base/test/file_inline_script.xhtml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+ Hello Mochitest
+
+
diff --git a/dom/base/test/file_js_cache.html b/dom/base/test/file_js_cache.html
new file mode 100644
index 0000000000..6feb94d872
--- /dev/null
+++ b/dom/base/test/file_js_cache.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Add a tag script to save the bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_js_cache.js b/dom/base/test/file_js_cache.js
new file mode 100644
index 0000000000..b9b966775c
--- /dev/null
+++ b/dom/base/test/file_js_cache.js
@@ -0,0 +1,5 @@
+function baz() {}
+function bar() {}
+function foo() { bar() }
+foo();
+
diff --git a/dom/base/test/file_js_cache_module.html b/dom/base/test/file_js_cache_module.html
new file mode 100644
index 0000000000..36d549c945
--- /dev/null
+++ b/dom/base/test/file_js_cache_module.html
@@ -0,0 +1,13 @@
+
+
+
+
+ Load the script as a module
+
+
+
+
+
+
diff --git a/dom/base/test/file_js_cache_save_after_load.html b/dom/base/test/file_js_cache_save_after_load.html
new file mode 100644
index 0000000000..8a696c0026
--- /dev/null
+++ b/dom/base/test/file_js_cache_save_after_load.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Save the bytecode when all scripts are executed
+
+
+
+
+
diff --git a/dom/base/test/file_js_cache_save_after_load.js b/dom/base/test/file_js_cache_save_after_load.js
new file mode 100644
index 0000000000..7f5a20b524
--- /dev/null
+++ b/dom/base/test/file_js_cache_save_after_load.js
@@ -0,0 +1,15 @@
+function send_ping() {
+ window.dispatchEvent(new Event("ping"));
+}
+send_ping(); // ping (=1)
+
+window.addEventListener("load", function () {
+ send_ping(); // ping (=2)
+
+ // Append a script which should call |foo|, before the encoding of this script
+ // bytecode.
+ var script = document.createElement("script");
+ script.type = "text/javascript";
+ script.innerText = "send_ping();"; // ping (=3)
+ document.head.appendChild(script);
+});
diff --git a/dom/base/test/file_js_cache_syntax_error.html b/dom/base/test/file_js_cache_syntax_error.html
new file mode 100644
index 0000000000..cc4a9b2daa
--- /dev/null
+++ b/dom/base/test/file_js_cache_syntax_error.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Do not save bytecode on compilation errors
+
+
+
+
+
diff --git a/dom/base/test/file_js_cache_syntax_error.js b/dom/base/test/file_js_cache_syntax_error.js
new file mode 100644
index 0000000000..fcf587ae70
--- /dev/null
+++ b/dom/base/test/file_js_cache_syntax_error.js
@@ -0,0 +1 @@
+var // SyntaxError: missing variable name.
diff --git a/dom/base/test/file_js_cache_with_sri.html b/dom/base/test/file_js_cache_with_sri.html
new file mode 100644
index 0000000000..38ecb26984
--- /dev/null
+++ b/dom/base/test/file_js_cache_with_sri.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Add a tag script to save the bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_location_href_unknown_protocol.html b/dom/base/test/file_location_href_unknown_protocol.html
new file mode 100644
index 0000000000..10c994fbde
--- /dev/null
+++ b/dom/base/test/file_location_href_unknown_protocol.html
@@ -0,0 +1,15 @@
+
+
diff --git a/dom/base/test/file_lock_orientation_with_pending_fullscreen.html b/dom/base/test/file_lock_orientation_with_pending_fullscreen.html
new file mode 100644
index 0000000000..07af0fc67d
--- /dev/null
+++ b/dom/base/test/file_lock_orientation_with_pending_fullscreen.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_messagemanager_unload.html b/dom/base/test/file_messagemanager_unload.html
new file mode 100644
index 0000000000..f01e60bae2
--- /dev/null
+++ b/dom/base/test/file_messagemanager_unload.html
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/dom/base/test/file_module_js_cache.html b/dom/base/test/file_module_js_cache.html
new file mode 100644
index 0000000000..1a0d433dcd
--- /dev/null
+++ b/dom/base/test/file_module_js_cache.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Add a tag module script to save the bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_module_js_cache.mjs b/dom/base/test/file_module_js_cache.mjs
new file mode 100644
index 0000000000..1b08386c81
--- /dev/null
+++ b/dom/base/test/file_module_js_cache.mjs
@@ -0,0 +1,6 @@
+function baz() {}
+function bar() {}
+function foo() {
+ bar();
+}
+foo();
diff --git a/dom/base/test/file_module_js_cache_no_module.html b/dom/base/test/file_module_js_cache_no_module.html
new file mode 100644
index 0000000000..d81884e44d
--- /dev/null
+++ b/dom/base/test/file_module_js_cache_no_module.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Load the module script as a regular script
+
+
+
+
+
diff --git a/dom/base/test/file_module_js_cache_with_sri.html b/dom/base/test/file_module_js_cache_with_sri.html
new file mode 100644
index 0000000000..f0039a431b
--- /dev/null
+++ b/dom/base/test/file_module_js_cache_with_sri.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Add a tag module script to save the bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_mozfiledataurl_img.jpg b/dom/base/test/file_mozfiledataurl_img.jpg
new file mode 100644
index 0000000000..dcd99b9670
Binary files /dev/null and b/dom/base/test/file_mozfiledataurl_img.jpg differ
diff --git a/dom/base/test/file_navigator_resolve_identity_xrays.xhtml b/dom/base/test/file_navigator_resolve_identity_xrays.xhtml
new file mode 100644
index 0000000000..bdce7c7b64
--- /dev/null
+++ b/dom/base/test/file_navigator_resolve_identity_xrays.xhtml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_receiveMessage.html b/dom/base/test/file_receiveMessage.html
new file mode 100644
index 0000000000..66f421270f
--- /dev/null
+++ b/dom/base/test/file_receiveMessage.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_restrictedEventSource.sjs b/dom/base/test/file_restrictedEventSource.sjs
new file mode 100644
index 0000000000..b7ca11002a
--- /dev/null
+++ b/dom/base/test/file_restrictedEventSource.sjs
@@ -0,0 +1,69 @@
+function handleRequest(request, response) {
+ if (
+ (request.queryString == "test=user1_xhr" &&
+ request.hasHeader("Authorization") &&
+ request.getHeader("Authorization") == "Basic dXNlciAxOnBhc3N3b3JkIDE=") ||
+ (request.queryString == "test=user1_evtsrc" &&
+ request.hasHeader("Authorization") &&
+ request.getHeader("Authorization") == "Basic dXNlciAxOnBhc3N3b3JkIDE=")
+ ) {
+ response.setStatusLine(null, 200, "OK");
+ response.setHeader("Content-Type", "text/event-stream", false);
+ response.setHeader(
+ "Access-Control-Allow-Origin",
+ "http://mochi.test:8888",
+ false
+ );
+ response.setHeader("Access-Control-Allow-Credentials", "true", false);
+ response.setHeader("Cache-Control", "no-cache, must-revalidate", false);
+ if (request.queryString == "test=user1_xhr") {
+ response.setHeader("Set-Cookie", "test=5c", false);
+ }
+ response.write("event: message\ndata: 1\n\n");
+ } else if (
+ (request.queryString == "test=user2_xhr" &&
+ request.hasHeader("Authorization") &&
+ request.getHeader("Authorization") == "Basic dXNlciAyOnBhc3N3b3JkIDI=") ||
+ (request.queryString == "test=user2_evtsrc" &&
+ request.hasHeader("Authorization") &&
+ request.getHeader("Authorization") == "Basic dXNlciAyOnBhc3N3b3JkIDI=" &&
+ request.hasHeader("Cookie") &&
+ request.getHeader("Cookie") == "test=5d")
+ ) {
+ response.setStatusLine(null, 200, "OK");
+ response.setHeader("Content-Type", "text/event-stream", false);
+ response.setHeader(
+ "Access-Control-Allow-Origin",
+ "http://mochi.test:8888",
+ false
+ );
+ response.setHeader("Access-Control-Allow-Credentials", "true", false);
+ response.setHeader("Cache-Control", "no-cache, must-revalidate", false);
+ if (request.queryString == "test=user2_xhr") {
+ response.setHeader("Set-Cookie", "test=5d", false);
+ }
+ response.write("event: message\ndata: 1\n\n");
+ } else if (
+ request.queryString == "test=user1_xhr" ||
+ request.queryString == "test=user2_xhr"
+ ) {
+ response.setStatusLine(null, 401, "Unauthorized");
+ response.setHeader("WWW-Authenticate", 'basic realm="restricted"', false);
+ response.setHeader(
+ "Access-Control-Allow-Origin",
+ "http://mochi.test:8888",
+ false
+ );
+ response.setHeader("Access-Control-Allow-Credentials", "true", false);
+ response.write("Unauthorized");
+ } else {
+ response.setStatusLine(null, 403, "Forbidden");
+ response.setHeader(
+ "Access-Control-Allow-Origin",
+ "http://mochi.test:8888",
+ false
+ );
+ response.setHeader("Access-Control-Allow-Credentials", "true", false);
+ response.write("Forbidden");
+ }
+}
diff --git a/dom/base/test/file_sandbox_and_document_uri.html b/dom/base/test/file_sandbox_and_document_uri.html
new file mode 100644
index 0000000000..ac23cd1fec
--- /dev/null
+++ b/dom/base/test/file_sandbox_and_document_uri.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_script.js b/dom/base/test/file_script.js
new file mode 100644
index 0000000000..3e15525fa6
--- /dev/null
+++ b/dom/base/test/file_script.js
@@ -0,0 +1 @@
+window.scriptRan = true;
diff --git a/dom/base/test/file_script_module_dynamic_and_element.html b/dom/base/test/file_script_module_dynamic_and_element.html
new file mode 100644
index 0000000000..3614ed6a99
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_element.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_dynamic_and_element.mjs b/dom/base/test/file_script_module_dynamic_and_element.mjs
new file mode 100644
index 0000000000..ead071d159
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_element.mjs
@@ -0,0 +1,20 @@
+const { f } = await import(
+ "./file_script_module_dynamic_and_element_imported_1.mjs"
+);
+import { g } from "./file_script_module_dynamic_and_element_imported_2.mjs";
+import { h } from "./file_script_module_dynamic_and_element_imported_3.mjs";
+
+f();
+g();
+h();
+
+let script = document.createElement("script");
+script.id = "watchme2";
+script.setAttribute("type", "module");
+script.setAttribute(
+ "src",
+ "file_script_module_dynamic_and_element_imported_1.mjs"
+);
+document.body.appendChild(script);
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_dynamic_and_element_imported_1.mjs b/dom/base/test/file_script_module_dynamic_and_element_imported_1.mjs
new file mode 100644
index 0000000000..f58abdf254
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_element_imported_1.mjs
@@ -0,0 +1,7 @@
+import { g } from "./file_script_module_dynamic_and_element_imported_2.mjs";
+import { h } from "./file_script_module_dynamic_and_element_imported_3.mjs";
+
+g();
+h();
+
+export function f() {}
diff --git a/dom/base/test/file_script_module_dynamic_and_element_imported_2.mjs b/dom/base/test/file_script_module_dynamic_and_element_imported_2.mjs
new file mode 100644
index 0000000000..f75e8c9b21
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_element_imported_2.mjs
@@ -0,0 +1 @@
+export function g() {}
diff --git a/dom/base/test/file_script_module_dynamic_and_element_imported_3.mjs b/dom/base/test/file_script_module_dynamic_and_element_imported_3.mjs
new file mode 100644
index 0000000000..6b340b7588
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_element_imported_3.mjs
@@ -0,0 +1 @@
+export function h() {}
diff --git a/dom/base/test/file_script_module_dynamic_and_static.html b/dom/base/test/file_script_module_dynamic_and_static.html
new file mode 100644
index 0000000000..4ecd6c74a3
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_static.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_dynamic_and_static.mjs b/dom/base/test/file_script_module_dynamic_and_static.mjs
new file mode 100644
index 0000000000..da8fff4002
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_static.mjs
@@ -0,0 +1,11 @@
+const { f } = await import(
+ "./file_script_module_dynamic_and_static_imported_1.mjs"
+);
+import { g } from "./file_script_module_dynamic_and_static_imported_2.mjs";
+import { h } from "./file_script_module_dynamic_and_static_imported_3.mjs";
+
+f();
+g();
+h();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_dynamic_and_static_imported_1.mjs b/dom/base/test/file_script_module_dynamic_and_static_imported_1.mjs
new file mode 100644
index 0000000000..3a752224a9
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_static_imported_1.mjs
@@ -0,0 +1,5 @@
+import { h } from "./file_script_module_dynamic_and_static_imported_3.mjs";
+
+h();
+
+export function f() {}
diff --git a/dom/base/test/file_script_module_dynamic_and_static_imported_2.mjs b/dom/base/test/file_script_module_dynamic_and_static_imported_2.mjs
new file mode 100644
index 0000000000..e00553b7e4
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_static_imported_2.mjs
@@ -0,0 +1,5 @@
+import { f } from "./file_script_module_dynamic_and_static_imported_1.mjs";
+
+f();
+
+export function g() {}
diff --git a/dom/base/test/file_script_module_dynamic_and_static_imported_3.mjs b/dom/base/test/file_script_module_dynamic_and_static_imported_3.mjs
new file mode 100644
index 0000000000..6b340b7588
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_and_static_imported_3.mjs
@@ -0,0 +1 @@
+export function h() {}
diff --git a/dom/base/test/file_script_module_dynamic_import.html b/dom/base/test/file_script_module_dynamic_import.html
new file mode 100644
index 0000000000..3222e0dc5e
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_import.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_dynamic_import.mjs b/dom/base/test/file_script_module_dynamic_import.mjs
new file mode 100644
index 0000000000..10c0186e69
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_import.mjs
@@ -0,0 +1,4 @@
+const { f } = await import("./file_script_module_dynamic_import_imported.mjs");
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_dynamic_import_imported.mjs b/dom/base/test/file_script_module_dynamic_import_imported.mjs
new file mode 100644
index 0000000000..8b38a11158
--- /dev/null
+++ b/dom/base/test/file_script_module_dynamic_import_imported.mjs
@@ -0,0 +1 @@
+export function f() {}
diff --git a/dom/base/test/file_script_module_element_and_dynamic.html b/dom/base/test/file_script_module_element_and_dynamic.html
new file mode 100644
index 0000000000..ceec5c2c64
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_dynamic.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_element_and_dynamic.mjs b/dom/base/test/file_script_module_element_and_dynamic.mjs
new file mode 100644
index 0000000000..3eeba5f28d
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_dynamic.mjs
@@ -0,0 +1,11 @@
+const { f } = await import(
+ "./file_script_module_element_and_dynamic_imported_1.mjs"
+);
+import { g } from "./file_script_module_element_and_dynamic_imported_2.mjs";
+import { h } from "./file_script_module_element_and_dynamic_imported_3.mjs";
+
+f();
+g();
+h();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_element_and_dynamic_imported_1.mjs b/dom/base/test/file_script_module_element_and_dynamic_imported_1.mjs
new file mode 100644
index 0000000000..cf09ed7dde
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_dynamic_imported_1.mjs
@@ -0,0 +1,13 @@
+import { g } from "./file_script_module_element_and_dynamic_imported_2.mjs";
+import { h } from "./file_script_module_element_and_dynamic_imported_3.mjs";
+
+g();
+h();
+
+export function f() {}
+
+let script = document.createElement("script");
+script.id = "watchme2";
+script.setAttribute("type", "module");
+script.setAttribute("src", "file_script_module_element_and_dynamic.mjs");
+document.body.appendChild(script);
diff --git a/dom/base/test/file_script_module_element_and_dynamic_imported_2.mjs b/dom/base/test/file_script_module_element_and_dynamic_imported_2.mjs
new file mode 100644
index 0000000000..f75e8c9b21
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_dynamic_imported_2.mjs
@@ -0,0 +1 @@
+export function g() {}
diff --git a/dom/base/test/file_script_module_element_and_dynamic_imported_3.mjs b/dom/base/test/file_script_module_element_and_dynamic_imported_3.mjs
new file mode 100644
index 0000000000..6b340b7588
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_dynamic_imported_3.mjs
@@ -0,0 +1 @@
+export function h() {}
diff --git a/dom/base/test/file_script_module_element_and_import.html b/dom/base/test/file_script_module_element_and_import.html
new file mode 100644
index 0000000000..483a97a61c
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_import.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_element_and_import.mjs b/dom/base/test/file_script_module_element_and_import.mjs
new file mode 100644
index 0000000000..1c10b2b300
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_import.mjs
@@ -0,0 +1,9 @@
+import { f } from "./file_script_module_element_and_import_imported_1.mjs";
+import { g } from "./file_script_module_element_and_import_imported_2.mjs";
+import { h } from "./file_script_module_element_and_import_imported_3.mjs";
+
+f();
+g();
+h();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_element_and_import_imported_1.mjs b/dom/base/test/file_script_module_element_and_import_imported_1.mjs
new file mode 100644
index 0000000000..358b1e34bd
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_import_imported_1.mjs
@@ -0,0 +1,13 @@
+import { g } from "./file_script_module_element_and_import_imported_2.mjs";
+import { h } from "./file_script_module_element_and_import_imported_3.mjs";
+
+g();
+h();
+
+export function f() {}
+
+let script = document.createElement("script");
+script.id = "watchme2";
+script.setAttribute("type", "module");
+script.setAttribute("src", "file_script_module_element_and_import.mjs");
+document.body.appendChild(script);
diff --git a/dom/base/test/file_script_module_element_and_import_imported_2.mjs b/dom/base/test/file_script_module_element_and_import_imported_2.mjs
new file mode 100644
index 0000000000..f75e8c9b21
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_import_imported_2.mjs
@@ -0,0 +1 @@
+export function g() {}
diff --git a/dom/base/test/file_script_module_element_and_import_imported_3.mjs b/dom/base/test/file_script_module_element_and_import_imported_3.mjs
new file mode 100644
index 0000000000..6b340b7588
--- /dev/null
+++ b/dom/base/test/file_script_module_element_and_import_imported_3.mjs
@@ -0,0 +1 @@
+export function h() {}
diff --git a/dom/base/test/file_script_module_frames_dynamic.html b/dom/base/test/file_script_module_frames_dynamic.html
new file mode 100644
index 0000000000..9f07e094fa
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_dynamic.html
@@ -0,0 +1,24 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_dynamic_load.html b/dom/base/test/file_script_module_frames_dynamic_load.html
new file mode 100644
index 0000000000..228ef710b3
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_dynamic_load.html
@@ -0,0 +1,19 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_dynamic_load.mjs b/dom/base/test/file_script_module_frames_dynamic_load.mjs
new file mode 100644
index 0000000000..ed7ca91fd4
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_dynamic_load.mjs
@@ -0,0 +1,4 @@
+const { f } = await import("./file_script_module_frames_dynamic_shared.mjs");
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_frames_dynamic_save.html b/dom/base/test/file_script_module_frames_dynamic_save.html
new file mode 100644
index 0000000000..13d07d4b95
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_dynamic_save.html
@@ -0,0 +1,19 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_dynamic_save.mjs b/dom/base/test/file_script_module_frames_dynamic_save.mjs
new file mode 100644
index 0000000000..ed7ca91fd4
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_dynamic_save.mjs
@@ -0,0 +1,4 @@
+const { f } = await import("./file_script_module_frames_dynamic_shared.mjs");
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_frames_dynamic_shared.mjs b/dom/base/test/file_script_module_frames_dynamic_shared.mjs
new file mode 100644
index 0000000000..8b38a11158
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_dynamic_shared.mjs
@@ -0,0 +1 @@
+export function f() {}
diff --git a/dom/base/test/file_script_module_frames_element.html b/dom/base/test/file_script_module_frames_element.html
new file mode 100644
index 0000000000..aec8dfa5f0
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_element.html
@@ -0,0 +1,24 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_element_load.html b/dom/base/test/file_script_module_frames_element_load.html
new file mode 100644
index 0000000000..a35c188ce2
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_element_load.html
@@ -0,0 +1,19 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_element_save.html b/dom/base/test/file_script_module_frames_element_save.html
new file mode 100644
index 0000000000..186d55e024
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_element_save.html
@@ -0,0 +1,19 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_element_shared.mjs b/dom/base/test/file_script_module_frames_element_shared.mjs
new file mode 100644
index 0000000000..741b76cd09
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_element_shared.mjs
@@ -0,0 +1 @@
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_frames_import.html b/dom/base/test/file_script_module_frames_import.html
new file mode 100644
index 0000000000..a71d372724
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_import.html
@@ -0,0 +1,24 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_import_load.html b/dom/base/test/file_script_module_frames_import_load.html
new file mode 100644
index 0000000000..9e1a11f19d
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_import_load.html
@@ -0,0 +1,19 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_import_load.mjs b/dom/base/test/file_script_module_frames_import_load.mjs
new file mode 100644
index 0000000000..96353ac0e1
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_import_load.mjs
@@ -0,0 +1,5 @@
+import { f } from "./file_script_module_frames_import_shared.mjs";
+
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_frames_import_save.html b/dom/base/test/file_script_module_frames_import_save.html
new file mode 100644
index 0000000000..4949de345f
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_import_save.html
@@ -0,0 +1,19 @@
+
+
+
+
+ Test module script bytecode across iframe
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_frames_import_save.mjs b/dom/base/test/file_script_module_frames_import_save.mjs
new file mode 100644
index 0000000000..96353ac0e1
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_import_save.mjs
@@ -0,0 +1,5 @@
+import { f } from "./file_script_module_frames_import_shared.mjs";
+
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_frames_import_shared.mjs b/dom/base/test/file_script_module_frames_import_shared.mjs
new file mode 100644
index 0000000000..8b38a11158
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_import_shared.mjs
@@ -0,0 +1 @@
+export function f() {}
diff --git a/dom/base/test/file_script_module_frames_relay.js b/dom/base/test/file_script_module_frames_relay.js
new file mode 100644
index 0000000000..141f202962
--- /dev/null
+++ b/dom/base/test/file_script_module_frames_relay.js
@@ -0,0 +1,22 @@
+function relay(event) {
+ if (event.type != "test_evaluated") {
+ if (!/^watchme/.test(event.target.id)) {
+ return;
+ }
+ }
+
+ const type = `${window.name}_${event.type}`;
+
+ window.parent.dispatchEvent(new window.parent.Event(type));
+}
+
+window.addEventListener("scriptloader_load_source", relay);
+window.addEventListener("scriptloader_load_bytecode", relay);
+window.addEventListener("scriptloader_execute", relay);
+window.addEventListener("scriptloader_evaluate_module", relay);
+window.addEventListener("scriptloader_encode", relay);
+window.addEventListener("scriptloader_no_encode", relay);
+window.addEventListener("scriptloader_bytecode_saved", relay);
+window.addEventListener("scriptloader_bytecode_failed", relay);
+window.addEventListener("scriptloader_fallback", relay);
+window.addEventListener("test_evaluated", relay);
diff --git a/dom/base/test/file_script_module_import.html b/dom/base/test/file_script_module_import.html
new file mode 100644
index 0000000000..f12e0db913
--- /dev/null
+++ b/dom/base/test/file_script_module_import.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_import.mjs b/dom/base/test/file_script_module_import.mjs
new file mode 100644
index 0000000000..6574dbdfb3
--- /dev/null
+++ b/dom/base/test/file_script_module_import.mjs
@@ -0,0 +1,5 @@
+import { f } from "./file_script_module_import_imported.mjs";
+
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_import_and_element.html b/dom/base/test/file_script_module_import_and_element.html
new file mode 100644
index 0000000000..b376028ce6
--- /dev/null
+++ b/dom/base/test/file_script_module_import_and_element.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_import_and_element.mjs b/dom/base/test/file_script_module_import_and_element.mjs
new file mode 100644
index 0000000000..c16f07dec7
--- /dev/null
+++ b/dom/base/test/file_script_module_import_and_element.mjs
@@ -0,0 +1,18 @@
+import { f } from "./file_script_module_import_and_element_imported_1.mjs";
+import { g } from "./file_script_module_import_and_element_imported_2.mjs";
+import { h } from "./file_script_module_import_and_element_imported_3.mjs";
+
+f();
+g();
+h();
+
+let script = document.createElement("script");
+script.id = "watchme2";
+script.setAttribute("type", "module");
+script.setAttribute(
+ "src",
+ "file_script_module_import_and_element_imported_1.mjs"
+);
+document.body.appendChild(script);
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_import_and_element_imported_1.mjs b/dom/base/test/file_script_module_import_and_element_imported_1.mjs
new file mode 100644
index 0000000000..6371cf2a4f
--- /dev/null
+++ b/dom/base/test/file_script_module_import_and_element_imported_1.mjs
@@ -0,0 +1,7 @@
+import { g } from "./file_script_module_import_and_element_imported_2.mjs";
+import { h } from "./file_script_module_import_and_element_imported_3.mjs";
+
+g();
+h();
+
+export function f() {}
diff --git a/dom/base/test/file_script_module_import_and_element_imported_2.mjs b/dom/base/test/file_script_module_import_and_element_imported_2.mjs
new file mode 100644
index 0000000000..f75e8c9b21
--- /dev/null
+++ b/dom/base/test/file_script_module_import_and_element_imported_2.mjs
@@ -0,0 +1 @@
+export function g() {}
diff --git a/dom/base/test/file_script_module_import_and_element_imported_3.mjs b/dom/base/test/file_script_module_import_and_element_imported_3.mjs
new file mode 100644
index 0000000000..6b340b7588
--- /dev/null
+++ b/dom/base/test/file_script_module_import_and_element_imported_3.mjs
@@ -0,0 +1 @@
+export function h() {}
diff --git a/dom/base/test/file_script_module_import_imported.mjs b/dom/base/test/file_script_module_import_imported.mjs
new file mode 100644
index 0000000000..8b38a11158
--- /dev/null
+++ b/dom/base/test/file_script_module_import_imported.mjs
@@ -0,0 +1 @@
+export function f() {}
diff --git a/dom/base/test/file_script_module_import_multi.html b/dom/base/test/file_script_module_import_multi.html
new file mode 100644
index 0000000000..58e08c5d0a
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_import_multi.mjs b/dom/base/test/file_script_module_import_multi.mjs
new file mode 100644
index 0000000000..f3a2f38fe8
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi.mjs
@@ -0,0 +1,7 @@
+import { f } from "./file_script_module_import_multi_imported_once.mjs";
+import { g } from "./file_script_module_import_multi_imported_twice.mjs";
+
+f();
+g();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_import_multi_elems.html b/dom/base/test/file_script_module_import_multi_elems.html
new file mode 100644
index 0000000000..27c1cb6904
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_elems.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_import_multi_elems_1.mjs b/dom/base/test/file_script_module_import_multi_elems_1.mjs
new file mode 100644
index 0000000000..2e421242fb
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_elems_1.mjs
@@ -0,0 +1,15 @@
+import { f } from "./file_script_module_import_multi_elems_imported_once_1.mjs";
+import { h } from "./file_script_module_import_multi_elems_imported_twice.mjs";
+
+f();
+h();
+
+// Dynamically insert the element after loading all source, so that
+// the module import doesn't race.
+const script = document.createElement("script");
+script.id = "watchme2";
+script.setAttribute("type", "module");
+script.setAttribute("src", "file_script_module_import_multi_elems_2.mjs");
+document.body.appendChild(script);
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_import_multi_elems_2.mjs b/dom/base/test/file_script_module_import_multi_elems_2.mjs
new file mode 100644
index 0000000000..df06378ebc
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_elems_2.mjs
@@ -0,0 +1,7 @@
+import { g } from "./file_script_module_import_multi_elems_imported_once_2.mjs";
+import { h } from "./file_script_module_import_multi_elems_imported_twice.mjs";
+
+g();
+h();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_once_1.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_once_1.mjs
new file mode 100644
index 0000000000..8b38a11158
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_elems_imported_once_1.mjs
@@ -0,0 +1 @@
+export function f() {}
diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_once_2.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_once_2.mjs
new file mode 100644
index 0000000000..f75e8c9b21
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_elems_imported_once_2.mjs
@@ -0,0 +1 @@
+export function g() {}
diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_once_3.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_once_3.mjs
new file mode 100644
index 0000000000..411595cafc
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_elems_imported_once_3.mjs
@@ -0,0 +1 @@
+export function i() {}
diff --git a/dom/base/test/file_script_module_import_multi_elems_imported_twice.mjs b/dom/base/test/file_script_module_import_multi_elems_imported_twice.mjs
new file mode 100644
index 0000000000..0b846e478e
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_elems_imported_twice.mjs
@@ -0,0 +1,4 @@
+import { i } from "./file_script_module_import_multi_elems_imported_once_3.mjs";
+
+i();
+export function h() {}
diff --git a/dom/base/test/file_script_module_import_multi_imported_once.mjs b/dom/base/test/file_script_module_import_multi_imported_once.mjs
new file mode 100644
index 0000000000..9a04303d66
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_imported_once.mjs
@@ -0,0 +1,5 @@
+import { g } from "./file_script_module_import_multi_imported_twice.mjs";
+
+g();
+
+export function f() {}
diff --git a/dom/base/test/file_script_module_import_multi_imported_twice.mjs b/dom/base/test/file_script_module_import_multi_imported_twice.mjs
new file mode 100644
index 0000000000..f75e8c9b21
--- /dev/null
+++ b/dom/base/test/file_script_module_import_multi_imported_twice.mjs
@@ -0,0 +1 @@
+export function g() {}
diff --git a/dom/base/test/file_script_module_single.html b/dom/base/test/file_script_module_single.html
new file mode 100644
index 0000000000..d02a7b5c53
--- /dev/null
+++ b/dom/base/test/file_script_module_single.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_single.mjs b/dom/base/test/file_script_module_single.mjs
new file mode 100644
index 0000000000..9a5745f516
--- /dev/null
+++ b/dom/base/test/file_script_module_single.mjs
@@ -0,0 +1,8 @@
+function baz() {}
+function bar() {}
+function foo() {
+ bar();
+}
+foo();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_basic.html b/dom/base/test/file_script_module_sri_basic.html
new file mode 100644
index 0000000000..d762218d6b
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_basic.html
@@ -0,0 +1,11 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_basic.mjs b/dom/base/test/file_script_module_sri_basic.mjs
new file mode 100644
index 0000000000..741b76cd09
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_basic.mjs
@@ -0,0 +1 @@
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_basic_prep.html b/dom/base/test/file_script_module_sri_basic_prep.html
new file mode 100644
index 0000000000..d762218d6b
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_basic_prep.html
@@ -0,0 +1,11 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem.html b/dom/base/test/file_script_module_sri_dynamic_elem.html
new file mode 100644
index 0000000000..d178f919be
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem.mjs b/dom/base/test/file_script_module_sri_dynamic_elem.mjs
new file mode 100644
index 0000000000..5a3552a106
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem.mjs
@@ -0,0 +1,6 @@
+const { f } = await import(
+ "./file_script_module_sri_dynamic_elem_imported.mjs"
+);
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_imported.mjs b/dom/base/test/file_script_module_sri_dynamic_elem_imported.mjs
new file mode 100644
index 0000000000..bf624148c0
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem_imported.mjs
@@ -0,0 +1,3 @@
+export function f() {}
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.html b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.html
new file mode 100644
index 0000000000..f81e10497d
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.mjs b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.mjs
new file mode 100644
index 0000000000..638ac3b298
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload.mjs
@@ -0,0 +1,20 @@
+const { f } = await import(
+ "./file_script_module_sri_dynamic_elem_nopreload_imported.mjs"
+);
+f();
+
+// Dynamically insert the script element in order to suppress preload.
+const script = document.createElement("script");
+script.id = "watchme2";
+script.setAttribute("type", "module");
+script.setAttribute(
+ "src",
+ "file_script_module_sri_dynamic_elem_nopreload_imported.mjs"
+);
+script.setAttribute(
+ "integrity",
+ "sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J"
+);
+document.body.appendChild(script);
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_imported.mjs b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_imported.mjs
new file mode 100644
index 0000000000..bf624148c0
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_imported.mjs
@@ -0,0 +1,3 @@
+export function f() {}
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_prep.html b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_prep.html
new file mode 100644
index 0000000000..40f8cdc692
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem_nopreload_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_dynamic_elem_prep.html b/dom/base/test/file_script_module_sri_dynamic_elem_prep.html
new file mode 100644
index 0000000000..c4c8367836
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_dynamic_elem_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_dynamic.html b/dom/base/test/file_script_module_sri_elem_dynamic.html
new file mode 100644
index 0000000000..1aee3802ba
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_dynamic.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_dynamic.mjs b/dom/base/test/file_script_module_sri_elem_dynamic.mjs
new file mode 100644
index 0000000000..a45a1c5756
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_dynamic.mjs
@@ -0,0 +1,6 @@
+const { f } = await import(
+ "./file_script_module_sri_elem_dynamic_imported.mjs"
+);
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_elem_dynamic_imported.mjs b/dom/base/test/file_script_module_sri_elem_dynamic_imported.mjs
new file mode 100644
index 0000000000..bf624148c0
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_dynamic_imported.mjs
@@ -0,0 +1,3 @@
+export function f() {}
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_elem_dynamic_prep.html b/dom/base/test/file_script_module_sri_elem_dynamic_prep.html
new file mode 100644
index 0000000000..a4e9c7e3c1
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_dynamic_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_elem_1.html b/dom/base/test/file_script_module_sri_elem_elem_1.html
new file mode 100644
index 0000000000..fafc07378c
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_elem_1.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_elem_1.mjs b/dom/base/test/file_script_module_sri_elem_elem_1.mjs
new file mode 100644
index 0000000000..741b76cd09
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_elem_1.mjs
@@ -0,0 +1 @@
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_elem_elem_1_prep.html b/dom/base/test/file_script_module_sri_elem_elem_1_prep.html
new file mode 100644
index 0000000000..a96d200c16
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_elem_1_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_elem_2.html b/dom/base/test/file_script_module_sri_elem_elem_2.html
new file mode 100644
index 0000000000..6df0a23061
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_elem_2.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_elem_2.mjs b/dom/base/test/file_script_module_sri_elem_elem_2.mjs
new file mode 100644
index 0000000000..741b76cd09
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_elem_2.mjs
@@ -0,0 +1 @@
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_elem_elem_2_prep.html b/dom/base/test/file_script_module_sri_elem_elem_2_prep.html
new file mode 100644
index 0000000000..d07887731b
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_elem_2_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_import.html b/dom/base/test/file_script_module_sri_elem_import.html
new file mode 100644
index 0000000000..d8a04951c6
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_import.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_elem_import.mjs b/dom/base/test/file_script_module_sri_elem_import.mjs
new file mode 100644
index 0000000000..acdd930cff
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_import.mjs
@@ -0,0 +1,5 @@
+import { f } from "./file_script_module_sri_elem_import_imported.mjs";
+
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_elem_import_imported.mjs b/dom/base/test/file_script_module_sri_elem_import_imported.mjs
new file mode 100644
index 0000000000..bf624148c0
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_import_imported.mjs
@@ -0,0 +1,3 @@
+export function f() {}
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_elem_import_prep.html b/dom/base/test/file_script_module_sri_elem_import_prep.html
new file mode 100644
index 0000000000..69ee5ba072
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_elem_import_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_fallback.html b/dom/base/test/file_script_module_sri_fallback.html
new file mode 100644
index 0000000000..19a9c5e70a
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_fallback.html
@@ -0,0 +1,11 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_fallback.mjs b/dom/base/test/file_script_module_sri_fallback.mjs
new file mode 100644
index 0000000000..741b76cd09
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_fallback.mjs
@@ -0,0 +1 @@
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_fallback_failure.html b/dom/base/test/file_script_module_sri_fallback_failure.html
new file mode 100644
index 0000000000..ea61b449bf
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_fallback_failure.html
@@ -0,0 +1,15 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_fallback_failure.mjs b/dom/base/test/file_script_module_sri_fallback_failure.mjs
new file mode 100644
index 0000000000..741b76cd09
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_fallback_failure.mjs
@@ -0,0 +1 @@
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_fallback_failure_prep.html b/dom/base/test/file_script_module_sri_fallback_failure_prep.html
new file mode 100644
index 0000000000..b949060132
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_fallback_failure_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_fallback_prep.html b/dom/base/test/file_script_module_sri_fallback_prep.html
new file mode 100644
index 0000000000..91456da399
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_fallback_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_import_elem.html b/dom/base/test/file_script_module_sri_import_elem.html
new file mode 100644
index 0000000000..67ec02d66d
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_import_elem.mjs b/dom/base/test/file_script_module_sri_import_elem.mjs
new file mode 100644
index 0000000000..d6fed48264
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem.mjs
@@ -0,0 +1,5 @@
+import { f } from "./file_script_module_sri_import_elem_imported.mjs";
+
+f();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_import_elem_imported.mjs b/dom/base/test/file_script_module_sri_import_elem_imported.mjs
new file mode 100644
index 0000000000..bf624148c0
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem_imported.mjs
@@ -0,0 +1,3 @@
+export function f() {}
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload.html b/dom/base/test/file_script_module_sri_import_elem_nopreload.html
new file mode 100644
index 0000000000..5b2388cd44
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem_nopreload.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload.mjs b/dom/base/test/file_script_module_sri_import_elem_nopreload.mjs
new file mode 100644
index 0000000000..beb7c4fa45
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem_nopreload.mjs
@@ -0,0 +1,19 @@
+import { f } from "./file_script_module_sri_import_elem_nopreload_imported.mjs";
+
+f();
+
+// Dynamically insert the script element in order to suppress preload.
+const script = document.createElement("script");
+script.id = "watchme2";
+script.setAttribute("type", "module");
+script.setAttribute(
+ "src",
+ "file_script_module_sri_import_elem_nopreload_imported.mjs"
+);
+script.setAttribute(
+ "integrity",
+ "sha384-3XSIfAj4/GALfWzL3T89+t3eaLIY59g8IWz1qq59xKnEW3aGd4cz7XvdcYqoK2+J"
+);
+document.body.appendChild(script);
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload_imported.mjs b/dom/base/test/file_script_module_sri_import_elem_nopreload_imported.mjs
new file mode 100644
index 0000000000..bf624148c0
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem_nopreload_imported.mjs
@@ -0,0 +1,3 @@
+export function f() {}
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_sri_import_elem_nopreload_prep.html b/dom/base/test/file_script_module_sri_import_elem_nopreload_prep.html
new file mode 100644
index 0000000000..7467946340
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem_nopreload_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_sri_import_elem_prep.html b/dom/base/test/file_script_module_sri_import_elem_prep.html
new file mode 100644
index 0000000000..2c1b427653
--- /dev/null
+++ b/dom/base/test/file_script_module_sri_import_elem_prep.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode fallback
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_static_and_dynamic.html b/dom/base/test/file_script_module_static_and_dynamic.html
new file mode 100644
index 0000000000..452fd2d61b
--- /dev/null
+++ b/dom/base/test/file_script_module_static_and_dynamic.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Test module script bytecode
+
+
+
+
+
diff --git a/dom/base/test/file_script_module_static_and_dynamic.mjs b/dom/base/test/file_script_module_static_and_dynamic.mjs
new file mode 100644
index 0000000000..8f6699315a
--- /dev/null
+++ b/dom/base/test/file_script_module_static_and_dynamic.mjs
@@ -0,0 +1,9 @@
+import { f } from "./file_script_module_static_and_dynamic_imported_1.mjs";
+import { g } from "./file_script_module_static_and_dynamic_imported_2.mjs";
+import { h } from "./file_script_module_static_and_dynamic_imported_3.mjs";
+
+f();
+g();
+h();
+
+window.dispatchEvent(new Event("test_evaluated"));
diff --git a/dom/base/test/file_script_module_static_and_dynamic_imported_1.mjs b/dom/base/test/file_script_module_static_and_dynamic_imported_1.mjs
new file mode 100644
index 0000000000..4c027c78ef
--- /dev/null
+++ b/dom/base/test/file_script_module_static_and_dynamic_imported_1.mjs
@@ -0,0 +1,5 @@
+import { h } from "./file_script_module_static_and_dynamic_imported_3.mjs";
+
+h();
+
+export function f() {}
diff --git a/dom/base/test/file_script_module_static_and_dynamic_imported_2.mjs b/dom/base/test/file_script_module_static_and_dynamic_imported_2.mjs
new file mode 100644
index 0000000000..63392ed71b
--- /dev/null
+++ b/dom/base/test/file_script_module_static_and_dynamic_imported_2.mjs
@@ -0,0 +1,6 @@
+const { f } = await import(
+ "./file_script_module_static_and_dynamic_imported_1.mjs"
+);
+f();
+
+export function g() {}
diff --git a/dom/base/test/file_script_module_static_and_dynamic_imported_3.mjs b/dom/base/test/file_script_module_static_and_dynamic_imported_3.mjs
new file mode 100644
index 0000000000..6b340b7588
--- /dev/null
+++ b/dom/base/test/file_script_module_static_and_dynamic_imported_3.mjs
@@ -0,0 +1 @@
+export function h() {}
diff --git a/dom/base/test/file_serializer_noscript.html b/dom/base/test/file_serializer_noscript.html
new file mode 100644
index 0000000000..440baf036c
--- /dev/null
+++ b/dom/base/test/file_serializer_noscript.html
@@ -0,0 +1 @@
+</noscript>
diff --git a/dom/base/test/file_setname.html b/dom/base/test/file_setname.html
new file mode 100644
index 0000000000..0830feb53a
--- /dev/null
+++ b/dom/base/test/file_setname.html
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/dom/base/test/file_settimeout_inner.html b/dom/base/test/file_settimeout_inner.html
new file mode 100644
index 0000000000..8a6626528d
--- /dev/null
+++ b/dom/base/test/file_settimeout_inner.html
@@ -0,0 +1,6 @@
+
diff --git a/dom/base/test/file_suppressed_events_and_scrolling.html b/dom/base/test/file_suppressed_events_and_scrolling.html
new file mode 100644
index 0000000000..edf6793dfb
--- /dev/null
+++ b/dom/base/test/file_suppressed_events_and_scrolling.html
@@ -0,0 +1,30 @@
+
+
+
+
diff --git a/dom/base/test/file_suppressed_events_inner.html b/dom/base/test/file_suppressed_events_inner.html
new file mode 100644
index 0000000000..44cc45254d
--- /dev/null
+++ b/dom/base/test/file_suppressed_events_inner.html
@@ -0,0 +1,16 @@
+
+
+
+Test event suppression
+
+
+Inner
+
+
+
diff --git a/dom/base/test/file_suppressed_events_middle.html b/dom/base/test/file_suppressed_events_middle.html
new file mode 100644
index 0000000000..86b1f05374
--- /dev/null
+++ b/dom/base/test/file_suppressed_events_middle.html
@@ -0,0 +1,10 @@
+
+
+
+Test event suppression
+
+
+Middle
+
+
+
diff --git a/dom/base/test/file_suppressed_events_top.html b/dom/base/test/file_suppressed_events_top.html
new file mode 100644
index 0000000000..ca031abb70
--- /dev/null
+++ b/dom/base/test/file_suppressed_events_top.html
@@ -0,0 +1,79 @@
+
+
+
+Test event suppression
+
+
+
+
+
+
+
+Top
+
+
+
+
diff --git a/dom/base/test/file_suppressed_events_top_modalstate.html b/dom/base/test/file_suppressed_events_top_modalstate.html
new file mode 100644
index 0000000000..e20938bb28
--- /dev/null
+++ b/dom/base/test/file_suppressed_events_top_modalstate.html
@@ -0,0 +1,79 @@
+
+
+
+Test event suppression
+
+
+
+
+
+
+
+Top
+
+
+
+
diff --git a/dom/base/test/file_suppressed_events_top_xhr.html b/dom/base/test/file_suppressed_events_top_xhr.html
new file mode 100644
index 0000000000..79299e291e
--- /dev/null
+++ b/dom/base/test/file_suppressed_events_top_xhr.html
@@ -0,0 +1,82 @@
+
+
+
+Test event suppression
+
+
+
+
+
+
+
+Top
+
+
+
+
diff --git a/dom/base/test/file_timer_flood.html b/dom/base/test/file_timer_flood.html
new file mode 100644
index 0000000000..dc729d7e42
--- /dev/null
+++ b/dom/base/test/file_timer_flood.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/dom/base/test/file_title.xhtml b/dom/base/test/file_title.xhtml
new file mode 100644
index 0000000000..d1b04418aa
--- /dev/null
+++ b/dom/base/test/file_title.xhtml
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/file_toScreenRect.html b/dom/base/test/file_toScreenRect.html
new file mode 100644
index 0000000000..990d9326f2
--- /dev/null
+++ b/dom/base/test/file_toScreenRect.html
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_use_counter_bfcache.html b/dom/base/test/file_use_counter_bfcache.html
new file mode 100644
index 0000000000..6baf738945
--- /dev/null
+++ b/dom/base/test/file_use_counter_bfcache.html
@@ -0,0 +1,38 @@
+
+
diff --git a/dom/base/test/file_use_counter_bfcache_helper.html b/dom/base/test/file_use_counter_bfcache_helper.html
new file mode 100644
index 0000000000..a5da790ae6
--- /dev/null
+++ b/dom/base/test/file_use_counter_bfcache_helper.html
@@ -0,0 +1,40 @@
+
+b
+c
+
+
diff --git a/dom/base/test/file_use_counter_outer.html b/dom/base/test/file_use_counter_outer.html
new file mode 100644
index 0000000000..1a7eb90f7c
--- /dev/null
+++ b/dom/base/test/file_use_counter_outer.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+ Test for Bug 968923
+
+
+Mozilla Bug 968923
+
+
+
+
diff --git a/dom/base/test/file_use_counter_outer_display_none.html b/dom/base/test/file_use_counter_outer_display_none.html
new file mode 100644
index 0000000000..22c4c4c8ab
--- /dev/null
+++ b/dom/base/test/file_use_counter_outer_display_none.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Test for Bug 968923
+
+
+Mozilla Bug 968923
+
+
+
diff --git a/dom/base/test/file_use_counter_style.html b/dom/base/test/file_use_counter_style.html
new file mode 100644
index 0000000000..4fd18195c2
--- /dev/null
+++ b/dom/base/test/file_use_counter_style.html
@@ -0,0 +1,14 @@
+
+
+
+
diff --git a/dom/base/test/file_use_counter_svg_currentScale.svg b/dom/base/test/file_use_counter_svg_currentScale.svg
new file mode 100644
index 0000000000..cf4d64aba0
--- /dev/null
+++ b/dom/base/test/file_use_counter_svg_currentScale.svg
@@ -0,0 +1,17 @@
+
+
+ Test graphic for hitting currentScale
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_use_counter_svg_fill_pattern.svg b/dom/base/test/file_use_counter_svg_fill_pattern.svg
new file mode 100644
index 0000000000..1cd84dd5e1
--- /dev/null
+++ b/dom/base/test/file_use_counter_svg_fill_pattern.svg
@@ -0,0 +1,16 @@
+
+
+ Borrowed from http://www.w3.org/TR/SVG/pservers.html
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_use_counter_svg_fill_pattern_data.svg b/dom/base/test/file_use_counter_svg_fill_pattern_data.svg
new file mode 100644
index 0000000000..9a180b2432
--- /dev/null
+++ b/dom/base/test/file_use_counter_svg_fill_pattern_data.svg
@@ -0,0 +1,13 @@
+
+
+ Borrowed from http://www.w3.org/TR/SVG/pservers.html
+
+
+
+
+
+
diff --git a/dom/base/test/file_use_counter_svg_fill_pattern_definition.svg b/dom/base/test/file_use_counter_svg_fill_pattern_definition.svg
new file mode 100644
index 0000000000..a84292a63f
--- /dev/null
+++ b/dom/base/test/file_use_counter_svg_fill_pattern_definition.svg
@@ -0,0 +1,12 @@
+
+
+ Borrowed from http://www.w3.org/TR/SVG/pservers.html
+
+
+
+
+
+
diff --git a/dom/base/test/file_use_counter_svg_fill_pattern_internal.svg b/dom/base/test/file_use_counter_svg_fill_pattern_internal.svg
new file mode 100644
index 0000000000..47adafe38c
--- /dev/null
+++ b/dom/base/test/file_use_counter_svg_fill_pattern_internal.svg
@@ -0,0 +1,24 @@
+
+
+ Borrowed from http://www.w3.org/TR/SVG/pservers.html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_use_counter_svg_getElementById.svg b/dom/base/test/file_use_counter_svg_getElementById.svg
new file mode 100644
index 0000000000..7cd12ba315
--- /dev/null
+++ b/dom/base/test/file_use_counter_svg_getElementById.svg
@@ -0,0 +1,22 @@
+
+
+ Test graphic for hitting getElementById
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_viewport_metrics_on_landscape_content.html b/dom/base/test/file_viewport_metrics_on_landscape_content.html
new file mode 100644
index 0000000000..02b079aeac
--- /dev/null
+++ b/dom/base/test/file_viewport_metrics_on_landscape_content.html
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_viewport_scroll_quirks.html b/dom/base/test/file_viewport_scroll_quirks.html
new file mode 100644
index 0000000000..992b8a9968
--- /dev/null
+++ b/dom/base/test/file_viewport_scroll_quirks.html
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/file_viewport_scroll_xml.xml b/dom/base/test/file_viewport_scroll_xml.xml
new file mode 100644
index 0000000000..1453e9b1ea
--- /dev/null
+++ b/dom/base/test/file_viewport_scroll_xml.xml
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/file_webaudio_startstop.html b/dom/base/test/file_webaudio_startstop.html
new file mode 100644
index 0000000000..c0e4fafb01
--- /dev/null
+++ b/dom/base/test/file_webaudio_startstop.html
@@ -0,0 +1,36 @@
+
+
diff --git a/dom/base/test/file_window_close.html b/dom/base/test/file_window_close.html
new file mode 100644
index 0000000000..5adec04ec4
--- /dev/null
+++ b/dom/base/test/file_window_close.html
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_window_close_2.html b/dom/base/test/file_window_close_2.html
new file mode 100644
index 0000000000..c06ec90a8b
--- /dev/null
+++ b/dom/base/test/file_window_close_2.html
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/dom/base/test/file_window_focus_by_close_and_open.html b/dom/base/test/file_window_focus_by_close_and_open.html
new file mode 100644
index 0000000000..ab5ad72ae3
--- /dev/null
+++ b/dom/base/test/file_window_focus_by_close_and_open.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_x-frame-options_main.html b/dom/base/test/file_x-frame-options_main.html
new file mode 100644
index 0000000000..903f951e08
--- /dev/null
+++ b/dom/base/test/file_x-frame-options_main.html
@@ -0,0 +1,44 @@
+
+
+X-Frame-Options tests
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/file_x-frame-options_page.sjs b/dom/base/test/file_x-frame-options_page.sjs
new file mode 100644
index 0000000000..13c9aa7cac
--- /dev/null
+++ b/dom/base/test/file_x-frame-options_page.sjs
@@ -0,0 +1,67 @@
+// SJS file for X-Frame-Options mochitests
+function handleRequest(request, response) {
+ var query = {};
+ var BOUNDARY = "BOUNDARYOMG3984";
+ request.queryString.split("&").forEach(function (val) {
+ var [name, value] = val.split("=");
+ query[name] = unescape(value);
+ });
+
+ if (query.multipart == "1") {
+ response.setHeader(
+ "Content-Type",
+ "multipart/x-mixed-replace;boundary=" + BOUNDARY,
+ false
+ );
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setStatusLine(request.httpVersion, 200, "OK");
+ response.write("--" + BOUNDARY + "\r\n");
+ response.write("Content-Type: text/html\r\n\r\n");
+ } else {
+ response.setHeader("Content-Type", "text/html", false);
+ response.setHeader("Cache-Control", "no-cache", false);
+ }
+
+ var testHeaders = {
+ deny: "DENY",
+ sameorigin: "SAMEORIGIN",
+ sameorigin2: "SAMEORIGIN, SAMEORIGIN",
+ sameorigin3: "SAMEORIGIN,SAMEORIGIN , SAMEORIGIN",
+ mixedpolicy: "DENY,SAMEORIGIN",
+
+ /* added for bug 836132 */
+ afa: "ALLOW-FROM http://mochi.test:8888/",
+ afd: "ALLOW-FROM http://example.com/",
+ afa1: "ALLOW-FROM http://mochi.test:8888",
+ afd1: "ALLOW-FROM:example.com",
+ afd2: "ALLOW-FROM: example.com",
+ afd3: "ALLOW-FROM example.com",
+ afd4: "ALLOW-FROM:http://example.com",
+ afd5: "ALLOW-FROM: http://example.com",
+ afd6: "ALLOW-FROM http://example.com",
+ afd7: "ALLOW-FROM:mochi.test:8888",
+ afd8: "ALLOW-FROM: mochi.test:8888",
+ afd9: "ALLOW-FROM:http://mochi.test:8888",
+ afd10: "ALLOW-FROM: http://mochi.test:8888",
+ afd11: "ALLOW-FROM mochi.test:8888",
+ afd12: "ALLOW-FROM",
+ afd13: "ALLOW-FROM ",
+ afd14: "ALLOW-FROM:",
+ };
+
+ if (testHeaders.hasOwnProperty(query.xfo)) {
+ response.setHeader("X-Frame-Options", testHeaders[query.xfo], false);
+ }
+
+ // from the test harness we'll be checking for the presence of this element
+ // to test if the page loaded
+ response.write('' + query.testid + " ");
+
+ if (query.testid == "postmessage") {
+ response.write("");
+ }
+
+ if (query.multipart == "1") {
+ response.write("\r\n--" + BOUNDARY + "\r\n");
+ }
+}
diff --git a/dom/base/test/file_xhtmlserializer_1.xhtml b/dom/base/test/file_xhtmlserializer_1.xhtml
new file mode 100644
index 0000000000..64271ce2ce
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1.xhtml
@@ -0,0 +1,60 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
diff --git a/dom/base/test/file_xhtmlserializer_1_bodyonly.xhtml b/dom/base/test/file_xhtmlserializer_1_bodyonly.xhtml
new file mode 100644
index 0000000000..fbefe91d6e
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_bodyonly.xhtml
@@ -0,0 +1,56 @@
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_format.xhtml b/dom/base/test/file_xhtmlserializer_1_format.xhtml
new file mode 100644
index 0000000000..d62cc367ba
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_format.xhtml
@@ -0,0 +1,71 @@
+
+
+
+
+
+ Test for html serializer
+
+
+ Hello world
+ Lorem ipsum dolor sit amet, consectetuer
+ adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis
+ ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent
+ taciti sociosqu ad litora torquent per conubia
+ nostra, per inceptos hymenaeos.
+
+ Nam tellus massa,éà èçù
+ fringilla aliquam,
+ fermentum sit amet,
+ posuere ac,
+ est.
+
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+ Fusce a ipsum
+ non lacus posuere aliquet.
+ Sed fermentum posuere nulla
+ Donec tempor.
+
+ Donec sollicitudin tortor
+
+ lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ ut gravida eros
+ leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+ Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
+ aliquet lectus. Nunc vitae eros. Class aptent taciti
+ lacinia
+ libero ullamcorper laoreet. Cras quis nisi at
+ odio consectetuer molestie. Curabitur consectetuer urna a
+ sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in
+ faucibus orci luctus et ultrices posuere cubilia Curae; Sed
+ sollicitudin, nulla at pharetra rutrum,
+
+ lacus risus pulvinar ante.
+
+
+
diff --git a/dom/base/test/file_xhtmlserializer_1_linebreak.xhtml b/dom/base/test/file_xhtmlserializer_1_linebreak.xhtml
new file mode 100644
index 0000000000..a0aecdd2c6
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_linebreak.xhtml
@@ -0,0 +1,65 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_links.xhtml b/dom/base/test/file_xhtmlserializer_1_links.xhtml
new file mode 100644
index 0000000000..0c2814311b
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_links.xhtml
@@ -0,0 +1,65 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
diff --git a/dom/base/test/file_xhtmlserializer_1_nested_body.xhtml b/dom/base/test/file_xhtmlserializer_1_nested_body.xhtml
new file mode 100644
index 0000000000..120f8e7dcb
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_nested_body.xhtml
@@ -0,0 +1,65 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+this is an other body element
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_no_body.xhtml b/dom/base/test/file_xhtmlserializer_1_no_body.xhtml
new file mode 100644
index 0000000000..6f5055bd57
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_no_body.xhtml
@@ -0,0 +1,10 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_noflag.xhtml b/dom/base/test/file_xhtmlserializer_1_noflag.xhtml
new file mode 100644
index 0000000000..a0aecdd2c6
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_noflag.xhtml
@@ -0,0 +1,65 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_noformatpre.xhtml b/dom/base/test/file_xhtmlserializer_1_noformatpre.xhtml
new file mode 100644
index 0000000000..a5eb6e9692
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_noformatpre.xhtml
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+
+ Cras quis
+
+ nisi at odio
+
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_raw.xhtml b/dom/base/test/file_xhtmlserializer_1_raw.xhtml
new file mode 100644
index 0000000000..d13fce2ccd
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_raw.xhtml
@@ -0,0 +1,60 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_sibling_body.xhtml b/dom/base/test/file_xhtmlserializer_1_sibling_body.xhtml
new file mode 100644
index 0000000000..9ef4840e36
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_sibling_body.xhtml
@@ -0,0 +1,65 @@
+
+
+
+
+
+ Test for html serializer
+
+
+this is an other body element
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml b/dom/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml
new file mode 100644
index 0000000000..f9f92a0670
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml
@@ -0,0 +1,56 @@
+this is an other body element
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_1_wrap.xhtml b/dom/base/test/file_xhtmlserializer_1_wrap.xhtml
new file mode 100644
index 0000000000..6b156278ad
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_1_wrap.xhtml
@@ -0,0 +1,70 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
+ ad
+ litora torquent per
+ conubia
+nostra, per inceptos hymenaeos.
+
+
+Nam tellus massa,éà èçù
+ fringilla
+aliquam, fermentum sit amet, posuere ac, est.
+ Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+Fusce
+ a ipsum non lacus posuere aliquet. Sed fermentum
+posuere nulla Donec tempor.
+Donec sollicitudin tortor
+
+lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus
+Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
+aliquet lectus. Nunc vitae eros. Class aptent taciti
+lacinia libero
+ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_2.xhtml b/dom/base/test/file_xhtmlserializer_2.xhtml
new file mode 100644
index 0000000000..2a9c55b95d
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_2.xhtml
@@ -0,0 +1,30 @@
+
+
+
+
+ Test for html serializer with entities
+
+
+
+The basic set is just " " & < > " for interoperability with older products that don't support α and friends.
+
+latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´
+µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ
+Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø
+Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê
+ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý
+þ ÿ
+symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ
+Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς
+σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ⁄ ℘ ℑ ℜ
+™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
+∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥
+⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦
+
+ others
+Œ œ Š š Ÿ ˆ ˜ –— ‘ ’
+‚“ ” „ † ‡ ‰ ‹ › €
+
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_2_basic.xhtml b/dom/base/test/file_xhtmlserializer_2_basic.xhtml
new file mode 100644
index 0000000000..c35cc48cf8
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_2_basic.xhtml
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Test for html serializer with entities
+
+
+
+The basic set is just " " & < > " for interoperability with older products that don't support α and friends.
+
+latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬  ® ¯ ° ± ² ³ ´
+µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À à Â Ã Ä Å Æ
+Ç È É Ê Ë Ì à Î à à Ñ Ò Ó Ô Õ Ö × Ø
+Ù Ú Û Ü à Þ ß à á â ã ä å æ ç è é ê
+ë ì à î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý
+þ ÿ
+symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ ΠΞ Ο ΠΡ Σ Τ Υ
+Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο Ï€ Ï Ï‚
+σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ℠℘ ℑ ℜ
+™ ℵ ↠↑ → ↓ ↔ ↵ ⇠⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
+∋ ∠∑ − ∗ √ ∠∞ ∠∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠≡ ≤ ≥
+⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ ⟨ ⟩ ◊ ♠♣ ♥ ♦
+
+ others
+Å’ Å“ Å Å¡ Ÿ ˆ Ëœ       ‌ †‎ â€â€“— ‘ ’
+‚“ †„ †‡ ‰ ‹ › €
+
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_2_enthtml.xhtml b/dom/base/test/file_xhtmlserializer_2_enthtml.xhtml
new file mode 100644
index 0000000000..0ba1c8421c
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_2_enthtml.xhtml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ Test for html serializer with entities
+
+
+
+The basic set is just & < > " for interoperability with older products that don't support α and friends.
+
+latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨
+© ª « ¬ ® ¯ ° ± ²
+³ ´
+µ ¶ · ¸ ¹ º » ¼ ½
+¾ ¿ À Á Â Ã Ä Å
+Æ
+Ç È É Ê Ë Ì Í Î
+Ï Ð Ñ Ò Ó Ô Õ Ö ×
+Ø
+Ù Ú Û Ü Ý Þ ß à
+á â ã ä å æ ç è
+é ê
+ë ì í î ï ð ñ ò ó
+ ô õ ö ÷ ø ù ú û
+ü ý
+þ ÿ
+symbols, math.. ƒ Α Β Γ Δ Ε
+Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο
+Π Ρ Σ Τ Υ
+Φ Χ Ψ Ω α β γ δ ε
+ζ η θ ι κ λ μ ν ξ ο
+π ρ ς
+σ τ υ φ χ ψ ω ϑ ϒ
+ϖ • … ′ ″ ‾ ⁄ ℘ ℑ
+ℜ
+™ ℵ ← ↑ → ↓ ↔ ↵ ⇐
+⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇
+∈ ∉
+∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧
+∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤
+≥
+⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈
+⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥
+♦
+
+ others
+Œ œ Š š Ÿ ˆ ˜
+ –— ‘ ’
+‚“ ” „ † ‡ ‰ ‹
+› €
+
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_2_entw3c.xhtml b/dom/base/test/file_xhtmlserializer_2_entw3c.xhtml
new file mode 100644
index 0000000000..0ba1c8421c
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_2_entw3c.xhtml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ Test for html serializer with entities
+
+
+
+The basic set is just & < > " for interoperability with older products that don't support α and friends.
+
+latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨
+© ª « ¬ ® ¯ ° ± ²
+³ ´
+µ ¶ · ¸ ¹ º » ¼ ½
+¾ ¿ À Á Â Ã Ä Å
+Æ
+Ç È É Ê Ë Ì Í Î
+Ï Ð Ñ Ò Ó Ô Õ Ö ×
+Ø
+Ù Ú Û Ü Ý Þ ß à
+á â ã ä å æ ç è
+é ê
+ë ì í î ï ð ñ ò ó
+ ô õ ö ÷ ø ù ú û
+ü ý
+þ ÿ
+symbols, math.. ƒ Α Β Γ Δ Ε
+Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο
+Π Ρ Σ Τ Υ
+Φ Χ Ψ Ω α β γ δ ε
+ζ η θ ι κ λ μ ν ξ ο
+π ρ ς
+σ τ υ φ χ ψ ω ϑ ϒ
+ϖ • … ′ ″ ‾ ⁄ ℘ ℑ
+ℜ
+™ ℵ ← ↑ → ↓ ↔ ↵ ⇐
+⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇
+∈ ∉
+∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧
+∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤
+≥
+⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈
+⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥
+♦
+
+ others
+Œ œ Š š Ÿ ˆ ˜
+ –— ‘ ’
+‚“ ” „ † ‡ ‰ ‹
+› €
+
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_xhtmlserializer_2_latin1.xhtml b/dom/base/test/file_xhtmlserializer_2_latin1.xhtml
new file mode 100644
index 0000000000..59b564ca77
--- /dev/null
+++ b/dom/base/test/file_xhtmlserializer_2_latin1.xhtml
@@ -0,0 +1,41 @@
+
+
+
+
+
+ Test for html serializer with entities
+
+
+
+The basic set is just & < > " for interoperability with older products that don't support α and friends.
+
+latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨
+© ª « ¬ ® ¯ ° ± ²
+³ ´
+µ ¶ · ¸ ¹ º » ¼ ½
+¾ ¿ À Á Â Ã Ä Å
+Æ
+Ç È É Ê Ë Ì Í Î
+Ï Ð Ñ Ò Ó Ô Õ Ö ×
+Ø
+Ù Ú Û Ü Ý Þ ß à
+á â ã ä å æ ç è
+é ê
+ë ì í î ï ð ñ ò ó
+ ô õ ö ÷ ø ù ú û
+ü ý
+þ ÿ
+symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ ΠΞ Ο ΠΡ Σ Τ Υ
+Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο Ï€ Ï Ï‚
+σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ℠℘ ℑ ℜ
+™ ℵ ↠↑ → ↓ ↔ ↵ ⇠⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
+∋ ∠∑ − ∗ √ ∠∞ ∠∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠≡ ≤ ≥
+⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ ⟨ ⟩ ◊ ♠♣ ♥ ♦
+
+ others
+Å’ Å“ Å Å¡ Ÿ ˆ Ëœ       ‌ †‎ â€â€“— ‘ ’
+‚“ †„ †‡ ‰ ‹ › €
+
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/file_youtube_flash_embed.html b/dom/base/test/file_youtube_flash_embed.html
new file mode 100644
index 0000000000..0eb63477f4
--- /dev/null
+++ b/dom/base/test/file_youtube_flash_embed.html
@@ -0,0 +1,65 @@
+
+
+
+
+
+ Test for Bug 1240471
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fmm/browser.toml b/dom/base/test/fmm/browser.toml
new file mode 100644
index 0000000000..064189b03d
--- /dev/null
+++ b/dom/base/test/fmm/browser.toml
@@ -0,0 +1,4 @@
+[DEFAULT]
+
+["browser_frame_message_manager_cache.js"]
+
diff --git a/dom/base/test/fmm/browser_frame_message_manager_cache.js b/dom/base/test/fmm/browser_frame_message_manager_cache.js
new file mode 100644
index 0000000000..fcedd6721a
--- /dev/null
+++ b/dom/base/test/fmm/browser_frame_message_manager_cache.js
@@ -0,0 +1,23 @@
+add_task(async function testCacheAfterInvalidate() {
+ // Load some page to make scripts cached.
+ let tab1 = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "about:addons"
+ );
+
+ // Discard ScriptPreloader cache.
+ Services.obs.notifyObservers(null, "startupcache-invalidate");
+
+ // Load some other page to use the cache in nsMessageManagerScriptExecutor
+ // cache.
+ let tab2 = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "about:preferences"
+ );
+
+ // Verify the browser doesn't crash.
+ ok(true);
+
+ BrowserTestUtils.removeTab(tab1);
+ BrowserTestUtils.removeTab(tab2);
+});
diff --git a/dom/base/test/forRemoval.resource b/dom/base/test/forRemoval.resource
new file mode 100644
index 0000000000..09e882b3ba
--- /dev/null
+++ b/dom/base/test/forRemoval.resource
@@ -0,0 +1,24 @@
+:this file must be enconded in utf8
+:and its Content-Type must be equal to text/event-stream
+
+retry:500
+event: message
+data: 1
+
+retry:500
+event: message
+data: 2
+
+retry:500
+event: message
+data: 3
+
+retry:500
+event: message
+data: 4
+
+retry:500
+event: message
+data: 5
+
+
diff --git a/dom/base/test/forRemoval.resource^headers^ b/dom/base/test/forRemoval.resource^headers^
new file mode 100644
index 0000000000..6a63b5341d
--- /dev/null
+++ b/dom/base/test/forRemoval.resource^headers^
@@ -0,0 +1,3 @@
+Content-Type: text/event-stream
+Cache-Control: no-cache, must-revalidate
+
diff --git a/dom/base/test/formReset.html b/dom/base/test/formReset.html
new file mode 100644
index 0000000000..faee1e5b4d
--- /dev/null
+++ b/dom/base/test/formReset.html
@@ -0,0 +1,15 @@
+
+
+
+ Form Elements
+
+
+
+ Check me!
+ Uncheck me!
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml b/dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml
new file mode 100644
index 0000000000..93f00311e7
--- /dev/null
+++ b/dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/browser.toml b/dom/base/test/fullscreen/browser.toml
new file mode 100644
index 0000000000..dc883a4ac2
--- /dev/null
+++ b/dom/base/test/fullscreen/browser.toml
@@ -0,0 +1,54 @@
+[DEFAULT]
+tags = "fullscreen"
+head = "head.js"
+support-files = [
+ "dummy_page.html",
+ "file_fullscreen-api-keys.html",
+ "file_fullscreen-iframe-inner.html",
+ "file_fullscreen-iframe-middle.html",
+ "file_fullscreen-iframe-top.html",
+ "file_fullscreen-newtab.html",
+ "fullscreen_helpers.js",
+]
+
+["browser_fullscreen-api-keys.js"]
+
+["browser_fullscreen-bug-1798219.js"]
+skip-if = ["!nightly_build"] # Bug 1818608
+support-files = [
+ "file_fullscreen-bug-1798219.html",
+ "file_fullscreen-bug-1798219-2.html",
+]
+
+["browser_fullscreen-contextmenu-esc.js"]
+
+["browser_fullscreen-document-mutation-navigation.js"]
+
+["browser_fullscreen-document-mutation-race.js"]
+
+["browser_fullscreen-document-mutation.js"]
+
+["browser_fullscreen-navigation-history-race.js"]
+
+["browser_fullscreen-navigation-history.js"]
+
+["browser_fullscreen-navigation-race.js"]
+
+["browser_fullscreen-navigation.js"]
+
+["browser_fullscreen-newtab.js"]
+skip-if = [
+ "os == 'mac'", # Bug 1494843
+ "os == 'linux' && bits == 64 && os_version == '18.04'", # Bug 1601460
+]
+
+["browser_fullscreen-sizemode.js"]
+
+["browser_fullscreen-tab-close-race.js"]
+
+["browser_fullscreen-tab-close.js"]
+
+["browser_fullscreen-window-open-race.js"]
+skip-if = ["os == 'mac'"] # test is checking for synchronous fullscreen completion
+
+["browser_fullscreen_exit_on_external_protocol.js"]
diff --git a/dom/base/test/fullscreen/browser_fullscreen-api-keys.js b/dom/base/test/fullscreen/browser_fullscreen-api-keys.js
new file mode 100644
index 0000000000..1b1a07975e
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-api-keys.js
@@ -0,0 +1,218 @@
+"use strict";
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+/** Test for Bug 545812 **/
+
+// List of key codes which should exit full-screen mode.
+const kKeyList = [
+ { key: "Escape", keyCode: "VK_ESCAPE", suppressed: true },
+ { key: "F11", keyCode: "VK_F11", suppressed: false },
+];
+
+function receiveExpectedKeyEvents(aBrowser, aKeyCode, aTrusted) {
+ return SpecialPowers.spawn(
+ aBrowser,
+ [aKeyCode, aTrusted],
+ (keyCode, trusted) => {
+ return new Promise(resolve => {
+ let events = trusted
+ ? ["keydown", "keyup"]
+ : ["keydown", "keypress", "keyup"];
+ if (trusted && keyCode == content.wrappedJSObject.KeyEvent.DOM_VK_F11) {
+ // trusted `F11` key shouldn't be fired because of reserved when it's
+ // a shortcut key for exiting from the full screen mode.
+ events.shift();
+ }
+ function listener(event) {
+ let expected = events.shift();
+ Assert.equal(
+ event.type,
+ expected,
+ `Should receive a ${expected} event`
+ );
+ Assert.equal(
+ event.keyCode,
+ keyCode,
+ `Should receive the event with key code ${keyCode}`
+ );
+ if (!events.length) {
+ content.document.removeEventListener("keydown", listener, true);
+ content.document.removeEventListener("keyup", listener, true);
+ content.document.removeEventListener("keypress", listener, true);
+ resolve();
+ }
+ }
+
+ content.document.addEventListener("keydown", listener, true);
+ content.document.addEventListener("keyup", listener, true);
+ content.document.addEventListener("keypress", listener, true);
+ });
+ }
+ );
+}
+
+const kPage =
+ "https://example.org/browser/" +
+ "dom/base/test/fullscreen/file_fullscreen-api-keys.html";
+
+add_task(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"]
+ );
+
+ let tab = BrowserTestUtils.addTab(gBrowser, kPage);
+ let browser = tab.linkedBrowser;
+ gBrowser.selectedTab = tab;
+ registerCleanupFunction(() => gBrowser.removeTab(tab));
+ await waitForDocLoadComplete();
+
+ // Wait for the document being activated, so that
+ // fullscreen request won't be denied.
+ await SpecialPowers.spawn(browser, [], () => {
+ return ContentTaskUtils.waitForCondition(
+ () => content.browsingContext.isActive && content.document.hasFocus(),
+ "document is active"
+ );
+ });
+
+ // Register listener to capture unexpected events
+ let keyEventsCount = 0;
+ let fullScreenEventsCount = 0;
+ let removeFullScreenListener = BrowserTestUtils.addContentEventListener(
+ browser,
+ "fullscreenchange",
+ () => fullScreenEventsCount++
+ );
+ let removeKeyDownListener = BrowserTestUtils.addContentEventListener(
+ browser,
+ "keydown",
+ () => keyEventsCount++,
+ { wantUntrusted: true }
+ );
+ let removeKeyPressListener = BrowserTestUtils.addContentEventListener(
+ browser,
+ "keypress",
+ () => keyEventsCount++,
+ { wantUntrusted: true }
+ );
+ let removeKeyUpListener = BrowserTestUtils.addContentEventListener(
+ browser,
+ "keyup",
+ () => keyEventsCount++,
+ { wantUntrusted: true }
+ );
+
+ let expectedFullScreenEventsCount = 0;
+ let expectedKeyEventsCount = 0;
+
+ for (let { key, keyCode, suppressed } of kKeyList) {
+ let keyCodeValue = KeyEvent["DOM_" + keyCode];
+ info(`Test keycode ${key} (${keyCodeValue})`);
+
+ info("Enter fullscreen");
+ let state = new Promise(resolve => {
+ let removeFun = BrowserTestUtils.addContentEventListener(
+ browser,
+ "fullscreenchange",
+ async () => {
+ removeFun();
+ resolve(
+ await SpecialPowers.spawn(browser, [], () => {
+ return !!content.document.fullscreenElement;
+ })
+ );
+ }
+ );
+ });
+ // request fullscreen
+ SpecialPowers.spawn(browser, [], () => {
+ content.document.body.requestFullscreen();
+ });
+ ok(await state, "The content should have entered fullscreen");
+ ok(document.fullscreenElement, "The chrome should also be in fullscreen");
+
+ is(
+ fullScreenEventsCount,
+ ++expectedFullScreenEventsCount,
+ "correct number of fullscreen events occurred"
+ );
+
+ info("Dispatch untrusted key events from content");
+ let promiseExpectedKeyEvents = receiveExpectedKeyEvents(
+ browser,
+ keyCodeValue,
+ false
+ );
+
+ SpecialPowers.spawn(browser, [keyCode], keyCodeChild => {
+ var evt = new content.CustomEvent("Test:DispatchKeyEvents", {
+ detail: Cu.cloneInto({ code: keyCodeChild }, content),
+ });
+ content.dispatchEvent(evt);
+ });
+ await promiseExpectedKeyEvents;
+
+ expectedKeyEventsCount += 3;
+ is(
+ keyEventsCount,
+ expectedKeyEventsCount,
+ "correct number of key events occurred"
+ );
+
+ info("Send trusted key events");
+
+ state = new Promise(resolve => {
+ let removeFun = BrowserTestUtils.addContentEventListener(
+ browser,
+ "fullscreenchange",
+ async () => {
+ removeFun();
+ resolve(
+ await SpecialPowers.spawn(browser, [], () => {
+ return !!content.document.fullscreenElement;
+ })
+ );
+ }
+ );
+ });
+
+ promiseExpectedKeyEvents = suppressed
+ ? Promise.resolve()
+ : receiveExpectedKeyEvents(browser, keyCodeValue, true);
+ await SpecialPowers.spawn(browser, [], () => {});
+
+ EventUtils.synthesizeKey("KEY_" + key);
+ await promiseExpectedKeyEvents;
+
+ ok(!(await state), "The content should have exited fullscreen");
+ ok(
+ !document.fullscreenElement,
+ "The chrome should also have exited fullscreen"
+ );
+
+ is(
+ fullScreenEventsCount,
+ ++expectedFullScreenEventsCount,
+ "correct number of fullscreen events occurred"
+ );
+ if (!suppressed) {
+ expectedKeyEventsCount += keyCode == "VK_F11" ? 1 : 3;
+ }
+ is(
+ keyEventsCount,
+ expectedKeyEventsCount,
+ "correct number of key events occurred"
+ );
+ }
+
+ removeFullScreenListener();
+ removeKeyDownListener();
+ removeKeyPressListener();
+ removeKeyUpListener();
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen-bug-1798219.js b/dom/base/test/fullscreen/browser_fullscreen-bug-1798219.js
new file mode 100644
index 0000000000..2aef23b042
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-bug-1798219.js
@@ -0,0 +1,127 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Import helpers
+/* import-globals-from fullscreen_helpers.js */
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error, https://bugzilla.mozilla.org/show_bug.cgi?id=1742890.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+async function waitAndCheckFullscreenState(aWindow) {
+ // Wait fullscreen exit event if browser is still in fullscreen mode.
+ if (
+ aWindow.fullScreen ||
+ aWindow.document.documentElement.hasAttribute("inFullscreen")
+ ) {
+ info("The widget is still in fullscreen, wait again");
+ await waitWidgetFullscreenEvent(aWindow, false, true);
+ }
+ if (aWindow.document.documentElement.hasAttribute("inDOMFullscreen")) {
+ info("The chrome document is still in fullscreen, wait again");
+ await waitForFullScreenObserver(aWindow, false, true);
+ }
+
+ // Ensure the browser exits fullscreen state.
+ ok(!aWindow.fullScreen, "The widget should not be in fullscreen");
+ ok(
+ !aWindow.document.documentElement.hasAttribute("inFullscreen"),
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !aWindow.document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+}
+
+add_task(async () => {
+ const URL =
+ "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html";
+ // We need this dummy tab which load the same URL as test tab to keep the
+ // original content process alive after test page navigates away.
+ let dummyTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: URL,
+ },
+ async function (browser) {
+ await SpecialPowers.spawn(browser, [], function () {
+ content.document.querySelector("button").click();
+ });
+
+ // Test requests fullscreen and performs navigation simultaneously,
+ // the fullscreen request might be rejected directly if navigation happens
+ // first, so there might be no reliable state that we can wait. So give
+ // some time for possible fullscreen transition instead and ensure window
+ // should end up exiting fullscreen.
+ await new Promise(aResolve => {
+ SimpleTest.executeSoon(() => {
+ SimpleTest.executeSoon(aResolve);
+ });
+ });
+ await waitAndCheckFullscreenState(window);
+ }
+ );
+
+ let dummyTabClosed = BrowserTestUtils.waitForTabClosing(dummyTab);
+ BrowserTestUtils.removeTab(dummyTab);
+ await dummyTabClosed;
+});
+
+add_task(async () => {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html",
+ },
+ async function (browser) {
+ // Open a new window to run the tests, the original window will keep the
+ // original content process alive after the test window navigates away.
+ let promiseWin = BrowserTestUtils.waitForNewWindow();
+ await SpecialPowers.spawn(browser, [], function () {
+ content.document.querySelector("button").click();
+ });
+ let newWindow = await promiseWin;
+
+ await SpecialPowers.spawn(
+ newWindow.gBrowser.selectedTab.linkedBrowser,
+ [],
+ function () {
+ content.document.querySelector("button").click();
+ }
+ );
+
+ // Test requests fullscreen and performs navigation simultaneously,
+ // the fullscreen request might be rejected directly if navigation happens
+ // first, so there might be no reliable state that we can wait. So give
+ // some time for possible fullscreen transition instead and ensure window
+ // should end up exiting fullscreen.
+ await new Promise(aResolve => {
+ SimpleTest.executeSoon(() => {
+ SimpleTest.executeSoon(aResolve);
+ });
+ });
+ await waitAndCheckFullscreenState(newWindow);
+
+ newWindow.close();
+ }
+ );
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen-contextmenu-esc.js b/dom/base/test/fullscreen/browser_fullscreen-contextmenu-esc.js
new file mode 100644
index 0000000000..e89409a90f
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-contextmenu-esc.js
@@ -0,0 +1,128 @@
+"use strict";
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+function captureUnexpectedFullscreenChange() {
+ ok(false, "Caught an unexpected fullscreen change");
+}
+
+const kPage =
+ "https://example.org/browser/dom/base/test/fullscreen/dummy_page.html";
+
+function waitForDocActivated(aBrowser) {
+ return SpecialPowers.spawn(aBrowser, [], () => {
+ return ContentTaskUtils.waitForCondition(
+ () => content.browsingContext.isActive && content.document.hasFocus()
+ );
+ });
+}
+
+add_task(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"]
+ );
+
+ let tab = await BrowserTestUtils.openNewForegroundTab({
+ gBrowser,
+ opening: kPage,
+ waitForStateStop: true,
+ });
+ let browser = tab.linkedBrowser;
+
+ // As requestFullscreen checks the active state of the docshell,
+ // wait for the document to be activated, just to be sure that
+ // the fullscreen request won't be denied.
+ await SpecialPowers.spawn(browser, [], () => {
+ return ContentTaskUtils.waitForCondition(
+ () => content.browsingContext.isActive && content.document.hasFocus()
+ );
+ });
+
+ let contextMenu = document.getElementById("contentAreaContextMenu");
+ ok(contextMenu, "Got context menu");
+
+ let state;
+ info("Enter DOM fullscreen");
+ let fullScreenChangedPromise = BrowserTestUtils.waitForContentEvent(
+ browser,
+ "fullscreenchange"
+ );
+ await SpecialPowers.spawn(browser, [], () => {
+ content.document.body.requestFullscreen();
+ });
+
+ await fullScreenChangedPromise;
+ state = await SpecialPowers.spawn(browser, [], () => {
+ return !!content.document.fullscreenElement;
+ });
+ ok(state, "The content should have entered fullscreen");
+ ok(document.fullscreenElement, "The chrome should also be in fullscreen");
+
+ let removeContentEventListener = BrowserTestUtils.addContentEventListener(
+ browser,
+ "fullscreenchange",
+ captureUnexpectedFullscreenChange
+ );
+
+ info("Open context menu");
+ is(contextMenu.state, "closed", "Should not have opened context menu");
+
+ let popupShownPromise = promiseWaitForEvent(window, "popupshown");
+
+ EventUtils.synthesizeMouse(
+ browser,
+ screen.width / 2,
+ screen.height / 2,
+ { type: "contextmenu", button: 2 },
+ window
+ );
+ await popupShownPromise;
+ is(contextMenu.state, "open", "Should have opened context menu");
+
+ let popupHidePromise = promiseWaitForEvent(window, "popuphidden");
+
+ if (
+ !AppConstants.platform == "macosx" ||
+ !Services.prefs.getBoolPref("widget.macos.native-context-menus", false)
+ ) {
+ info("Send the first escape");
+ EventUtils.synthesizeKey("KEY_Escape");
+ } else {
+ // We cannot synthesize key events at native macOS menus.
+ // We also do not see key events that are processed by native macOS menus,
+ // so we cannot accidentally exit fullscreen when the user closes a native
+ // menu with Escape.
+ // Close the menu normally.
+ info("Close the context menu");
+ contextMenu.hidePopup();
+ }
+ await popupHidePromise;
+ is(contextMenu.state, "closed", "Should have closed context menu");
+
+ // Wait a small time to confirm that the first ESC key
+ // does not exit fullscreen.
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
+ await new Promise(resolve => setTimeout(resolve, 1000));
+ state = await SpecialPowers.spawn(browser, [], () => {
+ return !!content.document.fullscreenElement;
+ });
+ ok(state, "The content should still be in fullscreen");
+ ok(document.fullscreenElement, "The chrome should still be in fullscreen");
+
+ removeContentEventListener();
+ info("Send the second escape");
+ let fullscreenExitPromise = BrowserTestUtils.waitForContentEvent(
+ browser,
+ "fullscreenchange"
+ );
+ EventUtils.synthesizeKey("KEY_Escape");
+ await fullscreenExitPromise;
+ ok(!document.fullscreenElement, "The chrome should have exited fullscreen");
+
+ gBrowser.removeTab(tab);
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen-document-mutation-navigation.js b/dom/base/test/fullscreen/browser_fullscreen-document-mutation-navigation.js
new file mode 100644
index 0000000000..f6b5715f59
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-document-mutation-navigation.js
@@ -0,0 +1,141 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+async function startTests(testFun, name) {
+ TEST_URLS.forEach(url => {
+ add_task(async () => {
+ info(`Test ${name}, url: ${url}`);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let promiseFsState = waitForFullscreenState(document, true);
+ // Trigger click event in inner most iframe
+ SpecialPowers.spawn(
+ browser.browsingContext.children[0].children[0],
+ [],
+ function () {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ }
+ );
+ await promiseFsState;
+
+ // This should exit fullscreen
+ promiseFsState = waitForFullscreenState(document, false, true);
+ await testFun(browser);
+ await promiseFsState;
+
+ // This test triggers a fullscreen request during the fullscreen exit
+ // process, so it could be possible that the widget or the chrome
+ // document goes into fullscreen mode again, but they should end up
+ // leaving fullscreen mode again.
+ if (
+ window.fullScreen ||
+ document.documentElement.hasAttribute("inFullscreen")
+ ) {
+ info("widget is still in fullscreen, wait again");
+ await waitWidgetFullscreenEvent(window, false, true);
+ }
+ if (document.documentElement.hasAttribute("inDOMFullscreen")) {
+ info("chrome document is still in fullscreen, wait again");
+ await waitForFullScreenObserver(document, false, true);
+ }
+
+ // Ensure the browser exits fullscreen state.
+ ok(!window.fullScreen, "The widget should not be in fullscreen");
+ ok(
+ !document.documentElement.hasAttribute("inFullscreen"),
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+ });
+}
+
+function MutateAndNavigateFromRemoteDocument(
+ aBrowsingContext,
+ aElementId,
+ aURL
+) {
+ return SpecialPowers.spawn(
+ aBrowsingContext,
+ [aElementId, aURL],
+ async function (id, url) {
+ let element = content.document.getElementById(id);
+ element.requestFullscreen();
+ content.document.body.appendChild(element);
+ content.location.href = url;
+ }
+ );
+}
+
+startTests(async browser => {
+ // toplevel
+ await MutateAndNavigateFromRemoteDocument(
+ browser.browsingContext,
+ "div",
+ "about:blank"
+ );
+}, "document_mutation_navigation_toplevel");
+
+startTests(async browser => {
+ let promiseRemoteFsState = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ ]);
+ // middle iframe
+ await MutateAndNavigateFromRemoteDocument(
+ browser.browsingContext.children[0],
+ "div",
+ "about:blank"
+ );
+ await promiseRemoteFsState;
+}, "document_mutation_navigation_middle_frame");
+
+startTests(async browser => {
+ let promiseRemoteFsState = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ [browser.browsingContext.children[0], "middle"],
+ ]);
+ // innermost iframe
+ await MutateAndNavigateFromRemoteDocument(
+ browser.browsingContext.children[0].children[0],
+ "div",
+ "about:blank"
+ );
+ await promiseRemoteFsState;
+}, "document_mutation_navigation_inner_frame");
diff --git a/dom/base/test/fullscreen/browser_fullscreen-document-mutation-race.js b/dom/base/test/fullscreen/browser_fullscreen-document-mutation-race.js
new file mode 100644
index 0000000000..75ca199aaa
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-document-mutation-race.js
@@ -0,0 +1,122 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+async function startTests(setupFun, name) {
+ TEST_URLS.forEach(url => {
+ add_task(async () => {
+ info(`Test ${name}, url: ${url}`);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let promiseFsState = Promise.all([
+ setupFun(browser),
+ waitForFullscreenState(document, false, true),
+ ]);
+ // Trigger click event in inner most iframe
+ SpecialPowers.spawn(
+ browser.browsingContext.children[0].children[0],
+ [],
+ function () {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ }
+ );
+ await promiseFsState;
+
+ // Ensure the browser exits fullscreen state.
+ ok(
+ !window.fullScreen,
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+ });
+}
+
+function RemoveElementFromRemoteDocument(aBrowsingContext, aElementId) {
+ return SpecialPowers.spawn(
+ aBrowsingContext,
+ [aElementId],
+ async function (id) {
+ content.document.addEventListener(
+ "fullscreenchange",
+ function () {
+ content.document.getElementById(id).remove();
+ },
+ { once: true }
+ );
+ }
+ );
+}
+
+startTests(async browser => {
+ // toplevel
+ let promise = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ ]);
+ await RemoveElementFromRemoteDocument(browser.browsingContext, "div");
+ return promise;
+}, "document_mutation_toplevel");
+
+startTests(async browser => {
+ // middle iframe
+ let promise = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ [browser.browsingContext.children[0], "middle"],
+ ]);
+ await RemoveElementFromRemoteDocument(
+ browser.browsingContext.children[0],
+ "div"
+ );
+ return promise;
+}, "document_mutation_middle_frame");
+
+startTests(async browser => {
+ // innermost iframe
+ let promise = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ [browser.browsingContext.children[0], "middle"],
+ [browser.browsingContext.children[0].children[0], "inner"],
+ ]);
+ await RemoveElementFromRemoteDocument(
+ browser.browsingContext.children[0].children[0],
+ "div"
+ );
+ return promise;
+}, "document_mutation_inner_frame");
diff --git a/dom/base/test/fullscreen/browser_fullscreen-document-mutation.js b/dom/base/test/fullscreen/browser_fullscreen-document-mutation.js
new file mode 100644
index 0000000000..7cecdabb95
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-document-mutation.js
@@ -0,0 +1,118 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+async function startTests(testFun, name) {
+ TEST_URLS.forEach(url => {
+ add_task(async () => {
+ info(`Test ${name}, url: ${url}`);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let promiseFsState = waitForFullscreenState(document, true);
+ // Trigger click event in inner most iframe
+ SpecialPowers.spawn(
+ browser.browsingContext.children[0].children[0],
+ [],
+ function () {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ }
+ );
+ await promiseFsState;
+
+ // This should exit fullscreen
+ promiseFsState = waitForFullscreenState(document, false);
+ await testFun(browser);
+ await promiseFsState;
+
+ // Ensure the browser exits fullscreen state.
+ ok(
+ !window.fullScreen,
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+ });
+}
+
+function RemoveElementFromRemoteDocument(aBrowsingContext, aElementId) {
+ return SpecialPowers.spawn(
+ aBrowsingContext,
+ [aElementId],
+ async function (id) {
+ content.document.getElementById(id).remove();
+ }
+ );
+}
+
+startTests(async browser => {
+ let promiseRemoteFsState = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ ]);
+ // toplevel
+ await RemoveElementFromRemoteDocument(browser.browsingContext, "div");
+ await promiseRemoteFsState;
+}, "document_mutation_toplevel");
+
+startTests(async browser => {
+ let promiseRemoteFsState = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ [browser.browsingContext.children[0], "middle"],
+ ]);
+ // middle iframe
+ await RemoveElementFromRemoteDocument(
+ browser.browsingContext.children[0],
+ "div"
+ );
+ await promiseRemoteFsState;
+}, "document_mutation_middle_frame");
+
+startTests(async browser => {
+ let promiseRemoteFsState = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ [browser.browsingContext.children[0], "middle"],
+ [browser.browsingContext.children[0].children[0], "inner"],
+ ]);
+ // innermost iframe
+ await RemoveElementFromRemoteDocument(
+ browser.browsingContext.children[0].children[0],
+ "div"
+ );
+ await promiseRemoteFsState;
+}, "document_mutation_inner_frame");
diff --git a/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js b/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js
new file mode 100644
index 0000000000..2ea2b9ee40
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js
@@ -0,0 +1,128 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error, bug 1742890.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+function preventBFCache(aBrowsingContext, aPrevent) {
+ return SpecialPowers.spawn(aBrowsingContext, [aPrevent], prevent => {
+ if (prevent) {
+ // Using a dummy onunload listener to disable the bfcache.
+ content.window.addEventListener("unload", () => {});
+ }
+ content.window.addEventListener(
+ "pagehide",
+ e => {
+ // XXX checking persisted property causes intermittent failures, so we
+ // dump the value instead, bug 1822263.
+ // is(e.persisted, !prevent, `Check BFCache state`);
+ info(`Check BFCache state: e.persisted is ${e.persisted}`);
+ },
+ { once: true }
+ );
+ });
+}
+
+[true, false].forEach(crossOrigin => {
+ [true, false].forEach(initialPagePreventsBFCache => {
+ [true, false].forEach(fullscreenPagePreventsBFCache => {
+ add_task(async function navigation_history() {
+ info(
+ `crossOrigin: ${crossOrigin}, initialPagePreventsBFCache: ${initialPagePreventsBFCache}, fullscreenPagePreventsBFCache: ${fullscreenPagePreventsBFCache}`
+ );
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: "http://mochi.test:8888/browser/dom/base/test/fullscreen/dummy_page.html",
+ },
+ async function (browser) {
+ // Maybe prevent BFCache on initial page.
+ await preventBFCache(
+ browser.browsingContext,
+ initialPagePreventsBFCache
+ );
+
+ // Navigate to fullscreen page.
+ const url = crossOrigin
+ ? "https://example.org/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html"
+ : "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html";
+ const loaded = BrowserTestUtils.browserLoaded(browser, false, url);
+ BrowserTestUtils.startLoadingURIString(browser, url);
+ await loaded;
+
+ // Maybe prevent BFCache on fullscreen test page.
+ await preventBFCache(
+ browser.browsingContext,
+ fullscreenPagePreventsBFCache
+ );
+
+ // Trigger click event to enter fullscreen.
+ await SpecialPowers.spawn(browser.browsingContext, [], () => {
+ let target = content.document.getElementById("div");
+ target.addEventListener(
+ "mousedown",
+ function (e) {
+ content.window.history.back();
+ },
+ { once: true }
+ );
+ EventUtils.synthesizeMouseAtCenter(target, {}, content.window);
+ });
+
+ // Give some time for fullscreen transition.
+ await new Promise(aResolve => {
+ SimpleTest.executeSoon(() => {
+ SimpleTest.executeSoon(aResolve);
+ });
+ });
+
+ // Wait fullscreen exit event if browser is still in fullscreen mode.
+ if (
+ window.fullScreen ||
+ document.documentElement.hasAttribute("inFullscreen")
+ ) {
+ info("The widget is still in fullscreen, wait again");
+ await waitWidgetFullscreenEvent(window, false, true);
+ }
+ if (document.documentElement.hasAttribute("inDOMFullscreen")) {
+ info("The chrome document is still in fullscreen, wait again");
+ await waitForFullScreenObserver(window, false, true);
+ }
+
+ // Ensure the browser exits fullscreen state.
+ ok(!window.fullScreen, "The widget should not be in fullscreen");
+ ok(
+ !document.documentElement.hasAttribute("inFullscreen"),
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+ });
+ });
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen-navigation-history.js b/dom/base/test/fullscreen/browser_fullscreen-navigation-history.js
new file mode 100644
index 0000000000..c4feb7f641
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-navigation-history.js
@@ -0,0 +1,100 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error, bug 1742890.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+function preventBFCache(aBrowsingContext, aPrevent) {
+ return SpecialPowers.spawn(aBrowsingContext, [aPrevent], prevent => {
+ if (prevent) {
+ // Using a dummy onunload listener to disable the bfcache.
+ content.window.addEventListener("unload", () => {});
+ }
+ content.window.addEventListener(
+ "pagehide",
+ e => {
+ // XXX checking persisted property causes intermittent failures, so we
+ // dump the value instead, bug 1822263.
+ // is(e.persisted, !prevent, `Check BFCache state`);
+ info(`Check BFCache state: e.persisted is ${e.persisted}`);
+ },
+ { once: true }
+ );
+ });
+}
+
+[true, false].forEach(crossOrigin => {
+ [true, false].forEach(initialPagePreventsBFCache => {
+ [true, false].forEach(fullscreenPagePreventsBFCache => {
+ add_task(async function navigation_history() {
+ info(
+ `crossOrigin: ${crossOrigin}, initialPagePreventsBFCache: ${initialPagePreventsBFCache}, fullscreenPagePreventsBFCache: ${fullscreenPagePreventsBFCache}`
+ );
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: "http://mochi.test:8888/browser/dom/base/test/fullscreen/dummy_page.html",
+ },
+ async function (browser) {
+ // Maybe prevent BFCache on initial page.
+ await preventBFCache(
+ browser.browsingContext,
+ initialPagePreventsBFCache
+ );
+
+ // Navigate to fullscreen page.
+ const url = crossOrigin
+ ? "https://example.org/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html"
+ : "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html";
+ const loaded = BrowserTestUtils.browserLoaded(browser, false, url);
+ BrowserTestUtils.startLoadingURIString(browser, url);
+ await loaded;
+
+ // Maybe prevent BFCache on fullscreen test page.
+ await preventBFCache(
+ browser.browsingContext,
+ fullscreenPagePreventsBFCache
+ );
+
+ // Trigger click event to enter fullscreen.
+ let promiseFsState = waitForFullscreenState(document, true);
+ SpecialPowers.spawn(browser.browsingContext, [], () => {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ });
+ await promiseFsState;
+
+ // Navigate back to the previous page should exit fullscreen.
+ promiseFsState = waitForFullscreenState(document, false);
+ await SpecialPowers.spawn(browser.browsingContext, [], () => {
+ content.window.history.back();
+ });
+ await promiseFsState;
+ }
+ );
+ });
+ });
+ });
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen-navigation-race.js b/dom/base/test/fullscreen/browser_fullscreen-navigation-race.js
new file mode 100644
index 0000000000..f9d1543a1a
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-navigation-race.js
@@ -0,0 +1,162 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+add_task(async function navigation() {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: `data:text/html,
+ Click here
+ `,
+ },
+ async function (browser) {
+ BrowserTestUtils.synthesizeMouseAtCenter("#button", {}, browser);
+
+ // Give some time for fullscreen transition.
+ await new Promise(aResolve => {
+ SimpleTest.executeSoon(() => {
+ SimpleTest.executeSoon(aResolve);
+ });
+ });
+
+ // Wait fullscreen exit event if browser is still in fullscreen mode.
+ if (
+ window.fullScreen ||
+ document.documentElement.hasAttribute("inFullscreen")
+ ) {
+ info("The widget is still in fullscreen, wait again");
+ await waitWidgetFullscreenEvent(window, false, true);
+ }
+ if (document.documentElement.hasAttribute("inDOMFullscreen")) {
+ info("The chrome document is still in fullscreen, wait again");
+ await waitForFullScreenObserver(window, false, true);
+ }
+
+ // Ensure the browser exits fullscreen state.
+ ok(!window.fullScreen, "The widget should not be in fullscreen");
+ ok(
+ !document.documentElement.hasAttribute("inFullscreen"),
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+});
+
+async function startTests(setupFun, name) {
+ TEST_URLS.forEach(url => {
+ add_task(async () => {
+ info(`Test ${name}, url: ${url}`);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let promiseFsState = Promise.all([
+ setupFun(browser),
+ waitForFullscreenState(document, false, true),
+ ]);
+ // Trigger click event in inner most iframe
+ SpecialPowers.spawn(
+ browser.browsingContext.children[0].children[0],
+ [],
+ function () {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ }
+ );
+ await promiseFsState;
+
+ // Ensure the browser exits fullscreen state.
+ ok(
+ !window.fullScreen,
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+ });
+}
+
+function NavigateRemoteDocument(aBrowsingContext, aURL) {
+ return SpecialPowers.spawn(aBrowsingContext, [aURL], async function (url) {
+ content.document.addEventListener(
+ "fullscreenchange",
+ function () {
+ content.location.href = url;
+ },
+ { once: true }
+ );
+ });
+}
+
+startTests(async browser => {
+ // toplevel
+ await NavigateRemoteDocument(browser.browsingContext, "about:blank");
+}, "navigation_toplevel");
+
+startTests(async browser => {
+ // middle iframe
+ let promise = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ ]);
+ await NavigateRemoteDocument(
+ browser.browsingContext.children[0],
+ "about:blank"
+ );
+ return promise;
+}, "navigation_middle_frame");
+
+startTests(async browser => {
+ // innermost iframe
+ let promise = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ [browser.browsingContext.children[0], "middle"],
+ ]);
+ await NavigateRemoteDocument(
+ browser.browsingContext.children[0].children[0],
+ "about:blank"
+ );
+ return promise;
+}, "navigation_inner_frame");
diff --git a/dom/base/test/fullscreen/browser_fullscreen-navigation.js b/dom/base/test/fullscreen/browser_fullscreen-navigation.js
new file mode 100644
index 0000000000..02387eb437
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-navigation.js
@@ -0,0 +1,142 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+add_task(async function navigation() {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: `data:text/html,
+ Click here
+ `,
+ },
+ async function (browser) {
+ let promiseFsState = waitForFullscreenState(document, true);
+ // Trigger click event
+ BrowserTestUtils.synthesizeMouseAtCenter("#button", {}, browser);
+ await promiseFsState;
+
+ promiseFsState = waitForFullscreenState(document, false);
+ await SpecialPowers.spawn(browser, [], async function () {
+ content.location.href = "about:blank";
+ });
+ await promiseFsState;
+
+ // Ensure the browser exits fullscreen state.
+ ok(!window.fullScreen, "The chrome window should not be in fullscreen");
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+});
+
+async function startTests(testFun, name) {
+ TEST_URLS.forEach(url => {
+ add_task(async () => {
+ info(`Test ${name}, url: ${url}`);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let promiseFsState = waitForFullscreenState(document, true);
+ // Trigger click event in inner most iframe
+ SpecialPowers.spawn(
+ browser.browsingContext.children[0].children[0],
+ [],
+ function () {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ }
+ );
+ await promiseFsState;
+
+ // This should exit fullscreen
+ promiseFsState = waitForFullscreenState(document, false);
+ await testFun(browser);
+ await promiseFsState;
+
+ // Ensure the browser exits fullscreen state.
+ ok(
+ !window.fullScreen,
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+ });
+}
+
+function NavigateRemoteDocument(aBrowsingContext, aURL) {
+ return SpecialPowers.spawn(aBrowsingContext, [aURL], async function (url) {
+ content.location.href = url;
+ });
+}
+
+startTests(async browser => {
+ // toplevel
+ await NavigateRemoteDocument(browser.browsingContext, "about:blank");
+}, "navigation_toplevel");
+
+startTests(async browser => {
+ let promiseRemoteFsState = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ ]);
+ // middle iframe
+ await NavigateRemoteDocument(
+ browser.browsingContext.children[0],
+ "about:blank"
+ );
+ await promiseRemoteFsState;
+}, "navigation_middle_frame");
+
+startTests(async browser => {
+ let promiseRemoteFsState = waitRemoteFullscreenExitEvents([
+ // browsingContext, name
+ [browser.browsingContext, "toplevel"],
+ [browser.browsingContext.children[0], "middle"],
+ ]);
+ // innermost iframe
+ await NavigateRemoteDocument(
+ browser.browsingContext.children[0].children[0],
+ "about:blank"
+ );
+ await promiseRemoteFsState;
+}, "navigation_inner_frame");
diff --git a/dom/base/test/fullscreen/browser_fullscreen-newtab.js b/dom/base/test/fullscreen/browser_fullscreen-newtab.js
new file mode 100644
index 0000000000..af714b1248
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-newtab.js
@@ -0,0 +1,91 @@
+"use strict";
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+const kPage =
+ "https://example.org/browser/" +
+ "dom/base/test/fullscreen/file_fullscreen-newtab.html";
+
+function getSizeMode() {
+ return document.documentElement.getAttribute("sizemode");
+}
+
+async function runTest() {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: kPage,
+ },
+ async function (browser) {
+ let promiseFsEvents = SpecialPowers.spawn(browser, [], function () {
+ return new Promise(resolve => {
+ let countFsChange = 0;
+ let countFsError = 0;
+ function checkAndResolve() {
+ if (countFsChange > 0 && countFsError > 0) {
+ Assert.ok(
+ false,
+ "Got both fullscreenchange and fullscreenerror events"
+ );
+ } else if (countFsChange > 2) {
+ Assert.ok(false, "Got too many fullscreenchange events");
+ } else if (countFsError > 1) {
+ Assert.ok(false, "Got too many fullscreenerror events");
+ } else if (countFsChange == 2 || countFsError == 1) {
+ resolve();
+ }
+ }
+
+ content.document.addEventListener("fullscreenchange", () => {
+ ++countFsChange;
+ checkAndResolve();
+ });
+ content.document.addEventListener("fullscreenerror", () => {
+ ++countFsError;
+ checkAndResolve();
+ });
+ });
+ });
+ let promiseNewTab = BrowserTestUtils.waitForNewTab(
+ gBrowser,
+ "about:blank"
+ );
+ await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser);
+ let [newtab] = await Promise.all([promiseNewTab, promiseFsEvents]);
+ await BrowserTestUtils.removeTab(newtab);
+
+ // Ensure the browser exits fullscreen state in reasonable time.
+ await Promise.race([
+ BrowserTestUtils.waitForCondition(() => getSizeMode() == "normal"),
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
+ new Promise(resolve => setTimeout(resolve, 2000)),
+ ]);
+
+ ok(!window.fullScreen, "The chrome window should not be in fullscreen");
+ ok(
+ !document.fullscreen,
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+}
+
+add_task(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"]
+ );
+ await runTest();
+});
+
+add_task(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "200 200"],
+ ["full-screen-api.transition-duration.leave", "200 200"]
+ );
+ await runTest();
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen-sizemode.js b/dom/base/test/fullscreen/browser_fullscreen-sizemode.js
new file mode 100644
index 0000000000..0aa79e5694
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-sizemode.js
@@ -0,0 +1,225 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const isMac = AppConstants.platform == "macosx";
+const isWin = AppConstants.platform == "win";
+
+async function waitForSizeMode(aWindow, aSizeMode) {
+ await BrowserTestUtils.waitForEvent(aWindow, "sizemodechange", false, () => {
+ return aWindow.windowState === aSizeMode;
+ });
+ const expectedHidden =
+ aSizeMode == aWindow.STATE_MINIMIZED || aWindow.isFullyOccluded;
+ if (aWindow.document.hidden != expectedHidden) {
+ await BrowserTestUtils.waitForEvent(aWindow, "visibilitychange");
+ }
+ is(
+ aWindow.document.hidden,
+ expectedHidden,
+ "Should be inactive if minimized or occluded"
+ );
+}
+
+async function checkSizeModeAndFullscreenState(
+ aWindow,
+ aSizeMode,
+ aFullscreen,
+ aFullscreenEventShouldHaveFired,
+ aStepFun
+) {
+ let promises = [];
+ if (aWindow.windowState != aSizeMode) {
+ promises.push(waitForSizeMode(aWindow, aSizeMode));
+ }
+ if (aFullscreenEventShouldHaveFired) {
+ promises.push(
+ BrowserTestUtils.waitForEvent(
+ aWindow,
+ aFullscreen ? "willenterfullscreen" : "willexitfullscreen"
+ )
+ );
+ promises.push(BrowserTestUtils.waitForEvent(aWindow, "fullscreen"));
+ }
+
+ // Add listener for unexpected event.
+ let unexpectedEventListener = aEvent => {
+ ok(false, `should not receive ${aEvent.type} event`);
+ };
+ if (aFullscreenEventShouldHaveFired) {
+ aWindow.addEventListener(
+ aFullscreen ? "willexitfullscreen" : "willenterfullscreen",
+ unexpectedEventListener
+ );
+ } else {
+ aWindow.addEventListener("willenterfullscreen", unexpectedEventListener);
+ aWindow.addEventListener("willexitfullscreen", unexpectedEventListener);
+ aWindow.addEventListener("fullscreen", unexpectedEventListener);
+ }
+
+ let eventPromise = Promise.all(promises);
+ aStepFun();
+ await eventPromise;
+
+ // Check SizeMode.
+ is(
+ aWindow.windowState,
+ aSizeMode,
+ "The new sizemode should have the expected value"
+ );
+ // Check Fullscreen state.
+ is(
+ aWindow.fullScreen,
+ aFullscreen,
+ `chrome window should ${aFullscreen ? "be" : "not be"} in fullscreen`
+ );
+ is(
+ aWindow.document.documentElement.hasAttribute("inFullscreen"),
+ aFullscreen,
+ `chrome documentElement should ${
+ aFullscreen ? "have" : "not have"
+ } inFullscreen attribute`
+ );
+
+ // Remove listener for unexpected event.
+ if (aFullscreenEventShouldHaveFired) {
+ aWindow.removeEventListener(
+ aFullscreen ? "willexitfullscreen" : "willenterfullscreen",
+ unexpectedEventListener
+ );
+ } else {
+ aWindow.removeEventListener("willenterfullscreen", unexpectedEventListener);
+ aWindow.removeEventListener("willexitfullscreen", unexpectedEventListener);
+ aWindow.removeEventListener("fullscreen", unexpectedEventListener);
+ }
+}
+
+async function restoreWindowToNormal(aWindow) {
+ while (aWindow.windowState != aWindow.STATE_NORMAL) {
+ info(`Try to restore window with state ${aWindow.windowState} to normal`);
+ let eventPromise = BrowserTestUtils.waitForEvent(aWindow, "sizemodechange");
+ aWindow.restore();
+ await eventPromise;
+ info(`Window is now in state ${aWindow.windowState}`);
+ }
+}
+
+add_task(async function test_fullscreen_restore() {
+ let win = await BrowserTestUtils.openNewBrowserWindow();
+ await restoreWindowToNormal(win);
+
+ info("Enter fullscreen");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_FULLSCREEN,
+ true,
+ true,
+ () => {
+ win.fullScreen = true;
+ }
+ );
+
+ info("Restore window");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_NORMAL,
+ false,
+ true,
+ () => {
+ win.restore();
+ }
+ );
+
+ await BrowserTestUtils.closeWindow(win);
+});
+
+// This test only enable on Windows because:
+// - Test gets intermittent timeout on macOS, see bug 1828848.
+// - Restoring a fullscreen window on GTK doesn't return it to the previous
+// sizemode, see bug 1828837.
+if (isWin) {
+ add_task(async function test_maximize_fullscreen_restore() {
+ let win = await BrowserTestUtils.openNewBrowserWindow();
+ await restoreWindowToNormal(win);
+
+ info("Maximize window");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_MAXIMIZED,
+ false,
+ false,
+ () => {
+ win.maximize();
+ }
+ );
+
+ info("Enter fullscreen");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_FULLSCREEN,
+ true,
+ true,
+ () => {
+ win.fullScreen = true;
+ }
+ );
+
+ info("Restore window");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_MAXIMIZED,
+ false,
+ true,
+ () => {
+ win.restore();
+ }
+ );
+
+ await BrowserTestUtils.closeWindow(win);
+ });
+}
+
+// Restoring a minimized window on macOS doesn't return it to the previous
+// sizemode, see bug 1828706.
+if (!isMac) {
+ add_task(async function test_fullscreen_minimize_restore() {
+ let win = await BrowserTestUtils.openNewBrowserWindow();
+ await restoreWindowToNormal(win);
+
+ info("Enter fullscreen");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_FULLSCREEN,
+ true,
+ true,
+ () => {
+ win.fullScreen = true;
+ }
+ );
+
+ info("Minimize window");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_MINIMIZED,
+ true,
+ false,
+ () => {
+ win.minimize();
+ }
+ );
+
+ info("Restore window");
+ await checkSizeModeAndFullscreenState(
+ win,
+ win.STATE_FULLSCREEN,
+ true,
+ false,
+ () => {
+ win.restore();
+ }
+ );
+
+ await BrowserTestUtils.closeWindow(win);
+ });
+}
diff --git a/dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js b/dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js
new file mode 100644
index 0000000000..10d10a0b0f
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js
@@ -0,0 +1,105 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+async function startTests(setupAndCompletionFn, name) {
+ TEST_URLS.forEach(url => {
+ add_task(async () => {
+ info(`Test ${name}, url: ${url}`);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let promiseFsState = waitForFullscreenExit(document);
+ let promiseSetup = setupAndCompletionFn(browser);
+ // Trigger click event in inner most iframe
+ await SpecialPowers.spawn(
+ browser.browsingContext.children[0].children[0],
+ [],
+ function () {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ }
+ );
+ await promiseSetup;
+ await promiseFsState;
+
+ // Ensure the browser exits fullscreen state.
+ ok(
+ !window.fullScreen,
+ "The chrome window should not be in fullscreen"
+ );
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+ });
+}
+
+async function WaitRemoveDocumentAndCloseTab(aBrowser, aBrowsingContext) {
+ await SpecialPowers.spawn(aBrowsingContext, [], function () {
+ return new Promise(resolve => {
+ content.document.addEventListener(
+ "fullscreenchange",
+ e => {
+ resolve();
+ },
+ { once: true }
+ );
+ });
+ });
+
+ // This should exit fullscreen
+ let tab = gBrowser.getTabForBrowser(aBrowser);
+ BrowserTestUtils.removeTab(tab);
+}
+
+startTests(browser => {
+ // toplevel
+ return WaitRemoveDocumentAndCloseTab(browser, browser.browsingContext);
+}, "tab_close_toplevel");
+
+startTests(browser => {
+ // middle iframe
+ return WaitRemoveDocumentAndCloseTab(
+ browser,
+ browser.browsingContext.children[0]
+ );
+}, "tab_close_middle_frame");
+
+startTests(browser => {
+ // innermost iframe
+ return WaitRemoveDocumentAndCloseTab(
+ browser,
+ browser.browsingContext.children[0].children[0]
+ );
+}, "tab_close_inner_frame");
diff --git a/dom/base/test/fullscreen/browser_fullscreen-tab-close.js b/dom/base/test/fullscreen/browser_fullscreen-tab-close.js
new file mode 100644
index 0000000000..7d1772cd48
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-tab-close.js
@@ -0,0 +1,65 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+TEST_URLS.forEach(url => {
+ add_task(async () => {
+ info(`url: ${url}`);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let promiseFsState = waitForFullscreenState(document, true);
+ // Trigger click event in inner most iframe
+ SpecialPowers.spawn(
+ browser.browsingContext.children[0].children[0],
+ [],
+ function () {
+ content.setTimeout(() => {
+ content.document.getElementById("div").click();
+ }, 0);
+ }
+ );
+ await promiseFsState;
+
+ let promiseFsExit = waitForFullscreenExit(document, false);
+ // This should exit fullscreen
+ let tab = gBrowser.getTabForBrowser(browser);
+ BrowserTestUtils.removeTab(tab);
+ await promiseFsExit;
+
+ // Ensure the browser exits fullscreen state.
+ ok(!window.fullScreen, "The chrome window should not be in fullscreen");
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+ }
+ );
+ });
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen-window-open-race.js b/dom/base/test/fullscreen/browser_fullscreen-window-open-race.js
new file mode 100644
index 0000000000..4cf8a3d8c7
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen-window-open-race.js
@@ -0,0 +1,73 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error, bug 1742890.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+add_task(async () => {
+ const url =
+ "http://mochi.test:8888/browser/dom/base/test/fullscreen/dummy_page.html";
+ const name = "foo";
+
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ info("open new window");
+ SpecialPowers.spawn(browser, [url, name], function (u, n) {
+ content.document.notifyUserGestureActivation();
+ content.window.open(u, n, "width=100,height=100");
+ });
+ let newWin = await BrowserTestUtils.waitForNewWindow({ url });
+ await SimpleTest.promiseFocus(newWin);
+
+ info("re-focusing main window");
+ await SimpleTest.promiseFocus(window);
+
+ info("open an existing window and request fullscreen");
+ await SpecialPowers.spawn(browser, [url, name], function (u, n) {
+ content.document.notifyUserGestureActivation();
+ content.window.open(u, n);
+ content.document.body.requestFullscreen();
+ });
+
+ // We call window.open() first than requestFullscreen() in a row on
+ // content page, but given that focus sync-up takes several IPC exchanges,
+ // so parent process ends up processing the requests in a reverse order,
+ // which should reject the fullscreen request and leave fullscreen.
+ await waitWidgetFullscreenEvent(window, false, true);
+
+ // Ensure the browser exits fullscreen state.
+ ok(!window.fullScreen, "The chrome window should not be in fullscreen");
+ ok(
+ !document.documentElement.hasAttribute("inDOMFullscreen"),
+ "The chrome document should not be in fullscreen"
+ );
+
+ await BrowserTestUtils.closeWindow(newWin);
+ }
+ );
+});
diff --git a/dom/base/test/fullscreen/browser_fullscreen_exit_on_external_protocol.js b/dom/base/test/fullscreen/browser_fullscreen_exit_on_external_protocol.js
new file mode 100644
index 0000000000..6f525da541
--- /dev/null
+++ b/dom/base/test/fullscreen/browser_fullscreen_exit_on_external_protocol.js
@@ -0,0 +1,215 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+SimpleTest.requestCompleteLog();
+
+requestLongerTimeout(2);
+
+// Import helpers
+Services.scriptloader.loadSubScript(
+ "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js",
+ this
+);
+
+add_setup(async function () {
+ await pushPrefs(
+ ["full-screen-api.transition-duration.enter", "0 0"],
+ ["full-screen-api.transition-duration.leave", "0 0"],
+ ["full-screen-api.allow-trusted-requests-only", false]
+ );
+});
+
+const { HandlerServiceTestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/HandlerServiceTestUtils.sys.mjs"
+);
+
+const gHandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService(
+ Ci.nsIHandlerService
+);
+
+const CONTENT = `data:text/html,
+
+
+
+
+
+
+
+
+`;
+
+// This test tends to trigger a race in the fullscreen time telemetry,
+// where the fullscreen enter and fullscreen exit events (which use the
+// same histogram ID) overlap. That causes TelemetryStopwatch to log an
+// error.
+SimpleTest.ignoreAllUncaughtExceptions(true);
+
+function setupMailHandler() {
+ let mailHandlerInfo = HandlerServiceTestUtils.getHandlerInfo("mailto");
+ let gOldMailHandlers = [];
+
+ // Remove extant web handlers because they have icons that
+ // we fetch from the web, which isn't allowed in tests.
+ let handlers = mailHandlerInfo.possibleApplicationHandlers;
+ for (let i = handlers.Count() - 1; i >= 0; i--) {
+ try {
+ let handler = handlers.queryElementAt(i, Ci.nsIWebHandlerApp);
+ gOldMailHandlers.push(handler);
+ // If we get here, this is a web handler app. Remove it:
+ handlers.removeElementAt(i);
+ } catch (ex) {}
+ }
+
+ let previousHandling = mailHandlerInfo.alwaysAskBeforeHandling;
+ mailHandlerInfo.alwaysAskBeforeHandling = true;
+
+ // Create a dummy web mail handler so we always know the mailto: protocol.
+ // Without this, the test fails on VMs without a default mailto: handler,
+ // because no dialog is ever shown, as we ignore subframe navigations to
+ // protocols that cannot be handled.
+ let dummy = Cc["@mozilla.org/uriloader/web-handler-app;1"].createInstance(
+ Ci.nsIWebHandlerApp
+ );
+ dummy.name = "Handler 1";
+ dummy.uriTemplate = "https://example.com/first/%s";
+ mailHandlerInfo.possibleApplicationHandlers.appendElement(dummy);
+
+ gHandlerSvc.store(mailHandlerInfo);
+ registerCleanupFunction(() => {
+ // Re-add the original protocol handlers:
+ let mailHandlers = mailHandlerInfo.possibleApplicationHandlers;
+ for (let i = handlers.Count() - 1; i >= 0; i--) {
+ try {
+ // See if this is a web handler. If it is, it'll throw, otherwise,
+ // we will remove it.
+ mailHandlers.queryElementAt(i, Ci.nsIWebHandlerApp);
+ mailHandlers.removeElementAt(i);
+ } catch (ex) {}
+ }
+ for (let h of gOldMailHandlers) {
+ mailHandlers.appendElement(h);
+ }
+ mailHandlerInfo.alwaysAskBeforeHandling = previousHandling;
+ gHandlerSvc.store(mailHandlerInfo);
+ });
+}
+
+add_task(setupMailHandler);
+
+// Fullscreen is canceled during fullscreen transition
+add_task(async function OpenExternalProtocolOnPendingLaterFullscreen() {
+ for (const useClick of [true, false]) {
+ await BrowserTestUtils.withNewTab(CONTENT, async browser => {
+ const leavelFullscreen = waitForFullscreenState(document, false, true);
+ await SpecialPowers.spawn(
+ browser,
+ [useClick],
+ async function (shouldClick) {
+ const button = content.document.querySelector("button");
+
+ const clickDone = new Promise(r => {
+ button.addEventListener(
+ "click",
+ function () {
+ content.document.documentElement.requestFullscreen();
+ // When anchor.click() is called, the fullscreen request
+ // is probably still pending.
+ content.setTimeout(() => {
+ if (shouldClick) {
+ content.document.querySelector("a").click();
+ } else {
+ content.document.location = "mailto:test@example.com";
+ }
+ r();
+ }, 0);
+ },
+ { once: true }
+ );
+ });
+ button.click();
+ await clickDone;
+ }
+ );
+
+ await leavelFullscreen;
+ ok(true, "Fullscreen should be exited");
+ });
+ }
+});
+
+// Fullscreen is canceled immediately.
+add_task(async function OpenExternalProtocolOnPendingFullscreen() {
+ for (const useClick of [true, false]) {
+ await BrowserTestUtils.withNewTab(CONTENT, async browser => {
+ await SpecialPowers.spawn(
+ browser,
+ [useClick],
+ async function (shouldClick) {
+ const button = content.document.querySelector("button");
+
+ const clickDone = new Promise(r => {
+ button.addEventListener(
+ "click",
+ function () {
+ content.document.documentElement
+ .requestFullscreen()
+ .then(() => {
+ ok(false, "Don't enter fullscreen");
+ })
+ .catch(() => {
+ ok(true, "Cancel entering fullscreen");
+ r();
+ });
+ // When anchor.click() is called, the fullscreen request
+ // is probably still pending.
+ if (shouldClick) {
+ content.document.querySelector("a").click();
+ } else {
+ content.document.location = "mailto:test@example.com";
+ }
+ },
+ { once: true }
+ );
+ });
+ button.click();
+ await clickDone;
+ }
+ );
+
+ ok(true, "Fullscreen should be exited");
+ });
+ }
+});
+
+add_task(async function OpenExternalProtocolOnFullscreen() {
+ for (const useClick of [true, false]) {
+ await BrowserTestUtils.withNewTab(CONTENT, async browser => {
+ const leavelFullscreen = waitForFullscreenState(document, false, true);
+ await SpecialPowers.spawn(
+ browser,
+ [useClick],
+ async function (shouldClick) {
+ let button = content.document.querySelector("button");
+ button.addEventListener("click", function () {
+ content.document.documentElement.requestFullscreen();
+ });
+ button.click();
+
+ await new Promise(r => {
+ content.document.addEventListener("fullscreenchange", r);
+ });
+
+ if (shouldClick) {
+ content.document.querySelector("a").click();
+ } else {
+ content.document.location = "mailto:test@example.com";
+ }
+ }
+ );
+
+ await leavelFullscreen;
+ ok(true, "Fullscreen should be exited");
+ });
+ }
+});
diff --git a/dom/base/test/fullscreen/chrome.toml b/dom/base/test/fullscreen/chrome.toml
new file mode 100644
index 0000000000..0ba7862f50
--- /dev/null
+++ b/dom/base/test/fullscreen/chrome.toml
@@ -0,0 +1,11 @@
+[DEFAULT]
+tags = "fullscreen"
+
+["test_MozDomFullscreen_event.xhtml"]
+support-files = [
+ "fullscreen.xhtml",
+ "MozDomFullscreen_chrome.xhtml",
+]
+
+["test_fullscreen.xhtml"]
+support-files = "file_MozDomFullscreen.html"
diff --git a/dom/base/test/fullscreen/dummy_page.html b/dom/base/test/fullscreen/dummy_page.html
new file mode 100644
index 0000000000..fd238954c6
--- /dev/null
+++ b/dom/base/test/fullscreen/dummy_page.html
@@ -0,0 +1,10 @@
+
+
+
+Dummy test page
+
+
+
+Dummy test page
+
+
diff --git a/dom/base/test/fullscreen/file_MozDomFullscreen.html b/dom/base/test/fullscreen/file_MozDomFullscreen.html
new file mode 100644
index 0000000000..f954892706
--- /dev/null
+++ b/dom/base/test/fullscreen/file_MozDomFullscreen.html
@@ -0,0 +1,8 @@
+
+
+
+
+Outer doc
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-api-keys.html b/dom/base/test/fullscreen/file_fullscreen-api-keys.html
new file mode 100644
index 0000000000..f526aa55ba
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-api-keys.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-api-race.html b/dom/base/test/fullscreen/file_fullscreen-api-race.html
new file mode 100644
index 0000000000..8310bc0a60
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-api-race.html
@@ -0,0 +1,8 @@
+
+
+
+ Helper file for test_fullscreen-api-race.html
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-api.html b/dom/base/test/fullscreen/file_fullscreen-api.html
new file mode 100644
index 0000000000..645e6ece46
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-api.html
@@ -0,0 +1,340 @@
+
+
+
+
+ Test for Bug 545812
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-async.html b/dom/base/test/fullscreen/file_fullscreen-async.html
new file mode 100644
index 0000000000..e9b4147124
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-async.html
@@ -0,0 +1,50 @@
+
+Test for Bug 1129227
+
+
+
+
+Async Request Fullscreen
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-backdrop.html b/dom/base/test/fullscreen/file_fullscreen-backdrop.html
new file mode 100644
index 0000000000..27be77a6d1
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-backdrop.html
@@ -0,0 +1,107 @@
+
+
+
+
+ Test for Bug 1064843
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html b/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html
new file mode 100644
index 0000000000..61db80c228
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html
@@ -0,0 +1,22 @@
+
+Launch
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html b/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html
new file mode 100644
index 0000000000..7490f12936
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html
@@ -0,0 +1,14 @@
+
+click me!
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-denied-inner.html b/dom/base/test/fullscreen/file_fullscreen-denied-inner.html
new file mode 100644
index 0000000000..6b5916b2e2
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-denied-inner.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-denied.html b/dom/base/test/fullscreen/file_fullscreen-denied.html
new file mode 100644
index 0000000000..db9a69e71a
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-denied.html
@@ -0,0 +1,171 @@
+
+
+
+
+ Test for Bug 545812
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html b/dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html
new file mode 100644
index 0000000000..d7d8a90aaf
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html
@@ -0,0 +1,58 @@
+
+
+
+
+ Test for Bug 700764
+
+
+
+
+
+
+
+Inner frame
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-esc-exit.html b/dom/base/test/fullscreen/file_fullscreen-esc-exit.html
new file mode 100644
index 0000000000..f65f930b3f
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-esc-exit.html
@@ -0,0 +1,63 @@
+
+
+
+
+ Test for Bug 700764
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-event-order.html b/dom/base/test/fullscreen/file_fullscreen-event-order.html
new file mode 100644
index 0000000000..72fb2c9b47
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-event-order.html
@@ -0,0 +1,50 @@
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-featurePolicy-inner.html b/dom/base/test/fullscreen/file_fullscreen-featurePolicy-inner.html
new file mode 100644
index 0000000000..844684b054
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-featurePolicy-inner.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-featurePolicy.html b/dom/base/test/fullscreen/file_fullscreen-featurePolicy.html
new file mode 100644
index 0000000000..c8b943c612
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-featurePolicy.html
@@ -0,0 +1,90 @@
+
+
+
+ Test for FeaturePolicy + fullscreen
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-focus-inner.html b/dom/base/test/fullscreen/file_fullscreen-focus-inner.html
new file mode 100644
index 0000000000..73d39a9d83
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-focus-inner.html
@@ -0,0 +1,24 @@
+
+
+
+ Focus test - child window
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-focus.html b/dom/base/test/fullscreen/file_fullscreen-focus.html
new file mode 100644
index 0000000000..be91025f45
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-focus.html
@@ -0,0 +1,67 @@
+
+
+
+
+ Test fullscreen request is blocked when window is not focused
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-hidden.html b/dom/base/test/fullscreen/file_fullscreen-hidden.html
new file mode 100644
index 0000000000..bd8c8189c9
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-hidden.html
@@ -0,0 +1,56 @@
+
+
+
+
+ Test for Bug 697636
+
+
+
+
+
+
+
+Mozilla Bug 697636
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html b/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html
new file mode 100644
index 0000000000..4a614fdecf
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html b/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html
new file mode 100644
index 0000000000..b60dea43bf
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html
@@ -0,0 +1,5 @@
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-iframe-top.html b/dom/base/test/fullscreen/file_fullscreen-iframe-top.html
new file mode 100644
index 0000000000..dddf4930c2
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-iframe-top.html
@@ -0,0 +1,5 @@
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-lenient-setters.html b/dom/base/test/fullscreen/file_fullscreen-lenient-setters.html
new file mode 100644
index 0000000000..02491c177e
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-lenient-setters.html
@@ -0,0 +1,61 @@
+
+
+
+
+ Test for Bug 1268798
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-multiple-inner.html b/dom/base/test/fullscreen/file_fullscreen-multiple-inner.html
new file mode 100644
index 0000000000..cb5ca9b28e
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-multiple-inner.html
@@ -0,0 +1,25 @@
+
+
+
+ Test for Bug 724554
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-multiple.html b/dom/base/test/fullscreen/file_fullscreen-multiple.html
new file mode 100644
index 0000000000..f9e35b5e78
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-multiple.html
@@ -0,0 +1,67 @@
+
+
+
+
+ Test for Bug 724554
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-navigation.html b/dom/base/test/fullscreen/file_fullscreen-navigation.html
new file mode 100644
index 0000000000..9b68fedf9a
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-navigation.html
@@ -0,0 +1,52 @@
+
+
+
+
+ Test for Bug 685402
+
+
+
+
+
+
+
+Mozilla Bug 685402
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-nested.html b/dom/base/test/fullscreen/file_fullscreen-nested.html
new file mode 100644
index 0000000000..1629d8386c
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-nested.html
@@ -0,0 +1,130 @@
+
+
+
+ Test for Bug 1187801
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-newtab.html b/dom/base/test/fullscreen/file_fullscreen-newtab.html
new file mode 100644
index 0000000000..0eaf5dd546
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-newtab.html
@@ -0,0 +1,4 @@
+
+
+Click here
diff --git a/dom/base/test/fullscreen/file_fullscreen-prefixed.html b/dom/base/test/fullscreen/file_fullscreen-prefixed.html
new file mode 100644
index 0000000000..dfe1965365
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-prefixed.html
@@ -0,0 +1,153 @@
+
+
+
+
+ Test for Bug 743198
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-resize.html b/dom/base/test/fullscreen/file_fullscreen-resize.html
new file mode 100644
index 0000000000..3050ba0d5d
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-resize.html
@@ -0,0 +1,39 @@
+
+
+
+
+ Test for Bug 1742421
+
+
+
+
+
+Mozilla Bug 1742421
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-rollback.html b/dom/base/test/fullscreen/file_fullscreen-rollback.html
new file mode 100644
index 0000000000..b1578b39cd
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-rollback.html
@@ -0,0 +1,140 @@
+
+
+
+
+ Test for Bug 700764
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-scrollbar.html b/dom/base/test/fullscreen/file_fullscreen-scrollbar.html
new file mode 100644
index 0000000000..05ab51431a
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-scrollbar.html
@@ -0,0 +1,147 @@
+
+
+
+
+ Test for Bug 1201798
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-selector.html b/dom/base/test/fullscreen/file_fullscreen-selector.html
new file mode 100644
index 0000000000..522f06f6fd
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-selector.html
@@ -0,0 +1,187 @@
+
+
+
+ Test for Bug 1199522
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-shadowdom.html b/dom/base/test/fullscreen/file_fullscreen-shadowdom.html
new file mode 100644
index 0000000000..348e08ae87
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-shadowdom.html
@@ -0,0 +1,52 @@
+
+
+
+
+ Bug 1430305
+
+
+
+
+
+
+ Mozilla Bug 1430305
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-single.html b/dom/base/test/fullscreen/file_fullscreen-single.html
new file mode 100644
index 0000000000..2ebc58bdae
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-single.html
@@ -0,0 +1,78 @@
+
+
+
+
+ Simple Fullscreen Enter and Exit Test
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-sub-iframe.html b/dom/base/test/fullscreen/file_fullscreen-sub-iframe.html
new file mode 100644
index 0000000000..28b0235c87
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-sub-iframe.html
@@ -0,0 +1,53 @@
+
+Test for Bug 1609180
+
+
+
+
+Request Fullscreen on sub iframe
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-svg-element.html b/dom/base/test/fullscreen/file_fullscreen-svg-element.html
new file mode 100644
index 0000000000..1dfc78aa1c
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-svg-element.html
@@ -0,0 +1,49 @@
+
+
+
+
+ Bug 735031
+
+
+
+
+
+
+ Mozilla Bug 735031
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-table.html b/dom/base/test/fullscreen/file_fullscreen-table.html
new file mode 100644
index 0000000000..39c602334a
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-table.html
@@ -0,0 +1,52 @@
+
+
+
+
+ Test for Bug 1223561
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-top-layer.html b/dom/base/test/fullscreen/file_fullscreen-top-layer.html
new file mode 100644
index 0000000000..9e95182b02
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-top-layer.html
@@ -0,0 +1,160 @@
+
+
+
+
+ Test for Bug 1126230
+
+
+
+
+
+
+
+Mozilla Bug 1126230
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen-utils.js b/dom/base/test/fullscreen/file_fullscreen-utils.js
new file mode 100644
index 0000000000..b4779da4de
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-utils.js
@@ -0,0 +1,87 @@
+// Keep track of how many fullscreenChange enters we've received, so that
+// we can balance them with the number of exits we receive. We reset this
+// to 0 when we load a test.
+var fullscreenChangeEnters = 0;
+
+addLoadEvent(function () {
+ info(`Resetting fullscreen enter count.`);
+ fullscreenChangeEnters = 0;
+});
+
+// This can be used to force a certain value for fullscreenChangeEnters
+// to handle unusual conditions -- such as exiting multiple levels of
+// fullscreen forcibly.
+function setFullscreenChangeEnters(enters) {
+ info(`Setting fullscreen enter count to ${enters}.`);
+ fullscreenChangeEnters = enters;
+}
+
+// Returns true if the window believes it is in fullscreen. This may be true even
+// before an asynchronous fullscreen transition is complete.
+function inFullscreenMode(win) {
+ return win.document.fullscreenElement;
+}
+
+// Adds a listener that will be called once a fullscreen transition
+// is complete. When type==='enter', callback is called when we've
+// received a fullscreenchange event, and the fullscreen transition is
+// complete. When type==='exit', callback is called when we've
+// received a fullscreenchange event and the window is out of
+// fullscreen. inDoc is the document which the listeners are added on,
+// if absent, the listeners are added to the current document.
+// the current document.
+function addFullscreenChangeContinuation(type, callback, inDoc) {
+ var doc = inDoc || document;
+ var topWin = doc.defaultView.top;
+ function checkCondition() {
+ if (type == "enter") {
+ fullscreenChangeEnters++;
+ return inFullscreenMode(topWin);
+ } else if (type == "exit") {
+ fullscreenChangeEnters--;
+ return fullscreenChangeEnters
+ ? inFullscreenMode(topWin)
+ : !inFullscreenMode(topWin);
+ }
+ throw new Error("'type' must be either 'enter', or 'exit'.");
+ }
+ function onFullscreenChange(event) {
+ doc.removeEventListener("fullscreenchange", onFullscreenChange);
+ ok(checkCondition(), `Should ${type} fullscreen.`);
+ // Delay invocation so other listeners have a chance to respond before
+ // we continue.
+ requestAnimationFrame(() => setTimeout(() => callback(event), 0), 0);
+ }
+ doc.addEventListener("fullscreenchange", onFullscreenChange);
+}
+
+// Calls |callback| when the next fullscreenerror is dispatched to inDoc||document.
+function addFullscreenErrorContinuation(callback, inDoc) {
+ let doc = inDoc || document;
+ let listener = function (event) {
+ doc.removeEventListener("fullscreenerror", listener);
+ // Delay invocation so other listeners have a chance to respond before
+ // we continue.
+ requestAnimationFrame(() => setTimeout(() => callback(event), 0), 0);
+ };
+ doc.addEventListener("fullscreenerror", listener);
+}
+
+// Waits until the window has both the load event and a MozAfterPaint called on
+// it, and then invokes the callback
+function waitForLoadAndPaint(win, callback) {
+ win.addEventListener(
+ "MozAfterPaint",
+ function () {
+ // The load event may have fired before the MozAfterPaint, in which case
+ // listening for it now will hang. Instead we check the readyState to see if
+ // it already fired, and if so, invoke the callback right away.
+ if (win.document.readyState == "complete") {
+ callback();
+ } else {
+ win.addEventListener("load", callback, { once: true });
+ }
+ },
+ { once: true }
+ );
+}
diff --git a/dom/base/test/fullscreen/file_fullscreen-with-full-zoom.html b/dom/base/test/fullscreen/file_fullscreen-with-full-zoom.html
new file mode 100644
index 0000000000..620bc5acf9
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen-with-full-zoom.html
@@ -0,0 +1,36 @@
+
+
+
+
+ Test for Bug 1223561
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/file_fullscreen_meta_viewport.html b/dom/base/test/fullscreen/file_fullscreen_meta_viewport.html
new file mode 100644
index 0000000000..9938fdda6b
--- /dev/null
+++ b/dom/base/test/fullscreen/file_fullscreen_meta_viewport.html
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/fullscreen.xhtml b/dom/base/test/fullscreen/fullscreen.xhtml
new file mode 100644
index 0000000000..2cc95642b6
--- /dev/null
+++ b/dom/base/test/fullscreen/fullscreen.xhtml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/fullscreen_helpers.js b/dom/base/test/fullscreen/fullscreen_helpers.js
new file mode 100644
index 0000000000..6e78015cd8
--- /dev/null
+++ b/dom/base/test/fullscreen/fullscreen_helpers.js
@@ -0,0 +1,174 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_URLS = [
+ // all frames are in different process.
+ `data:text/html,
+
+
+
`,
+ // toplevel and inner most iframe are in same process, and middle iframe is
+ // in a different process.
+ // eslint-disable-next-line @microsoft/sdl/no-insecure-url
+ `http://example.org/browser/dom/base/test/fullscreen/file_fullscreen-iframe-top.html`,
+ // toplevel and middle iframe are in same process, and inner most iframe is
+ // in a different process.
+ `http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-iframe-top.html`,
+];
+
+function waitRemoteFullscreenExitEvents(aBrowsingContexts) {
+ let promises = [];
+ aBrowsingContexts.forEach(([aBrowsingContext, aName]) => {
+ promises.push(
+ SpecialPowers.spawn(aBrowsingContext, [aName], async name => {
+ return new Promise(resolve => {
+ let document = content.document;
+ document.addEventListener(
+ "fullscreenchange",
+ function changeHandler() {
+ if (document.fullscreenElement) {
+ return;
+ }
+
+ ok(true, `check remote DOM fullscreen event (${name})`);
+ document.removeEventListener("fullscreenchange", changeHandler);
+ resolve();
+ }
+ );
+ });
+ })
+ );
+ });
+ return Promise.all(promises);
+}
+
+function waitDOMFullscreenEvent(
+ aDocument,
+ aIsInFullscreen,
+ aWaitUntil = false
+) {
+ return new Promise(resolve => {
+ function errorHandler() {
+ ok(false, "should not get fullscreenerror event");
+ aDocument.removeEventListener("fullscreenchange", changeHandler);
+ aDocument.removeEventListener("fullscreenerror", errorHandler);
+ resolve();
+ }
+
+ function changeHandler() {
+ if (aWaitUntil && aIsInFullscreen != !!aDocument.fullscreenElement) {
+ return;
+ }
+
+ is(
+ aIsInFullscreen,
+ !!aDocument.fullscreenElement,
+ "check DOM fullscreen (event)"
+ );
+ aDocument.removeEventListener("fullscreenchange", changeHandler);
+ aDocument.removeEventListener("fullscreenerror", errorHandler);
+ resolve();
+ }
+
+ aDocument.addEventListener("fullscreenchange", changeHandler);
+ aDocument.addEventListener("fullscreenerror", errorHandler);
+ });
+}
+
+function waitWidgetFullscreenEvent(
+ aWindow,
+ aIsInFullscreen,
+ aWaitUntil = false
+) {
+ return BrowserTestUtils.waitForEvent(aWindow, "fullscreen", false, aEvent => {
+ if (
+ aWaitUntil &&
+ aIsInFullscreen !=
+ aWindow.document.documentElement.hasAttribute("inFullscreen")
+ ) {
+ return false;
+ }
+
+ is(
+ aIsInFullscreen,
+ aWindow.document.documentElement.hasAttribute("inFullscreen"),
+ "check widget fullscreen (event)"
+ );
+ return true;
+ });
+}
+
+function waitForFullScreenObserver(
+ aDocument,
+ aIsInFullscreen,
+ aWaitUntil = false
+) {
+ return TestUtils.topicObserved("fullscreen-painted", (subject, data) => {
+ if (
+ aWaitUntil &&
+ aIsInFullscreen !=
+ aDocument.documentElement.hasAttribute("inDOMFullscreen")
+ ) {
+ return false;
+ }
+
+ is(
+ aIsInFullscreen,
+ aDocument.documentElement.hasAttribute("inDOMFullscreen"),
+ "check fullscreen (observer)"
+ );
+ return true;
+ });
+}
+
+function waitForFullscreenState(
+ aDocument,
+ aIsInFullscreen,
+ aWaitUntil = false
+) {
+ return Promise.all([
+ waitWidgetFullscreenEvent(
+ aDocument.defaultView,
+ aIsInFullscreen,
+ aWaitUntil
+ ),
+ waitDOMFullscreenEvent(aDocument, aIsInFullscreen, aWaitUntil),
+ waitForFullScreenObserver(aDocument, aIsInFullscreen, aWaitUntil),
+ ]);
+}
+
+// Wait for fullscreenchange event for fullscreen exit. And wait for
+// fullscreen-painted observed conditionally.
+async function waitForFullscreenExit(aDocument) {
+ info(`waitForFullscreenExit`);
+ let promiseFsObserver = null;
+ let observer = function () {
+ if (aDocument.documentElement.hasAttribute("inDOMFullscreen")) {
+ info(`waitForFullscreenExit, fullscreen-painted, inDOMFullscreen`);
+ Services.obs.removeObserver(observer, "fullscreen-painted");
+ promiseFsObserver = waitForFullScreenObserver(aDocument, false);
+ }
+ };
+ Services.obs.addObserver(observer, "fullscreen-painted");
+
+ await waitDOMFullscreenEvent(aDocument, false, true);
+ // If there is a fullscreen-painted observer notified for inDOMFullscreen set,
+ // we expect to have a subsequent fullscreen-painted observer notified with
+ // inDOMFullscreen unset.
+ if (promiseFsObserver) {
+ info(`waitForFullscreenExit, promiseFsObserver`);
+ await promiseFsObserver;
+ return;
+ }
+
+ Services.obs.removeObserver(observer, "fullscreen-painted");
+ // If inDOMFullscreen is set we expect to have a subsequent fullscreen-painted
+ // observer notified with inDOMFullscreen unset.
+ if (aDocument.documentElement.hasAttribute("inDOMFullscreen")) {
+ info(`waitForFullscreenExit, inDOMFullscreen`);
+ await waitForFullScreenObserver(aDocument, false, true);
+ }
+}
diff --git a/dom/base/test/fullscreen/head.js b/dom/base/test/fullscreen/head.js
new file mode 100644
index 0000000000..1e3b435d0c
--- /dev/null
+++ b/dom/base/test/fullscreen/head.js
@@ -0,0 +1,65 @@
+function pushPrefs(...aPrefs) {
+ return SpecialPowers.pushPrefEnv({ set: aPrefs });
+}
+
+function promiseWaitForEvent(
+ object,
+ eventName,
+ capturing = false,
+ chrome = false
+) {
+ return new Promise(resolve => {
+ function listener(event) {
+ info("Saw " + eventName);
+ object.removeEventListener(eventName, listener, capturing, chrome);
+ resolve(event);
+ }
+
+ info("Waiting for " + eventName);
+ object.addEventListener(eventName, listener, capturing, chrome);
+ });
+}
+
+/**
+ * Waits for the next load to complete in any browser or the given browser.
+ * If a is given it waits for a load in any of its browsers.
+ *
+ * @return promise
+ */
+function waitForDocLoadComplete(aBrowser = gBrowser) {
+ return new Promise(resolve => {
+ let listener = {
+ onStateChange(webProgress, req, flags, status) {
+ let docStop =
+ Ci.nsIWebProgressListener.STATE_IS_NETWORK |
+ Ci.nsIWebProgressListener.STATE_STOP;
+ info(
+ "Saw state " +
+ flags.toString(16) +
+ " and status " +
+ status.toString(16)
+ );
+ // When a load needs to be retargetted to a new process it is cancelled
+ // with NS_BINDING_ABORTED so ignore that case
+ if ((flags & docStop) == docStop && status != Cr.NS_BINDING_ABORTED) {
+ aBrowser.removeProgressListener(this);
+ waitForDocLoadComplete.listeners.delete(this);
+ let chan = req.QueryInterface(Ci.nsIChannel);
+ info("Browser loaded " + chan.originalURI.spec);
+ resolve();
+ }
+ },
+ QueryInterface: ChromeUtils.generateQI([
+ "nsIWebProgressListener",
+ "nsISupportsWeakReference",
+ ]),
+ };
+ aBrowser.addProgressListener(listener);
+ waitForDocLoadComplete.listeners.add(listener);
+ info("Waiting for browser load");
+ });
+}
+// Keep a set of progress listeners for waitForDocLoadComplete() to make sure
+// they're not GC'ed before we saw the page load.
+waitForDocLoadComplete.listeners = new Set();
+registerCleanupFunction(() => waitForDocLoadComplete.listeners.clear());
diff --git a/dom/base/test/fullscreen/mochitest.toml b/dom/base/test/fullscreen/mochitest.toml
new file mode 100644
index 0000000000..835efffa97
--- /dev/null
+++ b/dom/base/test/fullscreen/mochitest.toml
@@ -0,0 +1,64 @@
+[DEFAULT]
+tags = "fullscreen"
+support-files = [
+ "file_fullscreen-api-race.html",
+ "file_fullscreen-api.html",
+ "file_fullscreen-async.html",
+ "file_fullscreen-backdrop.html",
+ "file_fullscreen-denied-inner.html",
+ "file_fullscreen-denied.html",
+ "file_fullscreen-esc-exit-inner.html",
+ "file_fullscreen-esc-exit.html",
+ "file_fullscreen-event-order.html",
+ "file_fullscreen-featurePolicy.html",
+ "file_fullscreen-featurePolicy-inner.html",
+ "file_fullscreen-focus.html",
+ "file_fullscreen-focus-inner.html",
+ "file_fullscreen-hidden.html",
+ "file_fullscreen-lenient-setters.html",
+ "file_fullscreen_meta_viewport.html",
+ "file_fullscreen-multiple-inner.html",
+ "file_fullscreen-multiple.html",
+ "file_fullscreen-navigation.html",
+ "file_fullscreen-nested.html",
+ "file_fullscreen-prefixed.html",
+ "file_fullscreen-resize.html",
+ "file_fullscreen-rollback.html",
+ "file_fullscreen-scrollbar.html",
+ "file_fullscreen-selector.html",
+ "file_fullscreen-shadowdom.html",
+ "file_fullscreen-single.html",
+ "file_fullscreen-sub-iframe.html",
+ "file_fullscreen-svg-element.html",
+ "file_fullscreen-table.html",
+ "file_fullscreen-top-layer.html",
+ "file_fullscreen-utils.js",
+ "file_fullscreen-with-full-zoom.html",
+]
+
+["test_fullscreen-api-race.html"]
+skip-if = [
+ "os == 'android'", # same as test_fullscreen-api.html, 1356570
+ "os == 'mac' && debug",
+]
+
+["test_fullscreen-api-rapid-cycle.html"]
+
+["test_fullscreen-api.html"]
+allow_xul_xbl = true # XUL is used in file_fullscreen-api.html
+skip-if = [
+ "os == 'android'",
+ "os == 'mac'", # Bug 1579623, 1776996
+ "display == 'wayland' && os_version == '22.04'", # Bug 1857240
+ "http3",
+ "http2",
+]
+
+["test_fullscreen_meta_viewport.html"]
+
+["test_fullscreen_modal.html"]
+skip-if = [
+ "display == 'wayland' && os_version == '22.04'", # Bug 1857240
+ "http3",
+ "http2",
+]
diff --git a/dom/base/test/fullscreen/moz.build b/dom/base/test/fullscreen/moz.build
new file mode 100644
index 0000000000..3ac1d85dff
--- /dev/null
+++ b/dom/base/test/fullscreen/moz.build
@@ -0,0 +1,17 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+MOCHITEST_MANIFESTS += [
+ "mochitest.toml",
+]
+
+MOCHITEST_CHROME_MANIFESTS += [
+ "chrome.toml",
+]
+
+BROWSER_CHROME_MANIFESTS += [
+ "browser.toml",
+]
diff --git a/dom/base/test/fullscreen/test_MozDomFullscreen_event.xhtml b/dom/base/test/fullscreen/test_MozDomFullscreen_event.xhtml
new file mode 100644
index 0000000000..3041d851ac
--- /dev/null
+++ b/dom/base/test/fullscreen/test_MozDomFullscreen_event.xhtml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/test_fullscreen-api-race.html b/dom/base/test/fullscreen/test_fullscreen-api-race.html
new file mode 100644
index 0000000000..3fe4cd3500
--- /dev/null
+++ b/dom/base/test/fullscreen/test_fullscreen-api-race.html
@@ -0,0 +1,177 @@
+
+
+
+ Test for race conditions of Fullscreen API
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/test_fullscreen-api-rapid-cycle.html b/dom/base/test/fullscreen/test_fullscreen-api-rapid-cycle.html
new file mode 100644
index 0000000000..36e622ad4c
--- /dev/null
+++ b/dom/base/test/fullscreen/test_fullscreen-api-rapid-cycle.html
@@ -0,0 +1,167 @@
+
+
+
+ Test for rapid cycling of Fullscreen API requests
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/test_fullscreen-api.html b/dom/base/test/fullscreen/test_fullscreen-api.html
new file mode 100644
index 0000000000..2a59d6eeb0
--- /dev/null
+++ b/dom/base/test/fullscreen/test_fullscreen-api.html
@@ -0,0 +1,150 @@
+
+
+
+ Test for Bug 545812
+
+
+
+
+
+
+
+Mozilla Bug 545812
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/test_fullscreen.xhtml b/dom/base/test/fullscreen/test_fullscreen.xhtml
new file mode 100644
index 0000000000..e338bac523
--- /dev/null
+++ b/dom/base/test/fullscreen/test_fullscreen.xhtml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/fullscreen/test_fullscreen_meta_viewport.html b/dom/base/test/fullscreen/test_fullscreen_meta_viewport.html
new file mode 100644
index 0000000000..c2cd355c6b
--- /dev/null
+++ b/dom/base/test/fullscreen/test_fullscreen_meta_viewport.html
@@ -0,0 +1,33 @@
+
+Test for Bug 545812
+
+
+
+
diff --git a/dom/base/test/fullscreen/test_fullscreen_modal.html b/dom/base/test/fullscreen/test_fullscreen_modal.html
new file mode 100644
index 0000000000..78e70d9052
--- /dev/null
+++ b/dom/base/test/fullscreen/test_fullscreen_modal.html
@@ -0,0 +1,69 @@
+
+Test for bug 1771150
+
+
+
+
+
+Go fullscreen
+
diff --git a/dom/base/test/green.png b/dom/base/test/green.png
new file mode 100644
index 0000000000..7df25f33bd
Binary files /dev/null and b/dom/base/test/green.png differ
diff --git a/dom/base/test/gtest/TestContentUtils.cpp b/dom/base/test/gtest/TestContentUtils.cpp
new file mode 100644
index 0000000000..2a2d2b4600
--- /dev/null
+++ b/dom/base/test/gtest/TestContentUtils.cpp
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+
+#include "jsapi.h"
+#include "js/PropertyAndElement.h" // JS_DefineProperty
+#include "nsContentUtils.h"
+#include "nsNetUtil.h"
+#include "mozilla/CycleCollectedJSContext.h"
+#include "mozilla/dom/ScriptSettings.h"
+#include "mozilla/dom/SimpleGlobalObject.h"
+
+using namespace mozilla::dom;
+
+struct IsURIInListMatch {
+ nsLiteralCString pattern;
+ bool firstMatch, secondMatch;
+};
+
+std::ostream& operator<<(std::ostream& aStream,
+ const nsContentUtils::ParsedRange& aParsedRange) {
+ if (aParsedRange.Start()) {
+ aStream << *aParsedRange.Start();
+ }
+
+ aStream << "-";
+
+ if (aParsedRange.End()) {
+ aStream << *aParsedRange.End();
+ }
+
+ return aStream;
+}
+
+TEST(DOM_Base_ContentUtils, IsURIInList)
+{
+ nsCOMPtr uri, subURI;
+ nsresult rv = NS_NewURI(getter_AddRefs(uri),
+ "https://example.com/path/favicon.ico#"_ns);
+ ASSERT_TRUE(rv == NS_OK);
+
+ rv = NS_NewURI(getter_AddRefs(subURI),
+ "http://sub.example.com/favicon.ico?"_ns);
+ ASSERT_TRUE(rv == NS_OK);
+
+ static constexpr IsURIInListMatch patterns[] = {
+ {"bar.com,*.example.com,example.com,foo.com"_ns, true, true},
+ {"bar.com,example.com,*.example.com,foo.com"_ns, true, true},
+ {"*.example.com,example.com,foo.com"_ns, true, true},
+ {"example.com,*.example.com,foo.com"_ns, true, true},
+ {"*.example.com,example.com"_ns, true, true},
+ {"example.com,*.example.com"_ns, true, true},
+ {"*.example.com/,example.com/"_ns, true, true},
+ {"example.com/,*.example.com/"_ns, true, true},
+ {"*.example.com/pa,example.com/pa"_ns, false, false},
+ {"example.com/pa,*.example.com/pa"_ns, false, false},
+ {"*.example.com/pa/,example.com/pa/"_ns, false, false},
+ {"example.com/pa/,*.example.com/pa/"_ns, false, false},
+ {"*.example.com/path,example.com/path"_ns, false, false},
+ {"example.com/path,*.example.com/path"_ns, false, false},
+ {"*.example.com/path/,example.com/path/"_ns, true, false},
+ {"example.com/path/,*.example.com/path/"_ns, true, false},
+ {"*.example.com/favicon.ico"_ns, false, true},
+ {"example.com/path/favicon.ico"_ns, true, false},
+ {"*.example.com"_ns, false, true},
+ {"example.com"_ns, true, false},
+ {"foo.com"_ns, false, false},
+ {"*.foo.com"_ns, false, false},
+ };
+
+ for (auto& entry : patterns) {
+ bool result = nsContentUtils::IsURIInList(uri, entry.pattern);
+ ASSERT_EQ(result, entry.firstMatch) << "Matching " << entry.pattern;
+
+ result = nsContentUtils::IsURIInList(subURI, entry.pattern);
+ ASSERT_EQ(result, entry.secondMatch) << "Matching " << entry.pattern;
+ }
+}
+
+TEST(DOM_Base_ContentUtils,
+ StringifyJSON_EmptyValue_UndefinedIsNullStringLiteral)
+{
+ JS::Rooted globalObject(
+ mozilla::dom::RootingCx(),
+ mozilla::dom::SimpleGlobalObject::Create(
+ mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail));
+ mozilla::dom::AutoJSAPI jsAPI;
+ ASSERT_TRUE(jsAPI.Init(globalObject));
+ JSContext* cx = jsAPI.cx();
+ nsAutoString serializedValue;
+
+ ASSERT_TRUE(nsContentUtils::StringifyJSON(cx, JS::UndefinedHandleValue,
+ serializedValue,
+ UndefinedIsNullStringLiteral));
+ ASSERT_TRUE(serializedValue.EqualsLiteral("null"));
+}
+
+TEST(DOM_Base_ContentUtils, StringifyJSON_Object_UndefinedIsNullStringLiteral)
+{
+ JS::Rooted globalObject(
+ mozilla::dom::RootingCx(),
+ mozilla::dom::SimpleGlobalObject::Create(
+ mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail));
+ mozilla::dom::AutoJSAPI jsAPI;
+ ASSERT_TRUE(jsAPI.Init(globalObject));
+ JSContext* cx = jsAPI.cx();
+ nsAutoString serializedValue;
+
+ JS::Rooted jsObj(cx, JS_NewPlainObject(cx));
+ JS::Rooted valueStr(cx, JS_NewStringCopyZ(cx, "Hello World!"));
+ ASSERT_TRUE(JS_DefineProperty(cx, jsObj, "key1", valueStr, JSPROP_ENUMERATE));
+ JS::Rooted jsValue(cx, JS::ObjectValue(*jsObj));
+
+ ASSERT_TRUE(nsContentUtils::StringifyJSON(cx, jsValue, serializedValue,
+ UndefinedIsNullStringLiteral));
+
+ ASSERT_TRUE(serializedValue.EqualsLiteral("{\"key1\":\"Hello World!\"}"));
+}
+
+TEST(DOM_Base_ContentUtils, StringifyJSON_EmptyValue_UndefinedIsVoidString)
+{
+ JS::Rooted globalObject(
+ mozilla::dom::RootingCx(),
+ mozilla::dom::SimpleGlobalObject::Create(
+ mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail));
+ mozilla::dom::AutoJSAPI jsAPI;
+ ASSERT_TRUE(jsAPI.Init(globalObject));
+ JSContext* cx = jsAPI.cx();
+ nsAutoString serializedValue;
+
+ ASSERT_TRUE(nsContentUtils::StringifyJSON(
+ cx, JS::UndefinedHandleValue, serializedValue, UndefinedIsVoidString));
+
+ ASSERT_TRUE(serializedValue.IsVoid());
+}
+
+TEST(DOM_Base_ContentUtils, StringifyJSON_Object_UndefinedIsVoidString)
+{
+ JS::Rooted globalObject(
+ mozilla::dom::RootingCx(),
+ mozilla::dom::SimpleGlobalObject::Create(
+ mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail));
+ mozilla::dom::AutoJSAPI jsAPI;
+ ASSERT_TRUE(jsAPI.Init(globalObject));
+ JSContext* cx = jsAPI.cx();
+ nsAutoString serializedValue;
+
+ JS::Rooted jsObj(cx, JS_NewPlainObject(cx));
+ JS::Rooted valueStr(cx, JS_NewStringCopyZ(cx, "Hello World!"));
+ ASSERT_TRUE(JS_DefineProperty(cx, jsObj, "key1", valueStr, JSPROP_ENUMERATE));
+ JS::Rooted jsValue(cx, JS::ObjectValue(*jsObj));
+
+ ASSERT_TRUE(nsContentUtils::StringifyJSON(cx, jsValue, serializedValue,
+ UndefinedIsVoidString));
+
+ ASSERT_TRUE(serializedValue.EqualsLiteral("{\"key1\":\"Hello World!\"}"));
+}
+
+TEST(DOM_Base_ContentUtils, ParseSingleRangeHeader)
+{
+ // Parsing a simple range should succeed
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes=0-42"_ns, false),
+ mozilla::Some(nsContentUtils::ParsedRange(mozilla::Some(0),
+ mozilla::Some(42))));
+
+ // Range containing a invalid rangeStart should fail
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes= t-200"_ns, true),
+ mozilla::Nothing());
+
+ // Range containing whitespace, with allowWhitespace=false should fail.
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes= 2-200"_ns, false),
+ mozilla::Nothing());
+
+ // Range containing whitespace, with allowWhitespace=true should succeed
+ EXPECT_EQ(
+ nsContentUtils::ParseSingleRangeRequest("bytes \t= 2 - 200"_ns, true),
+ mozilla::Some(
+ nsContentUtils::ParsedRange(mozilla::Some(2), mozilla::Some(200))));
+
+ // Range containing invalid whitespace should fail
+ EXPECT_EQ(
+ nsContentUtils::ParseSingleRangeRequest("bytes \r= 2 - 200"_ns, true),
+ mozilla::Nothing());
+
+ // Range without a rangeStart should succeed
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes\t=\t-200"_ns, true),
+ mozilla::Some(nsContentUtils::ParsedRange(mozilla::Nothing(),
+ mozilla::Some(200))));
+
+ // Range without a rangeEnd should succeed
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes=55-"_ns, true),
+ mozilla::Some(nsContentUtils::ParsedRange(mozilla::Some(55),
+ mozilla::Nothing())));
+
+ // Range without a rangeStart or rangeEnd should fail
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes\t=\t-"_ns, true),
+ mozilla::Nothing());
+
+ // Range with extra characters should fail
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes=0-42 "_ns, true),
+ mozilla::Nothing());
+
+ // Range with rangeStart > rangeEnd should fail
+ EXPECT_EQ(nsContentUtils::ParseSingleRangeRequest("bytes=42-0 "_ns, true),
+ mozilla::Nothing());
+}
+
+TEST(DOM_Base_ContentUtils, IsAllowedNonCorsRange)
+{
+ EXPECT_EQ(nsContentUtils::IsAllowedNonCorsRange("bytes=-200"_ns), false);
+ EXPECT_EQ(nsContentUtils::IsAllowedNonCorsRange("bytes= 200-"_ns), false);
+ EXPECT_EQ(nsContentUtils::IsAllowedNonCorsRange("bytes=201-200"_ns), false);
+ EXPECT_EQ(nsContentUtils::IsAllowedNonCorsRange("bytes=200-201 "_ns), false);
+ EXPECT_EQ(nsContentUtils::IsAllowedNonCorsRange("bytes=200-"_ns), true);
+ EXPECT_EQ(nsContentUtils::IsAllowedNonCorsRange("bytes=200-201"_ns), true);
+ EXPECT_EQ(nsContentUtils::IsAllowedNonCorsRange("bytes=-200 "_ns), false);
+}
diff --git a/dom/base/test/gtest/TestMimeType.cpp b/dom/base/test/gtest/TestMimeType.cpp
new file mode 100644
index 0000000000..fecb3f8678
--- /dev/null
+++ b/dom/base/test/gtest/TestMimeType.cpp
@@ -0,0 +1,1078 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+
+#include "MimeType.h"
+#include "nsString.h"
+
+using mozilla::UniquePtr;
+
+TEST(MimeType, EmptyString)
+{
+ const auto in = u""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Empty string";
+}
+
+TEST(MimeType, JustWhitespace)
+{
+ const auto in = u" \t\r\n "_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Just whitespace";
+}
+
+TEST(MimeType, JustBackslash)
+{
+ const auto in = u"\\"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Just backslash";
+}
+
+TEST(MimeType, JustForwardslash)
+{
+ const auto in = u"/"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Just forward slash";
+}
+
+TEST(MimeType, MissingType1)
+{
+ const auto in = u"/bogus"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Missing type #1";
+}
+
+TEST(MimeType, MissingType2)
+{
+ const auto in = u" \r\n\t/bogus"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Missing type #2";
+}
+
+TEST(MimeType, MissingSubtype1)
+{
+ const auto in = u"bogus"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Missing subtype #1";
+}
+
+TEST(MimeType, MissingSubType2)
+{
+ const auto in = u"bogus/"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Missing subtype #2";
+}
+
+TEST(MimeType, MissingSubType3)
+{
+ const auto in = u"bogus;"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Missing subtype #3";
+}
+
+TEST(MimeType, MissingSubType4)
+{
+ const auto in = u"bogus; \r\n\t"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Missing subtype #3";
+}
+
+TEST(MimeType, ExtraForwardSlash)
+{
+ const auto in = u"bogus/bogus/;"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Extra forward slash";
+}
+
+TEST(MimeType, WhitespaceInType)
+{
+ const auto in = u"t\re\nx\tt /html"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Type with whitespace";
+}
+
+TEST(MimeType, WhitespaceInSubtype)
+{
+ const auto in = u"text/ h\rt\nm\tl"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Subtype with whitespace";
+}
+
+TEST(MimeType, NonAlphanumericMediaType1)
+{
+ const auto in = u">"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-alphanumeric media type #1";
+}
+
+TEST(MimeType, NonAlphanumericMediaType2)
+{
+ const auto in = u"(/)"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-alphanumeric media type #2";
+}
+
+TEST(MimeType, NonAlphanumericMediaType3)
+{
+ const auto in = u"{/}"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-alphanumeric media type #3";
+}
+
+TEST(MimeType, NonAlphanumericMediaType4)
+{
+ const auto in = u"\"/\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-alphanumeric media type #4";
+}
+
+TEST(MimeType, NonAlphanumericMediaType5)
+{
+ const auto in = u"\0/\0"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-alphanumeric media type #5";
+}
+
+TEST(MimeType, NonAlphanumericMediaType6)
+{
+ const auto in = u"text/html(;doesnot=matter"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-alphanumeric media type #6";
+}
+
+TEST(MimeType, NonLatin1MediaType1)
+{
+ const auto in = u"ÿ/ÿ"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-latin1 media type #1";
+}
+
+TEST(MimeType, NonLatin1MediaType2)
+{
+ const auto in = u"\x0100/\x0100"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_FALSE(parsed)
+ << "Non-latin1 media type #2";
+}
+
+TEST(MimeType, MultipleParameters)
+{
+ const auto in = u"text/html;charset=gbk;no=1;charset_=gbk_;yes=2"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals(u"text/html;charset=gbk;no=1;charset_=gbk_;yes=2"_ns))
+ << "Multiple parameters";
+}
+
+TEST(MimeType, DuplicateParameter1)
+{
+ const auto in = u"text/html;charset=gbk;charset=windows-1255"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals(u"text/html;charset=gbk"_ns))
+ << "Duplicate parameter #1";
+}
+
+TEST(MimeType, DuplicateParameter2)
+{
+ const auto in = u"text/html;charset=();charset=GBK"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals(u"text/html;charset=\"()\""_ns))
+ << "Duplicate parameter #2";
+}
+
+TEST(MimeType, CString)
+{
+ const auto in = "text/html;charset=();charset=GBK"_ns;
+ UniquePtr parsed = CMimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsCString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals("text/html;charset=\"()\""_ns))
+ << "Duplicate parameter #2";
+}
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable : 4819)
+#endif
+TEST(MimeType, NonAlphanumericParametersAreQuoted)
+{
+ const auto in = u"text/html;test=\x00FF\\;charset=gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals(u"text/html;test=\"\x00FF\\\\\";charset=gbk"_ns))
+ << "Non-alphanumeric parameters are quoted";
+}
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace1)
+{
+ const auto in = u"text/html;charset= g\\\"bk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" g\\\\\\\"bk\""))
+ << "Parameter is quoted if has leading whitespace #1";
+}
+
+TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace2)
+{
+ const auto in = u"text/html;charset= \"g\\bk\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" \\\"g\\\\bk\\\"\""))
+ << "Parameter is quoted if has leading whitespace #2";
+}
+
+TEST(MimeType, ParameterQuotedIfHasInternalWhitespace)
+{
+ const auto in = u"text/html;charset=g \\b\"k"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"g \\\\b\\\"k\""))
+ << "Parameter is quoted if has internal whitespace";
+}
+
+TEST(MimeType, ImproperlyQuotedParameter1)
+{
+ const auto in = u"x/x;test=\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("x/x;test=\"\""))
+ << "Improperly-quoted parameter is handled properly #1";
+}
+
+TEST(MimeType, ImproperlyQuotedParameter2)
+{
+ const auto in = u"x/x;test=\"\\"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("x/x;test=\"\\\\\""))
+ << "Improperly-quoted parameter is handled properly #2";
+}
+
+TEST(MimeType, NonLatin1ParameterIgnored)
+{
+ const auto in = u"x/x;test=\xFFFD;x=x"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("x/x;x=x"))
+ << "Non latin-1 parameters are ignored";
+}
+
+TEST(MimeType, ParameterIgnoredIfWhitespaceInName1)
+{
+ const auto in = u"text/html;charset =gbk;charset=123"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=123"))
+ << "Parameter ignored if whitespace in name #1";
+}
+
+TEST(MimeType, ParameterIgnoredIfWhitespaceInName2)
+{
+ const auto in = u"text/html;cha rset =gbk;charset=123"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=123"))
+ << "Parameter ignored if whitespace in name #2";
+}
+
+TEST(MimeType, WhitespaceTrimmed)
+{
+ const auto in = u"\n\r\t text/plain\n\r\t ;\n\r\t charset=123\n\r\t "_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/plain;charset=123"))
+ << "Whitespace appropriately ignored";
+}
+
+TEST(MimeType, WhitespaceOnlyParameterIgnored)
+{
+ const auto in = u"x/x;x= \r\n\t"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("x/x"))
+ << "Whitespace-only parameter is ignored";
+}
+
+TEST(MimeType, IncompleteParameterIgnored1)
+{
+ const auto in = u"x/x;test"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("x/x"))
+ << "Incomplete parameter is ignored #1";
+}
+
+TEST(MimeType, IncompleteParameterIgnored2)
+{
+ const auto in = u"x/x;test="_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("x/x"))
+ << "Incomplete parameter is ignored #2";
+}
+
+TEST(MimeType, IncompleteParameterIgnored3)
+{
+ const auto in = u"x/x;test= \r\n\t"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("x/x"))
+ << "Incomplete parameter is ignored #3";
+}
+
+TEST(MimeType, IncompleteParameterIgnored4)
+{
+ const auto in = u"text/html;test;charset=gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Incomplete parameter is ignored #4";
+}
+
+TEST(MimeType, IncompleteParameterIgnored5)
+{
+ const auto in = u"text/html;test=;charset=gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Incomplete parameter is ignored #5";
+}
+
+TEST(MimeType, EmptyParameterIgnored1)
+{
+ const auto in = u"text/html ; ; charset=gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Empty parameter ignored #1";
+}
+
+TEST(MimeType, EmptyParameterIgnored2)
+{
+ const auto in = u"text/html;;;;charset=gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Empty parameter ignored #2";
+}
+
+TEST(MimeType, InvalidParameterIgnored1)
+{
+ const auto in = u"text/html;';charset=gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Invalid parameter ignored #1";
+}
+
+TEST(MimeType, InvalidParameterIgnored2)
+{
+ const auto in = u"text/html;\";charset=gbk;=123; =321"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Invalid parameter ignored #2";
+}
+
+TEST(MimeType, InvalidParameterIgnored3)
+{
+ const auto in = u"text/html;charset= \"\u007F;charset=GBK"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=GBK"))
+ << "Invalid parameter ignored #3";
+}
+
+TEST(MimeType, InvalidParameterIgnored4)
+{
+ const auto in = nsLiteralString(
+ u"text/html;charset=\"\u007F;charset=foo\";charset=GBK;charset=");
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=GBK"))
+ << "Invalid parameter ignored #4";
+}
+
+TEST(MimeType, SingleQuotes1)
+{
+ const auto in = u"text/html;charset='gbk'"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset='gbk'"))
+ << "Single quotes handled properly #1";
+}
+
+TEST(MimeType, SingleQuotes2)
+{
+ const auto in = u"text/html;charset='gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset='gbk"))
+ << "Single quotes handled properly #2";
+}
+
+TEST(MimeType, SingleQuotes3)
+{
+ const auto in = u"text/html;charset=gbk'"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk'"))
+ << "Single quotes handled properly #3";
+}
+
+TEST(MimeType, SingleQuotes4)
+{
+ const auto in = u"text/html;charset=';charset=GBK"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset='"))
+ << "Single quotes handled properly #4";
+}
+
+TEST(MimeType, SingleQuotes5)
+{
+ const auto in = u"text/html;charset=''';charset=GBK"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset='''"))
+ << "Single quotes handled properly #5";
+}
+
+TEST(MimeType, DoubleQuotes1)
+{
+ const auto in = u"text/html;charset=\"gbk\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Double quotes handled properly #1";
+}
+
+TEST(MimeType, DoubleQuotes2)
+{
+ const auto in = u"text/html;charset=\"gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Double quotes handled properly #2";
+}
+
+TEST(MimeType, DoubleQuotes3)
+{
+ const auto in = u"text/html;charset=gbk\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk\\\"\""))
+ << "Double quotes handled properly #3";
+}
+
+TEST(MimeType, DoubleQuotes4)
+{
+ const auto in = u"text/html;charset=\" gbk\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" gbk\""))
+ << "Double quotes handled properly #4";
+}
+
+TEST(MimeType, DoubleQuotes5)
+{
+ const auto in = u"text/html;charset=\"gbk \""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk \""))
+ << "Double quotes handled properly #5";
+}
+
+TEST(MimeType, DoubleQuotes6)
+{
+ const auto in = u"text/html;charset=\"\\ gbk\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" gbk\""))
+ << "Double quotes handled properly #6";
+}
+
+TEST(MimeType, DoubleQuotes7)
+{
+ const auto in = u"text/html;charset=\"\\g\\b\\k\""_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Double quotes handled properly #7";
+}
+
+TEST(MimeType, DoubleQuotes8)
+{
+ const auto in = u"text/html;charset=\"gbk\"x"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
+ << "Double quotes handled properly #8";
+}
+
+TEST(MimeType, DoubleQuotes9)
+{
+ const auto in = u"text/html;charset=\"\";charset=GBK"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"\""))
+ << "Double quotes handled properly #9";
+}
+
+TEST(MimeType, DoubleQuotes10)
+{
+ const auto in = u"text/html;charset=\";charset=GBK"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\";charset=GBK\""))
+ << "Double quotes handled properly #10";
+}
+
+TEST(MimeType, UnexpectedCodePoints)
+{
+ const auto in = u"text/html;charset={gbk}"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"{gbk}\""))
+ << "Unexpected code points handled properly";
+}
+
+TEST(MimeType, LongTypesSubtypesAccepted)
+{
+ const auto in = nsLiteralString(
+ u"01234567890123456789012345678901234567890123456789012345678901234567890"
+ u"1"
+ "2345678901234567890123456789012345678901234567890123456789/"
+ "012345678901234567890123456789012345678901234567890123456789012345678901"
+ "2345678901234567890123456789012345678901234567890123456789");
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals(in))
+ << "Long type/subtype accepted";
+}
+
+TEST(MimeType, LongParametersAccepted)
+{
+ const auto in = nsLiteralString(
+ u"text/"
+ "html;"
+ "012345678901234567890123456789012345678901234567890123456789012345678901"
+ "2345678901234567890123456789012345678901234567890123456789=x;charset="
+ "gbk");
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals(in))
+ << "Long parameters accepted";
+}
+
+TEST(MimeType, AllValidCharactersAccepted1)
+{
+ const auto in = nsLiteralString(
+ u"x/x;x=\"\t "
+ u"!\\\"#$%&'()*+,-./"
+ u"0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`"
+ u"abcdefghijklmnopqrstuvwxyz{|}~"
+ u"\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A"
+ u"\u008B\u008C\u008D\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095"
+ u"\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F\u00A0"
+ u"\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB"
+ u"\u00AC\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6"
+ u"\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1"
+ u"\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC"
+ u"\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7"
+ u"\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2"
+ u"\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED"
+ u"\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8"
+ u"\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF\"");
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.Equals(in))
+ << "All valid characters accepted #1";
+}
+
+TEST(MimeType, CaseNormalization1)
+{
+ const auto in = u"TEXT/PLAIN;CHARSET=TEST"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/plain;charset=TEST"))
+ << "Case normalized properly #1";
+}
+
+TEST(MimeType, CaseNormalization2)
+{
+ const auto in = nsLiteralString(
+ u"!#$%&'*+-.^_`|~"
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/"
+ "!#$%&'*+-.^_`|~"
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;!#$%&'*+-"
+ ".^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=!#$"
+ "%&'*+-.^_`|~"
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral(
+ "!#$%&'*+-.^_`|~"
+ "0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/"
+ "!#$%&'*+-.^_`|~"
+ "0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz;!#$%&'*+-"
+ ".^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$"
+ "%&'*+-.^_`|~"
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"))
+ << "Case normalized properly #2";
+}
+
+TEST(MimeType, LegacyCommentSyntax1)
+{
+ const auto in = u"text/html;charset=gbk("_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk(\""))
+ << "Legacy comment syntax #1";
+}
+
+TEST(MimeType, LegacyCommentSyntax2)
+{
+ const auto in = u"text/html;x=(;charset=gbk"_ns;
+ UniquePtr parsed = MimeType::Parse(in);
+ ASSERT_TRUE(parsed)
+ << "Parsing succeeded";
+ nsAutoString out;
+ parsed->Serialize(out);
+ ASSERT_TRUE(out.EqualsLiteral("text/html;x=\"(\";charset=gbk"))
+ << "Legacy comment syntax #2";
+}
+
+TEST(MimeTypeParsing, contentTypes1)
+{
+ const nsAutoCString val(",text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_FALSE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral(""));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes2)
+{
+ const nsAutoCString val("text/plain,");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes3)
+{
+ const nsAutoCString val("text/html,text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes4)
+{
+ const nsAutoCString val("text/plain;charset=gbk,text/html");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes5)
+{
+ const nsAutoCString val(
+ "text/plain;charset=gbk,text/html;charset=windows-1254");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral("windows-1254"));
+}
+
+TEST(MimeTypeParsing, contentTypes6)
+{
+ const nsAutoCString val("text/plain;charset=gbk,text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral("gbk"));
+}
+
+TEST(MimeTypeParsing, contentTypes7)
+{
+ const nsAutoCString val(
+ "text/plain;charset=gbk,text/plain;charset=windows-1252");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral("windows-1252"));
+}
+
+TEST(MimeTypeParsing, contentTypes8)
+{
+ const nsAutoCString val("text/html;charset=gbk,text/html;x=\",text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral("gbk"));
+}
+
+TEST(MimeTypeParsing, contentTypes9)
+{
+ const nsAutoCString val("text/plain;charset=gbk;x=foo,text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral("gbk"));
+}
+
+TEST(MimeTypeParsing, contentTypes10)
+{
+ const nsAutoCString val("text/html;charset=gbk,text/plain,text/html");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes11)
+{
+ const nsAutoCString val("text/plain,*/*");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes12)
+{
+ const nsAutoCString val("text/html,*/*");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes13)
+{
+ const nsAutoCString val("*/*,text/html");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes14)
+{
+ const nsAutoCString val("text/plain,*/*;charset=gbk");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes15)
+{
+ const nsAutoCString val("text/html,*/*;charset=gbk");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes16)
+{
+ const nsAutoCString val("text/html;x=\",text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes17)
+{
+ const nsAutoCString val("text/html;\",text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes18)
+{
+ const nsAutoCString val("text/html;\",\\\",text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
+
+TEST(MimeTypeParsing, contentTypes19)
+{
+ const nsAutoCString val("text/html;\",\\\",text/plain,\";charset=GBK");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/html"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral("GBK"));
+}
+
+TEST(MimeTypeParsing, contentTypes20)
+{
+ const nsAutoCString val("text/html;\",\",text/plain");
+ nsCString contentType;
+ nsCString contentCharset;
+
+ bool parsed = CMimeType::Parse(val, contentType, contentCharset);
+
+ ASSERT_TRUE(parsed);
+ ASSERT_TRUE(contentType.EqualsLiteral("text/plain"));
+ ASSERT_TRUE(contentCharset.EqualsLiteral(""));
+}
diff --git a/dom/base/test/gtest/TestParser.cpp b/dom/base/test/gtest/TestParser.cpp
new file mode 100644
index 0000000000..d9240cced7
--- /dev/null
+++ b/dom/base/test/gtest/TestParser.cpp
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "nsCOMPtr.h"
+#include "nsString.h"
+#include "mozilla/dom/DOMParser.h"
+#include "mozilla/dom/Document.h"
+#include "nsIDocumentEncoder.h"
+#include "mozilla/ErrorResult.h"
+
+// This is a test for mozilla::dom::DOMParser::CreateWithoutGlobal() which was
+// implemented for use in Thunderbird's MailNews module.
+
+// int main(int argc, char** argv)
+TEST(TestParser, TestParserMain)
+{
+ bool allTestsPassed = false;
+ constexpr auto htmlInput =
+ u""
+ " "
+ "Hello Thunderbird! "_ns;
+
+ do {
+ // Parse the HTML source.
+ mozilla::IgnoredErrorResult rv2;
+ RefPtr parser =
+ mozilla::dom::DOMParser::CreateWithoutGlobal(rv2);
+ if (rv2.Failed()) break;
+ nsCOMPtr document = parser->ParseFromString(
+ htmlInput, mozilla::dom::SupportedType::Text_html, rv2);
+ if (rv2.Failed()) break;
+
+ // Serialize it back to HTML source again.
+ nsCOMPtr encoder =
+ do_createDocumentEncoder("text/html");
+ if (!encoder) break;
+ nsresult rv =
+ encoder->Init(document, u"text/html"_ns, nsIDocumentEncoder::OutputRaw);
+ if (NS_FAILED(rv)) break;
+ nsString parsed;
+ rv = encoder->EncodeToString(parsed);
+ if (NS_FAILED(rv)) break;
+
+ EXPECT_TRUE(parsed.Equals(htmlInput));
+ allTestsPassed = true;
+ } while (false);
+
+ EXPECT_TRUE(allTestsPassed);
+}
diff --git a/dom/base/test/gtest/TestPlainTextSerializer.cpp b/dom/base/test/gtest/TestPlainTextSerializer.cpp
new file mode 100644
index 0000000000..52ef864aa9
--- /dev/null
+++ b/dom/base/test/gtest/TestPlainTextSerializer.cpp
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+
+#include "nsServiceManagerUtils.h"
+#include "nsString.h"
+#include "nsIDocumentEncoder.h"
+#include "nsCRT.h"
+#include "nsIParserUtils.h"
+
+const uint32_t kDefaultWrapColumn = 72;
+
+void ConvertBufToPlainText(nsString& aConBuf, int aFlag, uint32_t aWrapColumn) {
+ nsCOMPtr utils = do_GetService(NS_PARSERUTILS_CONTRACTID);
+ utils->ConvertToPlainText(aConBuf, aFlag, aWrapColumn, aConBuf);
+}
+
+// Test for ASCII with format=flowed; delsp=yes
+TEST(PlainTextSerializer, ASCIIWithFlowedDelSp)
+{
+ nsString test;
+ nsString result;
+
+ test.AssignLiteral(
+ ""
+ "Firefox Firefox Firefox Firefox "
+ "Firefox Firefox Firefox Firefox "
+ "Firefox Firefox Firefox Firefox"
+ "");
+
+ ConvertBufToPlainText(test,
+ nsIDocumentEncoder::OutputFormatted |
+ nsIDocumentEncoder::OutputCRLineBreak |
+ nsIDocumentEncoder::OutputLFLineBreak |
+ nsIDocumentEncoder::OutputFormatFlowed |
+ nsIDocumentEncoder::OutputFormatDelSp,
+ kDefaultWrapColumn);
+
+ // create result case
+ result.AssignLiteral(
+ "Firefox Firefox Firefox Firefox "
+ "Firefox Firefox Firefox Firefox "
+ "Firefox \r\nFirefox Firefox Firefox\r\n");
+
+ ASSERT_TRUE(test.Equals(result))
+ << "Wrong HTML to ASCII text serialization with format=flowed; delsp=yes";
+}
+
+TEST(PlainTextSerializer, Bug1864820)
+{
+ nsString test(
+ uR"#(
+
+> label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&view=interop&q=label%3Ainterop-2023-property
+
+> label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&view=interop&q=label%3Ainterop-2023-property
+
+
+)#");
+
+ ConvertBufToPlainText(test,
+ nsIDocumentEncoder::OutputFormatted |
+ nsIDocumentEncoder::OutputPersistNBSP |
+ nsIDocumentEncoder::OutputLFLineBreak |
+ nsIDocumentEncoder::OutputFormatFlowed,
+ kDefaultWrapColumn);
+
+ nsString result(
+ uR"#(
+ >Â Â label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&view=interop&q=label%3Ainterop-2023-property
+
+ >Â Â label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned&view=interop&q=label%3Ainterop-2023-property
+)#");
+ result.Trim(" \n");
+ test.Trim(" \n");
+ ASSERT_TRUE(test.Equals(result))
+ << "Shouldn't hang with format=flowed: " << NS_ConvertUTF16toUTF8(test).get();
+}
+
+// Test for CJK with format=flowed; delsp=yes
+TEST(PlainTextSerializer, CJKWithFlowedDelSp)
+{
+ nsString test;
+ nsString result;
+
+ test.AssignLiteral("");
+ for (uint32_t i = 0; i < 40; i++) {
+ // Insert Kanji (U+5341)
+ test.Append(0x5341);
+ }
+ test.AppendLiteral("");
+
+ ConvertBufToPlainText(test,
+ nsIDocumentEncoder::OutputFormatted |
+ nsIDocumentEncoder::OutputCRLineBreak |
+ nsIDocumentEncoder::OutputLFLineBreak |
+ nsIDocumentEncoder::OutputFormatFlowed |
+ nsIDocumentEncoder::OutputFormatDelSp,
+ kDefaultWrapColumn);
+
+ // create result case
+ for (uint32_t i = 0; i < 36; i++) {
+ result.Append(0x5341);
+ }
+ result.AppendLiteral(" \r\n");
+ for (uint32_t i = 0; i < 4; i++) {
+ result.Append(0x5341);
+ }
+ result.AppendLiteral("\r\n");
+
+ ASSERT_TRUE(test.Equals(result))
+ << "Wrong HTML to CJK text serialization with format=flowed; delsp=yes";
+}
+
+// Test for CJK with DisallowLineBreaking
+TEST(PlainTextSerializer, CJKWithDisallowLineBreaking)
+{
+ nsString test;
+ nsString result;
+
+ test.AssignLiteral("");
+ for (uint32_t i = 0; i < 400; i++) {
+ // Insert Kanji (U+5341)
+ test.Append(0x5341);
+ }
+ test.AppendLiteral("");
+
+ ConvertBufToPlainText(test,
+ nsIDocumentEncoder::OutputFormatted |
+ nsIDocumentEncoder::OutputCRLineBreak |
+ nsIDocumentEncoder::OutputLFLineBreak |
+ nsIDocumentEncoder::OutputFormatFlowed |
+ nsIDocumentEncoder::OutputDisallowLineBreaking,
+ kDefaultWrapColumn);
+
+ // create result case
+ for (uint32_t i = 0; i < 400; i++) {
+ result.Append(0x5341);
+ }
+ result.AppendLiteral("\r\n");
+
+ ASSERT_TRUE(test.Equals(result))
+ << "Wrong HTML to CJK text serialization with OutputDisallowLineBreaking";
+}
+
+// Test for Latin with DisallowLineBreaking
+TEST(PlainTextSerializer, LatinWithDisallowLineBreaking)
+{
+ nsString test;
+ test.AssignLiteral("");
+ for (uint32_t i = 0; i < 400; i++) {
+ // Insert á (Latin Small Letter a with Acute) (U+00E1)
+ test.Append(0x00E1);
+ }
+ test.AppendLiteral("\r\n");
+
+ ConvertBufToPlainText(test,
+ nsIDocumentEncoder::OutputFormatted |
+ nsIDocumentEncoder::OutputCRLineBreak |
+ nsIDocumentEncoder::OutputLFLineBreak |
+ nsIDocumentEncoder::OutputFormatFlowed |
+ nsIDocumentEncoder::OutputDisallowLineBreaking,
+ kDefaultWrapColumn);
+
+ // Create expect case.
+ nsString expect;
+ for (uint32_t i = 0; i < 400; i++) {
+ expect.Append(0x00E1);
+ }
+ expect.AppendLiteral(" \r\n\r\n");
+
+ ASSERT_TRUE(test.Equals(expect))
+ << "Wrong HTML to Latin text serialization with OutputDisallowLineBreaking";
+}
+
+// Test for ASCII with format=flowed; and quoted lines in preformatted span.
+TEST(PlainTextSerializer, PreformatFlowedQuotes)
+{
+ nsString test;
+ nsString result;
+
+ test.AssignLiteral(
+ ""
+ ""
+ "> Firefox Firefox Firefox Firefox "
+ "> Firefox Firefox Firefox Firefox "
+ "> "
+ ">> Firefox Firefox Firefox Firefox "
+ ">> Firefox Firefox Firefox Firefox "
+ " ");
+
+ ConvertBufToPlainText(test,
+ nsIDocumentEncoder::OutputFormatted |
+ nsIDocumentEncoder::OutputCRLineBreak |
+ nsIDocumentEncoder::OutputLFLineBreak |
+ nsIDocumentEncoder::OutputFormatFlowed,
+ kDefaultWrapColumn);
+
+ // create result case
+ result.AssignLiteral(
+ "> Firefox Firefox Firefox Firefox \r\n"
+ "> Firefox Firefox Firefox Firefox\r\n"
+ ">\r\n"
+ ">> Firefox Firefox Firefox Firefox \r\n"
+ ">> Firefox Firefox Firefox Firefox\r\n");
+
+ ASSERT_TRUE(test.Equals(result))
+ << "Wrong HTML to ASCII text serialization "
+ "with format=flowed; and quoted "
+ "lines";
+}
+
+TEST(PlainTextSerializer, PrettyPrintedHtml)
+{
+ nsString test;
+ test.AppendLiteral("" NS_LINEBREAK "" NS_LINEBREAK
+ " first " NS_LINEBREAK " second " NS_LINEBREAK
+ "" NS_LINEBREAK "");
+
+ ConvertBufToPlainText(test, 0, kDefaultWrapColumn);
+ ASSERT_TRUE(test.EqualsLiteral("first" NS_LINEBREAK "second" NS_LINEBREAK))
+ << "Wrong prettyprinted html to text serialization";
+}
+
+TEST(PlainTextSerializer, PreElement)
+{
+ nsString test;
+ test.AppendLiteral("" NS_LINEBREAK "" NS_LINEBREAK
+ "" NS_LINEBREAK " first" NS_LINEBREAK
+ " second" NS_LINEBREAK " " NS_LINEBREAK
+ "" NS_LINEBREAK "");
+
+ ConvertBufToPlainText(test, 0, kDefaultWrapColumn);
+ ASSERT_TRUE(test.EqualsLiteral(" first" NS_LINEBREAK
+ " second" NS_LINEBREAK NS_LINEBREAK))
+ << "Wrong prettyprinted html to text serialization";
+}
+
+TEST(PlainTextSerializer, BlockElement)
+{
+ nsString test;
+ test.AppendLiteral("" NS_LINEBREAK "" NS_LINEBREAK
+ "" NS_LINEBREAK " first" NS_LINEBREAK
+ "
" NS_LINEBREAK "" NS_LINEBREAK
+ " second" NS_LINEBREAK "
" NS_LINEBREAK
+ "" NS_LINEBREAK "");
+
+ ConvertBufToPlainText(test, 0, kDefaultWrapColumn);
+ ASSERT_TRUE(test.EqualsLiteral("first" NS_LINEBREAK "second" NS_LINEBREAK))
+ << "Wrong prettyprinted html to text serialization";
+}
+
+TEST(PlainTextSerializer, PreWrapElementForThunderbird)
+{
+ // This test examines the magic pre-wrap setup that Thunderbird relies on.
+ nsString test;
+ test.AppendLiteral("" NS_LINEBREAK
+ "" NS_LINEBREAK
+ "" NS_LINEBREAK
+ " first line is too long" NS_LINEBREAK
+ " second line is even loooonger " NS_LINEBREAK
+ " " NS_LINEBREAK "" NS_LINEBREAK "");
+
+ const uint32_t wrapColumn = 10;
+ ConvertBufToPlainText(test, nsIDocumentEncoder::OutputWrap, wrapColumn);
+ // "\n\n first\nline is\ntoo long\n second\nline is\neven\nloooonger\n\n\n"
+ ASSERT_TRUE(test.EqualsLiteral(
+ NS_LINEBREAK NS_LINEBREAK
+ " first" NS_LINEBREAK "line is" NS_LINEBREAK "too long" NS_LINEBREAK
+ " second" NS_LINEBREAK "line is" NS_LINEBREAK "even" NS_LINEBREAK
+ "loooonger" NS_LINEBREAK NS_LINEBREAK NS_LINEBREAK))
+ << "Wrong prettyprinted html to text serialization";
+}
+
+TEST(PlainTextSerializer, Simple)
+{
+ nsString test;
+ test.AppendLiteral(
+ " basespan "
+ "body");
+ ConvertBufToPlainText(test, 0, kDefaultWrapColumn);
+ ASSERT_TRUE(test.EqualsLiteral("basespanbody"))
+ << "Wrong html to text serialization";
+}
+
+TEST(PlainTextSerializer, OneHundredAndOneOL)
+{
+ nsAutoString test;
+ test.AppendLiteral(
+ ""
+ ""
+ "<"
+ "ol><"
+ "ol><"
+ "ol><"
+ "ol><"
+ "ol> "
+ "ol> "
+ "ol> "
+ "ol> "
+ "ol> "
+ "ol> "
+ "ol> "
+ "ol> "
+ "ol>X "
+ ""
+ "");
+
+ ConvertBufToPlainText(test, nsIDocumentEncoder::OutputFormatted,
+ kDefaultWrapColumn);
+
+ nsAutoString expected;
+ expected.AppendLiteral(" 1. X" NS_LINEBREAK);
+ ASSERT_EQ(test, expected);
+}
+
+TEST(PlainTextSerializer, BlockQuoteCite)
+{
+ nsAutoString test;
+ test.AppendLiteral(u"hello world ");
+
+ const uint32_t wrapColumn = 10;
+ ConvertBufToPlainText(test,
+ nsIDocumentEncoder::OutputFormatted |
+ nsIDocumentEncoder::OutputFormatFlowed |
+ nsIDocumentEncoder::OutputCRLineBreak |
+ nsIDocumentEncoder::OutputLFLineBreak,
+ wrapColumn);
+
+ constexpr auto expect = NS_LITERAL_STRING_FROM_CSTRING(
+ "> hello \r\n"
+ "> world\r\n");
+
+ ASSERT_TRUE(test.Equals(expect))
+ << "Wrong blockquote cite to text serialization";
+}
diff --git a/dom/base/test/gtest/TestScheduler.cpp b/dom/base/test/gtest/TestScheduler.cpp
new file mode 100644
index 0000000000..5d04926627
--- /dev/null
+++ b/dom/base/test/gtest/TestScheduler.cpp
@@ -0,0 +1,348 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "mozilla/dom/CCGCScheduler.h"
+#include "mozilla/TimeStamp.h"
+
+// This is a test for mozilla::CCGCScheduler.
+
+using namespace mozilla;
+
+static TimeDuration kOneSecond = TimeDuration::FromSeconds(1);
+static TimeDuration kTenthSecond = TimeDuration::FromSeconds(0.1);
+static TimeDuration kFrameDuration = TimeDuration::FromSeconds(1.0 / 60.0);
+
+static mozilla::TimeStamp sNow = TimeStamp::Now();
+
+static mozilla::TimeStamp AdvanceTime(TimeDuration aDuration) {
+ sNow += aDuration;
+ return sNow;
+}
+
+static TimeStamp Now() { return sNow; }
+
+static uint32_t sSuspected = 0;
+
+static uint32_t SuspectedCCObjects() { return sSuspected; }
+static void SetNumSuspected(uint32_t n) { sSuspected = n; }
+static void SuspectMore(uint32_t n) { sSuspected += n; }
+
+using CCRunnerState = mozilla::CCGCScheduler::CCRunnerState;
+
+class TestGC {
+ protected:
+ CCGCScheduler& mScheduler;
+
+ public:
+ explicit TestGC(CCGCScheduler& aScheduler) : mScheduler(aScheduler) {}
+ void Run(int aNumSlices);
+};
+
+void TestGC::Run(int aNumSlices) {
+ // Make the purple buffer nearly empty so it is itself not an adequate reason
+ // for wanting a CC.
+ static_assert(3 < mozilla::kCCPurpleLimit);
+ SetNumSuspected(3);
+
+ // Running the GC should not influence whether a CC is currently seen as
+ // needed. But the first time we run GC, it will be false; later, we will
+ // have run a GC and set it to true.
+ CCReason neededCCAtStartOfGC =
+ mScheduler.IsCCNeeded(Now(), SuspectedCCObjects());
+
+ mScheduler.NoteGCBegin(JS::GCReason::API);
+
+ for (int slice = 0; slice < aNumSlices; slice++) {
+ EXPECT_TRUE(mScheduler.InIncrementalGC());
+ TimeStamp idleDeadline = Now() + kTenthSecond;
+ js::SliceBudget budget =
+ mScheduler.ComputeInterSliceGCBudget(idleDeadline, Now());
+ TimeDuration budgetDuration =
+ TimeDuration::FromMilliseconds(budget.timeBudget());
+ EXPECT_NEAR(budgetDuration.ToSeconds(), 0.1, 1.e-6);
+ // Pretend the GC took exactly the budget.
+ AdvanceTime(budgetDuration);
+
+ EXPECT_EQ(mScheduler.IsCCNeeded(Now(), SuspectedCCObjects()),
+ neededCCAtStartOfGC);
+
+ // Mutator runs for 1 second.
+ AdvanceTime(kOneSecond);
+ }
+
+ mScheduler.NoteGCEnd();
+ mScheduler.SetNeedsFullGC(false);
+}
+
+class TestCC {
+ protected:
+ CCGCScheduler& mScheduler;
+
+ public:
+ explicit TestCC(CCGCScheduler& aScheduler) : mScheduler(aScheduler) {}
+
+ void Run(int aNumSlices) {
+ Prepare();
+ MaybePokeCC();
+ TimerFires(aNumSlices);
+ EndCycleCollectionCallback();
+ KillCCRunner();
+ }
+
+ virtual void Prepare() = 0;
+ virtual void MaybePokeCC();
+ virtual void TimerFires(int aNumSlices);
+ virtual void RunSlices(int aNumSlices);
+ virtual void RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd,
+ int aSliceNum, int aNumSlices) = 0;
+ virtual void ForgetSkippable();
+ virtual void EndCycleCollectionCallback();
+ virtual void KillCCRunner();
+};
+
+void TestCC::MaybePokeCC() {
+ // nsJSContext::MaybePokeCC
+
+ // In all tests so far, we will be running this just after a GC.
+ CCReason reason = mScheduler.ShouldScheduleCC(Now(), SuspectedCCObjects());
+ EXPECT_EQ(reason, CCReason::GC_FINISHED);
+
+ mScheduler.InitCCRunnerStateMachine(CCRunnerState::ReducePurple, reason);
+ EXPECT_TRUE(mScheduler.IsEarlyForgetSkippable());
+}
+
+void TestCC::TimerFires(int aNumSlices) {
+ // Series of CCRunner timer fires.
+ CCRunnerStep step;
+
+ while (true) {
+ SuspectMore(1000);
+ TimeStamp idleDeadline = Now() + kOneSecond;
+ step =
+ mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
+ // Should first see a series of ForgetSkippable actions.
+ if (step.mAction != CCRunnerAction::ForgetSkippable ||
+ step.mParam.mRemoveChildless != KeepChildless) {
+ break;
+ }
+ EXPECT_EQ(step.mYield, Yield);
+ ForgetSkippable();
+ }
+
+ while (step.mYield == Continue) {
+ TimeStamp idleDeadline = Now() + kOneSecond;
+ step =
+ mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
+ }
+ EXPECT_EQ(step.mAction, CCRunnerAction::ForgetSkippable);
+ EXPECT_EQ(step.mParam.mRemoveChildless, RemoveChildless);
+ ForgetSkippable();
+
+ TimeStamp idleDeadline = Now() + kOneSecond;
+ step = mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
+ EXPECT_EQ(step.mAction, CCRunnerAction::CleanupContentUnbinder);
+ step = mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
+ EXPECT_EQ(step.mAction, CCRunnerAction::CleanupDeferred);
+
+ mScheduler.NoteCCBegin(CCReason::API, Now(), 0, sSuspected, 0);
+ RunSlices(aNumSlices);
+}
+
+void TestCC::ForgetSkippable() {
+ uint32_t suspectedBefore = sSuspected;
+ // ...ForgetSkippable would happen here...
+ js::SliceBudget budget =
+ mScheduler.ComputeForgetSkippableBudget(Now(), Now() + kTenthSecond);
+ EXPECT_NEAR(budget.timeBudget(), kTenthSecond.ToMilliseconds(), 1);
+ AdvanceTime(kTenthSecond);
+ mScheduler.NoteForgetSkippableComplete(Now(), suspectedBefore,
+ SuspectedCCObjects());
+}
+
+void TestCC::RunSlices(int aNumSlices) {
+ TimeStamp ccStartTime = Now();
+ TimeStamp prevSliceEnd = ccStartTime;
+ for (int ccslice = 0; ccslice < aNumSlices; ccslice++) {
+ RunSlice(ccStartTime, prevSliceEnd, ccslice, aNumSlices);
+ prevSliceEnd = Now();
+ }
+
+ SetNumSuspected(0);
+}
+
+void TestCC::EndCycleCollectionCallback() {
+ // nsJSContext::EndCycleCollectionCallback
+ CycleCollectorResults results;
+ results.mFreedGCed = 10;
+ results.mFreedJSZones = 2;
+ mScheduler.NoteCCEnd(results, Now(), TimeDuration());
+
+ // Because > 0 zones were freed.
+ EXPECT_TRUE(mScheduler.NeedsGCAfterCC());
+}
+
+void TestCC::KillCCRunner() {
+ // nsJSContext::KillCCRunner
+ mScheduler.KillCCRunner();
+}
+
+class TestIdleCC : public TestCC {
+ public:
+ explicit TestIdleCC(CCGCScheduler& aScheduler) : TestCC(aScheduler) {}
+
+ void Prepare() override;
+ void RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd, int aSliceNum,
+ int aNumSlices) override;
+};
+
+void TestIdleCC::Prepare() { EXPECT_TRUE(!mScheduler.InIncrementalGC()); }
+
+void TestIdleCC::RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd,
+ int aSliceNum, int aNumSlices) {
+ CCRunnerStep step;
+ TimeStamp idleDeadline = Now() + kTenthSecond;
+
+ // The scheduler should request a CycleCollect slice.
+ step = mScheduler.AdvanceCCRunner(idleDeadline, Now(), SuspectedCCObjects());
+ EXPECT_EQ(step.mAction, CCRunnerAction::CycleCollect);
+
+ // nsJSContext::RunCycleCollectorSlice
+
+ EXPECT_FALSE(mScheduler.InIncrementalGC());
+ bool preferShorter;
+ js::SliceBudget budget = mScheduler.ComputeCCSliceBudget(
+ idleDeadline, aCCStartTime, aPrevSliceEnd, Now(), &preferShorter);
+ // The scheduler will set the budget to our deadline (0.1sec in the future).
+ EXPECT_NEAR(budget.timeBudget(), kTenthSecond.ToMilliseconds(), 1);
+ EXPECT_FALSE(preferShorter);
+
+ AdvanceTime(kTenthSecond);
+}
+
+class TestNonIdleCC : public TestCC {
+ public:
+ explicit TestNonIdleCC(CCGCScheduler& aScheduler) : TestCC(aScheduler) {}
+
+ void Prepare() override;
+ void RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd, int aSliceNum,
+ int aNumSlices) override;
+};
+
+void TestNonIdleCC::Prepare() {
+ EXPECT_TRUE(!mScheduler.InIncrementalGC());
+
+ // Advance time by an hour to give time for a user event in the past.
+ AdvanceTime(TimeDuration::FromSeconds(3600));
+}
+
+void TestNonIdleCC::RunSlice(TimeStamp aCCStartTime, TimeStamp aPrevSliceEnd,
+ int aSliceNum, int aNumSlices) {
+ CCRunnerStep step;
+ TimeStamp nullDeadline;
+
+ // The scheduler should tell us to run a slice of cycle collection.
+ step = mScheduler.AdvanceCCRunner(nullDeadline, Now(), SuspectedCCObjects());
+ EXPECT_EQ(step.mAction, CCRunnerAction::CycleCollect);
+
+ // nsJSContext::RunCycleCollectorSlice
+
+ EXPECT_FALSE(mScheduler.InIncrementalGC());
+
+ bool preferShorter;
+ js::SliceBudget budget = mScheduler.ComputeCCSliceBudget(
+ nullDeadline, aCCStartTime, aPrevSliceEnd, Now(), &preferShorter);
+ if (aSliceNum == 0) {
+ // First slice of the CC, so always use the baseBudget which is
+ // kICCSliceBudget (3ms) for a non-idle slice.
+ EXPECT_NEAR(budget.timeBudget(), kICCSliceBudget.ToMilliseconds(), 0.1);
+ } else if (aSliceNum == 1) {
+ // Second slice still uses the baseBudget, since not much time has passed
+ // so none of the lengthening mechanisms have kicked in yet.
+ EXPECT_NEAR(budget.timeBudget(), kICCSliceBudget.ToMilliseconds(), 0.1);
+ } else if (aSliceNum == 2) {
+ // We're not overrunning kMaxICCDuration, so we don't go unlimited.
+ EXPECT_FALSE(budget.isUnlimited());
+ // This slice is delayed, slice time should be increased.
+ EXPECT_NEAR(budget.timeBudget(),
+ MainThreadIdlePeriod::GetLongIdlePeriod() / 2, 0.1);
+ } else {
+ // We're not overrunning kMaxICCDuration, so we don't go unlimited.
+ EXPECT_FALSE(budget.isUnlimited());
+
+ // These slices are not delayed, but enough time has passed that the
+ // dominating factor is now the linear ramp up to max slice time at the
+ // halfway point to kMaxICCDuration.
+ EXPECT_TRUE(budget.timeBudget() > kICCSliceBudget.ToMilliseconds());
+ EXPECT_TRUE(budget.timeBudget() <=
+ MainThreadIdlePeriod::GetLongIdlePeriod());
+ }
+ EXPECT_TRUE(preferShorter); // Non-idle prefers shorter slices
+
+ AdvanceTime(TimeDuration::FromMilliseconds(budget.timeBudget()));
+ if (aSliceNum == 1) {
+ // Delay the third slice (only).
+ AdvanceTime(kICCIntersliceDelay * 2);
+ }
+}
+
+// Do a GC then CC then GC.
+static bool BasicScenario(CCGCScheduler& aScheduler, TestGC* aTestGC,
+ TestCC* aTestCC) {
+ // Run a 10-slice incremental GC.
+ aTestGC->Run(10);
+
+ // After a GC, the scheduler should decide to do a full CC regardless of the
+ // number of purple buffer entries.
+ SetNumSuspected(3);
+ EXPECT_EQ(aScheduler.IsCCNeeded(Now(), SuspectedCCObjects()),
+ CCReason::GC_FINISHED);
+
+ // Now we should want to CC.
+ EXPECT_EQ(aScheduler.ShouldScheduleCC(Now(), SuspectedCCObjects()),
+ CCReason::GC_FINISHED);
+
+ // Do a 5-slice CC.
+ aTestCC->Run(5);
+
+ // Not enough suspected objects to deserve a CC.
+ EXPECT_EQ(aScheduler.IsCCNeeded(Now(), SuspectedCCObjects()),
+ CCReason::NO_REASON);
+ EXPECT_EQ(aScheduler.ShouldScheduleCC(Now(), SuspectedCCObjects()),
+ CCReason::NO_REASON);
+ SetNumSuspected(10000);
+
+ // We shouldn't want to CC again yet, it's too soon.
+ EXPECT_EQ(aScheduler.ShouldScheduleCC(Now(), SuspectedCCObjects()),
+ CCReason::NO_REASON);
+ AdvanceTime(mozilla::kCCDelay);
+
+ // *Now* it's time for another CC.
+ EXPECT_EQ(aScheduler.ShouldScheduleCC(Now(), SuspectedCCObjects()),
+ CCReason::MANY_SUSPECTED);
+
+ // Run a 3-slice incremental GC.
+ EXPECT_TRUE(!aScheduler.InIncrementalGC());
+ aTestGC->Run(3);
+
+ return true;
+}
+
+static CCGCScheduler scheduler;
+static TestGC gc(scheduler);
+static TestIdleCC ccIdle(scheduler);
+static TestNonIdleCC ccNonIdle(scheduler);
+
+TEST(TestScheduler, Idle)
+{
+ // Cannot CC until we GC once.
+ EXPECT_EQ(scheduler.ShouldScheduleCC(Now(), SuspectedCCObjects()),
+ CCReason::NO_REASON);
+
+ EXPECT_TRUE(BasicScenario(scheduler, &gc, &ccIdle));
+}
+
+TEST(TestScheduler, NonIdle)
+{ EXPECT_TRUE(BasicScenario(scheduler, &gc, &ccNonIdle)); }
diff --git a/dom/base/test/gtest/TestXMLSerializerNoBreakLink.cpp b/dom/base/test/gtest/TestXMLSerializerNoBreakLink.cpp
new file mode 100644
index 0000000000..a63410303e
--- /dev/null
+++ b/dom/base/test/gtest/TestXMLSerializerNoBreakLink.cpp
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "nsCOMPtr.h"
+#include "nsIDocumentEncoder.h"
+#include "nsString.h"
+#include "mozilla/ErrorResult.h"
+#include "mozilla/dom/Document.h"
+#include "mozilla/dom/DOMParser.h"
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
+// Test that serialising some DOM doesn't destroy links by word-wrapping long
+// href values containing spaces.
+TEST(TestXMLSerializerNoBreakLink, TestXMLSerializerNoBreakLinkMain)
+{
+ // Build up a stupidly-long URL with spaces. Default is to wrap at column
+ // 72, so we want to exceed that.
+ nsString longURL = u"http://www.example.com/link with spaces"_ns;
+ for (int i = 1; i < 125; ++i) {
+ longURL.Append(u' ');
+ longURL.Append(IntToTString(i));
+ }
+ nsString htmlInput =
+ u""
+ " "
+ "Hello Thunderbird! Link "_ns;
+
+ // Parse HTML into a Document.
+ nsCOMPtr document;
+ {
+ IgnoredErrorResult rv;
+ RefPtr parser = DOMParser::CreateWithoutGlobal(rv);
+ ASSERT_FALSE(rv.Failed());
+ document = parser->ParseFromString(htmlInput, SupportedType::Text_html, rv);
+ ASSERT_FALSE(rv.Failed());
+ }
+
+ // Serialize back in a variety of flavours and check the URL survives the
+ // round trip intact.
+ nsCString contentTypes[] = {"text/xml"_ns, "application/xml"_ns,
+ "application/xhtml+xml"_ns, "image/svg+xml"_ns,
+ "text/html"_ns};
+ for (auto const& contentType : contentTypes) {
+ uint32_t flagsToTest[] = {
+ nsIDocumentEncoder::OutputFormatted, nsIDocumentEncoder::OutputWrap,
+ nsIDocumentEncoder::OutputFormatted | nsIDocumentEncoder::OutputWrap};
+ for (uint32_t flags : flagsToTest) {
+ // Serialize doc back to HTML source again.
+ nsCOMPtr encoder =
+ do_createDocumentEncoder(contentType.get());
+ ASSERT_TRUE(encoder);
+ nsresult rv =
+ encoder->Init(document, NS_ConvertASCIItoUTF16(contentType), flags);
+ ASSERT_TRUE(NS_SUCCEEDED(rv));
+ nsString parsed;
+ rv = encoder->EncodeToString(parsed);
+ ASSERT_TRUE(NS_SUCCEEDED(rv));
+
+ // URL is intact?
+ EXPECT_TRUE(parsed.Find(longURL) != kNotFound);
+ }
+ }
+}
diff --git a/dom/base/test/gtest/TestXPathGenerator.cpp b/dom/base/test/gtest/TestXPathGenerator.cpp
new file mode 100644
index 0000000000..c9f4993179
--- /dev/null
+++ b/dom/base/test/gtest/TestXPathGenerator.cpp
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "XPathGenerator.h"
+#include "nsString.h"
+
+TEST(TestXPathGenerator, TestQuoteArgumentWithoutQuote)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"testing");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(u"\'testing\'");
+
+ nsAutoString result;
+ XPathGenerator::QuoteArgument(arg, result);
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator, TestQuoteArgumentWithSingleQuote)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"\'testing\'");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(u"\"\'testing\'\"");
+
+ nsAutoString result;
+ XPathGenerator::QuoteArgument(arg, result);
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator, TestQuoteArgumentWithDoubleQuote)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"\"testing\"");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(u"\'\"testing\"\'");
+
+ nsAutoString result;
+ XPathGenerator::QuoteArgument(arg, result);
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator, TestQuoteArgumentWithSingleAndDoubleQuote)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"\'testing\"");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(u"concat(\'\',\"\'\",\'testing\"\')");
+
+ nsAutoString result;
+ XPathGenerator::QuoteArgument(arg, result);
+ printf("Result: %s\nExpected: %s\n", NS_ConvertUTF16toUTF8(result).get(),
+ NS_ConvertUTF16toUTF8(expectedResult).get());
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator,
+ TestQuoteArgumentWithDoubleQuoteAndASequenceOfSingleQuote)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"\'\'\'\'testing\"");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(u"concat(\'\',\"\'\'\'\'\",\'testing\"\')");
+
+ nsAutoString result;
+ XPathGenerator::QuoteArgument(arg, result);
+ printf("Result: %s\nExpected: %s\n", NS_ConvertUTF16toUTF8(result).get(),
+ NS_ConvertUTF16toUTF8(expectedResult).get());
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator,
+ TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuote)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"\'\'\'\'testing\'\'\'\'\'\'\"");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(
+ u"concat(\'\',\"\'\'\'\'\",\'testing\',\"\'\'\'\'\'\'\",\'\"\')");
+
+ nsAutoString result;
+ XPathGenerator::QuoteArgument(arg, result);
+ printf("Result: %s\nExpected: %s\n", NS_ConvertUTF16toUTF8(result).get(),
+ NS_ConvertUTF16toUTF8(expectedResult).get());
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator,
+ TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuoteInMiddle)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"t\'\'\'\'estin\'\'\'\'\'\'\"g");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(
+ u"concat(\'t\',\"\'\'\'\'\",\'estin\',\"\'\'\'\'\'\'\",\'\"g\')");
+
+ nsAutoString result;
+ XPathGenerator::QuoteArgument(arg, result);
+ printf("Result: %s\nExpected: %s\n", NS_ConvertUTF16toUTF8(result).get(),
+ NS_ConvertUTF16toUTF8(expectedResult).get());
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator, TestEscapeNameWithNormalCharacters)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"testing");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(u"testing");
+
+ nsAutoString result;
+ XPathGenerator::EscapeName(arg, result);
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
+
+TEST(TestXPathGenerator, TestEscapeNameWithSpecialCharacters)
+{
+ nsAutoString arg;
+ arg.AssignLiteral(u"^testing!");
+
+ nsAutoString expectedResult;
+ expectedResult.AssignLiteral(u"*[local-name()=\'^testing!\']");
+
+ nsAutoString result;
+ XPathGenerator::EscapeName(arg, result);
+ printf("Result: %s\nExpected: %s\n", NS_ConvertUTF16toUTF8(result).get(),
+ NS_ConvertUTF16toUTF8(expectedResult).get());
+
+ ASSERT_TRUE(expectedResult.Equals(result));
+}
diff --git a/dom/base/test/gtest/moz.build b/dom/base/test/gtest/moz.build
new file mode 100644
index 0000000000..9a767eb2ff
--- /dev/null
+++ b/dom/base/test/gtest/moz.build
@@ -0,0 +1,21 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, you can obtain one at http://mozilla.org/MPL/2.0/.
+
+UNIFIED_SOURCES += [
+ "TestContentUtils.cpp",
+ "TestMimeType.cpp",
+ "TestParser.cpp",
+ "TestPlainTextSerializer.cpp",
+ "TestScheduler.cpp",
+ "TestXMLSerializerNoBreakLink.cpp",
+ "TestXPathGenerator.cpp",
+]
+
+LOCAL_INCLUDES += ["/dom/base"]
+
+include("/ipc/chromium/chromium-config.mozbuild")
+
+FINAL_LIBRARY = "xul-gtest"
diff --git a/dom/base/test/head.js b/dom/base/test/head.js
new file mode 100644
index 0000000000..2b39f7a7b1
--- /dev/null
+++ b/dom/base/test/head.js
@@ -0,0 +1,15 @@
+async function newFocusedWindow(trigger) {
+ let winPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
+ let delayedStartupPromise = BrowserTestUtils.waitForNewWindow();
+
+ await trigger();
+
+ let win = await winPromise;
+ // New windows get focused after the first paint, see bug 1262946
+ await BrowserTestUtils.waitForContentEvent(
+ win.gBrowser.selectedBrowser,
+ "MozAfterPaint"
+ );
+ await delayedStartupPromise;
+ return win;
+}
diff --git a/dom/base/test/iframe1_bug1640766.html b/dom/base/test/iframe1_bug1640766.html
new file mode 100644
index 0000000000..51da4f22f0
--- /dev/null
+++ b/dom/base/test/iframe1_bug1640766.html
@@ -0,0 +1,20 @@
+
+
+
+Iframe 1 for Bug 1640766
+
+
+Iframe 1
+
+
+
diff --git a/dom/base/test/iframe1_bug426646.html b/dom/base/test/iframe1_bug426646.html
new file mode 100644
index 0000000000..533e77ad4c
--- /dev/null
+++ b/dom/base/test/iframe1_bug426646.html
@@ -0,0 +1 @@
+ 1st page
diff --git a/dom/base/test/iframe1_bug431701.html b/dom/base/test/iframe1_bug431701.html
new file mode 100644
index 0000000000..18ecdcb795
--- /dev/null
+++ b/dom/base/test/iframe1_bug431701.html
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/iframe2_bug1640766.html b/dom/base/test/iframe2_bug1640766.html
new file mode 100644
index 0000000000..6a5ca30796
--- /dev/null
+++ b/dom/base/test/iframe2_bug1640766.html
@@ -0,0 +1,10 @@
+
+
+
+Iframe 2 for Bug 1640766
+
+
+Iframe 2
+
+
+
diff --git a/dom/base/test/iframe2_bug426646.html b/dom/base/test/iframe2_bug426646.html
new file mode 100644
index 0000000000..45e85c0f13
--- /dev/null
+++ b/dom/base/test/iframe2_bug426646.html
@@ -0,0 +1 @@
+ 2nd page
diff --git a/dom/base/test/iframe2_bug431701.html b/dom/base/test/iframe2_bug431701.html
new file mode 100644
index 0000000000..6c963c5455
--- /dev/null
+++ b/dom/base/test/iframe2_bug431701.html
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/iframe3_bug431701.html b/dom/base/test/iframe3_bug431701.html
new file mode 100644
index 0000000000..c0aac38766
--- /dev/null
+++ b/dom/base/test/iframe3_bug431701.html
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/iframe4_bug431701.xml b/dom/base/test/iframe4_bug431701.xml
new file mode 100644
index 0000000000..18ecdcb795
--- /dev/null
+++ b/dom/base/test/iframe4_bug431701.xml
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/iframe5_bug431701.xml b/dom/base/test/iframe5_bug431701.xml
new file mode 100644
index 0000000000..d761751ee1
--- /dev/null
+++ b/dom/base/test/iframe5_bug431701.xml
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/iframe6_bug431701.xml b/dom/base/test/iframe6_bug431701.xml
new file mode 100644
index 0000000000..17704b893a
--- /dev/null
+++ b/dom/base/test/iframe6_bug431701.xml
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/iframe7_bug431701.xml b/dom/base/test/iframe7_bug431701.xml
new file mode 100644
index 0000000000..73757924a7
--- /dev/null
+++ b/dom/base/test/iframe7_bug431701.xml
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/iframe_bug962251.html b/dom/base/test/iframe_bug962251.html
new file mode 100644
index 0000000000..2fa3a50dcf
--- /dev/null
+++ b/dom/base/test/iframe_bug962251.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dom/base/test/iframe_bug976673.html b/dom/base/test/iframe_bug976673.html
new file mode 100644
index 0000000000..92c5bf76d0
--- /dev/null
+++ b/dom/base/test/iframe_bug976673.html
@@ -0,0 +1,26 @@
+
+
+
+
+ Test for Bug 976673
+
+
+
+
+
+
diff --git a/dom/base/test/iframe_main_bug1022229.html b/dom/base/test/iframe_main_bug1022229.html
new file mode 100644
index 0000000000..c89a8c9a9d
--- /dev/null
+++ b/dom/base/test/iframe_main_bug1022229.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/iframe_meta_refresh.sjs b/dom/base/test/iframe_meta_refresh.sjs
new file mode 100644
index 0000000000..264a9e0efc
--- /dev/null
+++ b/dom/base/test/iframe_meta_refresh.sjs
@@ -0,0 +1,90 @@
+/*
+ * Test server for iframe refresh from meta http-equiv
+ */
+
+const SHARED_KEY = "iframe_meta_refresh";
+const DEFAULT_STATE = { count: 0, referrers: [] };
+const REFRESH_PAGE =
+ "http://example.com/tests/dom/base/test/iframe_meta_refresh.sjs?action=test";
+
+function createContent(refresh) {
+ let metaRefresh = "";
+ let scriptMessage = "";
+
+ if (refresh) {
+ metaRefresh = ` `;
+ } else {
+ scriptMessage = `
+ `;
+ }
+
+ return `
+
+
+
+ ${metaRefresh}
+ Test referrer of meta http-equiv refresh
+
+
+ ${scriptMessage}
+
+ `;
+}
+
+function handleRequest(request, response) {
+ let query = new URLSearchParams(request.queryString);
+
+ let action = query.get("action");
+
+ var referrerLevel = "none";
+ if (request.hasHeader("Referer")) {
+ let referrer = request.getHeader("Referer");
+ if (referrer.indexOf("test_meta_refresh_referrer") > 0) {
+ referrerLevel = "full";
+ } else if (referrer == "http://mochi.test:8888/") {
+ referrerLevel = "origin";
+ }
+ }
+
+ var state = getSharedState(SHARED_KEY);
+ if (state === "") {
+ state = DEFAULT_STATE;
+ } else {
+ state = JSON.parse(state);
+ }
+
+ response.setStatusLine(request.httpVersion, 200, "OK");
+
+ //avoid confusing cache behaviors
+ response.setHeader("Cache-Control", "no-cache", false);
+
+ if (action === "results") {
+ response.setHeader("Content-Type", "text/plain", false);
+ response.write(JSON.stringify(state));
+ return;
+ }
+
+ if (action === "reset") {
+ //reset server state
+ setSharedState(SHARED_KEY, JSON.stringify(DEFAULT_STATE));
+ response.write("");
+ return;
+ }
+
+ if (action === "test") {
+ let load = query.get("load");
+ state.count++;
+ if (state.referrers.indexOf(referrerLevel) < 0) {
+ state.referrers.push(referrerLevel);
+ }
+
+ // Write frame content
+ response.write(createContent(load));
+ }
+
+ setSharedState(SHARED_KEY, JSON.stringify(state));
+}
diff --git a/dom/base/test/iframe_postMessage_solidus.html b/dom/base/test/iframe_postMessage_solidus.html
new file mode 100644
index 0000000000..86f12367ec
--- /dev/null
+++ b/dom/base/test/iframe_postMessage_solidus.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/iframe_postMessages.html b/dom/base/test/iframe_postMessages.html
new file mode 100644
index 0000000000..0b07456eb8
--- /dev/null
+++ b/dom/base/test/iframe_postMessages.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/dom/base/test/iframe_sandbox_bug1022229.html b/dom/base/test/iframe_sandbox_bug1022229.html
new file mode 100644
index 0000000000..3d70e9d7af
--- /dev/null
+++ b/dom/base/test/iframe_sandbox_bug1022229.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/iframe_shared_compartment2a.html b/dom/base/test/iframe_shared_compartment2a.html
new file mode 100644
index 0000000000..e2451367bb
--- /dev/null
+++ b/dom/base/test/iframe_shared_compartment2a.html
@@ -0,0 +1,2 @@
+
diff --git a/dom/base/test/iframe_shared_compartment2b.html b/dom/base/test/iframe_shared_compartment2b.html
new file mode 100644
index 0000000000..64d57320f8
--- /dev/null
+++ b/dom/base/test/iframe_shared_compartment2b.html
@@ -0,0 +1,3 @@
+
diff --git a/dom/base/test/intersectionobserver_cross_domain_iframe.html b/dom/base/test/intersectionobserver_cross_domain_iframe.html
new file mode 100644
index 0000000000..750ccaf6f2
--- /dev/null
+++ b/dom/base/test/intersectionobserver_cross_domain_iframe.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/intersectionobserver_iframe.html b/dom/base/test/intersectionobserver_iframe.html
new file mode 100644
index 0000000000..dae0da82c9
--- /dev/null
+++ b/dom/base/test/intersectionobserver_iframe.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/intersectionobserver_window.html b/dom/base/test/intersectionobserver_window.html
new file mode 100644
index 0000000000..826b5064eb
--- /dev/null
+++ b/dom/base/test/intersectionobserver_window.html
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/invalid_accesscontrol.resource b/dom/base/test/invalid_accesscontrol.resource
new file mode 100644
index 0000000000..aca66f6f8d
--- /dev/null
+++ b/dom/base/test/invalid_accesscontrol.resource
@@ -0,0 +1,7 @@
+:this file must be enconded in utf8
+:and its Content-Type must be equal to text/event-stream
+
+event: message
+data: 1
+
+
diff --git a/dom/base/test/invalid_accesscontrol.resource^headers^ b/dom/base/test/invalid_accesscontrol.resource^headers^
new file mode 100644
index 0000000000..d5bed552cb
--- /dev/null
+++ b/dom/base/test/invalid_accesscontrol.resource^headers^
@@ -0,0 +1,4 @@
+Access-Control-Allow-Origin: http://an.accesscrontrol.domain:80
+Content-Type: text/event-stream
+Cache-Control: no-cache, must-revalidate
+
diff --git a/dom/base/test/jsmodules/.eslintrc.js b/dom/base/test/jsmodules/.eslintrc.js
new file mode 100644
index 0000000000..25a38d20af
--- /dev/null
+++ b/dom/base/test/jsmodules/.eslintrc.js
@@ -0,0 +1,15 @@
+"use strict";
+
+module.exports = {
+ overrides: [
+ {
+ // eslint-plugin-html doesn't automatically detect module sections in
+ // html files. Enable these as a module here. JavaScript files can use
+ // the mjs extension.
+ files: ["*.html"],
+ parserOptions: {
+ sourceType: "module",
+ },
+ },
+ ],
+};
diff --git a/dom/base/test/jsmodules/ambiguous_export.mjs b/dom/base/test/jsmodules/ambiguous_export.mjs
new file mode 100644
index 0000000000..0018e1bc47
--- /dev/null
+++ b/dom/base/test/jsmodules/ambiguous_export.mjs
@@ -0,0 +1,3 @@
+/* eslint-disable import/export */
+export * from "./exportA1.mjs";
+export * from "./exportA2.mjs";
diff --git a/dom/base/test/jsmodules/chrome.toml b/dom/base/test/jsmodules/chrome.toml
new file mode 100644
index 0000000000..82d02ad4df
--- /dev/null
+++ b/dom/base/test/jsmodules/chrome.toml
@@ -0,0 +1,94 @@
+[DEFAULT]
+support-files = [
+ "ambiguous_export.mjs",
+ "import_ambiguous.mjs",
+ "import_ambiguous_indirect_export.mjs",
+ "import_no_export.mjs",
+ "import_no_indirect_export.mjs",
+ "exportA1.mjs",
+ "exportA2.mjs",
+ "export_ambiguous.mjs",
+ "module_setRan.mjs",
+ "module_testSyntax.mjs",
+ "module_badSyntax.mjs",
+ "module_simpleImport.mjs",
+ "module_simpleExport.mjs",
+ "module_badImport.mjs",
+ "module_simple1.mjs",
+ "module_simple2.mjs",
+ "module_simple3.mjs",
+ "module_cyclic1.mjs",
+ "module_cyclic2.mjs",
+ "module_cyclic3.mjs",
+ "module_multiImports.mjs",
+ "module_multiLargeImports.mjs",
+ "no_export.mjs",
+ "no_indirect_export.mjs",
+ "script_simple2.js",
+ "module_large1.mjs",
+ "module_large2.mjs",
+ "module_large3.mjs",
+ "module_extractIntroType.mjs",
+ "iframe_extractIntroType.html",
+ "module_missingImport.mjs",
+]
+
+["test_asyncInlineModules.html"]
+
+["test_cyclicImport.html"]
+
+["test_dynamicImportErrorMessage.html"]
+
+["test_importIntroType.html"]
+
+["test_importNotFound.html"]
+
+["test_importResolveFailed.html"]
+
+["test_import_errorMessage.html"]
+
+["test_import_meta_resolve.html"]
+
+["test_importedModuleMemoization.html"]
+
+["test_linkErrorInCommon1.html"]
+
+["test_linkErrorInCommon2.html"]
+
+["test_moduleNotFound.html"]
+
+["test_moduleParsedAsModule.html"]
+
+["test_moduleScriptsRun.html"]
+
+["test_multiAsyncImports.html"]
+
+["test_multiModuleImports.html"]
+
+["test_multiModuleLargeImports.html"]
+
+["test_multiTopLevelImports.html"]
+
+["test_multiTopLevelLargeImports.html"]
+
+["test_scriptInsertedModule.html"]
+
+["test_scriptModuleOrder.html"]
+
+["test_scriptNotParsedAsModule.html"]
+
+["test_simpleImport.html"]
+
+["test_syntaxError.html"]
+
+["test_syntaxErrorAsync.html"]
+
+["test_syntaxErrorInline.html"]
+
+["test_syntaxErrorInlineAsync.html"]
+
+["test_topLevelIntroType.html"]
+
+["test_toplevelModuleMemoization.html"]
+
+["test_typeAttrCaseInsensitive.html"]
diff --git a/dom/base/test/jsmodules/exportA1.mjs b/dom/base/test/jsmodules/exportA1.mjs
new file mode 100644
index 0000000000..cc798ff50d
--- /dev/null
+++ b/dom/base/test/jsmodules/exportA1.mjs
@@ -0,0 +1 @@
+export const a = 1;
diff --git a/dom/base/test/jsmodules/exportA2.mjs b/dom/base/test/jsmodules/exportA2.mjs
new file mode 100644
index 0000000000..66d48fc1e6
--- /dev/null
+++ b/dom/base/test/jsmodules/exportA2.mjs
@@ -0,0 +1 @@
+export const a = 2;
diff --git a/dom/base/test/jsmodules/export_ambiguous.mjs b/dom/base/test/jsmodules/export_ambiguous.mjs
new file mode 100644
index 0000000000..cca2dfd68a
--- /dev/null
+++ b/dom/base/test/jsmodules/export_ambiguous.mjs
@@ -0,0 +1 @@
+export { a } from "./ambiguous_export.mjs";
diff --git a/dom/base/test/jsmodules/iframe_extractIntroType.html b/dom/base/test/jsmodules/iframe_extractIntroType.html
new file mode 100644
index 0000000000..26c58aea6d
--- /dev/null
+++ b/dom/base/test/jsmodules/iframe_extractIntroType.html
@@ -0,0 +1,14 @@
+
+
+
+
diff --git a/dom/base/test/jsmodules/import_ambiguous.mjs b/dom/base/test/jsmodules/import_ambiguous.mjs
new file mode 100644
index 0000000000..f5c12ff086
--- /dev/null
+++ b/dom/base/test/jsmodules/import_ambiguous.mjs
@@ -0,0 +1 @@
+import { a } from "./ambiguous_export.mjs";
diff --git a/dom/base/test/jsmodules/import_ambiguous_indirect_export.mjs b/dom/base/test/jsmodules/import_ambiguous_indirect_export.mjs
new file mode 100644
index 0000000000..bbf9375e49
--- /dev/null
+++ b/dom/base/test/jsmodules/import_ambiguous_indirect_export.mjs
@@ -0,0 +1 @@
+import { a } from "./export_ambiguous.mjs";
diff --git a/dom/base/test/jsmodules/import_no_export.mjs b/dom/base/test/jsmodules/import_no_export.mjs
new file mode 100644
index 0000000000..47cabac557
--- /dev/null
+++ b/dom/base/test/jsmodules/import_no_export.mjs
@@ -0,0 +1 @@
+import x from "./no_export.mjs";
diff --git a/dom/base/test/jsmodules/import_no_indirect_export.mjs b/dom/base/test/jsmodules/import_no_indirect_export.mjs
new file mode 100644
index 0000000000..dd1ca847fc
--- /dev/null
+++ b/dom/base/test/jsmodules/import_no_indirect_export.mjs
@@ -0,0 +1,2 @@
+/* eslint-disable import/default */
+import x from "./no_indirect_export.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/bad/module_2.mjs b/dom/base/test/jsmodules/importmaps/bad/module_2.mjs
new file mode 100644
index 0000000000..86c4251413
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/bad/module_2.mjs
@@ -0,0 +1 @@
+throw "Shouldn't load file bad/module_2.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/bad/module_3.mjs b/dom/base/test/jsmodules/importmaps/bad/module_3.mjs
new file mode 100644
index 0000000000..f0595118d4
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/bad/module_3.mjs
@@ -0,0 +1,8 @@
+// eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+import {} from "../circular_depdendency.mjs";
+
+export function exportedFunction() {
+ throw "Wrong version of function called";
+}
+
+throw "Shouldn't laod file bad/module_3.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/bad/module_4.mjs b/dom/base/test/jsmodules/importmaps/bad/module_4.mjs
new file mode 100644
index 0000000000..93dd8245ce
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/bad/module_4.mjs
@@ -0,0 +1 @@
+throw "Shouldn't load file bad/module_4.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/bad/module_7.mjs b/dom/base/test/jsmodules/importmaps/bad/module_7.mjs
new file mode 100644
index 0000000000..8844bf862c
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/bad/module_7.mjs
@@ -0,0 +1 @@
+throw "Shouldn't load file bad/module_7.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/bug_1865410_module_a.mjs b/dom/base/test/jsmodules/importmaps/bug_1865410_module_a.mjs
new file mode 100644
index 0000000000..07d43d115e
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/bug_1865410_module_a.mjs
@@ -0,0 +1,2 @@
+// eslint-disable-next-line import/no-unassigned-import
+import {} from "./bug_1865410_module_b.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/bug_1865410_module_b.mjs b/dom/base/test/jsmodules/importmaps/bug_1865410_module_b.mjs
new file mode 100644
index 0000000000..2bd6dce476
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/bug_1865410_module_b.mjs
@@ -0,0 +1 @@
+// Empty.
diff --git a/dom/base/test/jsmodules/importmaps/bug_1873417.mjs b/dom/base/test/jsmodules/importmaps/bug_1873417.mjs
new file mode 100644
index 0000000000..339e6acf91
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/bug_1873417.mjs
@@ -0,0 +1,2 @@
+console.log("Module loaded successfully!");
+state = "loaded";
diff --git a/dom/base/test/jsmodules/importmaps/chrome.toml b/dom/base/test/jsmodules/importmaps/chrome.toml
new file mode 100644
index 0000000000..0b8afe0f25
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/chrome.toml
@@ -0,0 +1,37 @@
+[DEFAULT]
+support-files = [
+ "external_importMap.js",
+ "insert_a_base_element.js",
+ "module_simpleImportMap.mjs",
+ "module_simpleImportMap_dir.mjs",
+ "module_simpleImportMap_remap.mjs",
+ "module_simpleImportMap_remap_https.mjs",
+ "module_simpleExport.mjs",
+ "module_sortedImportMap.mjs",
+ "scope1/module_simpleExport.mjs",
+ "scope1/module_simpleImportMap.mjs",
+ "scope1/scope2/module_simpleExport.mjs",
+ "scope1/scope2/module_simpleImportMap.mjs",
+]
+
+["test_dynamic_import_reject_importMap.html"]
+
+["test_externalImportMap.html"]
+
+["test_import_meta_resolve_importMap.html"]
+
+["test_inline_module_reject_importMap.html"]
+
+["test_load_importMap_with_base.html"]
+
+["test_load_importMap_with_base2.html"]
+
+["test_module_script_reject_importMap.html"]
+
+["test_parse_importMap_failed.html"]
+
+["test_reject_multiple_importMaps.html"]
+
+["test_simpleImportMap.html"]
+
+["test_sortedImportMap.html"]
diff --git a/dom/base/test/jsmodules/importmaps/circular_dependency.mjs b/dom/base/test/jsmodules/importmaps/circular_dependency.mjs
new file mode 100644
index 0000000000..f28d24b75e
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/circular_dependency.mjs
@@ -0,0 +1,6 @@
+// Should be remapped to good/module_3.mjs.
+import { exportedFunction } from "./bad/module_3.mjs";
+
+if (exportedFunction()) {
+ success("circular_dependency.mjs");
+}
diff --git a/dom/base/test/jsmodules/importmaps/external_importMap.js b/dom/base/test/jsmodules/importmaps/external_importMap.js
new file mode 100644
index 0000000000..e89d9f618f
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/external_importMap.js
@@ -0,0 +1,5 @@
+let imap = {
+ imports: {
+ foo: "./foo.js",
+ },
+};
diff --git a/dom/base/test/jsmodules/importmaps/good/module_0.mjs b/dom/base/test/jsmodules/importmaps/good/module_0.mjs
new file mode 100644
index 0000000000..5c3c5e2ab1
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/good/module_0.mjs
@@ -0,0 +1 @@
+success("good/module_0.mjs");
diff --git a/dom/base/test/jsmodules/importmaps/good/module_1.mjs b/dom/base/test/jsmodules/importmaps/good/module_1.mjs
new file mode 100644
index 0000000000..9b902b266a
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/good/module_1.mjs
@@ -0,0 +1 @@
+success("good/module_1.mjs");
diff --git a/dom/base/test/jsmodules/importmaps/good/module_2.mjs b/dom/base/test/jsmodules/importmaps/good/module_2.mjs
new file mode 100644
index 0000000000..6756465905
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/good/module_2.mjs
@@ -0,0 +1 @@
+success("good/module_2.mjs");
diff --git a/dom/base/test/jsmodules/importmaps/good/module_3.mjs b/dom/base/test/jsmodules/importmaps/good/module_3.mjs
new file mode 100644
index 0000000000..95450e55f7
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/good/module_3.mjs
@@ -0,0 +1,6 @@
+// eslint-disable-next-line import/no-unassigned-import
+import {} from "../circular_dependency.mjs";
+
+export function exportedFunction() {
+ return true;
+}
diff --git a/dom/base/test/jsmodules/importmaps/good/module_4.mjs b/dom/base/test/jsmodules/importmaps/good/module_4.mjs
new file mode 100644
index 0000000000..eaec9eb760
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/good/module_4.mjs
@@ -0,0 +1 @@
+success("good/module_4.mjs");
diff --git a/dom/base/test/jsmodules/importmaps/good/module_7.mjs b/dom/base/test/jsmodules/importmaps/good/module_7.mjs
new file mode 100644
index 0000000000..6603e1300d
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/good/module_7.mjs
@@ -0,0 +1 @@
+success("good/module_7.mjs");
diff --git a/dom/base/test/jsmodules/importmaps/insert_a_base_element.js b/dom/base/test/jsmodules/importmaps/insert_a_base_element.js
new file mode 100644
index 0000000000..435af97d1e
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/insert_a_base_element.js
@@ -0,0 +1,4 @@
+const el = document.createElement("base");
+el.href =
+ "chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/";
+document.currentScript.after(el);
diff --git a/dom/base/test/jsmodules/importmaps/mochitest.toml b/dom/base/test/jsmodules/importmaps/mochitest.toml
new file mode 100644
index 0000000000..4229455722
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/mochitest.toml
@@ -0,0 +1,33 @@
+[DEFAULT]
+support-files = [
+ "bug_1865410_module_a.mjs",
+ "bug_1865410_module_b.mjs",
+ "bug_1873417.mjs",
+ "module_importMap_with_external_script_0.mjs",
+ "module_importMap_with_external_script_1.mjs",
+ "module_importMap_with_external_script_2.mjs",
+ "module_importMap_with_external_script_3.mjs",
+ "module_importMap_with_external_script_4.mjs",
+ "module_importMap_with_external_script_5.mjs",
+ "module_importMap_with_external_script_5.mjs^headers^",
+ "module_importMap_with_external_script_6.mjs",
+ "module_importMap_with_external_script_6.mjs^headers^",
+ "module_importMap_with_external_script_7.mjs",
+ "bad/module_2.mjs",
+ "bad/module_3.mjs",
+ "bad/module_4.mjs",
+ "bad/module_7.mjs",
+ "good/module_0.mjs",
+ "good/module_1.mjs",
+ "good/module_2.mjs",
+ "good/module_3.mjs",
+ "good/module_4.mjs",
+ "good/module_7.mjs",
+ "circular_dependency.mjs",
+]
+
+["test_bug_1865410.html"]
+
+["test_bug_1873417.html"]
+
+["test_importMap_with_external_script.html"]
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_0.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_0.mjs
new file mode 100644
index 0000000000..e2ba9dee7e
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_0.mjs
@@ -0,0 +1,3 @@
+// Bareword specifier should be mapped to ./good/module_0.mjs.
+// eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+import {} from "bare";
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_1.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_1.mjs
new file mode 100644
index 0000000000..9d763a678f
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_1.mjs
@@ -0,0 +1,3 @@
+// Missing file ./bad/module_1.mjs should be mapped to ./good/module_1.mjs.
+// eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+import {} from "./bad/module_1.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_2.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_2.mjs
new file mode 100644
index 0000000000..f0cb539a48
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_2.mjs
@@ -0,0 +1,3 @@
+// Existing file ./bad/module_2.mjs should be mapped to ./good/module_2.mjs.
+// eslint-disable-next-line import/no-unassigned-import
+import {} from "./bad/module_2.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_3.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_3.mjs
new file mode 100644
index 0000000000..851f6dc3bc
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_3.mjs
@@ -0,0 +1,3 @@
+// Existing file ./bad/module_3.mjs should be mapped to ./good/module_3.mjs.
+// eslint-disable-next-line import/no-unassigned-import
+import {} from "./bad/module_3.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_4.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_4.mjs
new file mode 100644
index 0000000000..8f46b73123
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_4.mjs
@@ -0,0 +1,3 @@
+// Existing file ./bad/module_4.mjs should be mapped to ./good/module_4.mjs.
+// eslint-disable-next-line import/no-unassigned-import
+import {} from "./bad/module_4.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_5.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_5.mjs
new file mode 100644
index 0000000000..ac814c5e83
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_5.mjs
@@ -0,0 +1,3 @@
+// Existing file ./bad/module_3.mjs should be mapped to ./good/module_3.mjs.
+//import {} from "./bad/module_3.mjs";
+throw "Error: script_5.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_5.mjs^headers^ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_5.mjs^headers^
new file mode 100644
index 0000000000..4cbbbc283d
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_5.mjs^headers^
@@ -0,0 +1,2 @@
+HTTP 301 Moved Permanently
+Location: module_importMap_with_external_script_4.mjs
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_6.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_6.mjs
new file mode 100644
index 0000000000..9e02aa6bf4
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_6.mjs
@@ -0,0 +1,3 @@
+// Existing file ./bad/module_3.mjs should be mapped to ./good/module_3.mjs.
+//import {} from "./bad/module_3.mjs";
+throw "Error: script_6.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_6.mjs^headers^ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_6.mjs^headers^
new file mode 100644
index 0000000000..9f5e36c5a2
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_6.mjs^headers^
@@ -0,0 +1,2 @@
+HTTP 301 Moved Permanently
+Location: module_importMap_with_external_script_5.mjs
diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_7.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_7.mjs
new file mode 100644
index 0000000000..b602217da5
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_external_script_7.mjs
@@ -0,0 +1,3 @@
+// Existing file ./bad/module_7.mjs should be mapped to ./good/module_4.mjs.
+// eslint-disable-next-line import/no-unassigned-import
+import {} from "./bad/module_7.mjs";
diff --git a/dom/base/test/jsmodules/importmaps/module_simpleExport.mjs b/dom/base/test/jsmodules/importmaps/module_simpleExport.mjs
new file mode 100644
index 0000000000..9714d6d0ab
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_simpleExport.mjs
@@ -0,0 +1 @@
+export let x = 42;
diff --git a/dom/base/test/jsmodules/importmaps/module_simpleImportMap.mjs b/dom/base/test/jsmodules/importmaps/module_simpleImportMap.mjs
new file mode 100644
index 0000000000..2f7e649dce
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_simpleImportMap.mjs
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unresolved
+import { x } from "simple";
+
+result = x;
diff --git a/dom/base/test/jsmodules/importmaps/module_simpleImportMap_dir.mjs b/dom/base/test/jsmodules/importmaps/module_simpleImportMap_dir.mjs
new file mode 100644
index 0000000000..3a8a2a63b8
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_simpleImportMap_dir.mjs
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unresolved
+import { x } from "dir/module_simpleExport.mjs";
+
+result_dir = x + 1;
diff --git a/dom/base/test/jsmodules/importmaps/module_simpleImportMap_remap.mjs b/dom/base/test/jsmodules/importmaps/module_simpleImportMap_remap.mjs
new file mode 100644
index 0000000000..54d22e5a5c
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_simpleImportMap_remap.mjs
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unresolved
+import { x } from "./module.mjs";
+
+result_remap = x + 2;
diff --git a/dom/base/test/jsmodules/importmaps/module_simpleImportMap_remap_https.mjs b/dom/base/test/jsmodules/importmaps/module_simpleImportMap_remap_https.mjs
new file mode 100644
index 0000000000..d9b82243b7
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_simpleImportMap_remap_https.mjs
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unresolved
+import { x } from "https://example.com/module.mjs";
+
+result_remap_https = x + 3;
diff --git a/dom/base/test/jsmodules/importmaps/module_sortedImportMap.mjs b/dom/base/test/jsmodules/importmaps/module_sortedImportMap.mjs
new file mode 100644
index 0000000000..2b199ca272
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/module_sortedImportMap.mjs
@@ -0,0 +1,6 @@
+/* eslint-disable import/no-unresolved */
+import { x } from "scope1/scope2/module_simpleExport.mjs";
+import { x as y } from "scope1/scope2/scope3/scope4/module_simpleExport.mjs";
+
+sorted_result = x;
+sorted_result2 = y;
diff --git a/dom/base/test/jsmodules/importmaps/moz.build b/dom/base/test/jsmodules/importmaps/moz.build
new file mode 100644
index 0000000000..ca4ef002b0
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+MOCHITEST_CHROME_MANIFESTS += ["chrome.toml"]
+
+MOCHITEST_MANIFESTS += ["mochitest.toml"]
diff --git a/dom/base/test/jsmodules/importmaps/scope1/module_simpleExport.mjs b/dom/base/test/jsmodules/importmaps/scope1/module_simpleExport.mjs
new file mode 100644
index 0000000000..e6b0ed1c0c
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/scope1/module_simpleExport.mjs
@@ -0,0 +1 @@
+export let x = 84;
diff --git a/dom/base/test/jsmodules/importmaps/scope1/module_simpleImportMap.mjs b/dom/base/test/jsmodules/importmaps/scope1/module_simpleImportMap.mjs
new file mode 100644
index 0000000000..a64a098b7b
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/scope1/module_simpleImportMap.mjs
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unresolved
+import { x } from "simple";
+
+result_scope1 = x;
diff --git a/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleExport.mjs b/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleExport.mjs
new file mode 100644
index 0000000000..ba2bbae16b
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleExport.mjs
@@ -0,0 +1 @@
+export let x = 126;
diff --git a/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleImportMap.mjs b/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleImportMap.mjs
new file mode 100644
index 0000000000..00819aefd1
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/scope1/scope2/module_simpleImportMap.mjs
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unresolved
+import { x } from "simple";
+
+result_scope2 = x;
diff --git a/dom/base/test/jsmodules/importmaps/test_bug_1865410.html b/dom/base/test/jsmodules/importmaps/test_bug_1865410.html
new file mode 100644
index 0000000000..a59aba368d
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_bug_1865410.html
@@ -0,0 +1,27 @@
+
+
+Bug 1865410: Test interaction between speculative preload and import maps
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_bug_1873417.html b/dom/base/test/jsmodules/importmaps/test_bug_1873417.html
new file mode 100644
index 0000000000..9ae689be3b
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_bug_1873417.html
@@ -0,0 +1,39 @@
+
+
+Bug 1873417: Test if import-maps will block module script execution
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_dynamic_import_reject_importMap.html b/dom/base/test/jsmodules/importmaps/test_dynamic_import_reject_importMap.html
new file mode 100644
index 0000000000..96744c9317
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_dynamic_import_reject_importMap.html
@@ -0,0 +1,46 @@
+
+
+
+ Test import map should be rejected.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_externalImportMap.html b/dom/base/test/jsmodules/importmaps/test_externalImportMap.html
new file mode 100644
index 0000000000..1345f61947
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_externalImportMap.html
@@ -0,0 +1,43 @@
+
+
+Test an external import map
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_importMap_with_external_script.html b/dom/base/test/jsmodules/importmaps/test_importMap_with_external_script.html
new file mode 100644
index 0000000000..3b21003feb
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_importMap_with_external_script.html
@@ -0,0 +1,75 @@
+
+
+
+Test speculative preload of external script doesn't conflict with import map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html b/dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html
new file mode 100644
index 0000000000..5c81dd548e
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html
@@ -0,0 +1,49 @@
+
+
+
+ Test import.meta.resolve with import maps
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_inline_module_reject_importMap.html b/dom/base/test/jsmodules/importmaps/test_inline_module_reject_importMap.html
new file mode 100644
index 0000000000..458601619a
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_inline_module_reject_importMap.html
@@ -0,0 +1,61 @@
+
+
+
+ Test import map should be rejected.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html b/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html
new file mode 100644
index 0000000000..531431fcf0
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html
@@ -0,0 +1,51 @@
+
+
+
+ Test a simple import map with a base element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base2.html b/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base2.html
new file mode 100644
index 0000000000..7ab3fe96da
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base2.html
@@ -0,0 +1,51 @@
+
+
+
+ Test a simple import map with a script creates a base element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_module_script_reject_importMap.html b/dom/base/test/jsmodules/importmaps/test_module_script_reject_importMap.html
new file mode 100644
index 0000000000..88db016e3d
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_module_script_reject_importMap.html
@@ -0,0 +1,45 @@
+
+
+
+ Test import map should be rejected.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_parse_importMap_failed.html b/dom/base/test/jsmodules/importmaps/test_parse_importMap_failed.html
new file mode 100644
index 0000000000..b304acd943
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_parse_importMap_failed.html
@@ -0,0 +1,40 @@
+
+
+
+ Test the error message when parsing import maps failed
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_reject_multiple_importMaps.html b/dom/base/test/jsmodules/importmaps/test_reject_multiple_importMaps.html
new file mode 100644
index 0000000000..2a3498094c
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_reject_multiple_importMaps.html
@@ -0,0 +1,64 @@
+
+
+
+ Test the 2nd import map should be rejected.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_simpleImportMap.html b/dom/base/test/jsmodules/importmaps/test_simpleImportMap.html
new file mode 100644
index 0000000000..5323da31a9
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_simpleImportMap.html
@@ -0,0 +1,62 @@
+
+
+Test a simple import map
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/importmaps/test_sortedImportMap.html b/dom/base/test/jsmodules/importmaps/test_sortedImportMap.html
new file mode 100644
index 0000000000..f4b98fdf10
--- /dev/null
+++ b/dom/base/test/jsmodules/importmaps/test_sortedImportMap.html
@@ -0,0 +1,62 @@
+
+
+Test a sorted import map
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/module_badImport.mjs b/dom/base/test/jsmodules/module_badImport.mjs
new file mode 100644
index 0000000000..9d72b27c43
--- /dev/null
+++ b/dom/base/test/jsmodules/module_badImport.mjs
@@ -0,0 +1,2 @@
+/* eslint-disable import/no-unassigned-import, import/no-unresolved */
+import "invalid specifier";
diff --git a/dom/base/test/jsmodules/module_badSyntax.mjs b/dom/base/test/jsmodules/module_badSyntax.mjs
new file mode 100644
index 0000000000..744158108c
--- /dev/null
+++ b/dom/base/test/jsmodules/module_badSyntax.mjs
@@ -0,0 +1,3 @@
+// Module with a syntax error.
+some invalid js syntax;
+wasRun = true;
diff --git a/dom/base/test/jsmodules/module_cyclic1.mjs b/dom/base/test/jsmodules/module_cyclic1.mjs
new file mode 100644
index 0000000000..197a94989a
--- /dev/null
+++ b/dom/base/test/jsmodules/module_cyclic1.mjs
@@ -0,0 +1,8 @@
+import { func2 } from "./module_cyclic2.mjs";
+
+export function func1(x, y) {
+ if (x <= 0) {
+ return y;
+ }
+ return func2(x - 1, y + "1");
+}
diff --git a/dom/base/test/jsmodules/module_cyclic2.mjs b/dom/base/test/jsmodules/module_cyclic2.mjs
new file mode 100644
index 0000000000..7ecec80c65
--- /dev/null
+++ b/dom/base/test/jsmodules/module_cyclic2.mjs
@@ -0,0 +1,8 @@
+import { func3 } from "./module_cyclic3.mjs";
+
+export function func2(x, y) {
+ if (x <= 0) {
+ return y;
+ }
+ return func3(x - 1, y + "2");
+}
diff --git a/dom/base/test/jsmodules/module_cyclic3.mjs b/dom/base/test/jsmodules/module_cyclic3.mjs
new file mode 100644
index 0000000000..9458391d2e
--- /dev/null
+++ b/dom/base/test/jsmodules/module_cyclic3.mjs
@@ -0,0 +1,8 @@
+import { func1 } from "./module_cyclic1.mjs";
+
+export function func3(x, y) {
+ if (x <= 0) {
+ return y;
+ }
+ return func1(x - 1, y + "3");
+}
diff --git a/dom/base/test/jsmodules/module_extractIntroType.mjs b/dom/base/test/jsmodules/module_extractIntroType.mjs
new file mode 100644
index 0000000000..a5daa8f0ef
--- /dev/null
+++ b/dom/base/test/jsmodules/module_extractIntroType.mjs
@@ -0,0 +1,6 @@
+// Extract the introductionType for this module in conjunction with
+// iframe_extractIntroType.html.
+extractIntroType = function () {
+ // eslint-disable-next-line no-debugger
+ debugger;
+};
diff --git a/dom/base/test/jsmodules/module_large1.mjs b/dom/base/test/jsmodules/module_large1.mjs
new file mode 100644
index 0000000000..d6933d298d
--- /dev/null
+++ b/dom/base/test/jsmodules/module_large1.mjs
@@ -0,0 +1,78 @@
+/*
+ * Scripts larger than 5KB may be compiled off main thread. This is such a
+ * script.
+ *
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ */
+
+results.push(1);
diff --git a/dom/base/test/jsmodules/module_large2.mjs b/dom/base/test/jsmodules/module_large2.mjs
new file mode 100644
index 0000000000..e1b6da4c91
--- /dev/null
+++ b/dom/base/test/jsmodules/module_large2.mjs
@@ -0,0 +1,78 @@
+/*
+ * Scripts larger than 5KB may be compiled off main thread. This is such a
+ * script.
+ *
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ */
+
+results.push(2);
diff --git a/dom/base/test/jsmodules/module_large3.mjs b/dom/base/test/jsmodules/module_large3.mjs
new file mode 100644
index 0000000000..c966a8eb20
--- /dev/null
+++ b/dom/base/test/jsmodules/module_large3.mjs
@@ -0,0 +1,78 @@
+/*
+ * Scripts larger than 5KB may be compiled off main thread. This is such a
+ * script.
+ *
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ * large large large large large large large large large large large large
+ */
+
+results.push(3);
diff --git a/dom/base/test/jsmodules/module_missingImport.mjs b/dom/base/test/jsmodules/module_missingImport.mjs
new file mode 100644
index 0000000000..3b2ee2bc73
--- /dev/null
+++ b/dom/base/test/jsmodules/module_missingImport.mjs
@@ -0,0 +1 @@
+import { missing } from "./module_simple1.mjs";
diff --git a/dom/base/test/jsmodules/module_multiImports.mjs b/dom/base/test/jsmodules/module_multiImports.mjs
new file mode 100644
index 0000000000..9fe9516f92
--- /dev/null
+++ b/dom/base/test/jsmodules/module_multiImports.mjs
@@ -0,0 +1,6 @@
+/* eslint-disable import/no-unassigned-import */
+import "./module_simple1.mjs";
+import "./module_simple2.mjs";
+import "./module_simple3.mjs";
+
+results.push(4);
diff --git a/dom/base/test/jsmodules/module_multiLargeImports.mjs b/dom/base/test/jsmodules/module_multiLargeImports.mjs
new file mode 100644
index 0000000000..c4f32baf4e
--- /dev/null
+++ b/dom/base/test/jsmodules/module_multiLargeImports.mjs
@@ -0,0 +1,6 @@
+/* eslint-disable import/no-unassigned-import */
+import "./module_large1.mjs";
+import "./module_large2.mjs";
+import "./module_large3.mjs";
+
+results.push(4);
diff --git a/dom/base/test/jsmodules/module_setRan.mjs b/dom/base/test/jsmodules/module_setRan.mjs
new file mode 100644
index 0000000000..4804382fdd
--- /dev/null
+++ b/dom/base/test/jsmodules/module_setRan.mjs
@@ -0,0 +1,2 @@
+// Set a global flag to indicate that this module was executed.
+moduleRan = true;
diff --git a/dom/base/test/jsmodules/module_simple1.mjs b/dom/base/test/jsmodules/module_simple1.mjs
new file mode 100644
index 0000000000..7594ac699e
--- /dev/null
+++ b/dom/base/test/jsmodules/module_simple1.mjs
@@ -0,0 +1 @@
+results.push(1);
diff --git a/dom/base/test/jsmodules/module_simple2.mjs b/dom/base/test/jsmodules/module_simple2.mjs
new file mode 100644
index 0000000000..f92a1c9d6e
--- /dev/null
+++ b/dom/base/test/jsmodules/module_simple2.mjs
@@ -0,0 +1 @@
+results.push(2);
diff --git a/dom/base/test/jsmodules/module_simple3.mjs b/dom/base/test/jsmodules/module_simple3.mjs
new file mode 100644
index 0000000000..71979926e6
--- /dev/null
+++ b/dom/base/test/jsmodules/module_simple3.mjs
@@ -0,0 +1 @@
+results.push(3);
diff --git a/dom/base/test/jsmodules/module_simpleExport.mjs b/dom/base/test/jsmodules/module_simpleExport.mjs
new file mode 100644
index 0000000000..9714d6d0ab
--- /dev/null
+++ b/dom/base/test/jsmodules/module_simpleExport.mjs
@@ -0,0 +1 @@
+export let x = 42;
diff --git a/dom/base/test/jsmodules/module_simpleImport.mjs b/dom/base/test/jsmodules/module_simpleImport.mjs
new file mode 100644
index 0000000000..7a9d05325b
--- /dev/null
+++ b/dom/base/test/jsmodules/module_simpleImport.mjs
@@ -0,0 +1,3 @@
+import { x } from "./module_simpleExport.mjs";
+
+result = x;
diff --git a/dom/base/test/jsmodules/module_testSyntax.mjs b/dom/base/test/jsmodules/module_testSyntax.mjs
new file mode 100644
index 0000000000..3d647ae0b4
--- /dev/null
+++ b/dom/base/test/jsmodules/module_testSyntax.mjs
@@ -0,0 +1,3 @@
+// Module that throws a syntax error if parsed as a script.
+export default 1;
+wasRun = true;
diff --git a/dom/base/test/jsmodules/moz.build b/dom/base/test/jsmodules/moz.build
new file mode 100644
index 0000000000..36ed046708
--- /dev/null
+++ b/dom/base/test/jsmodules/moz.build
@@ -0,0 +1,7 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+MOCHITEST_CHROME_MANIFESTS += ["chrome.toml"]
diff --git a/dom/base/test/jsmodules/no_export.mjs b/dom/base/test/jsmodules/no_export.mjs
new file mode 100644
index 0000000000..7d519cc264
--- /dev/null
+++ b/dom/base/test/jsmodules/no_export.mjs
@@ -0,0 +1 @@
+const y = 1;
diff --git a/dom/base/test/jsmodules/no_indirect_export.mjs b/dom/base/test/jsmodules/no_indirect_export.mjs
new file mode 100644
index 0000000000..1fcc87bf88
--- /dev/null
+++ b/dom/base/test/jsmodules/no_indirect_export.mjs
@@ -0,0 +1 @@
+export { a } from "./no_export.mjs";
diff --git a/dom/base/test/jsmodules/script_simple2.js b/dom/base/test/jsmodules/script_simple2.js
new file mode 100644
index 0000000000..f92a1c9d6e
--- /dev/null
+++ b/dom/base/test/jsmodules/script_simple2.js
@@ -0,0 +1 @@
+results.push(2);
diff --git a/dom/base/test/jsmodules/test_asyncInlineModules.html b/dom/base/test/jsmodules/test_asyncInlineModules.html
new file mode 100644
index 0000000000..47df5f1d03
--- /dev/null
+++ b/dom/base/test/jsmodules/test_asyncInlineModules.html
@@ -0,0 +1,36 @@
+
+
+Test async inline modules
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_cyclicImport.html b/dom/base/test/jsmodules/test_cyclicImport.html
new file mode 100644
index 0000000000..8fb78c4f93
--- /dev/null
+++ b/dom/base/test/jsmodules/test_cyclicImport.html
@@ -0,0 +1,18 @@
+
+
+Test cyclic module imports
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_dynamicImportErrorMessage.html b/dom/base/test/jsmodules/test_dynamicImportErrorMessage.html
new file mode 100644
index 0000000000..f5552d5a6b
--- /dev/null
+++ b/dom/base/test/jsmodules/test_dynamicImportErrorMessage.html
@@ -0,0 +1,16 @@
+
+
+Test the error message from import()
+
+
+
diff --git a/dom/base/test/jsmodules/test_importIntroType.html b/dom/base/test/jsmodules/test_importIntroType.html
new file mode 100644
index 0000000000..f08aea1925
--- /dev/null
+++ b/dom/base/test/jsmodules/test_importIntroType.html
@@ -0,0 +1,22 @@
+
+
+Test introduction type of an imported module
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_importNotFound.html b/dom/base/test/jsmodules/test_importNotFound.html
new file mode 100644
index 0000000000..aac2f58bb5
--- /dev/null
+++ b/dom/base/test/jsmodules/test_importNotFound.html
@@ -0,0 +1,27 @@
+
+
+Test what happens when a module import is not found
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_importResolveFailed.html b/dom/base/test/jsmodules/test_importResolveFailed.html
new file mode 100644
index 0000000000..8b15a1762a
--- /dev/null
+++ b/dom/base/test/jsmodules/test_importResolveFailed.html
@@ -0,0 +1,21 @@
+
+
+Test error thrown when an import cannot be resolved
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_import_errorMessage.html b/dom/base/test/jsmodules/test_import_errorMessage.html
new file mode 100644
index 0000000000..6ab0b1dd74
--- /dev/null
+++ b/dom/base/test/jsmodules/test_import_errorMessage.html
@@ -0,0 +1,47 @@
+
+
+Test module import error message
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_import_meta_resolve.html b/dom/base/test/jsmodules/test_import_meta_resolve.html
new file mode 100644
index 0000000000..66eedc95bc
--- /dev/null
+++ b/dom/base/test/jsmodules/test_import_meta_resolve.html
@@ -0,0 +1,65 @@
+
+
+
+ Test import.meta.resolve
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_importedModuleMemoization.html b/dom/base/test/jsmodules/test_importedModuleMemoization.html
new file mode 100644
index 0000000000..df7686fb70
--- /dev/null
+++ b/dom/base/test/jsmodules/test_importedModuleMemoization.html
@@ -0,0 +1,30 @@
+
+
+Test imported modules are momoized and only loaded once
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_linkErrorInCommon1.html b/dom/base/test/jsmodules/test_linkErrorInCommon1.html
new file mode 100644
index 0000000000..251b96d367
--- /dev/null
+++ b/dom/base/test/jsmodules/test_linkErrorInCommon1.html
@@ -0,0 +1,32 @@
+
+
+Test handling of a link error in a common module
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_linkErrorInCommon2.html b/dom/base/test/jsmodules/test_linkErrorInCommon2.html
new file mode 100644
index 0000000000..77f0bab0b9
--- /dev/null
+++ b/dom/base/test/jsmodules/test_linkErrorInCommon2.html
@@ -0,0 +1,32 @@
+
+
+Test handling of a link error in a common module
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_moduleNotFound.html b/dom/base/test/jsmodules/test_moduleNotFound.html
new file mode 100644
index 0000000000..d8662c9494
--- /dev/null
+++ b/dom/base/test/jsmodules/test_moduleNotFound.html
@@ -0,0 +1,24 @@
+
+
+Test what happens when a top-level module is not found
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_moduleParsedAsModule.html b/dom/base/test/jsmodules/test_moduleParsedAsModule.html
new file mode 100644
index 0000000000..33000271dc
--- /dev/null
+++ b/dom/base/test/jsmodules/test_moduleParsedAsModule.html
@@ -0,0 +1,23 @@
+
+
+Test module script parsed as module
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_moduleScriptsRun.html b/dom/base/test/jsmodules/test_moduleScriptsRun.html
new file mode 100644
index 0000000000..193b5ba386
--- /dev/null
+++ b/dom/base/test/jsmodules/test_moduleScriptsRun.html
@@ -0,0 +1,19 @@
+
+
+Test script elements with type="module" are run for chrome HTML
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_multiAsyncImports.html b/dom/base/test/jsmodules/test_multiAsyncImports.html
new file mode 100644
index 0000000000..07d9776b82
--- /dev/null
+++ b/dom/base/test/jsmodules/test_multiAsyncImports.html
@@ -0,0 +1,30 @@
+
+
+Test a loading multiple modules with the async attribute from top level
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_multiModuleImports.html b/dom/base/test/jsmodules/test_multiModuleImports.html
new file mode 100644
index 0000000000..924b3bce55
--- /dev/null
+++ b/dom/base/test/jsmodules/test_multiModuleImports.html
@@ -0,0 +1,28 @@
+
+
+Test a importing multiple modules from a module
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_multiModuleLargeImports.html b/dom/base/test/jsmodules/test_multiModuleLargeImports.html
new file mode 100644
index 0000000000..2e788e1469
--- /dev/null
+++ b/dom/base/test/jsmodules/test_multiModuleLargeImports.html
@@ -0,0 +1,28 @@
+
+
+Test importing multiple large modules which may be compiled off main thread from a module
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_multiTopLevelImports.html b/dom/base/test/jsmodules/test_multiTopLevelImports.html
new file mode 100644
index 0000000000..1e4652e827
--- /dev/null
+++ b/dom/base/test/jsmodules/test_multiTopLevelImports.html
@@ -0,0 +1,30 @@
+
+
+Test importing multiple modules from top level
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_multiTopLevelLargeImports.html b/dom/base/test/jsmodules/test_multiTopLevelLargeImports.html
new file mode 100644
index 0000000000..3ec7241061
--- /dev/null
+++ b/dom/base/test/jsmodules/test_multiTopLevelLargeImports.html
@@ -0,0 +1,30 @@
+
+
+Test a importing large modules which may be compiled off main thread
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_scriptInsertedModule.html b/dom/base/test/jsmodules/test_scriptInsertedModule.html
new file mode 100644
index 0000000000..09a03f3186
--- /dev/null
+++ b/dom/base/test/jsmodules/test_scriptInsertedModule.html
@@ -0,0 +1,20 @@
+
+
+Test a script-inserted module
+
+
+
diff --git a/dom/base/test/jsmodules/test_scriptModuleOrder.html b/dom/base/test/jsmodules/test_scriptModuleOrder.html
new file mode 100644
index 0000000000..bec30a3350
--- /dev/null
+++ b/dom/base/test/jsmodules/test_scriptModuleOrder.html
@@ -0,0 +1,30 @@
+
+
+Test execution order of deferred scripts and modules
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_scriptNotParsedAsModule.html b/dom/base/test/jsmodules/test_scriptNotParsedAsModule.html
new file mode 100644
index 0000000000..dbad1bc722
--- /dev/null
+++ b/dom/base/test/jsmodules/test_scriptNotParsedAsModule.html
@@ -0,0 +1,23 @@
+
+
+Test classic script not parsed as module
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_simpleImport.html b/dom/base/test/jsmodules/test_simpleImport.html
new file mode 100644
index 0000000000..21d02fdb90
--- /dev/null
+++ b/dom/base/test/jsmodules/test_simpleImport.html
@@ -0,0 +1,16 @@
+
+
+Test a simple module import
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_syntaxError.html b/dom/base/test/jsmodules/test_syntaxError.html
new file mode 100644
index 0000000000..c35179579b
--- /dev/null
+++ b/dom/base/test/jsmodules/test_syntaxError.html
@@ -0,0 +1,30 @@
+
+
+Test syntax errors parsing a module are reported
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_syntaxErrorAsync.html b/dom/base/test/jsmodules/test_syntaxErrorAsync.html
new file mode 100644
index 0000000000..fedf7c1d5c
--- /dev/null
+++ b/dom/base/test/jsmodules/test_syntaxErrorAsync.html
@@ -0,0 +1,30 @@
+
+
+Test syntax errors parsing an async module are reported
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_syntaxErrorInline.html b/dom/base/test/jsmodules/test_syntaxErrorInline.html
new file mode 100644
index 0000000000..4960f5358a
--- /dev/null
+++ b/dom/base/test/jsmodules/test_syntaxErrorInline.html
@@ -0,0 +1,34 @@
+
+
+Test syntax errors parsing an inline module are reported
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_syntaxErrorInlineAsync.html b/dom/base/test/jsmodules/test_syntaxErrorInlineAsync.html
new file mode 100644
index 0000000000..39b8a7354d
--- /dev/null
+++ b/dom/base/test/jsmodules/test_syntaxErrorInlineAsync.html
@@ -0,0 +1,34 @@
+
+
+Test syntax errors parsing an inline async module are reported
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_topLevelIntroType.html b/dom/base/test/jsmodules/test_topLevelIntroType.html
new file mode 100644
index 0000000000..2cc7c12e09
--- /dev/null
+++ b/dom/base/test/jsmodules/test_topLevelIntroType.html
@@ -0,0 +1,21 @@
+
+
+Test introduction type of a top-level module
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_toplevelModuleMemoization.html b/dom/base/test/jsmodules/test_toplevelModuleMemoization.html
new file mode 100644
index 0000000000..0f1d57c6eb
--- /dev/null
+++ b/dom/base/test/jsmodules/test_toplevelModuleMemoization.html
@@ -0,0 +1,30 @@
+
+
+Test toplevel modules are momoized and only loaded once
+
+
+
+
+
+
diff --git a/dom/base/test/jsmodules/test_typeAttrCaseInsensitive.html b/dom/base/test/jsmodules/test_typeAttrCaseInsensitive.html
new file mode 100644
index 0000000000..106e0f9522
--- /dev/null
+++ b/dom/base/test/jsmodules/test_typeAttrCaseInsensitive.html
@@ -0,0 +1,19 @@
+
+
+Test script element's type attribute comparision is case-insensitive
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/mochitest.toml b/dom/base/test/meta_viewport/mochitest.toml
new file mode 100644
index 0000000000..8d7c1a8d38
--- /dev/null
+++ b/dom/base/test/meta_viewport/mochitest.toml
@@ -0,0 +1,102 @@
+[DEFAULT]
+support-files = ["viewport_helpers.js"]
+
+["test_meta_viewport0.html"]
+
+["test_meta_viewport1.html"]
+
+["test_meta_viewport2.html"]
+
+["test_meta_viewport3.html"]
+
+["test_meta_viewport4.html"]
+
+["test_meta_viewport5.html"]
+
+["test_meta_viewport6.html"]
+
+["test_meta_viewport7.html"]
+
+["test_meta_viewport8.html"]
+
+["test_meta_viewport_auto_size_by_device_height.html"]
+
+["test_meta_viewport_auto_size_by_device_width.html"]
+
+["test_meta_viewport_auto_size_by_fixed_height_and_initial_scale_1.html"]
+
+["test_meta_viewport_auto_size_by_fixed_width_and_device_height.html"]
+
+["test_meta_viewport_auto_size_by_fixed_width_and_initial_scale_1.html"]
+
+["test_meta_viewport_auto_size_by_initial_scale_0_5.html"]
+
+["test_meta_viewport_auto_size_by_initial_scale_1.html"]
+
+["test_meta_viewport_auto_size_by_invalid_width.html"]
+
+["test_meta_viewport_auto_size_by_invalid_width_and_fixed_height.html"]
+
+["test_meta_viewport_change_content_among_multiple.html"]
+
+["test_meta_viewport_change_name.html"]
+
+["test_meta_viewport_change_name_among_multiple.html"]
+
+["test_meta_viewport_device_width.html"]
+
+["test_meta_viewport_device_width_with_initial_scale_0_5.html"]
+
+["test_meta_viewport_device_width_with_initial_scale_2.html"]
+
+["test_meta_viewport_empty_content_and_valid_content_tags.html"]
+
+["test_meta_viewport_fit.html"]
+
+["test_meta_viewport_fit_multiple.html"]
+
+["test_meta_viewport_fixed_width_and_zero_display_width.html"]
+
+["test_meta_viewport_initial_scale_0_5.html"]
+
+["test_meta_viewport_initial_scale_2.html"]
+
+["test_meta_viewport_initial_scale_with_trailing_characters.html"]
+
+["test_meta_viewport_insert_before_existing_tag.html"]
+
+["test_meta_viewport_maximum_scale_0.html"]
+
+["test_meta_viewport_maximum_scale_0_5.html"]
+
+["test_meta_viewport_maximum_scale_2.html"]
+
+["test_meta_viewport_multiple_tags.html"]
+
+["test_meta_viewport_negative_width_and_negative_height.html"]
+
+["test_meta_viewport_negative_width_and_no_height.html"]
+
+["test_meta_viewport_negative_width_and_valid_height.html"]
+
+["test_meta_viewport_no_content_and_valid_content_tags.html"]
+
+["test_meta_viewport_no_width_and_negative_height.html"]
+
+["test_meta_viewport_no_width_and_valid_height.html"]
+
+["test_meta_viewport_remove_node.html"]
+
+["test_meta_viewport_remove_node_from_multiple.html"]
+
+["test_meta_viewport_removing_content_attribute.html"]
+
+["test_meta_viewport_replace_content.html"]
+
+["test_meta_viewport_tiny_display_size.html"]
+
+["test_meta_viewport_valid_width_and_negative_height.html"]
+
+["test_meta_viewport_valid_width_and_no_height.html"]
+
+["test_meta_viewport_width_with_trailing_characters.html"]
diff --git a/dom/base/test/meta_viewport/moz.build b/dom/base/test/meta_viewport/moz.build
new file mode 100644
index 0000000000..3ef5d9c8cd
--- /dev/null
+++ b/dom/base/test/meta_viewport/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+MOCHITEST_MANIFESTS += [
+ "mochitest.toml",
+]
diff --git a/dom/base/test/meta_viewport/test_meta_viewport0.html b/dom/base/test/meta_viewport/test_meta_viewport0.html
new file mode 100644
index 0000000000..8fef72c578
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport0.html
@@ -0,0 +1,41 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+ No <meta name="viewport"> tag
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport1.html b/dom/base/test/meta_viewport/test_meta_viewport1.html
new file mode 100644
index 0000000000..66dd02461e
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport1.html
@@ -0,0 +1,41 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ width=device-width, initial-scale=1
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport2.html b/dom/base/test/meta_viewport/test_meta_viewport2.html
new file mode 100644
index 0000000000..e0f45813be
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport2.html
@@ -0,0 +1,41 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ width=device-width
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport3.html b/dom/base/test/meta_viewport/test_meta_viewport3.html
new file mode 100644
index 0000000000..32464bd126
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport3.html
@@ -0,0 +1,43 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ width=320
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport4.html b/dom/base/test/meta_viewport/test_meta_viewport4.html
new file mode 100644
index 0000000000..bc7f7ada55
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport4.html
@@ -0,0 +1,42 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ initial-scale=1.0, user-scalable=no
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport5.html b/dom/base/test/meta_viewport/test_meta_viewport5.html
new file mode 100644
index 0000000000..938cc052ee
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport5.html
@@ -0,0 +1,24 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ user-scalable=NO
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport6.html b/dom/base/test/meta_viewport/test_meta_viewport6.html
new file mode 100644
index 0000000000..e3ca1b72aa
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport6.html
@@ -0,0 +1,47 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ width=2000, minimum-scale=0.75
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport7.html b/dom/base/test/meta_viewport/test_meta_viewport7.html
new file mode 100644
index 0000000000..1f40c27109
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport7.html
@@ -0,0 +1,71 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ Dynamic viewport updates
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport8.html b/dom/base/test/meta_viewport/test_meta_viewport8.html
new file mode 100644
index 0000000000..4c711c9cc6
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport8.html
@@ -0,0 +1,27 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ minimum-scale=0.01
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_device_height.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_device_height.html
new file mode 100644
index 0000000000..1b6c35a602
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_device_height.html
@@ -0,0 +1,24 @@
+
+
+
+
+ device-height enables autoSize
+
+
+
+
+
+
+ height=device-height
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_device_width.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_device_width.html
new file mode 100644
index 0000000000..fb91f2e50c
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_device_width.html
@@ -0,0 +1,24 @@
+
+
+
+
+ device-width enables autoSize
+
+
+
+
+
+
+ width=device-width
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_height_and_initial_scale_1.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_height_and_initial_scale_1.html
new file mode 100644
index 0000000000..83346f4924
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_height_and_initial_scale_1.html
@@ -0,0 +1,25 @@
+
+
+
+
+ initial-scale=1 with fixed height enable autoSize
+
+
+
+
+
+
+ height=400, initial-scale=1
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_width_and_device_height.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_width_and_device_height.html
new file mode 100644
index 0000000000..e570f80644
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_width_and_device_height.html
@@ -0,0 +1,25 @@
+
+
+
+
+ Fixed width and device-height disables autoSize
+
+
+
+
+
+
+ width=400, height=device-height
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_width_and_initial_scale_1.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_width_and_initial_scale_1.html
new file mode 100644
index 0000000000..4453b4c959
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_fixed_width_and_initial_scale_1.html
@@ -0,0 +1,25 @@
+
+
+
+
+ initial-scale=1 with fixed width disables autoSize
+
+
+
+
+
+
+ width=400, initial-scale=1
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_initial_scale_0_5.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_initial_scale_0_5.html
new file mode 100644
index 0000000000..ff12b22454
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_initial_scale_0_5.html
@@ -0,0 +1,25 @@
+
+
+
+
+ initial-scale!=1 without width disables autoSize
+
+
+
+
+
+
+ initial-scale!=1
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_initial_scale_1.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_initial_scale_1.html
new file mode 100644
index 0000000000..e86742b8f2
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_initial_scale_1.html
@@ -0,0 +1,25 @@
+
+
+
+
+ initial-scale=1 without width enables autoSize
+
+
+
+
+
+
+ initial-scale=1
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_invalid_width.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_invalid_width.html
new file mode 100644
index 0000000000..6c950185bc
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_invalid_width.html
@@ -0,0 +1,24 @@
+
+
+
+
+ invalid width enables autoSize
+
+
+
+
+
+
+ width=-1
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_invalid_width_and_fixed_height.html b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_invalid_width_and_fixed_height.html
new file mode 100644
index 0000000000..db68ecb6ec
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_auto_size_by_invalid_width_and_fixed_height.html
@@ -0,0 +1,25 @@
+
+
+
+
+ invalid width but with fixed height disables autoSize
+
+
+
+
+
+
+ width=-1,height=200
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_change_content_among_multiple.html b/dom/base/test/meta_viewport/test_meta_viewport_change_content_among_multiple.html
new file mode 100644
index 0000000000..8ec88b8920
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_change_content_among_multiple.html
@@ -0,0 +1,52 @@
+
+
+
+
+ content attribute changes among multiple meta viewport tags
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_change_name.html b/dom/base/test/meta_viewport/test_meta_viewport_change_name.html
new file mode 100644
index 0000000000..84b9c321df
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_change_name.html
@@ -0,0 +1,47 @@
+
+
+
+
+ name attribute changes
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_change_name_among_multiple.html b/dom/base/test/meta_viewport/test_meta_viewport_change_name_among_multiple.html
new file mode 100644
index 0000000000..ca41577bbe
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_change_name_among_multiple.html
@@ -0,0 +1,44 @@
+
+
+
+
+ name attribute changes among multiple meta viewport tags
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_device_width.html b/dom/base/test/meta_viewport/test_meta_viewport_device_width.html
new file mode 100644
index 0000000000..0e1f2f1dac
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_device_width.html
@@ -0,0 +1,25 @@
+
+
+
+
+ device-width in meta viewport
+
+
+
+
+
+
+ width=device-width
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_device_width_with_initial_scale_0_5.html b/dom/base/test/meta_viewport/test_meta_viewport_device_width_with_initial_scale_0_5.html
new file mode 100644
index 0000000000..fc3192c854
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_device_width_with_initial_scale_0_5.html
@@ -0,0 +1,26 @@
+
+
+
+
+ device-width with initial-scale=0.5 in meta viewport
+
+
+
+
+
+
+ width=device-width, initial-scale=0.5
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_device_width_with_initial_scale_2.html b/dom/base/test/meta_viewport/test_meta_viewport_device_width_with_initial_scale_2.html
new file mode 100644
index 0000000000..e701266e60
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_device_width_with_initial_scale_2.html
@@ -0,0 +1,31 @@
+
+
+
+
+ device-width with initial-scale=2 in meta viewport
+
+
+
+
+
+
+ width=device-width, initial-scale=2
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_empty_content_and_valid_content_tags.html b/dom/base/test/meta_viewport/test_meta_viewport_empty_content_and_valid_content_tags.html
new file mode 100644
index 0000000000..6de2e08c40
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_empty_content_and_valid_content_tags.html
@@ -0,0 +1,26 @@
+
+
+
+
+ a valid meta viewport tag and empty content attribute viewport tag
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_fit.html b/dom/base/test/meta_viewport/test_meta_viewport_fit.html
new file mode 100644
index 0000000000..e86ad817d6
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_fit.html
@@ -0,0 +1,34 @@
+
+
+
+
+ meta viewport viewport-fit test
+
+
+
+
+
+
+ viewport-fit=cover
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_fit_multiple.html b/dom/base/test/meta_viewport/test_meta_viewport_fit_multiple.html
new file mode 100644
index 0000000000..e204bb70f6
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_fit_multiple.html
@@ -0,0 +1,25 @@
+
+
+
+
+ multiple meta viewport viewport-fit test
+
+
+
+
+
+
+
+ viewport-fit=cover
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_fixed_width_and_zero_display_width.html b/dom/base/test/meta_viewport/test_meta_viewport_fixed_width_and_zero_display_width.html
new file mode 100644
index 0000000000..e649ad9fcd
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_fixed_width_and_zero_display_width.html
@@ -0,0 +1,29 @@
+
+
+
+
+ Fixed meta viewport width, zero display width
+
+
+
+
+
+
+ Fixed meta viewport width, zero display width
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_0_5.html b/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_0_5.html
new file mode 100644
index 0000000000..99fb5c1d36
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_0_5.html
@@ -0,0 +1,33 @@
+
+
+
+
+ initial-scale=0.5 in meta viewport
+
+
+
+
+
+
+ initial-scale=0.5
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_2.html b/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_2.html
new file mode 100644
index 0000000000..22f0adc061
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_2.html
@@ -0,0 +1,26 @@
+
+
+
+
+ initial-scale=2 in meta viewport
+
+
+
+
+
+
+ initial-scale=2
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_with_trailing_characters.html b/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_with_trailing_characters.html
new file mode 100644
index 0000000000..5939691cb5
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_initial_scale_with_trailing_characters.html
@@ -0,0 +1,26 @@
+
+
+
+
+ initial-scale with trailing characters in meta viewport
+
+
+
+
+
+
+ initial-scale=1.0/
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_insert_before_existing_tag.html b/dom/base/test/meta_viewport/test_meta_viewport_insert_before_existing_tag.html
new file mode 100644
index 0000000000..e2162c81f8
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_insert_before_existing_tag.html
@@ -0,0 +1,32 @@
+
+
+
+
+ interting a meta viewport tag before existing one
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_0.html b/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_0.html
new file mode 100644
index 0000000000..893f3128d9
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_0.html
@@ -0,0 +1,28 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ width=device-width, minimum-scale=1, maximum-scale=0
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_0_5.html b/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_0_5.html
new file mode 100644
index 0000000000..7f17ef146e
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_0_5.html
@@ -0,0 +1,29 @@
+
+
+
+
+ maximum-scale=0.5 in meta viewport
+
+
+
+
+
+
+ maximum-scale=0.5
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_2.html b/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_2.html
new file mode 100644
index 0000000000..2fe3baf27d
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_maximum_scale_2.html
@@ -0,0 +1,26 @@
+
+
+
+
+ maximum-scale=2 in meta viewport
+
+
+
+
+
+
+ maximum-scale=2
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_multiple_tags.html b/dom/base/test/meta_viewport/test_meta_viewport_multiple_tags.html
new file mode 100644
index 0000000000..816dd62061
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_multiple_tags.html
@@ -0,0 +1,28 @@
+
+
+
+
+ multilple meta viewport tags
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_negative_height.html b/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_negative_height.html
new file mode 100644
index 0000000000..e458cbc8dd
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_negative_height.html
@@ -0,0 +1,27 @@
+
+
+
+
+ negative width and height in meta viewport
+
+
+
+
+
+
+ width=-400, height=-240
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_no_height.html b/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_no_height.html
new file mode 100644
index 0000000000..2369f3b4f3
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_no_height.html
@@ -0,0 +1,25 @@
+
+
+
+
+ negative width in meta viewport
+
+
+
+
+
+
+ width=-400
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_valid_height.html b/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_valid_height.html
new file mode 100644
index 0000000000..579712504d
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_negative_width_and_valid_height.html
@@ -0,0 +1,25 @@
+
+
+
+
+ negative width and valid height in meta viewport
+
+
+
+
+
+
+ width=-400, height=240
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_no_content_and_valid_content_tags.html b/dom/base/test/meta_viewport/test_meta_viewport_no_content_and_valid_content_tags.html
new file mode 100644
index 0000000000..f5a78d9eec
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_no_content_and_valid_content_tags.html
@@ -0,0 +1,25 @@
+
+
+
+
+ a valid meta viewport tag and no content attribute viewport tag
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_no_width_and_negative_height.html b/dom/base/test/meta_viewport/test_meta_viewport_no_width_and_negative_height.html
new file mode 100644
index 0000000000..0e0d37812b
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_no_width_and_negative_height.html
@@ -0,0 +1,26 @@
+
+
+
+
+ negative height in meta viewport
+
+
+
+
+
+
+ height=-200
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_no_width_and_valid_height.html b/dom/base/test/meta_viewport/test_meta_viewport_no_width_and_valid_height.html
new file mode 100644
index 0000000000..a7be88ec40
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_no_width_and_valid_height.html
@@ -0,0 +1,25 @@
+
+
+
+
+ valid height in meta viewport
+
+
+
+
+
+
+ height=240
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_remove_node.html b/dom/base/test/meta_viewport/test_meta_viewport_remove_node.html
new file mode 100644
index 0000000000..12104cdf50
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_remove_node.html
@@ -0,0 +1,34 @@
+
+
+
+
+ remove meta viewport node
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_remove_node_from_multiple.html b/dom/base/test/meta_viewport/test_meta_viewport_remove_node_from_multiple.html
new file mode 100644
index 0000000000..b967967cc1
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_remove_node_from_multiple.html
@@ -0,0 +1,44 @@
+
+
+
+
+ remove a meta viewport node from multiple ones
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_removing_content_attribute.html b/dom/base/test/meta_viewport/test_meta_viewport_removing_content_attribute.html
new file mode 100644
index 0000000000..784a503e9f
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_removing_content_attribute.html
@@ -0,0 +1,33 @@
+
+
+
+
+ removing content attribute
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_replace_content.html b/dom/base/test/meta_viewport/test_meta_viewport_replace_content.html
new file mode 100644
index 0000000000..202c62362b
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_replace_content.html
@@ -0,0 +1,39 @@
+
+
+
+
+ replace meta viewport content
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_tiny_display_size.html b/dom/base/test/meta_viewport/test_meta_viewport_tiny_display_size.html
new file mode 100644
index 0000000000..8e47fc677a
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_tiny_display_size.html
@@ -0,0 +1,28 @@
+
+
+
+
+ meta viewport test
+
+
+
+
+
+
+ width=device-width
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_valid_width_and_negative_height.html b/dom/base/test/meta_viewport/test_meta_viewport_valid_width_and_negative_height.html
new file mode 100644
index 0000000000..10bce57d87
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_valid_width_and_negative_height.html
@@ -0,0 +1,26 @@
+
+
+
+
+ valid width and negative height in meta viewport
+
+
+
+
+
+
+ width=400, height=-200
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_valid_width_and_no_height.html b/dom/base/test/meta_viewport/test_meta_viewport_valid_width_and_no_height.html
new file mode 100644
index 0000000000..b24ce680a7
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_valid_width_and_no_height.html
@@ -0,0 +1,26 @@
+
+
+
+
+ valid width in meta viewport
+
+
+
+
+
+
+ width=400
+
+
+
diff --git a/dom/base/test/meta_viewport/test_meta_viewport_width_with_trailing_characters.html b/dom/base/test/meta_viewport/test_meta_viewport_width_with_trailing_characters.html
new file mode 100644
index 0000000000..f3545d057b
--- /dev/null
+++ b/dom/base/test/meta_viewport/test_meta_viewport_width_with_trailing_characters.html
@@ -0,0 +1,26 @@
+
+
+
+
+ width with trailing characters in meta viewport
+
+
+
+
+
+
+ width=400/
+
+
+
diff --git a/dom/base/test/meta_viewport/viewport_helpers.js b/dom/base/test/meta_viewport/viewport_helpers.js
new file mode 100644
index 0000000000..d4d346b5d0
--- /dev/null
+++ b/dom/base/test/meta_viewport/viewport_helpers.js
@@ -0,0 +1,44 @@
+function scaleRatio(scale) {
+ return {
+ set: [
+ ["layout.css.devPixelsPerPx", "" + scale],
+ ["dom.meta-viewport.enabled", true],
+ ],
+ };
+}
+
+function getViewportInfo(aDisplayWidth, aDisplayHeight) {
+ let defaultZoom = {},
+ allowZoom = {},
+ minZoom = {},
+ maxZoom = {},
+ width = {},
+ height = {},
+ autoSize = {};
+
+ let cwu = SpecialPowers.getDOMWindowUtils(window);
+ cwu.getViewportInfo(
+ aDisplayWidth,
+ aDisplayHeight,
+ defaultZoom,
+ allowZoom,
+ minZoom,
+ maxZoom,
+ width,
+ height,
+ autoSize
+ );
+ return {
+ defaultZoom: defaultZoom.value,
+ minZoom: minZoom.value,
+ maxZoom: maxZoom.value,
+ width: width.value,
+ height: height.value,
+ autoSize: autoSize.value,
+ allowZoom: allowZoom.value,
+ };
+}
+
+function fuzzeq(a, b, msg) {
+ ok(Math.abs(a - b) < 1e-6, msg);
+}
diff --git a/dom/base/test/mochitest.toml b/dom/base/test/mochitest.toml
new file mode 100644
index 0000000000..6415c4b33b
--- /dev/null
+++ b/dom/base/test/mochitest.toml
@@ -0,0 +1,1788 @@
+[DEFAULT]
+tags = "condprof"
+prefs = [
+ "formhelper.autozoom.force-disable.test-only=true",
+ "plugins.rewrite_youtube_embeds=true",
+ "dom.domrequest.enabled=true",
+]
+support-files = [
+ "audio.ogg",
+ "iframe_bug962251.html",
+ "iframe_bug976673.html",
+ "iframe_main_bug1022229.html",
+ "iframe_sandbox_bug1022229.html",
+ "file_empty.html",
+ "iframe_postMessage_solidus.html",
+ "file_setname.html",
+ "345339_iframe.html",
+ "Ahem.ttf",
+ "accesscontrol.resource",
+ "accesscontrol.resource^headers^",
+ "badContentType.eventsource",
+ "badContentType.eventsource^headers^",
+ "badHTTPResponseCode.eventsource",
+ "badHTTPResponseCode.eventsource^headers^",
+ "badMessageEvent.eventsource",
+ "badMessageEvent.eventsource^headers^",
+ "badMessageEvent2.eventsource",
+ "badMessageEvent2.eventsource^headers^",
+ "bug282547.sjs",
+ "bug298064-subframe.html",
+ "bug313646.txt",
+ "bug382113_object.html",
+ "bug403852_fileOpener.js",
+ "bug419132.html",
+ "bug426308-redirect.sjs",
+ "bug435425.sjs",
+ "bug435425_redirect.sjs",
+ "bug444322.js",
+ "bug444322.txt",
+ "bug455629-helper.svg",
+ "bug457746.sjs",
+ "bug461735-post-redirect.js",
+ "bug461735-redirect1.sjs",
+ "bug461735-redirect2.sjs",
+ "bug466080.sjs",
+ "bug466409-empty.css",
+ "bug466409-page.html",
+ "bug475156.sjs",
+ "bug482935.sjs",
+ "bug540854.sjs",
+ "bug578096LoadChromeScript.js",
+ "bug638112-response.txt",
+ "bug638112.sjs",
+ "bug696301-script-1.js",
+ "bug696301-script-1.js^headers^",
+ "bug696301-script-2.js",
+ "bug704320.sjs",
+ "bug704320_counter.sjs",
+ "bug819051.sjs",
+ "bug1576154.sjs",
+ "chrome/bug418986-1.js",
+ "copypaste.js",
+ "delayedServerEvents.sjs",
+ "eventsource_message.sjs",
+ "eventsource_reconnect.sjs",
+ "eventsource.resource",
+ "eventsource.resource^headers^",
+ "eventsource_redirect.resource",
+ "eventsource_redirect.resource^headers^",
+ "eventsource_redirect_to.resource",
+ "eventsource_redirect_to.resource^headers^",
+ "eventsource_worker.js",
+ "file_bug1091883_frame.html",
+ "file_bug1091883_subframe.html",
+ "file_bug1091883_target.html",
+ "file_bug28293.sjs",
+ "file_bug326337.xml",
+ "file_bug326337_inner.html",
+ "file_bug326337_outer.html",
+ "file_bug416317.xhtml",
+ "file_bug426646-1.html",
+ "file_bug426646-2.html",
+ "file_bug428847-1.xhtml",
+ "file_bug428847-2.xhtml",
+ "file_bug498897.css",
+ "file_bug498897.html",
+ "file_bug498897.html^headers^",
+ "file_bug503481.sjs",
+ "file_bug503481b_inner.html",
+ "file_bug541937.html",
+ "file_bug541937.xhtml",
+ "file_bug557892.html",
+ "file_bug562137.txt",
+ "file_bug590812-ref.xhtml",
+ "file_bug590812.xml",
+ "file_bug590870.html",
+ "file_bug601803a.html",
+ "file_bug601803b.html",
+ "file_bug604660-1.xml",
+ "file_bug604660-2.xsl",
+ "file_bug604660-3.js",
+ "file_bug604660-4.js",
+ "file_bug604660-5.xml",
+ "file_bug604660-6.xsl",
+ "file_bug622088.sjs",
+ "file_bug622088_inner.html",
+ "file_bug675121.sjs",
+ "file_bug687859-16.js",
+ "file_bug687859-16.js^headers^",
+ "file_bug687859-bom.js",
+ "file_bug687859-bom.js^headers^",
+ "file_bug687859-charset.js",
+ "file_bug687859-http.js",
+ "file_bug687859-http.js^headers^",
+ "file_bug687859-inherit.js",
+ "file_bug692434.xml",
+ "file_bug704320_preload_attr.html",
+ "file_bug704320_preload_common.js",
+ "file_bug704320_preload_reuse.html",
+ "file_bug704320_redirect.html",
+ "file_bug707142_baseline.json",
+ "file_bug707142_bom.json",
+ "file_bug707142_utf-16.json",
+ "file_bug708620-2.html",
+ "file_bug708620.html",
+ "file_bug753278.html",
+ "file_bug769117.html",
+ "file_bug782342.txt",
+ "file_bug787778.sjs",
+ "file_bug869432.eventsource",
+ "file_bug869432.eventsource^headers^",
+ "file_bug907892.html",
+ "file_bug945152.jar",
+ "file_bug1274806.html",
+ "file_current_inner_window.html",
+ "file_domwindowutils_animation.html",
+ "file_domwindowutils_dynamic_toolbar.html",
+ "file_focus_shadow_dom.html",
+ "file_general_document.html",
+ "file_history_document_open.html",
+ "file_htmlserializer_1.html",
+ "file_htmlserializer_1_bodyonly.html",
+ "file_htmlserializer_1_format.html",
+ "file_htmlserializer_1_linebreak.html",
+ "file_htmlserializer_1_links.html",
+ "file_htmlserializer_1_nested_body.html",
+ "file_htmlserializer_1_no_body.html",
+ "file_htmlserializer_1_noflag.html",
+ "file_htmlserializer_1_noformatpre.html",
+ "file_htmlserializer_1_raw.html",
+ "file_htmlserializer_1_sibling_body.html",
+ "file_htmlserializer_1_sibling_body_only_body.html",
+ "file_htmlserializer_1_wrap.html",
+ "file_htmlserializer_2.html",
+ "file_htmlserializer_2_basic.html",
+ "file_htmlserializer_ipv6.html",
+ "file_htmlserializer_ipv6_out.html",
+ "file_lock_orientation_with_pending_fullscreen.html",
+ "file_mozfiledataurl_img.jpg",
+ "file_restrictedEventSource.sjs",
+ "file_settimeout_inner.html",
+ "file_timer_flood.html",
+ "file_viewport_scroll_quirks.html",
+ "file_viewport_scroll_xml.xml",
+ "file_window_close.html",
+ "file_window_close_2.html",
+ "file_x-frame-options_main.html",
+ "file_x-frame-options_page.sjs",
+ "file_xhtmlserializer_1.xhtml",
+ "file_xhtmlserializer_1_bodyonly.xhtml",
+ "file_xhtmlserializer_1_format.xhtml",
+ "file_xhtmlserializer_1_linebreak.xhtml",
+ "file_xhtmlserializer_1_links.xhtml",
+ "file_xhtmlserializer_1_nested_body.xhtml",
+ "file_xhtmlserializer_1_no_body.xhtml",
+ "file_xhtmlserializer_1_noflag.xhtml",
+ "file_xhtmlserializer_1_noformatpre.xhtml",
+ "file_xhtmlserializer_1_raw.xhtml",
+ "file_xhtmlserializer_1_sibling_body.xhtml",
+ "file_xhtmlserializer_1_sibling_body_only_body.xhtml",
+ "file_xhtmlserializer_1_wrap.xhtml",
+ "file_xhtmlserializer_2.xhtml",
+ "file_xhtmlserializer_2_basic.xhtml",
+ "file_xhtmlserializer_2_enthtml.xhtml",
+ "file_xhtmlserializer_2_entw3c.xhtml",
+ "file_xhtmlserializer_2_latin1.xhtml",
+ "file_youtube_flash_embed.html",
+ "forRemoval.resource",
+ "forRemoval.resource^headers^",
+ "formReset.html",
+ "invalid_accesscontrol.resource",
+ "invalid_accesscontrol.resource^headers^",
+ "script-1_bug597345.sjs",
+ "script-2_bug597345.js",
+ "script_bug602838.sjs",
+ "send_gzip_content.sjs",
+ "somedatas.resource",
+ "somedatas.resource^headers^",
+ "variable_style_sheet.sjs",
+ "w3element_traversal.svg",
+ "wholeTexty-helper.xml",
+ "referrerHelper.js",
+ "file_audioLoop.html",
+ "file_webaudio_startstop.html",
+ "referrer_helper.js",
+ "referrer_testserver.sjs",
+ "script_postmessages_fileList.js",
+ "common_postMessages.js",
+ "iframe_postMessages.html",
+ "worker_postMessages.js",
+ "test_anonymousContent_style_csp.html^headers^",
+ "file_explicit_user_agent.sjs",
+ "referrer_change_server.sjs",
+ "file_change_policy_redirect.html",
+ "file_bug1198095.js",
+ "file_bug1250148.sjs",
+ "file_bug1268962.sjs",
+ "iframe_meta_refresh.sjs",
+ "!/dom/security/test/cors/file_CrossSiteXHR_server.sjs",
+ "!/image/test/mochitest/blue.png",
+ "script_bug1238440.js",
+ "intersectionobserver_iframe.html",
+ "intersectionobserver_cross_domain_iframe.html",
+ "intersectionobserver_window.html",
+ "object_bug353334.html",
+ "embed_bug455472.html",
+ "object_bug455472.html",
+ "iframe1_bug431701.html",
+ "iframe2_bug431701.html",
+ "iframe3_bug431701.html",
+ "iframe4_bug431701.xml",
+ "iframe5_bug431701.xml",
+ "iframe6_bug431701.xml",
+ "iframe7_bug431701.xml",
+ "iframe1_bug426646.html",
+ "iframe2_bug426646.html",
+ "iframe_shared_compartment2a.html",
+ "iframe_shared_compartment2b.html",
+ "file1_setting_opener.html",
+ "file2_setting_opener.html",
+ "file3_setting_opener.html",
+ "file4_setting_opener.html",
+ "PASS.html",
+ "FAIL.html",
+ "!/dom/animation/test/testcommon.js",
+ "!/dom/events/test/event_leak_utils.js",
+ "../../../toolkit/components/pdfjs/test/file_pdfjs_test.pdf",
+ "green.png",
+ "slow.sjs",
+]
+
+["test_EventSource_redirects.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_Image_constructor.html"]
+
+["test_NodeIterator_basics_filters.xhtml"]
+skip-if = ["xorigin"] # JavaScript error: http://mochi.test:8888/tests/SimpleTest/SimpleTest.js, line 76: DataCloneError: The object could not be cloned.
+
+["test_NodeIterator_mutations_1.xhtml"]
+
+["test_NodeIterator_mutations_2.html"]
+
+["test_NodeIterator_mutations_3.html"]
+
+["test_anchor_area_referrer.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_anchor_area_referrer_changing.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_anchor_area_referrer_invalid.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_anchor_area_referrer_rel.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_anonymousContent_api.html"]
+
+["test_anonymousContent_append_after_reflow.html"]
+
+["test_anonymousContent_canvas.html"]
+skip-if = ["headless"] # Bug 1405867
+
+["test_anonymousContent_insert.html"]
+
+["test_anonymousContent_manipulate_content.html"]
+
+["test_anonymousContent_style_csp.html"]
+
+["test_async_setTimeout_stack.html"]
+
+["test_async_setTimeout_stack_across_globals.html"]
+
+["test_base.xhtml"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug5141.html"]
+
+["test_bug28293.html"]
+
+["test_bug28293.xhtml"]
+
+["test_bug51034.html"]
+
+["test_bug116083.html"]
+skip-if = ["headless"] # fails in clipboard mode
+
+["test_bug166235.html"]
+skip-if = ["headless"] # headless != clipboard
+
+["test_bug199959.html"]
+
+["test_bug218236.html"]
+
+["test_bug218277.html"]
+
+["test_bug238409.html"]
+
+["test_bug254337.html"]
+
+["test_bug270145.xhtml"]
+
+["test_bug276037-1.html"]
+
+["test_bug276037-2.xhtml"]
+
+["test_bug282547.html"]
+
+["test_bug298064.html"]
+
+["test_bug300992.html"]
+
+["test_bug311681.xml"]
+
+["test_bug313646.html"]
+
+["test_bug320799.html"]
+
+["test_bug322317.html"]
+
+["test_bug326337.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug331959.html"]
+
+["test_bug333064.html"]
+
+["test_bug333198.html"]
+
+["test_bug333673.html"]
+
+["test_bug337631.html"]
+
+["test_bug338541.xhtml"]
+
+["test_bug338583.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug338679.html"]
+
+["test_bug339494.html"]
+
+["test_bug339494.xhtml"]
+
+["test_bug343596.html"]
+
+["test_bug345339.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug346485.html"]
+
+["test_bug352728.html"]
+
+["test_bug352728.xhtml"]
+
+["test_bug353334.html"]
+
+["test_bug355026.html"]
+
+["test_bug357450.html"]
+support-files = ["file_bug357450.js"]
+
+["test_bug357450.xhtml"]
+
+["test_bug357450_svg.xhtml"]
+
+["test_bug357509.html"]
+
+["test_bug358660.html"]
+
+["test_bug362391.xhtml"]
+
+["test_bug364092.xhtml"]
+
+["test_bug364413.xhtml"]
+
+["test_bug366944.html"]
+
+["test_bug366946.html"]
+
+["test_bug367164.html"]
+
+["test_bug368972.html"]
+
+["test_bug371576-2.html"]
+
+["test_bug371576-3.html"]
+
+["test_bug371576-4.html"]
+
+["test_bug371576-5.html"]
+
+["test_bug372086.html"]
+
+["test_bug372964-2.html"]
+
+["test_bug372964.html"]
+
+["test_bug373181.xhtml"]
+
+["test_bug375314-2.html"]
+skip-if = [
+ "xorigin", # Hangs, [Exception... "Component returned failure code: 0xc1f30100 (NS_ERROR_FACTORY_EXISTS) [nsIComponentRegistrar.registerFactory]" nsresult: "0xc1f30100 (NS_ERROR_FACTORY_EXISTS)" location: "JS frame :: createChromeScript :: createChromeScript :: line 40" data: no]
+ "http3",
+ "http2",
+]
+
+["test_bug375314.html"]
+
+["test_bug378969.html"]
+
+["test_bug380418.html"]
+support-files = ["test_bug380418.html^headers^"]
+
+["test_bug382113.html"]
+
+["test_bug382871.html"]
+
+["test_bug384003.xhtml"]
+
+["test_bug390219.html"]
+
+["test_bug390735.html"]
+
+["test_bug392318.html"]
+
+["test_bug392511.html"]
+
+["test_bug393968.html"]
+
+["test_bug395915.html"]
+
+["test_bug397234.html"]
+
+["test_bug398243.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug401662.html"]
+
+["test_bug402150.html"]
+support-files = ["test_bug402150.html^headers^"]
+
+["test_bug403841.html"]
+
+["test_bug403852.html"]
+
+["test_bug403868.xml"]
+
+["test_bug405182.html"]
+
+["test_bug409380.html"]
+
+["test_bug410229.html"]
+
+["test_bug413974.html"]
+
+["test_bug414190.html"]
+
+["test_bug415860.html"]
+
+["test_bug416317-1.html"]
+
+["test_bug416317-2.html"]
+
+["test_bug416383.html"]
+
+["test_bug417255.html"]
+
+["test_bug417384.html"]
+
+["test_bug418214.html"]
+
+["test_bug418986-1.html"]
+
+["test_bug419132.html"]
+
+["test_bug420609.xhtml"]
+
+["test_bug420700.html"]
+
+["test_bug421602.html"]
+
+["test_bug422403-1.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug422403-2.xhtml"]
+
+["test_bug422537.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug424212.html"]
+
+["test_bug424359-1.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug424359-2.html"]
+
+["test_bug426308.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug426646.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug428847.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug431082.html"]
+
+["test_bug431701.html"]
+
+["test_bug431833.html"]
+
+["test_bug433533.html"]
+
+["test_bug433662.html"]
+
+["test_bug435425.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug444322.html"]
+
+["test_bug444546.html"]
+disabled = "Disabled for now. Mochitest is not reliable enough for these."
+support-files = ["bug444546.sjs"]
+
+["test_bug444722.html"]
+
+["test_bug448993.html"]
+
+["test_bug450160.html"]
+
+["test_bug451376.html"]
+
+["test_bug453521.html"]
+
+["test_bug453736.html"]
+
+["test_bug454325.html"]
+
+["test_bug454326.html"]
+
+["test_bug455472.html"]
+
+["test_bug455629.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug456262.html"]
+
+["test_bug457746.html"]
+
+["test_bug459424.html"]
+
+["test_bug461555.html"]
+
+["test_bug461735.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug465767.html"]
+
+["test_bug466080.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug466409.html"]
+
+["test_bug466751.xhtml"]
+
+["test_bug469020.html"]
+
+["test_bug469304.html"]
+
+["test_bug473162-1.html"]
+
+["test_bug473162-2.html"]
+
+["test_bug475156.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug482935.html"]
+
+["test_bug484396.html"]
+
+["test_bug493881.html"]
+support-files = ["test_bug493881.js"]
+
+["test_bug498240.html"]
+
+["test_bug498433.html"]
+
+["test_bug498897.html"]
+
+["test_bug499656.html"]
+
+["test_bug499656.xhtml"]
+
+["test_bug500937.html"]
+
+["test_bug503473.html"]
+disabled = "Disabled due to making the harness time out"
+support-files = ["file_bug503473-frame.sjs"]
+
+["test_bug503481.html"]
+
+["test_bug503481b.html"]
+
+["test_bug513194.html"]
+
+["test_bug514487.html"]
+
+["test_bug515401.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug518104.html"]
+support-files = ["file_bug518104.js"]
+
+["test_bug527896.html"]
+
+["test_bug540854.html"]
+
+["test_bug541937.html"]
+
+["test_bug544642.html"]
+
+["test_bug545644.html"]
+
+["test_bug545644.xhtml"]
+
+["test_bug548463.html"]
+
+["test_bug553896.xhtml"]
+
+["test_bug557892.html"]
+
+["test_bug558726.html"]
+
+["test_bug559526.html"]
+
+["test_bug560780.html"]
+
+["test_bug562137.html"]
+
+["test_bug562169-1.html"]
+
+["test_bug562169-2.html"]
+
+["test_bug562652.html"]
+
+["test_bug564047.html"]
+
+["test_bug564863.xhtml"]
+
+["test_bug567350.html"]
+
+["test_bug574596.html"]
+skip-if = ["os == 'android'"]
+
+["test_bug578096.html"]
+skip-if = ["verify && os == 'win'"]
+
+["test_bug585978.html"]
+
+["test_bug587931.html"]
+
+["test_bug588990.html"]
+
+["test_bug590812.html"]
+skip-if = [
+ "verify && !debug && os == 'linux'", #bug 687032
+ "http3",
+ "http2",
+]
+
+["test_bug590870.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug592366.html"]
+
+["test_bug592829.html"]
+
+["test_bug597345.html"]
+
+["test_bug599295.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug599588.html"]
+
+["test_bug601803.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug602838.html"]
+
+["test_bug604592.html"]
+
+["test_bug604660.html"]
+
+["test_bug605982.html"]
+
+["test_bug606729.html"]
+
+["test_bug614058.html"]
+
+["test_bug622088.html"]
+
+["test_bug622117.html"]
+support-files = ["!/gfx/layers/apz/test/mochitest/apz_test_utils.js"]
+
+["test_bug622246.html"]
+support-files = ["!/gfx/layers/apz/test/mochitest/apz_test_utils.js"]
+
+["test_bug625722.html"]
+
+["test_bug626262.html"]
+
+["test_bug628938.html"]
+
+["test_bug631615.html"]
+
+["test_bug638112.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug647518.html"]
+
+["test_bug650001.html"]
+
+["test_bug650776.html"]
+
+["test_bug650784.html"]
+
+["test_bug656283.html"]
+
+["test_bug664916.html"]
+
+["test_bug666604.html"]
+
+["test_bug675121.html"]
+
+["test_bug675166.html"]
+
+["test_bug682463.html"]
+
+["test_bug682554.html"]
+
+["test_bug682592.html"]
+
+["test_bug684671.html"]
+
+["test_bug685798.html"]
+
+["test_bug686449.xhtml"]
+
+["test_bug687859.html"]
+
+["test_bug690056.html"]
+
+["test_bug692434.html"]
+
+["test_bug693615.html"]
+
+["test_bug693875.html"]
+
+["test_bug694754.xhtml"]
+
+["test_bug696301-1.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug696301-2.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug698381.html"]
+
+["test_bug698384.html"]
+
+["test_bug704063.html"]
+
+["test_bug704320-1.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug704320-2.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug704320_policyset.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug704320_policyset2.html"]
+
+["test_bug704320_preload.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug707142.html"]
+
+["test_bug708620.html"]
+
+["test_bug711047.html"]
+
+["test_bug711180.html"]
+
+["test_bug719533.html"]
+
+["test_bug726364.html"]
+
+["test_bug737087.html"]
+
+["test_bug737565.html"]
+
+["test_bug737612.html"]
+
+["test_bug738108.html"]
+
+["test_bug744830.html"]
+
+["test_bug749367.html"]
+
+["test_bug750096.html"]
+
+["test_bug753278.html"]
+
+["test_bug761120.html"]
+
+["test_bug769117.html"]
+
+["test_bug782342.html"]
+
+["test_bug787778.html"]
+
+["test_bug789315.html"]
+
+["test_bug789856.html"]
+
+["test_bug809003.html"]
+
+["test_bug810494.html"]
+
+["test_bug811701.html"]
+
+["test_bug811701.xhtml"]
+
+["test_bug813919.html"]
+
+["test_bug814576.html"]
+
+["test_bug819051.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug820909.html"]
+
+["test_bug864595.html"]
+
+["test_bug868999.html"]
+
+["test_bug869000.html"]
+
+["test_bug869002.html"]
+
+["test_bug869006.html"]
+
+["test_bug876282.html"]
+
+["test_bug891952.html"]
+
+["test_bug894874.html"]
+
+["test_bug895974.html"]
+
+["test_bug907892.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug913761.html"]
+
+["test_bug922681.html"]
+
+["test_bug927196.html"]
+
+["test_bug962251.html"]
+
+["test_bug976673.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug982153.html"]
+
+["test_bug999456.html"]
+
+["test_bug1022229.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1025933.html"]
+
+["test_bug1037687.html"]
+support-files = ["test_bug1037687_subframe.html"]
+
+["test_bug1043106.html"]
+
+["test_bug1057176.html"]
+
+["test_bug1060938.html"]
+
+["test_bug1064481.html"]
+
+["test_bug1070015.html"]
+
+["test_bug1075702.html"]
+
+["test_bug1091883.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1100912.html"]
+support-files = ["file_bug1100912.html"]
+
+["test_bug1101364.html"]
+
+["test_bug1118689.html"]
+
+["test_bug1126851.html"]
+
+["test_bug1163743.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1165501.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1187157.html"]
+
+["test_bug1198095.html"]
+
+["test_bug1222633.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1222633_link_update.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1238440.html"]
+
+["test_bug1250148.html"]
+
+["test_bug1259588.html"]
+
+["test_bug1268962.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1274806.html"]
+
+["test_bug1295852.html"]
+
+["test_bug1307730.html"]
+
+["test_bug1308069.html"]
+
+["test_bug1314032.html"]
+
+["test_bug1318303.html"]
+
+["test_bug1375050.html"]
+
+["test_bug1381710.html"]
+
+["test_bug1399605.html"]
+
+["test_bug1404385.html"]
+
+["test_bug1406102.html"]
+
+["test_bug1421568.html"]
+
+["test_bug1433073.html"]
+skip-if = [
+ "os == 'android'",
+ "headless",
+]
+
+["test_bug1472427.html"]
+
+["test_bug1499169.html"]
+skip-if = ["os == 'android'"] # Timeouts on android due to page closing issues with embedded pdf
+
+["test_bug1576154.html"]
+
+["test_bug1632975.html"]
+
+["test_bug1639328.html"]
+support-files = ["file_bug1639328.html"]
+
+["test_bug1640766.html"]
+support-files = [
+ "iframe1_bug1640766.html",
+ "iframe2_bug1640766.html",
+]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug1648887.html"]
+
+["test_bug1667316.html"]
+
+["test_bug1730284.html"]
+# https://bugzilla.mozilla.org/show_bug.cgi?id=1632196 and
+# https://bugzilla.mozilla.org/show_bug.cgi?id=1632438.
+
+["test_bug1739957.html"]
+support-files = ["bug1739957.sjs"]
+
+["test_bug1784187.html"]
+
+["test_bug1799354.html"]
+
+["test_caretPositionFromPoint.html"]
+
+["test_change_policy.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_clearTimeoutIntervalNoArg.html"]
+
+["test_clipboard_nbsp.html"]
+
+["test_constructor-assignment.html"]
+
+["test_constructor.html"]
+
+["test_content_iterator_post_order.html"]
+
+["test_content_iterator_pre_order.html"]
+
+["test_content_iterator_subtree.html"]
+
+["test_copyimage.html"]
+skip-if = [
+ "os == 'android'",
+ "headless", #bug 904183
+]
+
+["test_copypaste.html"]
+skip-if = [
+ "os == 'android'",
+ "headless", #bug 904183
+]
+
+["test_copypaste.xhtml"]
+skip-if = ["headless"] #bug 904183
+
+["test_copypaste_disabled.html"]
+support-files = ["!/gfx/layers/apz/test/mochitest/apz_test_utils.js"]
+
+["test_createHTMLDocument.html"]
+
+["test_current_inner_window.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_custom_element.html"]
+
+["test_custom_element_reflector.html"]
+
+["test_data_uri.html"]
+
+["test_delazification_strategy.html"]
+skip-if = [
+ "verify",
+ "ccov",
+]
+support-files = [
+ "file_delazification_strategy.html",
+ "file_delazification_strategy.js",
+]
+
+["test_document.all_iteration.html"]
+
+["test_document.all_unqualified.html"]
+
+["test_document_constructor.html"]
+
+["test_document_importNode_document.html"]
+
+["test_document_wireframe.html"]
+skip-if = [
+ "!sessionHistoryInParent",
+ "http3",
+ "http2",
+]
+
+["test_domparser_null_char.html"]
+
+["test_domparsing.html"]
+
+["test_domrequest.html"]
+
+["test_domwindowutils.html"]
+skip-if = ["os == 'android'"] # Bug 1525959
+
+["test_element.matches.html"]
+
+["test_elementTraversal.html"]
+
+["test_element_closest.html"]
+
+["test_embed_xorigin_document.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_encodeToStringWithMaxLength.html"]
+
+["test_encodeToStringWithRequiresReinitAfterOutput.html"]
+
+["test_eventsource_event_listener_leaks.html"]
+
+["test_eventsourceservice_basic.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_eventsourceservice_reconnect_error.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_eventsourceservice_status_error.html"]
+
+["test_eventsourceservice_worker.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_explicit_user_agent.html"]
+
+["test_find.html"]
+
+["test_find_bug1601118.html"]
+
+["test_find_bug1654683.html"]
+
+["test_find_nac.html"]
+
+["test_focus_design_mode.html"]
+support-files = ["file_focus_design_mode_inner.html"]
+
+["test_focus_display_none_xorigin_iframe.html"]
+support-files = ["file_focus_display_none_xorigin_iframe_inner.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_focus_keyboard_event.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_focus_scroll_padding_tab.html"]
+
+["test_focus_scrollable_fieldset.html"]
+
+["test_focus_scrollable_input.html"]
+
+["test_focus_shadow_dom.html"]
+
+["test_focus_shadow_dom_root.html"]
+
+["test_getAttribute_after_createAttribute.html"]
+
+["test_getElementById.html"]
+
+["test_getTranslationNodes.html"]
+
+["test_getTranslationNodes_limit.html"]
+
+["test_gsp-qualified.html"]
+
+["test_gsp-quirks.html"]
+
+["test_gsp-standards.html"]
+
+["test_history_document_open.html"]
+
+["test_history_state_null.html"]
+
+["test_html_colors_quirks.html"]
+
+["test_html_colors_standards.html"]
+
+["test_htmlcopyencoder.html"]
+
+["test_htmlcopyencoder.xhtml"]
+
+["test_iframe_event_listener_leaks.html"]
+
+["test_iframe_referrer.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_iframe_referrer_changing.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_iframe_referrer_invalid.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_innersize_scrollport.html"]
+
+["test_input_vsync_alignment_inner_event_loop.html"]
+
+["test_input_vsync_alignment_input_while_vsync.html"]
+
+["test_input_vsync_alignment_lower_than_normal.html"]
+
+["test_integer_attr_with_leading_zero.html"]
+
+["test_intersectionobservers.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_link_prefetch.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_link_preload.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_link_stylesheet.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_location_href_unknown_protocol.html"]
+support-files = ["file_location_href_unknown_protocol.html"]
+
+["test_lock_orientation_after_fullscreen.html"]
+skip-if = [
+ "os != 'android'", # Only run on Android.
+]
+
+["test_lock_orientation_with_pending_fullscreen.html"]
+skip-if = [
+ "os == 'mac'",
+ "os == 'linux'",
+ "headless",
+]
+
+["test_meta_refresh_referrer.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_mozMatchesSelector.html"]
+
+["test_mutationobservers.html"]
+
+["test_named_frames.html"]
+
+["test_navigatorPrefOverride.html"]
+
+["test_navigator_cookieEnabled.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_navigator_hardwareConcurrency.html"]
+
+["test_navigator_language.html"]
+
+["test_nested_event_loop_spin_and_idle_tasks.html"]
+
+["test_nodelist_holes.html"]
+
+["test_openDialogChromeOnly.html"]
+tags = "openwindow"
+
+["test_open_null_features.html"]
+
+["test_pasting_svg_image.html"]
+skip-if = ["headless"] # Bug 1669923.
+
+["test_pdf_print.html"]
+skip-if = [
+ "os == 'android'", # We don't ship pdf.js on Android
+ "win11_2009 && condprof", # Bug 1843710
+]
+
+["test_plugin_freezing.html"]
+
+["test_postMessage_originAttributes.html"]
+support-files = ["file_receiveMessage.html"]
+skip-if = ["true"] # Uses mismatched OriginAttributes for iframe (bug 1616353)
+
+["test_postMessage_solidus.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_postMessages_broadcastChannel.html"]
+
+["test_postMessages_messagePort.html"]
+
+["test_postMessages_window.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_postMessages_workers.html"]
+
+["test_processing_instruction_update_stylesheet.xhtml"]
+
+["test_progress_events_for_gzip_data.html"]
+skip-if = ["tsan"] # Bug 1621323
+
+["test_pushState_structuredclone.html"]
+scheme = "https"
+
+["test_range_bounds.html"]
+
+["test_reentrant_flush.html"]
+
+["test_root_iframe.html"]
+
+["test_sandbox_and_document_uri.html"]
+support-files = ["file_sandbox_and_document_uri.html"]
+
+["test_screen_orientation.html"]
+
+["test_script_loader_crossorigin_data_url.html"]
+
+["test_script_loader_js_cache.html"]
+disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173"
+skip-if = ["verify"]
+support-files = [
+ "file_js_cache.html",
+ "file_js_cache_with_sri.html",
+ "file_js_cache_module.html",
+ "file_js_cache.js",
+ "file_module_js_cache.html",
+ "file_module_js_cache_with_sri.html",
+ "file_module_js_cache_no_module.html",
+ "file_module_js_cache.mjs",
+ "file_js_cache_save_after_load.html",
+ "file_js_cache_save_after_load.js",
+ "file_js_cache_syntax_error.html",
+ "file_js_cache_syntax_error.js",
+]
+
+["test_script_loader_js_cache_frames.html"]
+skip-if = ["verify"]
+support-files = [
+ "file_script_module_frames_relay.js",
+ "file_script_module_frames_element.html",
+ "file_script_module_frames_element_save.html",
+ "file_script_module_frames_element_load.html",
+ "file_script_module_frames_element_shared.mjs",
+ "file_script_module_frames_import.html",
+ "file_script_module_frames_import_save.html",
+ "file_script_module_frames_import_save.mjs",
+ "file_script_module_frames_import_load.html",
+ "file_script_module_frames_import_load.mjs",
+ "file_script_module_frames_import_shared.mjs",
+ "file_script_module_frames_dynamic.html",
+ "file_script_module_frames_dynamic_save.html",
+ "file_script_module_frames_dynamic_save.mjs",
+ "file_script_module_frames_dynamic_load.html",
+ "file_script_module_frames_dynamic_load.mjs",
+ "file_script_module_frames_dynamic_shared.mjs",
+]
+
+["test_script_loader_js_cache_module.html"]
+disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173"
+skip-if = ["verify"]
+support-files = [
+ "file_script_module_single.html",
+ "file_script_module_single.mjs",
+ "file_script_module_import.html",
+ "file_script_module_import.mjs",
+ "file_script_module_import_imported.mjs",
+ "file_script_module_import_multi.html",
+ "file_script_module_import_multi.mjs",
+ "file_script_module_import_multi_imported_once.mjs",
+ "file_script_module_import_multi_imported_twice.mjs",
+ "file_script_module_import_multi_elems.html",
+ "file_script_module_import_multi_elems_1.mjs",
+ "file_script_module_import_multi_elems_2.mjs",
+ "file_script_module_import_multi_elems_imported_once_1.mjs",
+ "file_script_module_import_multi_elems_imported_once_2.mjs",
+ "file_script_module_import_multi_elems_imported_once_3.mjs",
+ "file_script_module_import_multi_elems_imported_twice.mjs",
+ "file_script_module_import_and_element.html",
+ "file_script_module_import_and_element.mjs",
+ "file_script_module_import_and_element_imported_1.mjs",
+ "file_script_module_import_and_element_imported_2.mjs",
+ "file_script_module_import_and_element_imported_3.mjs",
+ "file_script_module_element_and_import.html",
+ "file_script_module_element_and_import.mjs",
+ "file_script_module_element_and_import_imported_1.mjs",
+ "file_script_module_element_and_import_imported_2.mjs",
+ "file_script_module_element_and_import_imported_3.mjs",
+ "file_script_module_dynamic_import.html",
+ "file_script_module_dynamic_import.mjs",
+ "file_script_module_dynamic_import_imported.mjs",
+ "file_script_module_dynamic_and_element.html",
+ "file_script_module_dynamic_and_element.mjs",
+ "file_script_module_dynamic_and_element_imported_1.mjs",
+ "file_script_module_dynamic_and_element_imported_2.mjs",
+ "file_script_module_dynamic_and_element_imported_3.mjs",
+ "file_script_module_element_and_dynamic.html",
+ "file_script_module_element_and_dynamic.mjs",
+ "file_script_module_element_and_dynamic_imported_1.mjs",
+ "file_script_module_element_and_dynamic_imported_2.mjs",
+ "file_script_module_element_and_dynamic_imported_3.mjs",
+ "file_script_module_dynamic_and_static.html",
+ "file_script_module_dynamic_and_static.mjs",
+ "file_script_module_dynamic_and_static_imported_1.mjs",
+ "file_script_module_dynamic_and_static_imported_2.mjs",
+ "file_script_module_dynamic_and_static_imported_3.mjs",
+ "file_script_module_static_and_dynamic.html",
+ "file_script_module_static_and_dynamic.mjs",
+ "file_script_module_static_and_dynamic_imported_1.mjs",
+ "file_script_module_static_and_dynamic_imported_2.mjs",
+ "file_script_module_static_and_dynamic_imported_3.mjs",
+]
+
+["test_script_loader_js_cache_module_sri.html"]
+disabled = "https://bugzilla.mozilla.org/show_bug.cgi?id=1853173"
+skip-if = ["verify"]
+support-files = [
+ "file_script_module_sri_basic.html",
+ "file_script_module_sri_basic_prep.html",
+ "file_script_module_sri_basic.mjs",
+ "file_script_module_sri_fallback.html",
+ "file_script_module_sri_fallback_prep.html",
+ "file_script_module_sri_fallback.mjs",
+ "file_script_module_sri_fallback_failure.html",
+ "file_script_module_sri_fallback_failure_prep.html",
+ "file_script_module_sri_fallback_failure.mjs",
+ "file_script_module_sri_elem_elem_1.html",
+ "file_script_module_sri_elem_elem_1_prep.html",
+ "file_script_module_sri_elem_elem_1.mjs",
+ "file_script_module_sri_elem_elem_2.html",
+ "file_script_module_sri_elem_elem_2_prep.html",
+ "file_script_module_sri_elem_elem_2.mjs",
+ "file_script_module_sri_elem_import.html",
+ "file_script_module_sri_elem_import_prep.html",
+ "file_script_module_sri_elem_import.mjs",
+ "file_script_module_sri_elem_import_imported.mjs",
+ "file_script_module_sri_import_elem.html",
+ "file_script_module_sri_import_elem_prep.html",
+ "file_script_module_sri_import_elem.mjs",
+ "file_script_module_sri_import_elem_imported.mjs",
+ "file_script_module_sri_import_elem_nopreload.html",
+ "file_script_module_sri_import_elem_nopreload_prep.html",
+ "file_script_module_sri_import_elem_nopreload.mjs",
+ "file_script_module_sri_import_elem_nopreload_imported.mjs",
+ "file_script_module_sri_elem_dynamic.html",
+ "file_script_module_sri_elem_dynamic_prep.html",
+ "file_script_module_sri_elem_dynamic.mjs",
+ "file_script_module_sri_elem_dynamic_imported.mjs",
+ "file_script_module_sri_dynamic_elem.html",
+ "file_script_module_sri_dynamic_elem_prep.html",
+ "file_script_module_sri_dynamic_elem.mjs",
+ "file_script_module_sri_dynamic_elem_imported.mjs",
+ "file_script_module_sri_dynamic_elem_nopreload.html",
+ "file_script_module_sri_dynamic_elem_nopreload_prep.html",
+ "file_script_module_sri_dynamic_elem_nopreload.mjs",
+ "file_script_module_sri_dynamic_elem_nopreload_imported.mjs",
+]
+
+["test_setInterval_from_start.html"]
+
+["test_setInterval_uncatchable_exception.html"]
+skip-if = ["debug == false"]
+
+["test_setTimeoutWith0.html"]
+
+["test_settimeout_extra_arguments.html"]
+
+["test_settimeout_inner.html"]
+
+["test_setting_opener.html"]
+
+["test_shared_compartment1.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_shared_compartment2.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_structuredclone_backref.html"]
+
+["test_structuredclone_error.html"]
+
+["test_style_cssText.html"]
+
+["test_suppressed_events_and_scrolling.html"]
+support-files = ["file_suppressed_events_and_scrolling.html"]
+
+["test_suppressed_events_nested_iframe.html"]
+skip-if = [
+ "os == 'android'",
+ "http3",
+ "http2",
+]
+support-files = [
+ "file_suppressed_events_top_xhr.html",
+ "file_suppressed_events_top_modalstate.html",
+ "file_suppressed_events_top.html",
+ "file_suppressed_events_middle.html",
+ "file_suppressed_events_inner.html",
+ "!/gfx/layers/apz/test/mochitest/apz_test_utils.js",
+]
+
+["test_suppressed_microtasks.html"]
+skip-if = [
+ "debug",
+ "asan",
+ "verify",
+ "os == 'android'", # The test needs to run reasonably fast.
+]
+
+["test_text_wholeText.html"]
+
+["test_textnode_normalize_in_selection.html"]
+
+["test_textnode_split_in_selection.html"]
+
+["test_timeout_clamp.html"]
+
+["test_timer_flood.html"]
+
+["test_title.html"]
+support-files = ["file_title.xhtml"]
+
+["test_toScreenRect.html"]
+support-files = ["file_toScreenRect.html"]
+
+["test_treewalker_nextsibling.xml"]
+
+["test_user_select.html"]
+skip-if = ["os == 'android'"] # Bug 1791049
+
+["test_viewport_metrics_on_landscape_content.html"]
+support-files = ["file_viewport_metrics_on_landscape_content.html"]
+
+["test_viewport_scroll.html"]
+
+["test_viewsource_forbidden_in_object.html"]
+
+["test_w3element_traversal.html"]
+
+["test_w3element_traversal.xhtml"]
+
+["test_w3element_traversal_svg.html"]
+
+["test_warning_for_blocked_cross_site_request.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_window_close.html"]
+
+["test_window_constructor.html"]
+
+["test_window_content.html"]
+
+["test_window_cross_origin_props.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_window_define_nonconfigurable.html"]
+
+["test_window_define_symbol.html"]
+
+["test_window_element_enumeration.html"]
+
+["test_window_enumeration.html"]
+
+["test_window_extensible.html"]
+
+["test_window_focus_by_close_and_open.html"]
+support-files = ["file_window_focus_by_close_and_open.html"]
+
+["test_window_indexing.html"]
+
+["test_window_keys.html"]
+
+["test_window_named_frame_enumeration.html"]
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_window_own_props.html"]
+
+["test_window_proto.html"]
+
+["test_writable-replaceable.html"]
+
+["test_x-frame-options.html"]
+skip-if = [
+ "os == 'android' && debug",
+ "xorigin", # JavaScript error: http://mochi.test:8888/tests/dom/base/test/test_x-frame-options.html, line 48: TypeError: can't access property "textContent", this.content.document.getElementById(...) is null, JavaScript error: resource://gre/modules/ProcessSelector.jsm, line 56: TypeError: can't access property "tabCount", process is null
+ "http3",
+ "http2",
+]
+
+["test_youtube_flash_embed.html"]
+skip-if = [
+ "http3",
+ "http2",
+ "os == 'linux' && debug" #Bug 1870499 and other bugs with crashes after this test start
+]
+# Please keep alphabetical order.
diff --git a/dom/base/test/moz.build b/dom/base/test/moz.build
new file mode 100644
index 0000000000..374e735b88
--- /dev/null
+++ b/dom/base/test/moz.build
@@ -0,0 +1,44 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+XPCSHELL_TESTS_MANIFESTS += [
+ "unit/xpcshell.toml",
+ "unit_ipc/xpcshell.toml",
+]
+
+MOCHITEST_MANIFESTS += [
+ "mochitest.toml",
+]
+
+MOCHITEST_CHROME_MANIFESTS += [
+ "chrome.toml",
+ "chrome/chrome.toml",
+]
+
+BROWSER_CHROME_MANIFESTS += [
+ "browser.toml",
+ "fmm/browser.toml",
+]
+
+TEST_DIRS += [
+ "fullscreen",
+ "gtest",
+ "jsmodules",
+ "jsmodules/importmaps",
+ "useractivation",
+ "meta_viewport",
+]
+
+TEST_HARNESS_FILES.testing.mochitest.tests.dom.base.test.chrome += [
+ "chrome/bug421622-referer.sjs",
+ "chrome/bug884693.sjs",
+ "chrome/nochrome_bug1346936.html",
+ "chrome/nochrome_bug1346936.js",
+ "chrome/nochrome_bug1346936.js^headers^",
+ "chrome/nochrome_bug765993.html",
+ "chrome/nochrome_bug765993.js",
+ "chrome/nochrome_bug765993.js^headers^",
+]
diff --git a/dom/base/test/object_bug353334.html b/dom/base/test/object_bug353334.html
new file mode 100644
index 0000000000..8e73c916c6
--- /dev/null
+++ b/dom/base/test/object_bug353334.html
@@ -0,0 +1 @@
+test
diff --git a/dom/base/test/object_bug455472.html b/dom/base/test/object_bug455472.html
new file mode 100644
index 0000000000..b2f3ae4f44
--- /dev/null
+++ b/dom/base/test/object_bug455472.html
@@ -0,0 +1 @@
+
diff --git a/dom/base/test/red.png b/dom/base/test/red.png
new file mode 100644
index 0000000000..a6e195d59c
Binary files /dev/null and b/dom/base/test/red.png differ
diff --git a/dom/base/test/referrerHelper.js b/dom/base/test/referrerHelper.js
new file mode 100644
index 0000000000..da3097b849
--- /dev/null
+++ b/dom/base/test/referrerHelper.js
@@ -0,0 +1,343 @@
+/**
+ * Listen for notifications from the child.
+ * These are sent in case of error, or when the loads we await have completed.
+ */
+window.addEventListener("message", function (event) {
+ if (event.data == "childLoadComplete") {
+ // all loads happen, continue the test.
+ advance();
+ } else if (event.data == "childOverload") {
+ // too many loads happened in a test frame, abort.
+ ok(false, "Too many load handlers called in test.");
+ SimpleTest.finish();
+ } else if (event.data.indexOf("fail-") == 0) {
+ // something else failed in the test frame, abort.
+ ok(false, "Child failed the test with error " + event.data.substr(5));
+ SimpleTest.finish();
+ }
+});
+
+/**
+ * helper to perform an XHR.
+ */
+function doXHR(url, onSuccess, onFail) {
+ var xhr = new XMLHttpRequest();
+ xhr.onload = function () {
+ if (xhr.status == 200) {
+ onSuccess(xhr);
+ } else {
+ onFail(xhr);
+ }
+ };
+ xhr.open("GET", url, true);
+ xhr.send(null);
+}
+
+/**
+ * This triggers state-resetting on the counter server.
+ */
+function resetCounter() {
+ doXHR(
+ "/tests/dom/base/test/bug704320_counter.sjs?reset",
+ advance,
+ function (xhr) {
+ ok(false, "Need to be able to reset the request counter");
+ SimpleTest.finish();
+ }
+ );
+}
+
+/**
+ * Grabs the results via XHR and passes to checker.
+ */
+function checkIndividualResults(testname, expected) {
+ doXHR(
+ "/tests/dom/base/test/bug704320_counter.sjs?results",
+ function (xhr) {
+ var results = JSON.parse(xhr.responseText);
+ info(xhr.responseText);
+
+ ok(
+ "img" in results,
+ testname + " test: some image loads required in results object."
+ );
+ is(
+ results.img.count,
+ 2,
+ testname + " Test: Expected 2 loads for image requests."
+ );
+
+ expected.forEach(function (ref) {
+ ok(
+ results.img.referrers.includes(ref),
+ testname +
+ " Test: Expected " +
+ ref +
+ " referrer policy in test, results were " +
+ JSON.stringify(results.img.referrers) +
+ "."
+ );
+ });
+ advance();
+ },
+ function (xhr) {
+ ok(false, "Can't get results from the counter server.");
+ SimpleTest.finish();
+ }
+ );
+}
+
+/**
+ * Grabs the results via XHR and checks them
+ */
+function checkExpectedGlobalResults(testName) {
+ var url = "bug704320.sjs?action=get-test-results";
+ doXHR(
+ url,
+ function (xhr) {
+ var response = JSON.parse(xhr.response);
+
+ for (type in response) {
+ for (scheme in response[type]) {
+ for (policy in response[type][scheme]) {
+ var expectedResult =
+ EXPECTED_RESULTS[type] === undefined
+ ? EXPECTED_RESULTS.default[scheme][policy]
+ : EXPECTED_RESULTS[type][scheme][policy];
+ is(
+ response[type][scheme][policy],
+ expectedResult,
+ type + " " + scheme + " " + policy
+ );
+ }
+ }
+ }
+ advance(testName);
+ },
+ function (xhr) {
+ ok(false, "Can't get results from the counter server.");
+ SimpleTest.finish();
+ }
+ );
+}
+
+var EXPECTED_RESULTS = {
+ // From docshell/base/nsDocShell.cpp:
+ // "If the document containing the hyperlink being audited was not retrieved
+ // over an encrypted connection and its address does not have the same
+ // origin as "ping URL", send a referrer."
+ "link-ping": {
+ // Same-origin
+ "http-to-http": {
+ "no-referrer": "",
+ "unsafe-url": "",
+ origin: "",
+ "origin-when-cross-origin": "",
+ "no-referrer-when-downgrade": "",
+ "same-origin": "",
+ "strict-origin": "",
+ "strict-origin-when-cross-origin": "",
+ },
+ "http-to-https": {
+ "no-referrer": "",
+ "unsafe-url":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=unsafe-url",
+ origin: "http://example.com/",
+ "origin-when-cross-origin": "http://example.com/",
+ "no-referrer-when-downgrade":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=no-referrer-when-downgrade",
+ "same-origin": "",
+ "strict-origin": "http://example.com/",
+ "strict-origin-when-cross-origin": "http://example.com/",
+ },
+ // Encrypted and not same-origin
+ "https-to-http": {
+ "no-referrer": "",
+ "unsafe-url": "",
+ origin: "",
+ "origin-when-cross-origin": "",
+ "no-referrer-when-downgrade": "",
+ "same-origin": "",
+ "strict-origin": "",
+ "strict-origin-when-cross-origin": "",
+ },
+ // Encrypted
+ "https-to-https": {
+ "no-referrer": "",
+ "unsafe-url": "",
+ origin: "",
+ "origin-when-cross-origin": "",
+ "no-referrer-when-downgrade": "",
+ "same-origin": "",
+ "strict-origin": "",
+ "strict-origin-when-cross-origin": "",
+ },
+ },
+ // form is tested in a 2nd level iframe.
+ form: {
+ "http-to-http": {
+ "no-referrer": "",
+ "unsafe-url":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=unsafe-url&type=form",
+ origin: "http://example.com/",
+ "origin-when-cross-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=origin-when-cross-origin&type=form",
+ "no-referrer-when-downgrade":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=no-referrer-when-downgrade&type=form",
+ "same-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=same-origin&type=form",
+ "strict-origin": "http://example.com/",
+ "strict-origin-when-cross-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=strict-origin-when-cross-origin&type=form",
+ },
+ "http-to-https": {
+ "no-referrer": "",
+ "unsafe-url":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=https&policy=unsafe-url&type=form",
+ origin: "http://example.com/",
+ "origin-when-cross-origin": "http://example.com/",
+ "no-referrer-when-downgrade":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=https&policy=no-referrer-when-downgrade&type=form",
+ "same-origin": "",
+ "strict-origin": "http://example.com/",
+ "strict-origin-when-cross-origin": "http://example.com/",
+ },
+ "https-to-http": {
+ "no-referrer": "",
+ "unsafe-url":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=http&policy=unsafe-url&type=form",
+ origin: "https://example.com/",
+ "origin-when-cross-origin": "https://example.com/",
+ "no-referrer-when-downgrade": "",
+ "same-origin": "",
+ "strict-origin": "",
+ "strict-origin-when-cross-origin": "",
+ },
+ "https-to-https": {
+ "no-referrer": "",
+ "unsafe-url":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=unsafe-url&type=form",
+ origin: "https://example.com/",
+ "origin-when-cross-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=origin-when-cross-origin&type=form",
+ "no-referrer-when-downgrade":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=no-referrer-when-downgrade&type=form",
+ "same-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=same-origin&type=form",
+ "strict-origin": "https://example.com/",
+ "strict-origin-when-cross-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=strict-origin-when-cross-origin&type=form",
+ },
+ },
+ // window.location is tested in a 2nd level iframe.
+ "window.location": {
+ "http-to-http": {
+ "no-referrer": "",
+ "unsafe-url":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=unsafe-url&type=window.location",
+ origin: "http://example.com/",
+ "origin-when-cross-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=origin-when-cross-origin&type=window.location",
+ "no-referrer-when-downgrade":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=no-referrer-when-downgrade&type=window.location",
+ "same-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=same-origin&type=window.location",
+ "strict-origin": "http://example.com/",
+ "strict-origin-when-cross-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=http&policy=strict-origin-when-cross-origin&type=window.location",
+ },
+ "http-to-https": {
+ "no-referrer": "",
+ "unsafe-url":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=https&policy=unsafe-url&type=window.location",
+ origin: "http://example.com/",
+ "origin-when-cross-origin": "http://example.com/",
+ "no-referrer-when-downgrade":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=http&scheme-to=https&policy=no-referrer-when-downgrade&type=window.location",
+ "same-origin": "",
+ "strict-origin": "http://example.com/",
+ "strict-origin-when-cross-origin": "http://example.com/",
+ },
+ "https-to-http": {
+ "no-referrer": "",
+ "unsafe-url":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=http&policy=unsafe-url&type=window.location",
+ origin: "https://example.com/",
+ "origin-when-cross-origin": "https://example.com/",
+ "no-referrer-when-downgrade": "",
+ "same-origin": "",
+ "strict-origin": "",
+ "strict-origin-when-cross-origin": "",
+ },
+ "https-to-https": {
+ "no-referrer": "",
+ "unsafe-url":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=unsafe-url&type=window.location",
+ origin: "https://example.com/",
+ "origin-when-cross-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=origin-when-cross-origin&type=window.location",
+ "no-referrer-when-downgrade":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=no-referrer-when-downgrade&type=window.location",
+ "same-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=same-origin&type=window.location",
+ "strict-origin": "https://example.com/",
+ "strict-origin-when-cross-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-2nd-level-iframe&scheme-from=https&scheme-to=https&policy=strict-origin-when-cross-origin&type=window.location",
+ },
+ },
+ default: {
+ "http-to-http": {
+ "no-referrer": "",
+ "unsafe-url":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=unsafe-url",
+ origin: "http://example.com/",
+ "origin-when-cross-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=origin-when-cross-origin",
+ "no-referrer-when-downgrade":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=no-referrer-when-downgrade",
+ "same-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=same-origin",
+ "strict-origin": "http://example.com/",
+ "strict-origin-when-cross-origin":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=http&policy=strict-origin-when-cross-origin",
+ },
+ "http-to-https": {
+ "no-referrer": "",
+ "unsafe-url":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=unsafe-url",
+ origin: "http://example.com/",
+ "origin-when-cross-origin": "http://example.com/",
+ "no-referrer-when-downgrade":
+ "http://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=http&scheme-to=https&policy=no-referrer-when-downgrade",
+ "same-origin": "",
+ "strict-origin": "http://example.com/",
+ "strict-origin-when-cross-origin": "http://example.com/",
+ },
+ "https-to-http": {
+ "no-referrer": "",
+ "unsafe-url":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=http&policy=unsafe-url",
+ origin: "https://example.com/",
+ "origin-when-cross-origin": "https://example.com/",
+ "no-referrer-when-downgrade": "",
+ "same-origin": "",
+ "strict-origin": "",
+ "strict-origin-when-cross-origin": "",
+ },
+ "https-to-https": {
+ "no-referrer": "",
+ "unsafe-url":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=unsafe-url",
+ origin: "https://example.com/",
+ "origin-when-cross-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=origin-when-cross-origin",
+ "no-referrer-when-downgrade":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=no-referrer-when-downgrade",
+ "same-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=same-origin",
+ "strict-origin": "https://example.com/",
+ "strict-origin-when-cross-origin":
+ "https://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=https&scheme-to=https&policy=strict-origin-when-cross-origin",
+ },
+ },
+};
diff --git a/dom/base/test/referrer_change_server.sjs b/dom/base/test/referrer_change_server.sjs
new file mode 100644
index 0000000000..4cc11bb044
--- /dev/null
+++ b/dom/base/test/referrer_change_server.sjs
@@ -0,0 +1,169 @@
+var BASE_URL = "example.com/tests/dom/base/test/referrer_change_server.sjs";
+
+function createTestUrl(aPolicy, aAction, aName) {
+ return (
+ "http://" +
+ BASE_URL +
+ "?" +
+ "action=" +
+ aAction +
+ "&" +
+ "policy=" +
+ aPolicy +
+ "&" +
+ "name=" +
+ aName +
+ "&" +
+ "type=link"
+ );
+}
+
+function createTest(aMetaPolicy, aReferrerPolicy, aName) {
+ return (
+ "\n\
+ " +
+ ' ' +
+ "" +
+ '' +
+ aReferrerPolicy +
+ " " +
+ "\n\
+ \n\
+ "
+ );
+}
+
+function createTest2(aMetaPolicy, aReferrerPolicy, aName) {
+ return (
+ "\n\
+ " +
+ ' ' +
+ "" +
+ '' +
+ aReferrerPolicy +
+ " " +
+ "\n\
+ \n\
+ "
+ );
+}
+
+function handleRequest(request, response) {
+ var sharedKey = "referrer_change_server.sjs";
+ var params = request.queryString.split("&");
+ var action = params[0].split("=")[1];
+
+ if (action === "resetState") {
+ var state = getSharedState(sharedKey);
+ state = {};
+ setSharedState(sharedKey, JSON.stringify(state));
+ response.write("");
+ return;
+ }
+ if (action === "test") {
+ // ?action=test&policy=origin&name=name
+ var policy = params[1].split("=")[1];
+ var name = params[2].split("=")[1];
+ var type = params[3].split("=")[1];
+ var result = getSharedState(sharedKey);
+
+ if (result === "") {
+ result = {};
+ } else {
+ result = JSON.parse(result);
+ }
+
+ if (!result.tests) {
+ result.tests = {};
+ }
+
+ var referrerLevel = "none";
+ var test = {};
+ if (request.hasHeader("Referer")) {
+ let referrer = request.getHeader("Referer");
+ if (referrer.indexOf("referrer_change_server") > 0) {
+ referrerLevel = "full";
+ } else if (referrer == "http://mochi.test:8888") {
+ referrerLevel = "origin";
+ }
+ test.referrer = request.getHeader("Referer");
+ } else {
+ test.referrer = "";
+ }
+ test.policy = referrerLevel;
+ test.expected = policy;
+
+ result.tests[name] = test;
+
+ setSharedState(sharedKey, JSON.stringify(result));
+
+ // forward link click to redirect URL to finish test
+ if (type === "link") {
+ var loc =
+ "https://example.com/tests/dom/base/test/file_change_policy_redirect.html";
+ response.setStatusLine("1.1", 302, "Found");
+ response.setHeader("Location", loc, false);
+ }
+
+ return;
+ }
+ if (action === "get-test-results") {
+ // ?action=get-result
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "text/plain", false);
+ response.write(getSharedState(sharedKey));
+ return;
+ }
+ if (action === "generate-policy-test") {
+ // ?action=generate-policy-test&referrerPolicy=b64-encoded-string&name=name&newPolicy=b64-encoded-string
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "text/html; charset=utf-8", false);
+ var referrerPolicy = unescape(params[1].split("=")[1]);
+ var name = unescape(params[2].split("=")[1]);
+ var newPolicy = params[3].split("=")[1];
+
+ response.write(createTest(referrerPolicy, newPolicy, name));
+ return;
+ }
+ if (action === "generate-policy-test2") {
+ // ?action=generate-policy-test2&referrerPolicy=b64-encoded-string&name=name&newPolicy=b64-encoded-string
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "text/html; charset=utf-8", false);
+ var referrerPolicy = unescape(params[1].split("=")[1]);
+ var name = unescape(params[2].split("=")[1]);
+ var newPolicy = params[3].split("=")[1];
+
+ response.write(createTest2(referrerPolicy, newPolicy, name));
+ return;
+ }
+
+ response.write("I don't know action " + action);
+}
diff --git a/dom/base/test/referrer_header.sjs b/dom/base/test/referrer_header.sjs
new file mode 100644
index 0000000000..29c324b8f6
--- /dev/null
+++ b/dom/base/test/referrer_header.sjs
@@ -0,0 +1,6 @@
+function handleRequest(request, response) {
+ response.setHeader("Referrer-Policy", "same-origin");
+ response.write(
+ 'Loaded'
+ );
+}
diff --git a/dom/base/test/referrer_helper.js b/dom/base/test/referrer_helper.js
new file mode 100644
index 0000000000..ad24a027e7
--- /dev/null
+++ b/dom/base/test/referrer_helper.js
@@ -0,0 +1,129 @@
+// This helper expects these globals to be defined.
+/* global PARAMS, SJS, testCases */
+
+/*
+ * common functionality for iframe, anchor, and area referrer attribute tests
+ */
+const GET_RESULT = SJS + "ACTION=get-test-results";
+const RESET_STATE = SJS + "ACTION=resetState";
+
+SimpleTest.waitForExplicitFinish();
+var advance = function () {
+ tests.next();
+};
+
+/**
+ * Listen for notifications from the child.
+ * These are sent in case of error, or when the loads we await have completed.
+ */
+window.addEventListener("message", function (event) {
+ if (event.data == "childLoadComplete") {
+ // all loads happen, continue the test.
+ advance();
+ }
+});
+
+/**
+ * helper to perform an XHR
+ * to do checkIndividualResults and resetState
+ */
+function doXHR(aUrl, onSuccess, onFail) {
+ // The server is at http[s]://example.com so we need cross-origin XHR.
+ var xhr = new XMLHttpRequest({ mozSystem: true });
+ xhr.responseType = "json";
+ xhr.onload = function () {
+ onSuccess(xhr);
+ };
+ xhr.onerror = function () {
+ onFail(xhr);
+ };
+ xhr.open("GET", "http" + aUrl, true);
+ xhr.send(null);
+}
+
+/**
+ * Grabs the results via XHR and passes to checker.
+ */
+function checkIndividualResults(aTestname, aExpectedReferrer, aName) {
+ var onload = xhr => {
+ var results = xhr.response;
+ info(JSON.stringify(xhr.response));
+ ok(aName in results, aName + " tests have to be performed.");
+ is(
+ results[aName].policy,
+ aExpectedReferrer,
+ aTestname +
+ " --- " +
+ results[aName].policy +
+ " (" +
+ results[aName].referrer +
+ ")"
+ );
+ advance();
+ };
+ var onerror = xhr => {
+ ok(false, "Can't get results from the counter server.");
+ SimpleTest.finish();
+ };
+ doXHR(GET_RESULT, onload, onerror);
+}
+
+function resetState() {
+ doXHR(RESET_STATE, advance, function (xhr) {
+ ok(false, "error in reset state");
+ SimpleTest.finish();
+ });
+}
+
+/**
+ * testing if referrer header is sent correctly
+ */
+var tests = (function* () {
+ yield SpecialPowers.pushPrefEnv(
+ { set: [["security.mixed_content.block_active_content", false]] },
+ advance
+ );
+ yield SpecialPowers.pushPrefEnv(
+ { set: [["network.http.referer.disallowRelaxingDefault", false]] },
+ advance
+ );
+ yield SpecialPowers.pushPermissions(
+ [{ type: "systemXHR", allow: true, context: document }],
+ advance
+ );
+
+ var iframe = document.getElementById("testframe");
+
+ for (var j = 0; j < testCases.length; j++) {
+ if (testCases[j].PREFS) {
+ yield SpecialPowers.pushPrefEnv({ set: testCases[j].PREFS }, advance);
+ }
+
+ var actions = testCases[j].ACTION;
+ var subTests = testCases[j].TESTS;
+ for (var k = 0; k < actions.length; k++) {
+ var actionString = actions[k];
+ for (var i = 0; i < subTests.length; i++) {
+ yield resetState();
+ var searchParams = new URLSearchParams();
+ searchParams.append("ACTION", actionString);
+ searchParams.append("NAME", subTests[i].NAME);
+ for (var l of PARAMS) {
+ if (subTests[i][l]) {
+ searchParams.append(l, subTests[i][l]);
+ }
+ }
+ var schemeFrom = subTests[i].SCHEME_FROM || "http";
+ yield (iframe.src = schemeFrom + SJS + searchParams.toString());
+ yield checkIndividualResults(
+ subTests[i].DESC,
+ subTests[i].RESULT,
+ subTests[i].NAME
+ );
+ }
+ }
+ }
+
+ // complete.
+ SimpleTest.finish();
+})();
diff --git a/dom/base/test/referrer_testserver.sjs b/dom/base/test/referrer_testserver.sjs
new file mode 100644
index 0000000000..7a1476004e
--- /dev/null
+++ b/dom/base/test/referrer_testserver.sjs
@@ -0,0 +1,691 @@
+/*
+ * Test server for iframe, anchor, and area referrer attributes.
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=1175736
+ * Also server for further referrer tests such as redirecting tests
+ * bug 1174913, bug 1175736, bug 1184781
+ */
+
+const SJS = "referrer_testserver.sjs?";
+const SJS_PATH = "/tests/dom/base/test/";
+const BASE_ORIGIN = "example.com";
+const BASE_URL = BASE_ORIGIN + SJS_PATH + SJS;
+const SHARED_KEY = SJS;
+const SAME_ORIGIN = "mochi.test:8888" + SJS_PATH + SJS;
+const CROSS_ORIGIN_URL = "test1.example.com" + SJS_PATH + SJS;
+
+const IMG_BYTES = atob(
+ "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12" +
+ "P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
+);
+
+function createTestUrl(
+ aPolicy,
+ aAction,
+ aName,
+ aType,
+ aSchemeFrom,
+ aSchemeTo,
+ crossOrigin,
+ referrerPolicyHeader
+) {
+ var schemeTo = aSchemeTo || "http";
+ var schemeFrom = aSchemeFrom || "http";
+ var rpHeader = referrerPolicyHeader || "";
+ var url = schemeTo + "://";
+ url += crossOrigin ? CROSS_ORIGIN_URL : BASE_URL;
+ url +=
+ "ACTION=" +
+ aAction +
+ "&" +
+ "policy=" +
+ aPolicy +
+ "&" +
+ "NAME=" +
+ aName +
+ "&" +
+ "type=" +
+ aType +
+ "&" +
+ "RP_HEADER=" +
+ rpHeader +
+ "&" +
+ "SCHEME_FROM=" +
+ schemeFrom;
+ return url;
+}
+
+// test page using iframe referrer attribute
+// if aParams are set this creates a test where the iframe url is a redirect
+function createIframeTestPageUsingRefferer(
+ aMetaPolicy,
+ aAttributePolicy,
+ aNewAttributePolicy,
+ aName,
+ aParams,
+ aSchemeFrom,
+ aSchemeTo,
+ aChangingMethod
+) {
+ var metaString = "";
+ if (aMetaPolicy) {
+ metaString = ` `;
+ }
+ var changeString = "";
+ if (aChangingMethod === "setAttribute") {
+ changeString = `document.getElementById("myframe").setAttribute("referrerpolicy", "${aNewAttributePolicy}")`;
+ } else if (aChangingMethod === "property") {
+ changeString = `document.getElementById("myframe").referrerPolicy = "${aNewAttributePolicy}"`;
+ }
+ var iFrameString = ``;
+ var iframeUrl = "";
+ if (aParams) {
+ aParams.delete("ACTION");
+ aParams.append("ACTION", "redirectIframe");
+ iframeUrl = "http://" + CROSS_ORIGIN_URL + aParams.toString();
+ } else {
+ iframeUrl = createTestUrl(
+ aAttributePolicy,
+ "test",
+ aName,
+ "iframe",
+ aSchemeFrom,
+ aSchemeTo
+ );
+ }
+
+ return `
+
+
+ ${metaString}
+
+
+ ${iFrameString}
+
+
+ `;
+}
+
+function buildAnchorString(
+ aMetaPolicy,
+ aReferrerPolicy,
+ aName,
+ aRelString,
+ aSchemeFrom,
+ aSchemeTo
+) {
+ if (aReferrerPolicy) {
+ return `${aReferrerPolicy} `;
+ }
+ return `link `;
+}
+
+function buildAreaString(
+ aMetaPolicy,
+ aReferrerPolicy,
+ aName,
+ aRelString,
+ aSchemeFrom,
+ aSchemeTo
+) {
+ var result = ` `;
+ result += ``;
+ if (aReferrerPolicy) {
+ result += ` `;
+ } else {
+ result += ` `;
+ }
+ result += ` `;
+
+ return result;
+}
+
+// test page using anchor or area referrer attribute
+function createAETestPageUsingRefferer(
+ aMetaPolicy,
+ aAttributePolicy,
+ aNewAttributePolicy,
+ aName,
+ aRel,
+ aStringBuilder,
+ aSchemeFrom,
+ aSchemeTo,
+ aChangingMethod
+) {
+ var metaString = "";
+ if (aMetaPolicy) {
+ metaString = ` `;
+ }
+ var changeString = "";
+ if (aChangingMethod === "setAttribute") {
+ changeString = `document.getElementById("link").setAttribute("referrerpolicy", "${aNewAttributePolicy}")`;
+ } else if (aChangingMethod === "property") {
+ changeString = `document.getElementById("link").referrerPolicy = "${aNewAttributePolicy}"`;
+ }
+ var relString = "";
+ if (aRel) {
+ relString = `rel="noreferrer"`;
+ }
+ var elementString = aStringBuilder(
+ aMetaPolicy,
+ aAttributePolicy,
+ aName,
+ relString,
+ aSchemeFrom,
+ aSchemeTo
+ );
+
+ return `
+
+ ${metaString}
+
+ ${elementString}
+
+
+ `;
+}
+
+// test page using anchor target=_blank rel=noopener
+function createTargetBlankRefferer(
+ aMetaPolicy,
+ aName,
+ aSchemeFrom,
+ aSchemeTo,
+ aRpHeader
+) {
+ var metaString = "";
+ if (aMetaPolicy) {
+ metaString = ` `;
+ }
+ var elementString = `link `;
+
+ return `
+
+ ${metaString}
+
+ ${elementString}
+
+
+ `;
+}
+
+// creates test page with img that is a redirect
+function createRedirectImgTestCase(aParams, aAttributePolicy) {
+ var metaString = "";
+ if (aParams.has("META_POLICY")) {
+ metaString = ` `;
+ }
+ aParams.delete("ACTION");
+ aParams.append("ACTION", "redirectImg");
+ var imgUrl = "http://" + CROSS_ORIGIN_URL + aParams.toString();
+
+ return `
+
+
+
+ ${metaString}
+ Test referrer policies on redirect (img)
+
+
+
+
+
+ `;
+}
+
+// test page using link referrer attribute
+function createLinkPageUsingRefferer(
+ aMetaPolicy,
+ aAttributePolicy,
+ aNewAttributePolicy,
+ aName,
+ aRel,
+ aStringBuilder,
+ aSchemeFrom,
+ aSchemeTo,
+ aTestType
+) {
+ var metaString = "";
+ if (aMetaPolicy) {
+ metaString = ` `;
+ }
+
+ var changeString = "";
+ var policy = aAttributePolicy ? aAttributePolicy : aMetaPolicy;
+ var elementString = aStringBuilder(
+ policy,
+ aName,
+ aRel,
+ aSchemeFrom,
+ aSchemeTo,
+ aTestType
+ );
+
+ if (aTestType === "setAttribute") {
+ changeString = `var link = document.getElementById("test_link");
+ link.setAttribute("referrerpolicy", "${aNewAttributePolicy}");
+ link.href = "${createTestUrl(
+ policy,
+ "test",
+ aName,
+ "link_element_" + aRel,
+ aSchemeFrom,
+ aSchemeTo
+ )}";`;
+ } else if (aTestType === "property") {
+ changeString = `var link = document.getElementById("test_link");
+ link.referrerPolicy = "${aNewAttributePolicy}";
+ link.href = "${createTestUrl(
+ policy,
+ "test",
+ aName,
+ "link_element_" + aRel,
+ aSchemeFrom,
+ aSchemeTo
+ )}";`;
+ }
+
+ return `
+
+
+ ${metaString}
+
+
+ ${elementString}
+
+
+ `;
+}
+
+function createFetchUserControlRPTestCase(
+ aName,
+ aSchemeFrom,
+ aSchemeTo,
+ crossOrigin
+) {
+ var srcUrl = createTestUrl(
+ "",
+ "test",
+ aName,
+ "fetch",
+ aSchemeFrom,
+ aSchemeTo,
+ crossOrigin
+ );
+
+ return `
+
+
+
+ Test user control referrer policies
+
+
+
+
+ `;
+}
+
+function buildLinkString(
+ aPolicy,
+ aName,
+ aRel,
+ aSchemeFrom,
+ aSchemeTo,
+ aTestType
+) {
+ var href = "";
+ var onChildComplete = `window.parent.postMessage("childLoadComplete", "http://mochi.test:8888");`;
+ var policy = "";
+ var asString = "";
+ var relString = "";
+
+ if (aRel) {
+ relString = `rel="${aRel}"`;
+ }
+
+ if (aPolicy) {
+ policy = `referrerpolicy=${aPolicy}`;
+ }
+
+ if (aRel == "preload") {
+ asString = 'as="image"';
+ }
+
+ if (!aTestType) {
+ href = `href=${createTestUrl(
+ aPolicy,
+ "test",
+ aName,
+ "link_element_" + aRel,
+ aSchemeFrom,
+ aSchemeTo
+ )}`;
+ }
+
+ return ` `;
+}
+
+// eslint-disable-next-line complexity
+function handleRequest(request, response) {
+ var params = new URLSearchParams(request.queryString);
+ var action = params.get("ACTION");
+ var schemeFrom = params.get("SCHEME_FROM") || "http";
+ var schemeTo = params.get("SCHEME_TO") || "http";
+ var crossOrigin = params.get("CROSS_ORIGIN") || false;
+ var referrerPolicyHeader = params.get("RP_HEADER") || "";
+
+ response.setHeader("Access-Control-Allow-Origin", "*", false);
+ if (referrerPolicyHeader) {
+ response.setHeader("Referrer-Policy", referrerPolicyHeader, false);
+ }
+
+ if (action === "resetState") {
+ setSharedState(SHARED_KEY, "{}");
+ response.write("");
+ return;
+ }
+ if (action === "get-test-results") {
+ // ?action=get-result
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "text/plain", false);
+ response.write(getSharedState(SHARED_KEY));
+ return;
+ }
+ if (action === "redirect") {
+ response.write(
+ ''
+ );
+ return;
+ }
+ if (action === "redirectImg") {
+ params.delete("ACTION");
+ params.append("ACTION", "test");
+ params.append("type", "img");
+ // 302 found, 301 Moved Permanently, 303 See Other, 307 Temporary Redirect
+ response.setStatusLine("1.1", 302, "found");
+ response.setHeader(
+ "Location",
+ "http://" + CROSS_ORIGIN_URL + params.toString(),
+ false
+ );
+ return;
+ }
+ if (action === "redirectIframe") {
+ params.delete("ACTION");
+ params.append("ACTION", "test");
+ params.append("type", "iframe");
+ // 302 found, 301 Moved Permanently, 303 See Other, 307 Temporary Redirect
+ response.setStatusLine("1.1", 302, "found");
+ response.setHeader(
+ "Location",
+ "http://" + CROSS_ORIGIN_URL + params.toString(),
+ false
+ );
+ return;
+ }
+ if (action === "test") {
+ // ?action=test&policy=origin&name=name
+ var policy = params.get("policy");
+ var name = params.get("NAME");
+ var type = params.get("type");
+ var result = getSharedState(SHARED_KEY);
+
+ result = result ? JSON.parse(result) : {};
+
+ var referrerLevel = "none";
+ var test = {};
+ if (request.hasHeader("Referer")) {
+ var referrer = request.getHeader("Referer");
+ if (referrer.indexOf("referrer_testserver") > 0) {
+ referrerLevel = "full";
+ } else if (referrer.indexOf(schemeFrom + "://example.com") == 0) {
+ referrerLevel = "origin";
+ } else {
+ // this is never supposed to happen
+ referrerLevel = "other-origin";
+ }
+ test.referrer = referrer;
+ } else {
+ test.referrer = "";
+ }
+ test.policy = referrerLevel;
+ test.expected = policy;
+
+ result[name] = test;
+
+ setSharedState(SHARED_KEY, JSON.stringify(result));
+
+ if (type === "img" || type == "link_element_preload") {
+ // return image
+ response.setHeader("Content-Type", "image/png");
+ response.write(IMG_BYTES);
+ return;
+ }
+ if (type === "iframe") {
+ // return iframe page
+ response.write("I am the iframe");
+ return;
+ }
+ if (type === "link") {
+ // forward link click to redirect URL to finish test
+ var loc = "http://" + BASE_URL + "ACTION=redirect";
+ response.setStatusLine("1.1", 302, "Found");
+ response.setHeader("Location", loc, false);
+ }
+ return;
+ }
+
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "text/html; charset=utf-8", false);
+
+ // parse test arguments and start test
+ var attributePolicy = params.get("ATTRIBUTE_POLICY") || "";
+ var newAttributePolicy = params.get("NEW_ATTRIBUTE_POLICY") || "";
+ var metaPolicy = params.get("META_POLICY") || "";
+ var rel = params.get("REL") || "";
+ var name = params.get("NAME");
+
+ // anchor & area
+ var _getPage = createAETestPageUsingRefferer.bind(
+ null,
+ metaPolicy,
+ attributePolicy,
+ newAttributePolicy,
+ name,
+ rel
+ );
+ var _getAnchorPage = _getPage.bind(
+ null,
+ buildAnchorString,
+ schemeFrom,
+ schemeTo
+ );
+ var _getAreaPage = _getPage.bind(null, buildAreaString, schemeFrom, schemeTo);
+
+ // aMetaPolicy, aAttributePolicy, aNewAttributePolicy, aName, aChangingMethod, aStringBuilder
+ if (action === "generate-anchor-policy-test") {
+ response.write(_getAnchorPage());
+ return;
+ }
+ if (action === "generate-anchor-changing-policy-test-set-attribute") {
+ response.write(_getAnchorPage("setAttribute"));
+ return;
+ }
+ if (action === "generate-anchor-changing-policy-test-property") {
+ response.write(_getAnchorPage("property"));
+ return;
+ }
+ if (action === "generate-area-policy-test") {
+ response.write(_getAreaPage());
+ return;
+ }
+ if (action === "generate-area-changing-policy-test-set-attribute") {
+ response.write(_getAreaPage("setAttribute"));
+ return;
+ }
+ if (action === "generate-area-changing-policy-test-property") {
+ response.write(_getAreaPage("property"));
+ return;
+ }
+ if (action === "generate-anchor-target-blank-policy-test") {
+ response.write(
+ createTargetBlankRefferer(
+ metaPolicy,
+ name,
+ schemeFrom,
+ schemeTo,
+ referrerPolicyHeader
+ )
+ );
+ return;
+ }
+
+ // iframe
+ _getPage = createIframeTestPageUsingRefferer.bind(
+ null,
+ metaPolicy,
+ attributePolicy,
+ newAttributePolicy,
+ name,
+ "",
+ schemeFrom,
+ schemeTo
+ );
+
+ // aMetaPolicy, aAttributePolicy, aNewAttributePolicy, aName, aChangingMethod
+ if (action === "generate-iframe-policy-test") {
+ response.write(_getPage());
+ return;
+ }
+ if (action === "generate-iframe-changing-policy-test-set-attribute") {
+ response.write(_getPage("setAttribute"));
+ return;
+ }
+ if (action === "generate-iframe-changing-policy-test-property") {
+ response.write(_getPage("property"));
+ return;
+ }
+
+ // redirect tests with img and iframe
+ if (action === "generate-img-redirect-policy-test") {
+ response.write(createRedirectImgTestCase(params, attributePolicy));
+ return;
+ }
+ if (action === "generate-iframe-redirect-policy-test") {
+ response.write(
+ createIframeTestPageUsingRefferer(
+ metaPolicy,
+ attributePolicy,
+ newAttributePolicy,
+ name,
+ params,
+ schemeFrom,
+ schemeTo
+ )
+ );
+ return;
+ }
+
+ var _getPage = createLinkPageUsingRefferer.bind(
+ null,
+ metaPolicy,
+ attributePolicy,
+ newAttributePolicy,
+ name,
+ rel
+ );
+ var _getLinkPage = _getPage.bind(null, buildLinkString, schemeFrom, schemeTo);
+
+ // link
+ if (action === "generate-link-policy-test") {
+ response.write(_getLinkPage());
+ return;
+ }
+ if (action === "generate-link-policy-test-set-attribute") {
+ response.write(_getLinkPage("setAttribute"));
+ return;
+ }
+ if (action === "generate-link-policy-test-property") {
+ response.write(_getLinkPage("property"));
+ return;
+ }
+
+ if (action === "generate-fetch-user-control-policy-test") {
+ response.write(
+ createFetchUserControlRPTestCase(name, schemeFrom, schemeTo, crossOrigin)
+ );
+ return;
+ }
+
+ response.write("I don't know action " + action);
+}
diff --git a/dom/base/test/reftest/mixed-bmp-png.ico b/dom/base/test/reftest/mixed-bmp-png.ico
new file mode 100644
index 0000000000..32e2c4995c
Binary files /dev/null and b/dom/base/test/reftest/mixed-bmp-png.ico differ
diff --git a/dom/base/test/reftest/reftest.list b/dom/base/test/reftest/reftest.list
new file mode 100644
index 0000000000..8aa3f3b949
--- /dev/null
+++ b/dom/base/test/reftest/reftest.list
@@ -0,0 +1,7 @@
+== test_bug920877.html test_bug920877-ref.html
+HTTP == test_xmlPrettyPrint_csp.xml test_xmlPrettyPrint_csp-ref.xml
+# Ordinarily, reftests use a browser.viewport.desktopWidth of 800px, same as the
+# size of the reftest document. This test however needs something more representative
+# of a real mobile device, where the desktop viewport width doesn't match the
+# width of the device screen.
+test-pref(dom.meta-viewport.enabled,true) test-pref(browser.viewport.desktopWidth,1200) == test_bug1525662.txt test_bug1525662-ref.html
diff --git a/dom/base/test/reftest/test_bug1525662-ref.html b/dom/base/test/reftest/test_bug1525662-ref.html
new file mode 100644
index 0000000000..063daf7615
--- /dev/null
+++ b/dom/base/test/reftest/test_bug1525662-ref.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras ac velit sed tellus facilisis euismod. Proin vel nulla vel turpis tristique dignissim. Donec lacus ipsum, eleifend ut, volutpat a, ultrices adipiscing, arcu. Etiam ligula dolor, adipiscing ut, porta vitae, bibendum non, dolor. Mauris ligula. Sed placerat tincidunt elit. Vestibulum non libero. Curabitur cursus tortor id sem. Integer consectetuer auctor lacus. Proin nisl nisi, pulvinar eget, pharetra at, aliquam eu, velit. Morbi fringilla. Quisque faucibus, mauris posuere vulputate interdum, lectus libero sollicitudin tellus, sit amet ultrices enim purus ac mauris. Pellentesque sit amet mauris eu ante aliquet egestas. Mauris dapibus, velit consectetuer tristique luctus, enim augue pulvinar libero, fringilla dictum lectus felis eu ligula. In ac lorem.
+
+Integer laoreet. Ut ultricies arcu nec est. Aenean varius nisl ut odio. Nullam arcu. Vestibulum non pede. Proin vel est. Nam condimentum fermentum dui. Donec at arcu. Donec at libero adipiscing odio mattis dapibus. Suspendisse libero neque, faucibus sed, facilisis et, convallis sit amet, justo. Duis purus tortor, ornare ac, convallis ut, pretium et, tellus. Nam accumsan, ipsum eget accumsan mollis, sapien dolor adipiscing metus, id tincidunt ipsum metus sed nulla. Praesent hendrerit lectus eget tortor. Morbi id lectus et elit ultrices hendrerit. Cras gravida velit sed mauris. Proin lacinia tempus est. Sed sapien tortor, fringilla vel, elementum in, volutpat ac, ante. Vivamus eu tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
+
+Mauris in sem ac felis pretium placerat. Donec tempus cursus sem. Aliquam scelerisque porttitor sem. Curabitur consectetuer, pede vitae aliquam aliquet, sapien lacus vehicula neque, ut rhoncus nibh neque sed velit. In rhoncus, nulla eu dignissim egestas, diam nibh hendrerit mauris, condimentum laoreet sapien arcu quis mi. Sed euismod sem. Nulla non ligula sed lacus tempor molestie. Quisque varius. In hac habitasse platea dictumst. Sed felis ipsum, consequat et, blandit vitae, tincidunt id, quam. Nunc nunc. Duis gravida. In massa neque, cursus quis, rutrum sed, semper quis, erat. Donec enim. Suspendisse condimentum eros vel elit. Vestibulum adipiscing erat id lorem. Maecenas enim dui, cursus a, pulvinar ac, rutrum sed, sem. Suspendisse gravida ante vel lectus.
+
+Vestibulum molestie, ante at dignissim venenatis, pede urna dictum arcu, vel ullamcorper ligula eros eget metus. Pellentesque nec nisl. Morbi ut nibh. Aenean mauris. Mauris rutrum justo nec velit. Nunc condimentum tortor id augue. Quisque semper massa eget nibh. Maecenas ac odio pretium lorem tincidunt faucibus. Sed congue. Cras sit amet orci ut ligula cursus congue. Etiam laoreet lacus sit amet tortor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus accumsan. Ut gravida urna hendrerit leo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+
+
+
diff --git a/dom/base/test/reftest/test_bug1525662.txt b/dom/base/test/reftest/test_bug1525662.txt
new file mode 100644
index 0000000000..33fd1fd851
--- /dev/null
+++ b/dom/base/test/reftest/test_bug1525662.txt
@@ -0,0 +1,7 @@
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras ac velit sed tellus facilisis euismod. Proin vel nulla vel turpis tristique dignissim. Donec lacus ipsum, eleifend ut, volutpat a, ultrices adipiscing, arcu. Etiam ligula dolor, adipiscing ut, porta vitae, bibendum non, dolor. Mauris ligula. Sed placerat tincidunt elit. Vestibulum non libero. Curabitur cursus tortor id sem. Integer consectetuer auctor lacus. Proin nisl nisi, pulvinar eget, pharetra at, aliquam eu, velit. Morbi fringilla. Quisque faucibus, mauris posuere vulputate interdum, lectus libero sollicitudin tellus, sit amet ultrices enim purus ac mauris. Pellentesque sit amet mauris eu ante aliquet egestas. Mauris dapibus, velit consectetuer tristique luctus, enim augue pulvinar libero, fringilla dictum lectus felis eu ligula. In ac lorem.
+
+Integer laoreet. Ut ultricies arcu nec est. Aenean varius nisl ut odio. Nullam arcu. Vestibulum non pede. Proin vel est. Nam condimentum fermentum dui. Donec at arcu. Donec at libero adipiscing odio mattis dapibus. Suspendisse libero neque, faucibus sed, facilisis et, convallis sit amet, justo. Duis purus tortor, ornare ac, convallis ut, pretium et, tellus. Nam accumsan, ipsum eget accumsan mollis, sapien dolor adipiscing metus, id tincidunt ipsum metus sed nulla. Praesent hendrerit lectus eget tortor. Morbi id lectus et elit ultrices hendrerit. Cras gravida velit sed mauris. Proin lacinia tempus est. Sed sapien tortor, fringilla vel, elementum in, volutpat ac, ante. Vivamus eu tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
+
+Mauris in sem ac felis pretium placerat. Donec tempus cursus sem. Aliquam scelerisque porttitor sem. Curabitur consectetuer, pede vitae aliquam aliquet, sapien lacus vehicula neque, ut rhoncus nibh neque sed velit. In rhoncus, nulla eu dignissim egestas, diam nibh hendrerit mauris, condimentum laoreet sapien arcu quis mi. Sed euismod sem. Nulla non ligula sed lacus tempor molestie. Quisque varius. In hac habitasse platea dictumst. Sed felis ipsum, consequat et, blandit vitae, tincidunt id, quam. Nunc nunc. Duis gravida. In massa neque, cursus quis, rutrum sed, semper quis, erat. Donec enim. Suspendisse condimentum eros vel elit. Vestibulum adipiscing erat id lorem. Maecenas enim dui, cursus a, pulvinar ac, rutrum sed, sem. Suspendisse gravida ante vel lectus.
+
+Vestibulum molestie, ante at dignissim venenatis, pede urna dictum arcu, vel ullamcorper ligula eros eget metus. Pellentesque nec nisl. Morbi ut nibh. Aenean mauris. Mauris rutrum justo nec velit. Nunc condimentum tortor id augue. Quisque semper massa eget nibh. Maecenas ac odio pretium lorem tincidunt faucibus. Sed congue. Cras sit amet orci ut ligula cursus congue. Etiam laoreet lacus sit amet tortor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus accumsan. Ut gravida urna hendrerit leo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
diff --git a/dom/base/test/reftest/test_bug920877-ref.html b/dom/base/test/reftest/test_bug920877-ref.html
new file mode 100644
index 0000000000..1a593e5849
--- /dev/null
+++ b/dom/base/test/reftest/test_bug920877-ref.html
@@ -0,0 +1,20 @@
+
+
+
+
+
diff --git a/dom/base/test/reftest/test_bug920877.html b/dom/base/test/reftest/test_bug920877.html
new file mode 100644
index 0000000000..18bae4009e
--- /dev/null
+++ b/dom/base/test/reftest/test_bug920877.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/reftest/test_xmlPrettyPrint_csp-ref.xml b/dom/base/test/reftest/test_xmlPrettyPrint_csp-ref.xml
new file mode 100644
index 0000000000..7b3c180912
--- /dev/null
+++ b/dom/base/test/reftest/test_xmlPrettyPrint_csp-ref.xml
@@ -0,0 +1,4 @@
+
+
+ This is an XML document
+
diff --git a/dom/base/test/reftest/test_xmlPrettyPrint_csp.xml b/dom/base/test/reftest/test_xmlPrettyPrint_csp.xml
new file mode 100644
index 0000000000..7b3c180912
--- /dev/null
+++ b/dom/base/test/reftest/test_xmlPrettyPrint_csp.xml
@@ -0,0 +1,4 @@
+
+
+ This is an XML document
+
diff --git a/dom/base/test/reftest/test_xmlPrettyPrint_csp.xml^headers^ b/dom/base/test/reftest/test_xmlPrettyPrint_csp.xml^headers^
new file mode 100644
index 0000000000..93d453bd3b
--- /dev/null
+++ b/dom/base/test/reftest/test_xmlPrettyPrint_csp.xml^headers^
@@ -0,0 +1 @@
+Content-Security-Policy: default-src 'none';
diff --git a/dom/base/test/script-1_bug597345.sjs b/dom/base/test/script-1_bug597345.sjs
new file mode 100644
index 0000000000..7beb3283fc
--- /dev/null
+++ b/dom/base/test/script-1_bug597345.sjs
@@ -0,0 +1,20 @@
+// timer has to be alive so it can't be eaten by the GC.
+var timer;
+
+function handleRequest(request, response) {
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader("Content-Type", "text/javascript", false);
+ // The "stray" open comment at the end of the write is important!
+ response.write(
+ "document.write(\"
+
+
+ Test for Bug 338583
+
+
+
+
+
+
+Mozilla Bug 716841
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_Image_constructor.html b/dom/base/test/test_Image_constructor.html
new file mode 100644
index 0000000000..4c4bb70e54
--- /dev/null
+++ b/dom/base/test/test_Image_constructor.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+ Test for Bug 862702
+
+
+
+
+
+Mozilla Bug 862702
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_NodeIterator_basics_filters.xhtml b/dom/base/test/test_NodeIterator_basics_filters.xhtml
new file mode 100644
index 0000000000..768782dc2a
--- /dev/null
+++ b/dom/base/test/test_NodeIterator_basics_filters.xhtml
@@ -0,0 +1,178 @@
+
+
+
+ DOM Traversal: NodeIterator: Basics and Filters
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_NodeIterator_mutations_1.xhtml b/dom/base/test/test_NodeIterator_mutations_1.xhtml
new file mode 100644
index 0000000000..5f6dc2f861
--- /dev/null
+++ b/dom/base/test/test_NodeIterator_mutations_1.xhtml
@@ -0,0 +1,204 @@
+
+
+
+ DOM Traversal: NodeIterator: Mutations (1/x)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_NodeIterator_mutations_2.html b/dom/base/test/test_NodeIterator_mutations_2.html
new file mode 100644
index 0000000000..47d7b8b5e4
--- /dev/null
+++ b/dom/base/test/test_NodeIterator_mutations_2.html
@@ -0,0 +1,112 @@
+
+
+
+
+ DOM Traversal: NodeIterator: Mutations (2/x)
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_NodeIterator_mutations_3.html b/dom/base/test/test_NodeIterator_mutations_3.html
new file mode 100644
index 0000000000..3eb23ee3ce
--- /dev/null
+++ b/dom/base/test/test_NodeIterator_mutations_3.html
@@ -0,0 +1,160 @@
+
+
+
+ DOM Traversal: NodeIterator: Mutations (3/x)
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_anchor_area_referrer.html b/dom/base/test/test_anchor_area_referrer.html
new file mode 100644
index 0000000000..7e6992b404
--- /dev/null
+++ b/dom/base/test/test_anchor_area_referrer.html
@@ -0,0 +1,127 @@
+
+
+
+
+ Test anchor and area policy attribute for Bug 1174913
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_anchor_area_referrer_changing.html b/dom/base/test/test_anchor_area_referrer_changing.html
new file mode 100644
index 0000000000..e8d6c249fb
--- /dev/null
+++ b/dom/base/test/test_anchor_area_referrer_changing.html
@@ -0,0 +1,66 @@
+
+
+
+
+ Test anchor and area policy attribute for Bug 1174913
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_anchor_area_referrer_invalid.html b/dom/base/test/test_anchor_area_referrer_invalid.html
new file mode 100644
index 0000000000..f5687b7180
--- /dev/null
+++ b/dom/base/test/test_anchor_area_referrer_invalid.html
@@ -0,0 +1,74 @@
+
+
+
+
+ Test anchor and area policy attribute for Bug 1174913
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_anchor_area_referrer_rel.html b/dom/base/test/test_anchor_area_referrer_rel.html
new file mode 100644
index 0000000000..71cd4f6390
--- /dev/null
+++ b/dom/base/test/test_anchor_area_referrer_rel.html
@@ -0,0 +1,50 @@
+
+
+
+
+ Test anchor and area policy attribute for Bug 1174913
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_anchor_target_blank_referrer.html b/dom/base/test/test_anchor_target_blank_referrer.html
new file mode 100644
index 0000000000..b494c28017
--- /dev/null
+++ b/dom/base/test/test_anchor_target_blank_referrer.html
@@ -0,0 +1,136 @@
+
+
+
+
+ Test anchor target=_blank rel=noopener referrer header for Bug 1502678
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_anonymousContent_api.html b/dom/base/test/test_anonymousContent_api.html
new file mode 100644
index 0000000000..ee37c202d1
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_api.html
@@ -0,0 +1,30 @@
+
+
+
+Test for Bug 1020244 - Test the chrome-only AnonymousContent API
+
+
+Mozilla Bug 1020244
+
diff --git a/dom/base/test/test_anonymousContent_append_after_reflow.html b/dom/base/test/test_anonymousContent_append_after_reflow.html
new file mode 100644
index 0000000000..0bdca2c502
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_append_after_reflow.html
@@ -0,0 +1,35 @@
+
+
+
+
+Test for Bug 1020244 - Make sure anonymous content still works after a reflow (after the canvasframe has been reconstructed)
+
+
+
+
diff --git a/dom/base/test/test_anonymousContent_canvas.html b/dom/base/test/test_anonymousContent_canvas.html
new file mode 100644
index 0000000000..d5a5a1e6c4
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_canvas.html
@@ -0,0 +1,48 @@
+
+
+
+
+Test for Bug 1212477 - Needs a way to access to <canvas>'s context (2d, webgl) from Anonymous Content API
+
+
+Mozilla Bug 1212477
+
+
diff --git a/dom/base/test/test_anonymousContent_insert.html b/dom/base/test/test_anonymousContent_insert.html
new file mode 100644
index 0000000000..ce73a1521f
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_insert.html
@@ -0,0 +1,42 @@
+
+
+
+
+Test for Bug 1020244 - Insert content using the AnonymousContent API, several times, and don't remove it
+
+
+Mozilla Bug 1020244
+
+
diff --git a/dom/base/test/test_anonymousContent_manipulate_content.html b/dom/base/test/test_anonymousContent_manipulate_content.html
new file mode 100644
index 0000000000..e67bfdfea6
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_manipulate_content.html
@@ -0,0 +1,41 @@
+
+
+
+
+Test for Bug 1020244 - Manipulate content created with the AnonymousContent API
+
+
+Mozilla Bug 1020244
+
+
diff --git a/dom/base/test/test_anonymousContent_style_csp.html b/dom/base/test/test_anonymousContent_style_csp.html
new file mode 100644
index 0000000000..2aa82a6b2a
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_style_csp.html
@@ -0,0 +1,23 @@
+
+
+
+
+Test for Bug 1185351 - Make sure that we don't enforce CSP on styles for AnonymousContent
+
+
+
+
diff --git a/dom/base/test/test_anonymousContent_style_csp.html^headers^ b/dom/base/test/test_anonymousContent_style_csp.html^headers^
new file mode 100644
index 0000000000..b7b3c8a4f9
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_style_csp.html^headers^
@@ -0,0 +1 @@
+Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'
diff --git a/dom/base/test/test_anonymousContent_xul_window.xhtml b/dom/base/test/test_anonymousContent_xul_window.xhtml
new file mode 100644
index 0000000000..b81f827075
--- /dev/null
+++ b/dom/base/test/test_anonymousContent_xul_window.xhtml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+ This is a test box
+
+
+
diff --git a/dom/base/test/test_async_setTimeout_stack.html b/dom/base/test/test_async_setTimeout_stack.html
new file mode 100644
index 0000000000..773a923be3
--- /dev/null
+++ b/dom/base/test/test_async_setTimeout_stack.html
@@ -0,0 +1,60 @@
+
+
+
+
+
+ Test for Bug 1142577 - Async stacks for setTimeout
+
+
+
+
+ Mozilla Bug 1142577
+
+
+
+
diff --git a/dom/base/test/test_async_setTimeout_stack_across_globals.html b/dom/base/test/test_async_setTimeout_stack_across_globals.html
new file mode 100644
index 0000000000..358aa21abe
--- /dev/null
+++ b/dom/base/test/test_async_setTimeout_stack_across_globals.html
@@ -0,0 +1,60 @@
+
+
+
+
+
+ Test for Bug 1142577 - Async stacks for setTimeout
+
+
+
+
+ Mozilla Bug 1142577
+
+
+
+
+
diff --git a/dom/base/test/test_base.xhtml b/dom/base/test/test_base.xhtml
new file mode 100644
index 0000000000..b61bc72f68
--- /dev/null
+++ b/dom/base/test/test_base.xhtml
@@ -0,0 +1,39 @@
+
+
+ Test for base URIs
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_blockParsing.html b/dom/base/test/test_blockParsing.html
new file mode 100644
index 0000000000..af4c8aaac5
--- /dev/null
+++ b/dom/base/test/test_blockParsing.html
@@ -0,0 +1,136 @@
+
+
+
+ Test for document.blockParsing
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_blocking_image.html b/dom/base/test/test_blocking_image.html
new file mode 100644
index 0000000000..e579d9f025
--- /dev/null
+++ b/dom/base/test/test_blocking_image.html
@@ -0,0 +1,87 @@
+
+
+
+
+ Test for Bug 1267075
+
+
+
+
+
+Mozilla Bug 1267075
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1008126.html b/dom/base/test/test_bug1008126.html
new file mode 100644
index 0000000000..414f2727ec
--- /dev/null
+++ b/dom/base/test/test_bug1008126.html
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+ Test for Bug 1008126
+
+
+
+
+Mozilla Bug 1008126
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1016960.html b/dom/base/test/test_bug1016960.html
new file mode 100644
index 0000000000..d801a1dba5
--- /dev/null
+++ b/dom/base/test/test_bug1016960.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+ Test for Bug 1016960
+
+
+
+
+
+Mozilla Bug 1016960
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1022229.html b/dom/base/test/test_bug1022229.html
new file mode 100644
index 0000000000..7663cc22d0
--- /dev/null
+++ b/dom/base/test/test_bug1022229.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+ Test for Bug 1022229
+
+
+
+
+
+Mozilla Bug 1022229
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1025933.html b/dom/base/test/test_bug1025933.html
new file mode 100644
index 0000000000..e578ebef20
--- /dev/null
+++ b/dom/base/test/test_bug1025933.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+ Test for Bug 1025933
+
+
+
+
+
+Mozilla Bug 1025933
+
+
+
+
+
diff --git a/dom/base/test/test_bug1037687.html b/dom/base/test/test_bug1037687.html
new file mode 100644
index 0000000000..62f886c837
--- /dev/null
+++ b/dom/base/test/test_bug1037687.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Test for Bug 1037687
+
+
+
+
+Mozilla Bug 1037687
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1037687_subframe.html b/dom/base/test/test_bug1037687_subframe.html
new file mode 100644
index 0000000000..4258f772b6
--- /dev/null
+++ b/dom/base/test/test_bug1037687_subframe.html
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1043106.html b/dom/base/test/test_bug1043106.html
new file mode 100644
index 0000000000..42d6cfff57
--- /dev/null
+++ b/dom/base/test/test_bug1043106.html
@@ -0,0 +1,44 @@
+
+
+
+
+
+ Test for Bug 1043106
+
+
+
+
+ Mozilla Bug 1043106
+
+
+
+
diff --git a/dom/base/test/test_bug1057176.html b/dom/base/test/test_bug1057176.html
new file mode 100644
index 0000000000..e9e516ac1e
--- /dev/null
+++ b/dom/base/test/test_bug1057176.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Test for Bug 1057176
+
+
+
+
+
+Mozilla Bug 1057176
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1060938.html b/dom/base/test/test_bug1060938.html
new file mode 100644
index 0000000000..451ed0d6fb
--- /dev/null
+++ b/dom/base/test/test_bug1060938.html
@@ -0,0 +1,44 @@
+
+
+
+
+
+ Test for Bug 1060938
+
+
+
+
+
+ Mozilla Bug 1060938
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1064481.html b/dom/base/test/test_bug1064481.html
new file mode 100644
index 0000000000..9ce32f4d49
--- /dev/null
+++ b/dom/base/test/test_bug1064481.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Test for Bug 1064481
+
+
+
+
+ Mozilla Bug 1064481
+
+
+
+
diff --git a/dom/base/test/test_bug1070015.html b/dom/base/test/test_bug1070015.html
new file mode 100644
index 0000000000..5debff4dc0
--- /dev/null
+++ b/dom/base/test/test_bug1070015.html
@@ -0,0 +1,53 @@
+
+
+
+
+ Test for Bug 1070015
+
+
+
+
+
+Mozilla Bug 1070015
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1075702.html b/dom/base/test/test_bug1075702.html
new file mode 100644
index 0000000000..a3842a21a5
--- /dev/null
+++ b/dom/base/test/test_bug1075702.html
@@ -0,0 +1,77 @@
+
+
+
+
+
+ Test for Bug 1075702
+
+
+
+
+
+ Mozilla Bug 1075702
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1091883.html b/dom/base/test/test_bug1091883.html
new file mode 100644
index 0000000000..fd2558d89c
--- /dev/null
+++ b/dom/base/test/test_bug1091883.html
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+ Test for Bug 1091883
+
+
+
+
+Mozilla Bug 1091883
+Results
+Running...
+
+
+
+
+
diff --git a/dom/base/test/test_bug1100912.html b/dom/base/test/test_bug1100912.html
new file mode 100644
index 0000000000..9887f1facb
--- /dev/null
+++ b/dom/base/test/test_bug1100912.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+ Test for Bug 1100912
+
+
+
+
+
+Mozilla Bug 1100912
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1101364.html b/dom/base/test/test_bug1101364.html
new file mode 100644
index 0000000000..f3794d3dd0
--- /dev/null
+++ b/dom/base/test/test_bug1101364.html
@@ -0,0 +1,93 @@
+
+
+
+
+Test for Bug 1101364
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1118689.html b/dom/base/test/test_bug1118689.html
new file mode 100644
index 0000000000..e073b6fcfa
--- /dev/null
+++ b/dom/base/test/test_bug1118689.html
@@ -0,0 +1,40 @@
+
+
+
+
+
+ Test for Bug 1118689
+
+
+
+
+
+Mozilla Bug 1118689
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1120222.html b/dom/base/test/test_bug1120222.html
new file mode 100644
index 0000000000..f4f1bf8faa
--- /dev/null
+++ b/dom/base/test/test_bug1120222.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Test document-title-changed observer
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1126851.html b/dom/base/test/test_bug1126851.html
new file mode 100644
index 0000000000..117aabb530
--- /dev/null
+++ b/dom/base/test/test_bug1126851.html
@@ -0,0 +1,44 @@
+
+
+
+
+
+ Test for Bug 1126851
+
+
+
+
+
+Mozilla Bug 1126851
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug116083.html b/dom/base/test/test_bug116083.html
new file mode 100644
index 0000000000..a1736d6cce
--- /dev/null
+++ b/dom/base/test/test_bug116083.html
@@ -0,0 +1,120 @@
+
+
+
+
+ Test for Bug 116083
+
+
+
+
+
+Mozilla Bug 116083
+
+
foo bar
+
foo bar
+
foo bar
+
foo bar
+
foo bar
+
foo bar
+
foo bar
+
foo bar
+
bar baz
+
bar baz
+
bar baz
+
bar baz
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
foo bar
+
+
+
+
diff --git a/dom/base/test/test_bug1163743.html b/dom/base/test/test_bug1163743.html
new file mode 100644
index 0000000000..1965909284
--- /dev/null
+++ b/dom/base/test/test_bug1163743.html
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+ Test policies for Bug 1163743
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1165501.html b/dom/base/test/test_bug1165501.html
new file mode 100644
index 0000000000..d0f98a9b05
--- /dev/null
+++ b/dom/base/test/test_bug1165501.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ Test policies for Bug 1165501
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1187157.html b/dom/base/test/test_bug1187157.html
new file mode 100644
index 0000000000..d96c11e635
--- /dev/null
+++ b/dom/base/test/test_bug1187157.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+ Test for Bug 1187157
+
+
+
+
+Mozilla Bug 1187157
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1198095.html b/dom/base/test/test_bug1198095.html
new file mode 100644
index 0000000000..bcc005d897
--- /dev/null
+++ b/dom/base/test/test_bug1198095.html
@@ -0,0 +1,71 @@
+
+
+
+
+ Test for Bug 1198095
+
+
+
+
+
+Mozilla Bug 1198095
+
+
+
+
+
diff --git a/dom/base/test/test_bug1222633.html b/dom/base/test/test_bug1222633.html
new file mode 100644
index 0000000000..229aa5e35c
--- /dev/null
+++ b/dom/base/test/test_bug1222633.html
@@ -0,0 +1,110 @@
+
+
+
+
+ Test for Bug 1222633
+
+
+
+
+Mozilla Bug 1222633
+
+
+
+
+
diff --git a/dom/base/test/test_bug1222633_link_update.html b/dom/base/test/test_bug1222633_link_update.html
new file mode 100644
index 0000000000..a398f648b7
--- /dev/null
+++ b/dom/base/test/test_bug1222633_link_update.html
@@ -0,0 +1,127 @@
+
+
+
+
+ Test for Bug 1222633
+
+
+
+
+Mozilla Bug 1222633
+
+
+
+
+
diff --git a/dom/base/test/test_bug1238440.html b/dom/base/test/test_bug1238440.html
new file mode 100644
index 0000000000..528b337c00
--- /dev/null
+++ b/dom/base/test/test_bug1238440.html
@@ -0,0 +1,88 @@
+
+
+
+
+ Test - bug 1238440
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1250148.html b/dom/base/test/test_bug1250148.html
new file mode 100644
index 0000000000..b32124ded6
--- /dev/null
+++ b/dom/base/test/test_bug1250148.html
@@ -0,0 +1,64 @@
+
+
+
+
+
+ Test for Bug 1250148 - FormData and HTML submission compatibility
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1259588.html b/dom/base/test/test_bug1259588.html
new file mode 100644
index 0000000000..40a272f905
--- /dev/null
+++ b/dom/base/test/test_bug1259588.html
@@ -0,0 +1,13 @@
+
+
+Test for Bug 1259588
+
+
+
+
diff --git a/dom/base/test/test_bug1268962.html b/dom/base/test/test_bug1268962.html
new file mode 100644
index 0000000000..54f99f8456
--- /dev/null
+++ b/dom/base/test/test_bug1268962.html
@@ -0,0 +1,104 @@
+
+
+
+
+ Test for Bug 1268962
+
+
+
+
+Mozilla Bug 1268962
+
+
+
+
+
diff --git a/dom/base/test/test_bug1274806.html b/dom/base/test/test_bug1274806.html
new file mode 100644
index 0000000000..c8ccb0bc65
--- /dev/null
+++ b/dom/base/test/test_bug1274806.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+ Test for Bug 1274806
+
+
+
+
+
+Mozilla Bug 1274806
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1295852.html b/dom/base/test/test_bug1295852.html
new file mode 100644
index 0000000000..a4991c6149
--- /dev/null
+++ b/dom/base/test/test_bug1295852.html
@@ -0,0 +1,19 @@
+
+
+Bug 1295852
+
+
+
+
diff --git a/dom/base/test/test_bug1307730.html b/dom/base/test/test_bug1307730.html
new file mode 100644
index 0000000000..e0cad741f9
--- /dev/null
+++ b/dom/base/test/test_bug1307730.html
@@ -0,0 +1,44 @@
+
+
+
+
+ Test for Bug 1307730
+
+
+
+
+Mozilla Bug 1307730
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1308069.html b/dom/base/test/test_bug1308069.html
new file mode 100644
index 0000000000..2775ff1b7e
--- /dev/null
+++ b/dom/base/test/test_bug1308069.html
@@ -0,0 +1,87 @@
+
+
+
+
+Bug 1308069
+
+
+
+
+Mozilla Bug 1308069
+
+
+
diff --git a/dom/base/test/test_bug1314032.html b/dom/base/test/test_bug1314032.html
new file mode 100644
index 0000000000..693eba2f62
--- /dev/null
+++ b/dom/base/test/test_bug1314032.html
@@ -0,0 +1,38 @@
+
+
+
+
+ Test for Bug 1314032
+
+
+
+
+Mozilla Bug 1243846
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1318303.html b/dom/base/test/test_bug1318303.html
new file mode 100644
index 0000000000..2db8420ffc
--- /dev/null
+++ b/dom/base/test/test_bug1318303.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+ Test for Bug 1318303
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1375050.html b/dom/base/test/test_bug1375050.html
new file mode 100644
index 0000000000..5f598d7469
--- /dev/null
+++ b/dom/base/test/test_bug1375050.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+ Test for Bug 1375050
+
+
+
+
+
+Mozilla Bug 1375050
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1381710.html b/dom/base/test/test_bug1381710.html
new file mode 100644
index 0000000000..97531d1426
--- /dev/null
+++ b/dom/base/test/test_bug1381710.html
@@ -0,0 +1,40 @@
+
+
+
+
+ Test for Mozilla Bug 1381710
+
+
+
+
+Mozilla Bug 1381710
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1399605.html b/dom/base/test/test_bug1399605.html
new file mode 100644
index 0000000000..a8e0c6453d
--- /dev/null
+++ b/dom/base/test/test_bug1399605.html
@@ -0,0 +1,32 @@
+
+
+
+
+ Test for Bug 1399605
+
+
+
+
+Mozilla Bug 1399605
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1404385.html b/dom/base/test/test_bug1404385.html
new file mode 100644
index 0000000000..828a44918f
--- /dev/null
+++ b/dom/base/test/test_bug1404385.html
@@ -0,0 +1,31 @@
+
+
+
+
+ Test for Bug 1404385
+
+
+
+
+Mozilla Bug 1404385
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1406102.html b/dom/base/test/test_bug1406102.html
new file mode 100644
index 0000000000..a561f1e8b6
--- /dev/null
+++ b/dom/base/test/test_bug1406102.html
@@ -0,0 +1,41 @@
+
+
+
+
+ Test for Bug 1406102
+
+
+
+
+
+Mozilla Bug 1406102
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1421568.html b/dom/base/test/test_bug1421568.html
new file mode 100644
index 0000000000..f4864c81c1
--- /dev/null
+++ b/dom/base/test/test_bug1421568.html
@@ -0,0 +1,48 @@
+
+
+
+
+
+ Test for Bug 1421568
+
+
+
+
+
+Mozilla Bug 1421568
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1433073.html b/dom/base/test/test_bug1433073.html
new file mode 100644
index 0000000000..7fe91aa287
--- /dev/null
+++ b/dom/base/test/test_bug1433073.html
@@ -0,0 +1,89 @@
+
+
+
+
+ Test bug 1433073
+
+
+
+
+
+
+Mozilla Bug 1433073
+
+
+
+
+
+ x
+ y
+
+
+ u
+ v
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1472427.html b/dom/base/test/test_bug1472427.html
new file mode 100644
index 0000000000..902b9cd05b
--- /dev/null
+++ b/dom/base/test/test_bug1472427.html
@@ -0,0 +1,89 @@
+
+
+
+
+
+ Test for Bug 1472427
+
+
+
+
+
+
+Mozilla Bug 1472427
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1499169.html b/dom/base/test/test_bug1499169.html
new file mode 100644
index 0000000000..7d5141797d
--- /dev/null
+++ b/dom/base/test/test_bug1499169.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Test for Bug 1499169
+
+
+
+
+
+
+ Mozilla Bug 1499169
+
+
+
diff --git a/dom/base/test/test_bug1576154.html b/dom/base/test/test_bug1576154.html
new file mode 100644
index 0000000000..eca8db6275
--- /dev/null
+++ b/dom/base/test/test_bug1576154.html
@@ -0,0 +1,36 @@
+
+
+
+
+ Test for Bug 1576154
+
+
+
+
+
+Mozilla Bug 1576154
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1632975.html b/dom/base/test/test_bug1632975.html
new file mode 100644
index 0000000000..8b54ca47a5
--- /dev/null
+++ b/dom/base/test/test_bug1632975.html
@@ -0,0 +1,54 @@
+
+
+
+
+ Test for Bug 1632975
+
+
+
+
+
+
+Mozilla Bug 1632975
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1639328.html b/dom/base/test/test_bug1639328.html
new file mode 100644
index 0000000000..567b97ddb5
--- /dev/null
+++ b/dom/base/test/test_bug1639328.html
@@ -0,0 +1,89 @@
+
+
+Test for bug 1639328
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1640766.html b/dom/base/test/test_bug1640766.html
new file mode 100644
index 0000000000..ea77c99e59
--- /dev/null
+++ b/dom/base/test/test_bug1640766.html
@@ -0,0 +1,67 @@
+
+
+
+
+ Test for Bug 1640766
+
+
+
+
+Mozilla Bug 1640766
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1648887.html b/dom/base/test/test_bug1648887.html
new file mode 100644
index 0000000000..a185086137
--- /dev/null
+++ b/dom/base/test/test_bug1648887.html
@@ -0,0 +1,34 @@
+
+
+
+
+Test for Bug 1648887
+
+
+
+
+Mozilla Bug 1648887
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug166235.html b/dom/base/test/test_bug166235.html
new file mode 100644
index 0000000000..0431e204c2
--- /dev/null
+++ b/dom/base/test/test_bug166235.html
@@ -0,0 +1,156 @@
+
+
+
+
+ Test for Bug 166235
+
+
+
+
+Mozilla Bug 166235 and Bug 816298
+This text should be copied.
+This text should NOT be copied.
+This text should NOT be copied.
+This text should NOT be copied.
+This text should NOT be copied.
+This text should be copied.
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1667316.html b/dom/base/test/test_bug1667316.html
new file mode 100644
index 0000000000..7836931ee3
--- /dev/null
+++ b/dom/base/test/test_bug1667316.html
@@ -0,0 +1,147 @@
+
+
+
+
+ Test for Bug 1667316
+
+
+
+
+Mozilla Bug 1667316
+
+
+
+
+
diff --git a/dom/base/test/test_bug1730284.html b/dom/base/test/test_bug1730284.html
new file mode 100644
index 0000000000..84e4230a13
--- /dev/null
+++ b/dom/base/test/test_bug1730284.html
@@ -0,0 +1,71 @@
+
+
+Test for bug 1730284 (throttling of same-origin iframes)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1739957.html b/dom/base/test/test_bug1739957.html
new file mode 100644
index 0000000000..fdfe1e3861
--- /dev/null
+++ b/dom/base/test/test_bug1739957.html
@@ -0,0 +1,40 @@
+
+
+
+
+ Importing a node should respect sandbox
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1784187.html b/dom/base/test/test_bug1784187.html
new file mode 100644
index 0000000000..6f9f782e3e
--- /dev/null
+++ b/dom/base/test/test_bug1784187.html
@@ -0,0 +1,38 @@
+
+
+
+
+ Test for Bug 1784187
+
+
+
+
+
+
+Mozilla Bug 1784187
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug1799354.html b/dom/base/test/test_bug1799354.html
new file mode 100644
index 0000000000..ba2177d576
--- /dev/null
+++ b/dom/base/test/test_bug1799354.html
@@ -0,0 +1,77 @@
+
+
+
+
+ Test bug 1799354
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug199959.html b/dom/base/test/test_bug199959.html
new file mode 100644
index 0000000000..e807646c10
--- /dev/null
+++ b/dom/base/test/test_bug199959.html
@@ -0,0 +1,39 @@
+
+
+
+
+ Test for Bug 199959
+
+
+
+
+Mozilla Bug 199959
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug218236.html b/dom/base/test/test_bug218236.html
new file mode 100644
index 0000000000..d691ad4418
--- /dev/null
+++ b/dom/base/test/test_bug218236.html
@@ -0,0 +1,139 @@
+
+
+
+
+ Test for Bug 218236
+
+
+
+
+Mozilla Bug 218236
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug218277.html b/dom/base/test/test_bug218277.html
new file mode 100644
index 0000000000..bcad1dafd7
--- /dev/null
+++ b/dom/base/test/test_bug218277.html
@@ -0,0 +1,28 @@
+
+
+
+
+ Test for Bug 218277
+
+
+
+
+Mozilla Bug 218277
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug238409.html b/dom/base/test/test_bug238409.html
new file mode 100644
index 0000000000..ac0b261548
--- /dev/null
+++ b/dom/base/test/test_bug238409.html
@@ -0,0 +1,45 @@
+
+
+
+
+ Test for Bug 238409
+
+
+
+
+Mozilla Bug 238409
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug254337.html b/dom/base/test/test_bug254337.html
new file mode 100644
index 0000000000..1c68b18c14
--- /dev/null
+++ b/dom/base/test/test_bug254337.html
@@ -0,0 +1,42 @@
+
+
+
+
+ Test for Bug 254337
+
+
+
+
+Mozilla Bug 254337
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug270145.xhtml b/dom/base/test/test_bug270145.xhtml
new file mode 100644
index 0000000000..ebf89ef5ca
--- /dev/null
+++ b/dom/base/test/test_bug270145.xhtml
@@ -0,0 +1,51 @@
+
+
+
+ Test the html copy encoder with XHTML
+
+
+
+
+Mozilla Bug 270145
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug276037-1.html b/dom/base/test/test_bug276037-1.html
new file mode 100644
index 0000000000..2216480337
--- /dev/null
+++ b/dom/base/test/test_bug276037-1.html
@@ -0,0 +1,105 @@
+
+
+
+
+ Test for Bug 276037
+
+
+
+
+Mozilla Bug 276037
+
+
+
+
+
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+
+
+
+
diff --git a/dom/base/test/test_bug276037-2.xhtml b/dom/base/test/test_bug276037-2.xhtml
new file mode 100644
index 0000000000..d0155a4168
--- /dev/null
+++ b/dom/base/test/test_bug276037-2.xhtml
@@ -0,0 +1,106 @@
+
+
+
+ Test for Bug 276037
+
+
+
+
+Mozilla Bug 276037
+
+
+
+
+
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+Static text in span.
+
+
+
+
+
diff --git a/dom/base/test/test_bug282547.html b/dom/base/test/test_bug282547.html
new file mode 100644
index 0000000000..4c310a2724
--- /dev/null
+++ b/dom/base/test/test_bug282547.html
@@ -0,0 +1,104 @@
+
+
+
+
+ Test for Bug 282547
+
+
+
+
+Mozilla Bug 282547
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug28293.html b/dom/base/test/test_bug28293.html
new file mode 100644
index 0000000000..332c75e42b
--- /dev/null
+++ b/dom/base/test/test_bug28293.html
@@ -0,0 +1,86 @@
+
+
+
+
+ Test for Bug 28293
+
+
+
+
+
+Mozilla Bug 28293
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug28293.xhtml b/dom/base/test/test_bug28293.xhtml
new file mode 100644
index 0000000000..47d73a01b4
--- /dev/null
+++ b/dom/base/test/test_bug28293.xhtml
@@ -0,0 +1,87 @@
+
+
+
+ Test for Bug 28293
+
+
+
+
+
+Mozilla Bug 28293
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug298064.html b/dom/base/test/test_bug298064.html
new file mode 100644
index 0000000000..6fd21e5129
--- /dev/null
+++ b/dom/base/test/test_bug298064.html
@@ -0,0 +1,32 @@
+
+
+
+
+ Test for Bug 298064
+
+
+
+
+Mozilla Bug 298064
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug300992.html b/dom/base/test/test_bug300992.html
new file mode 100644
index 0000000000..c9059bea85
--- /dev/null
+++ b/dom/base/test/test_bug300992.html
@@ -0,0 +1,45 @@
+
+
+
+
+ Test for Bug 300992
+
+
+
+
+Mozilla Bug 300992
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug311681.xml b/dom/base/test/test_bug311681.xml
new file mode 100644
index 0000000000..23efcb4688
--- /dev/null
+++ b/dom/base/test/test_bug311681.xml
@@ -0,0 +1,103 @@
+
+
+
+ Test for Bug 311681
+
+
+
+
+Mozilla Bug 311681
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug313646.html b/dom/base/test/test_bug313646.html
new file mode 100644
index 0000000000..55bb760978
--- /dev/null
+++ b/dom/base/test/test_bug313646.html
@@ -0,0 +1,62 @@
+
+
+
+
+ Test for Bug 313646
+
+
+
+
+Mozilla Bug 313646
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug320799.html b/dom/base/test/test_bug320799.html
new file mode 100644
index 0000000000..dd7f598a0f
--- /dev/null
+++ b/dom/base/test/test_bug320799.html
@@ -0,0 +1,74 @@
+
+
+
+
+ Test for Bug 320799
+
+
+
+
+Mozilla Bug 320799
+
+
+ This is a test, it really is a test I tell you
+
+
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+
+
+ x
+
+
+ This is a test, it really is a test I tell you
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug322317.html b/dom/base/test/test_bug322317.html
new file mode 100644
index 0000000000..d4e7b6f853
--- /dev/null
+++ b/dom/base/test/test_bug322317.html
@@ -0,0 +1,33 @@
+
+
+
+
+ Test for Bug 322317
+
+
+
+
+Mozilla Bug 322317
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug326337.html b/dom/base/test/test_bug326337.html
new file mode 100644
index 0000000000..fc789018cb
--- /dev/null
+++ b/dom/base/test/test_bug326337.html
@@ -0,0 +1,35 @@
+
+
+
+
+ Test for Bug 326337
+
+
+
+
+Mozilla Bug 326337
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug331959.html b/dom/base/test/test_bug331959.html
new file mode 100644
index 0000000000..c098c55d7b
--- /dev/null
+++ b/dom/base/test/test_bug331959.html
@@ -0,0 +1,151 @@
+
+
+
+
+ Test for Bug 331959
+
+
+
+
+
+Mozilla Bug 331959
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug333064.html b/dom/base/test/test_bug333064.html
new file mode 100644
index 0000000000..65cc893a42
--- /dev/null
+++ b/dom/base/test/test_bug333064.html
@@ -0,0 +1,59 @@
+
+
+
+
+ Test for Bug 333064
+
+
+
+
+
+Mozilla Bug 333064
+
+
+
+
+안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug333198.html b/dom/base/test/test_bug333198.html
new file mode 100644
index 0000000000..e1c09000e8
--- /dev/null
+++ b/dom/base/test/test_bug333198.html
@@ -0,0 +1,84 @@
+
+
+
+
+ Test for Bug 333198
+
+
+
+
+
+
+Mozilla Bug 333198
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug333673.html b/dom/base/test/test_bug333673.html
new file mode 100644
index 0000000000..2e8547b56c
--- /dev/null
+++ b/dom/base/test/test_bug333673.html
@@ -0,0 +1,30 @@
+
+
+
+
+ Test for Bug 333673
+
+
+
+
+Mozilla Bug 333673
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug337631.html b/dom/base/test/test_bug337631.html
new file mode 100644
index 0000000000..ad8d4e3d5a
--- /dev/null
+++ b/dom/base/test/test_bug337631.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Test for Bug 337631
+
+
+
+
+Mozilla Bug 337631
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug338541.xhtml b/dom/base/test/test_bug338541.xhtml
new file mode 100644
index 0000000000..9a83332a13
--- /dev/null
+++ b/dom/base/test/test_bug338541.xhtml
@@ -0,0 +1,49 @@
+
+
+
+ Test for Bug 338541
+
+
+
+
+Mozilla Bug 338541
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug338583.html b/dom/base/test/test_bug338583.html
new file mode 100644
index 0000000000..1316128484
--- /dev/null
+++ b/dom/base/test/test_bug338583.html
@@ -0,0 +1,666 @@
+
+
+
+
+
+ Test for Bug 338583
+
+
+
+
+
+
+Mozilla Bug 338583
+
+
+
+
+
+
+
+ Wait please...
+
+
diff --git a/dom/base/test/test_bug338679.html b/dom/base/test/test_bug338679.html
new file mode 100644
index 0000000000..bcc214f349
--- /dev/null
+++ b/dom/base/test/test_bug338679.html
@@ -0,0 +1,82 @@
+
+
+
+
+Bug 338679: correct reporting of newValue/prevValue in
+ DOMAttrModified events
+
+
+
+
+Bug
+ 338679: correct reporting of newValue/prevValue in
+ DOMAttrModified events
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug339494.html b/dom/base/test/test_bug339494.html
new file mode 100644
index 0000000000..dbf81f5e98
--- /dev/null
+++ b/dom/base/test/test_bug339494.html
@@ -0,0 +1,59 @@
+
+
+
+
+ Test for Bug 339494
+
+
+
+
+Mozilla Bug 339494
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug339494.xhtml b/dom/base/test/test_bug339494.xhtml
new file mode 100644
index 0000000000..985d78b368
--- /dev/null
+++ b/dom/base/test/test_bug339494.xhtml
@@ -0,0 +1,58 @@
+
+
+
+ Test for Bug 339494
+
+
+
+
+Mozilla Bug 339494
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug343596.html b/dom/base/test/test_bug343596.html
new file mode 100644
index 0000000000..31a3e92820
--- /dev/null
+++ b/dom/base/test/test_bug343596.html
@@ -0,0 +1,51 @@
+
+
+
+
+ Test for Bug 343596
+
+
+
+
+Mozilla Bug 343596
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug345339.html b/dom/base/test/test_bug345339.html
new file mode 100644
index 0000000000..12baea6b25
--- /dev/null
+++ b/dom/base/test/test_bug345339.html
@@ -0,0 +1,93 @@
+
+
+
+
+ Test for Bug 345339
+
+
+
+
+Mozilla Bug 345339
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug346485.html b/dom/base/test/test_bug346485.html
new file mode 100644
index 0000000000..53f5587a5f
--- /dev/null
+++ b/dom/base/test/test_bug346485.html
@@ -0,0 +1,77 @@
+
+
+
+
+ Test for Bug 346485
+
+
+
+
+Mozilla Bug 346485
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug352728.html b/dom/base/test/test_bug352728.html
new file mode 100644
index 0000000000..c5bc92da5c
--- /dev/null
+++ b/dom/base/test/test_bug352728.html
@@ -0,0 +1,122 @@
+
+
+
+
+ Test for Bug 352728
+
+
+
+
+Mozilla Bug 352728
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug352728.xhtml b/dom/base/test/test_bug352728.xhtml
new file mode 100644
index 0000000000..b868deb463
--- /dev/null
+++ b/dom/base/test/test_bug352728.xhtml
@@ -0,0 +1,188 @@
+
+
+
+ Test for Bug 352728
+
+
+
+
+Mozilla Bug 352728
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug353334.html b/dom/base/test/test_bug353334.html
new file mode 100644
index 0000000000..4fa30828a2
--- /dev/null
+++ b/dom/base/test/test_bug353334.html
@@ -0,0 +1,67 @@
+
+
+
+
+ Test for Bug 353334
+
+
+
+
+
+Mozilla Bug 353334
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug355026.html b/dom/base/test/test_bug355026.html
new file mode 100644
index 0000000000..e5ace96970
--- /dev/null
+++ b/dom/base/test/test_bug355026.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+Mozilla Bug 355026
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug357450.html b/dom/base/test/test_bug357450.html
new file mode 100644
index 0000000000..006768fa89
--- /dev/null
+++ b/dom/base/test/test_bug357450.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+ Test for Bug 357450
+
+
+
+
+
+
+
+
+Mozilla Bug 357450
+
+
+hmm
+hmm
+
+
hmm
+
hmm
+
hmm
+
hmm
+
hmm
+
hmm
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug357450.xhtml b/dom/base/test/test_bug357450.xhtml
new file mode 100644
index 0000000000..dee66f1cd1
--- /dev/null
+++ b/dom/base/test/test_bug357450.xhtml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ Test for Bug 357450
+
+
+
+
+
+
+
+Mozilla Bug 357450
+
+
+hmm
+hmm
+
+
+
hmm
+
hmm
+
hmm
+
hmm
+
hmm
+
hmm
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug357450_svg.xhtml b/dom/base/test/test_bug357450_svg.xhtml
new file mode 100644
index 0000000000..a1d8a528a7
--- /dev/null
+++ b/dom/base/test/test_bug357450_svg.xhtml
@@ -0,0 +1,46 @@
+
+
+
+
+
+ Test for Bug 357450
+
+
+
+
+
+
+
+
+Mozilla Bug 357450
+
+
+hmm
+hmm
+
+
hmm
+
hmm
+
hmm
+
hmm
+
hmm
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug357509.html b/dom/base/test/test_bug357509.html
new file mode 100644
index 0000000000..d8b288c2fd
--- /dev/null
+++ b/dom/base/test/test_bug357509.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+Mozilla Bug 357509
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug358660.html b/dom/base/test/test_bug358660.html
new file mode 100644
index 0000000000..4788b1824b
--- /dev/null
+++ b/dom/base/test/test_bug358660.html
@@ -0,0 +1,37 @@
+
+
+
+
+ Test for Bug 358660
+
+
+
+
+Mozilla Bug 358660
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug362391.xhtml b/dom/base/test/test_bug362391.xhtml
new file mode 100644
index 0000000000..a00b8e52a8
--- /dev/null
+++ b/dom/base/test/test_bug362391.xhtml
@@ -0,0 +1,75 @@
+
+
+
+
+ Test for Bug 362391
+
+
+
+
+
+
+
+
+
+Mozilla Bug 362391
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug364092.xhtml b/dom/base/test/test_bug364092.xhtml
new file mode 100644
index 0000000000..93ba2554ec
--- /dev/null
+++ b/dom/base/test/test_bug364092.xhtml
@@ -0,0 +1,46 @@
+
+
+
+
+ Test for Bug 364092
+
+
+
+
+
+
+
+
+
+Mozilla Bug 364092
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug364413.xhtml b/dom/base/test/test_bug364413.xhtml
new file mode 100644
index 0000000000..4e4b20ea8c
--- /dev/null
+++ b/dom/base/test/test_bug364413.xhtml
@@ -0,0 +1,48 @@
+
+
+
+
+ Test for Bug 364413
+
+
+
+
+
+
+
+
+
+Mozilla Bug 364413
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug366944.html b/dom/base/test/test_bug366944.html
new file mode 100644
index 0000000000..8e4acd9e3f
--- /dev/null
+++ b/dom/base/test/test_bug366944.html
@@ -0,0 +1,49 @@
+
+
+Test for Bug 366944
+
+
+Mozilla Bug 366944
+
diff --git a/dom/base/test/test_bug366946.html b/dom/base/test/test_bug366946.html
new file mode 100644
index 0000000000..a8173828dc
--- /dev/null
+++ b/dom/base/test/test_bug366946.html
@@ -0,0 +1,79 @@
+
+
+
+
+ Test for Bug 366946
+
+
+
+
+Mozilla Bug 366946
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug367164.html b/dom/base/test/test_bug367164.html
new file mode 100644
index 0000000000..46dc4f779f
--- /dev/null
+++ b/dom/base/test/test_bug367164.html
@@ -0,0 +1,47 @@
+
+
+
+
+ Test for Bug 367164
+
+
+
+
+Mozilla Bug 367164
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug368972.html b/dom/base/test/test_bug368972.html
new file mode 100644
index 0000000000..08a348b3cd
--- /dev/null
+++ b/dom/base/test/test_bug368972.html
@@ -0,0 +1,120 @@
+
+
+
+
+ Test for Bug 368972
+
+
+
+
+
+Mozilla Bug 368972
+
+
+Embed without defined width/height:
+
+Embed width=0 height=0
+
+Embed width=100 height=100
+
+Embed height=100
+
+Embed width=100
+
+Embed width=100xxx height=100
+
+Embed width=0100 height=100
+
+Embed width= height=100
+
+Embed width=100 height=100 style="width:400px"
+
+Embed height=100 style="width:400px"
+
+Embed height=100 (stylesheet width:400px height:400px)
+
+
+Object without defined width/height:
+
+
+Object width=0 height=0
+
+
+Object width=100 height=100
+
+
+Object height=100
+
+
+Object width=100
+
+
+Object width=100xxx height=100
+
+
+Object width=0100 height=100
+
+
+Object width= height=100
+
+
+Object width=100 height=100 style="width:400px"
+
+
+Object height=100 style="width:400px"
+
+
+Object height=100 (stylesheet width:400px height:400px)
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug371576-2.html b/dom/base/test/test_bug371576-2.html
new file mode 100644
index 0000000000..2a09118645
--- /dev/null
+++ b/dom/base/test/test_bug371576-2.html
@@ -0,0 +1,32 @@
+
+
+
+
+ Test for Bug 371576
+
+
+
+
+Mozilla Bug 371576
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug371576-3.html b/dom/base/test/test_bug371576-3.html
new file mode 100644
index 0000000000..ec91f7361c
--- /dev/null
+++ b/dom/base/test/test_bug371576-3.html
@@ -0,0 +1,29 @@
+
+
+
+
+ Test for Bug 371576
+
+
+
+
+Mozilla Bug 371576
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug371576-4.html b/dom/base/test/test_bug371576-4.html
new file mode 100644
index 0000000000..8fbd81fe51
--- /dev/null
+++ b/dom/base/test/test_bug371576-4.html
@@ -0,0 +1,21 @@
+
+
+
+ Test2 for Bug 371576
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug371576-5.html b/dom/base/test/test_bug371576-5.html
new file mode 100644
index 0000000000..842fa9e3c3
--- /dev/null
+++ b/dom/base/test/test_bug371576-5.html
@@ -0,0 +1,36 @@
+
+
+
+
+ Test for Bug 371576
+
+
+
+
+
+
+
+You shouldn't see this
+Mozilla Bug 371576
+
+
diff --git a/dom/base/test/test_bug372086.html b/dom/base/test/test_bug372086.html
new file mode 100644
index 0000000000..e6ef6ee176
--- /dev/null
+++ b/dom/base/test/test_bug372086.html
@@ -0,0 +1,96 @@
+
+
+
+
+ Test for Bug 372086
+
+
+
+
+Mozilla Bug 372086
+
+
abc
def
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug372964-2.html b/dom/base/test/test_bug372964-2.html
new file mode 100644
index 0000000000..f106965d6f
--- /dev/null
+++ b/dom/base/test/test_bug372964-2.html
@@ -0,0 +1,58 @@
+
+
+
+
+ Test for Bug 372964
+
+
+
+
+Mozilla Bug 372964
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug372964.html b/dom/base/test/test_bug372964.html
new file mode 100644
index 0000000000..c8f53850bc
--- /dev/null
+++ b/dom/base/test/test_bug372964.html
@@ -0,0 +1,144 @@
+
+
+
+
+ Test for Bug 372964
+
+
+
+
+Mozilla Bug 372964
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug373181.xhtml b/dom/base/test/test_bug373181.xhtml
new file mode 100644
index 0000000000..ed046e96c3
--- /dev/null
+++ b/dom/base/test/test_bug373181.xhtml
@@ -0,0 +1,17 @@
+
+
+
+ Testcase for bug 373181
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug375314-2.html b/dom/base/test/test_bug375314-2.html
new file mode 100644
index 0000000000..bc842cdffb
--- /dev/null
+++ b/dom/base/test/test_bug375314-2.html
@@ -0,0 +1,151 @@
+
+
+
+
+ Test for Bug 375314
+
+
+
+
+Mozilla Bug 375314
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug375314.html b/dom/base/test/test_bug375314.html
new file mode 100644
index 0000000000..b061e907bc
--- /dev/null
+++ b/dom/base/test/test_bug375314.html
@@ -0,0 +1,157 @@
+
+
+
+
+ Test for Bug 375314
+
+
+
+
+Mozilla Bug 375314
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug378969.html b/dom/base/test/test_bug378969.html
new file mode 100644
index 0000000000..18b5671b5a
--- /dev/null
+++ b/dom/base/test/test_bug378969.html
@@ -0,0 +1,48 @@
+
+
+
+
+ Test for Bug 378969
+
+
+
+
+Mozilla Bug 378969
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug380418.html b/dom/base/test/test_bug380418.html
new file mode 100644
index 0000000000..45b6f21d99
--- /dev/null
+++ b/dom/base/test/test_bug380418.html
@@ -0,0 +1,34 @@
+
+
+
+
+ Test for Bug 380418
+
+
+
+
+Mozilla Bug 380418
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug380418.html^headers^ b/dom/base/test/test_bug380418.html^headers^
new file mode 100644
index 0000000000..5f8d4969c0
--- /dev/null
+++ b/dom/base/test/test_bug380418.html^headers^
@@ -0,0 +1,4 @@
+Set-Cookie: test
+Set-Cookie2: test2
+X-Dummy: test
+Cache-Control: max-age=0
diff --git a/dom/base/test/test_bug382113.html b/dom/base/test/test_bug382113.html
new file mode 100644
index 0000000000..faf0deef25
--- /dev/null
+++ b/dom/base/test/test_bug382113.html
@@ -0,0 +1,35 @@
+
+
+
+
+ Test for Bug 382113
+
+
+
+
+
+Mozilla Bug 382113
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug382871.html b/dom/base/test/test_bug382871.html
new file mode 100644
index 0000000000..1414954060
--- /dev/null
+++ b/dom/base/test/test_bug382871.html
@@ -0,0 +1,46 @@
+
+
+
+
+ Test for Bug 382871
+
+
+
+
+Mozilla Bug 382871
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug384003.xhtml b/dom/base/test/test_bug384003.xhtml
new file mode 100644
index 0000000000..6d1a4f5898
--- /dev/null
+++ b/dom/base/test/test_bug384003.xhtml
@@ -0,0 +1,84 @@
+
+
+
+
+ Test for Bug 384003
+
+
+
+
+Mozilla Bug 384003
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug390219.html b/dom/base/test/test_bug390219.html
new file mode 100644
index 0000000000..630b2bdd85
--- /dev/null
+++ b/dom/base/test/test_bug390219.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Test for Bug 390219
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug390735.html b/dom/base/test/test_bug390735.html
new file mode 100644
index 0000000000..57c300b5eb
--- /dev/null
+++ b/dom/base/test/test_bug390735.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+ Test for Bug 390735
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug392318.html b/dom/base/test/test_bug392318.html
new file mode 100644
index 0000000000..112468f894
--- /dev/null
+++ b/dom/base/test/test_bug392318.html
@@ -0,0 +1,44 @@
+
+
+
+
+ Test for Bug 392318
+
+
+
+
+
+
+
+Mozilla Bug 392318
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug392511.html b/dom/base/test/test_bug392511.html
new file mode 100644
index 0000000000..b97d83377f
--- /dev/null
+++ b/dom/base/test/test_bug392511.html
@@ -0,0 +1,53 @@
+
+
+
+
+ Test for Bug 392511
+
+
+
+
+Mozilla Bug 392511
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug393968.html b/dom/base/test/test_bug393968.html
new file mode 100644
index 0000000000..784376fadc
--- /dev/null
+++ b/dom/base/test/test_bug393968.html
@@ -0,0 +1,34 @@
+
+
+
+
+ Test for Bug 393968
+
+
+
+
+Mozilla Bug 393968
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug395915.html b/dom/base/test/test_bug395915.html
new file mode 100644
index 0000000000..711a6fd6a3
--- /dev/null
+++ b/dom/base/test/test_bug395915.html
@@ -0,0 +1,43 @@
+
+
+
+
+ Test for Bug 395915
+
+
+
+
+Mozilla Bug 395915
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug397234.html b/dom/base/test/test_bug397234.html
new file mode 100644
index 0000000000..f9219f643c
--- /dev/null
+++ b/dom/base/test/test_bug397234.html
@@ -0,0 +1,35 @@
+
+
+
+
+ Test for Bug 397234
+
+
+
+
+Mozilla Bug 397234
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug398243.html b/dom/base/test/test_bug398243.html
new file mode 100644
index 0000000000..11328f66ed
--- /dev/null
+++ b/dom/base/test/test_bug398243.html
@@ -0,0 +1,56 @@
+
+
+
+
+ Test for Bug 398243
+
+
+
+
+Mozilla Bug 398243
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug401662.html b/dom/base/test/test_bug401662.html
new file mode 100644
index 0000000000..76b910ce74
--- /dev/null
+++ b/dom/base/test/test_bug401662.html
@@ -0,0 +1,51 @@
+
+
+
+
+ Test for Bug 401662
+
+
+
+
+Mozilla Bug 401662
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug402150.html b/dom/base/test/test_bug402150.html
new file mode 100644
index 0000000000..eb3bf84a53
--- /dev/null
+++ b/dom/base/test/test_bug402150.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Test for Bug 402150
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug402150.html^headers^ b/dom/base/test/test_bug402150.html^headers^
new file mode 100644
index 0000000000..453e7e1f37
--- /dev/null
+++ b/dom/base/test/test_bug402150.html^headers^
@@ -0,0 +1 @@
+Last-Modified: Fri, 2 Nov 19107 00:00:01 GMT
diff --git a/dom/base/test/test_bug403841.html b/dom/base/test/test_bug403841.html
new file mode 100644
index 0000000000..469b31730f
--- /dev/null
+++ b/dom/base/test/test_bug403841.html
@@ -0,0 +1,29 @@
+
+
+
+
+ Test for Bug 403841
+
+
+
+
+Mozilla Bug 403841
+abc
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug403852.html b/dom/base/test/test_bug403852.html
new file mode 100644
index 0000000000..fec41e9cc4
--- /dev/null
+++ b/dom/base/test/test_bug403852.html
@@ -0,0 +1,66 @@
+
+
+
+
+ Test for Bug 403852
+
+
+
+
+
+Mozilla Bug 403852
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug403868.xml b/dom/base/test/test_bug403868.xml
new file mode 100644
index 0000000000..cb2ababff4
--- /dev/null
+++ b/dom/base/test/test_bug403868.xml
@@ -0,0 +1,85 @@
+
+
+
+ Test for Bug 403868
+
+
+
+
+Mozilla Bug 403868
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug405182.html b/dom/base/test/test_bug405182.html
new file mode 100644
index 0000000000..d48d003ad0
--- /dev/null
+++ b/dom/base/test/test_bug405182.html
@@ -0,0 +1,47 @@
+
+
+
+
+ Test for Bug 405182
+
+
+
+
+Mozilla Bug 405182
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug409380.html b/dom/base/test/test_bug409380.html
new file mode 100644
index 0000000000..ddc796b223
--- /dev/null
+++ b/dom/base/test/test_bug409380.html
@@ -0,0 +1,378 @@
+
+
+
+
+ Test for Bug 409380
+
+
+
+
+Mozilla Bug 409380
+
+
+
+
+
+
+
+zz
+
+
diff --git a/dom/base/test/test_bug410229.html b/dom/base/test/test_bug410229.html
new file mode 100644
index 0000000000..9e3815b094
--- /dev/null
+++ b/dom/base/test/test_bug410229.html
@@ -0,0 +1,108 @@
+
+
+
+
+ Test for Bug 410229
+
+
+
+
+
+Mozilla Bug 410229
+
+
+Hello
+My
+Kitty
+
+
+HelloMy
Kitty
+
+
+My
Kitty
+
+
+My
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug413974.html b/dom/base/test/test_bug413974.html
new file mode 100644
index 0000000000..d1b1ca0cc1
--- /dev/null
+++ b/dom/base/test/test_bug413974.html
@@ -0,0 +1,35 @@
+
+
+
+
+ Test for Bug 413974
+
+
+
+
+Mozilla Bug 413974
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug414190.html b/dom/base/test/test_bug414190.html
new file mode 100644
index 0000000000..813d35ae7d
--- /dev/null
+++ b/dom/base/test/test_bug414190.html
@@ -0,0 +1,70 @@
+
+
+
+
+ Test for Bug 414190
+
+
+
+
+
+Mozilla Bug 414190
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug415860.html b/dom/base/test/test_bug415860.html
new file mode 100644
index 0000000000..1c00ce8843
--- /dev/null
+++ b/dom/base/test/test_bug415860.html
@@ -0,0 +1,240 @@
+
+
+
+
+ Test for Bug 415860
+
+
+
+
+Mozilla Bug 415860
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug416317-1.html b/dom/base/test/test_bug416317-1.html
new file mode 100644
index 0000000000..bc571ad4a2
--- /dev/null
+++ b/dom/base/test/test_bug416317-1.html
@@ -0,0 +1,32 @@
+
+
+
+
+ Test for Bug 416317
+
+
+
+
+
+Mozilla Bug 416317
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug416317-2.html b/dom/base/test/test_bug416317-2.html
new file mode 100644
index 0000000000..59d26fa70c
--- /dev/null
+++ b/dom/base/test/test_bug416317-2.html
@@ -0,0 +1,32 @@
+
+
+
+
+ Test for Bug 416317
+
+
+
+
+
+Mozilla Bug 416317
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug416383.html b/dom/base/test/test_bug416383.html
new file mode 100644
index 0000000000..8228d277f7
--- /dev/null
+++ b/dom/base/test/test_bug416383.html
@@ -0,0 +1,43 @@
+
+
+
+
+ Test for Bug 416383
+
+
+
+
+Mozilla Bug 416383
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug417255.html b/dom/base/test/test_bug417255.html
new file mode 100644
index 0000000000..0e7a137f0b
--- /dev/null
+++ b/dom/base/test/test_bug417255.html
@@ -0,0 +1,60 @@
+
+
+
+
+ Test for Bug 417255
+
+
+
+
+
+
+Mozilla Bug 417255
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug417384.html b/dom/base/test/test_bug417384.html
new file mode 100644
index 0000000000..b99d96f155
--- /dev/null
+++ b/dom/base/test/test_bug417384.html
@@ -0,0 +1,50 @@
+
+
+
+
+ Test for Bug 417384
+
+
+
+
+Mozilla Bug 417384
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug418214.html b/dom/base/test/test_bug418214.html
new file mode 100644
index 0000000000..0c747a873f
--- /dev/null
+++ b/dom/base/test/test_bug418214.html
@@ -0,0 +1,105 @@
+
+
+
+
+ Test for Bug 418214
+
+
+
+
+Mozilla Bug 418214
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug418986-1.html b/dom/base/test/test_bug418986-1.html
new file mode 100644
index 0000000000..bbae1feced
--- /dev/null
+++ b/dom/base/test/test_bug418986-1.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Test 1/3 for Bug 418986 - Resist fingerprinting by preventing exposure of screen and system info
+
+
+
+
+
+ Bug 418986
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug419132.html b/dom/base/test/test_bug419132.html
new file mode 100644
index 0000000000..c21e68afcf
--- /dev/null
+++ b/dom/base/test/test_bug419132.html
@@ -0,0 +1,48 @@
+
+
+
+
+ Test for Bug 419132
+
+
+
+
+
+Mozilla Bug 419132
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug419527.xhtml b/dom/base/test/test_bug419527.xhtml
new file mode 100644
index 0000000000..6b3644a0a0
--- /dev/null
+++ b/dom/base/test/test_bug419527.xhtml
@@ -0,0 +1,68 @@
+
+
+
+
+ Test for Bug 419527
+
+
+
+
+Foo
+Mozilla Bug 419527
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug420609.xhtml b/dom/base/test/test_bug420609.xhtml
new file mode 100644
index 0000000000..64cbe3e320
--- /dev/null
+++ b/dom/base/test/test_bug420609.xhtml
@@ -0,0 +1,34 @@
+
+
+
+
+ Test for Bug 420609
+
+
+
+
+Mozilla Bug 420609
+
+
+ —¹…
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug420700.html b/dom/base/test/test_bug420700.html
new file mode 100644
index 0000000000..cdab3fee8b
--- /dev/null
+++ b/dom/base/test/test_bug420700.html
@@ -0,0 +1,35 @@
+
+
+
+
+ Test for Bug 420700
+
+
+
+
+Mozilla Bug 420700
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug421602.html b/dom/base/test/test_bug421602.html
new file mode 100644
index 0000000000..b283d81fed
--- /dev/null
+++ b/dom/base/test/test_bug421602.html
@@ -0,0 +1,53 @@
+
+
+
+
+ Test for Bug 421602
+
+
+
+
+Mozilla Bug 421602
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug422403-1.html b/dom/base/test/test_bug422403-1.html
new file mode 100644
index 0000000000..c3778cc075
--- /dev/null
+++ b/dom/base/test/test_bug422403-1.html
@@ -0,0 +1,204 @@
+
+
+
+
+ Test for XHTML serializer
+
+
+
+
+Mozilla Bug
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug422403-2.xhtml b/dom/base/test/test_bug422403-2.xhtml
new file mode 100644
index 0000000000..bff04c8f45
--- /dev/null
+++ b/dom/base/test/test_bug422403-2.xhtml
@@ -0,0 +1,296 @@
+
+
+
+
+ Test XHTML serializer with entities and selection
+
+
+
+
+Mozilla Bug
+
+
+
+
+
+';
+ is(out, expected, "test short attr #4");
+
+ node = document.getElementById('shortattr5');
+ encoder.init(document, "application/xhtml+xml",de.OutputSelectionOnly | de.OutputRaw);
+ encoder.setNode(node);
+ out = encoder.encodeToString();
+ expected = 'aaa ';
+ is(out, expected, "test short attr #5");
+
+ node = document.getElementById('shortattr6');
+ encoder.init(document, "application/xhtml+xml",de.OutputSelectionOnly | de.OutputRaw);
+ encoder.setNode(node);
+ out = encoder.encodeToString();
+ expected = ' ';
+ is(out, expected, "test short attr #6");
+
+ node = document.getElementById('shortattr7');
+ encoder.init(document, "application/xhtml+xml",de.OutputSelectionOnly | de.OutputRaw);
+ encoder.setNode(node);
+ out = encoder.encodeToString();
+ expected = '
';
+ is(out, expected, "test short attr #7");
+
+ // test on _moz and -moz attr
+ node = document.getElementById('mozattr');
+ encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly | de.OutputRaw);
+ encoder.setNode(node);
+ out = encoder.encodeToString();
+ expected = ' lorem ipsum
';
+ is(out, expected, "test -moz/_moz attr");
+
+ node.setAttribute('_moz_c','barc');
+ node.setAttribute('_-moz_d','bard');
+ node.setAttribute('__moz_e','bare');
+
+ encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly | de.OutputRaw);
+ encoder.setNode(node);
+ out = encoder.encodeToString();
+ expected = ' lorem ipsum
';
+ is(out, expected, "test -moz/_moz attr #2");
+
+ SimpleTest.finish();
+}
+
+
+SimpleTest.waitForExplicitFinish();
+
+addLoadEvent(testHtmlSerializer_1);
+//]]>
+
+
+
+
+
This is a draggable bit of text.
+
+
+
+
+
+ Lorem ipsum dolor
+ sit amet, consectetuer
+ adipiscing elit
+ Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
+ aptent taciti
+
+
+
+
+
+
+
+
+
aaa
+
+
+
lorem ipsum
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug422537.html b/dom/base/test/test_bug422537.html
new file mode 100644
index 0000000000..f8cd03f111
--- /dev/null
+++ b/dom/base/test/test_bug422537.html
@@ -0,0 +1,55 @@
+
+
+
+
+ Test for bug 422537
+
+
+
+
+
+Mozilla Bug 422537
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug424212.html b/dom/base/test/test_bug424212.html
new file mode 100644
index 0000000000..4203794c01
--- /dev/null
+++ b/dom/base/test/test_bug424212.html
@@ -0,0 +1,35 @@
+
+
+
+
+ Test for Bug 424212
+
+
+
+
+Mozilla Bug 424212
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug424359-1.html b/dom/base/test/test_bug424359-1.html
new file mode 100644
index 0000000000..870b54438d
--- /dev/null
+++ b/dom/base/test/test_bug424359-1.html
@@ -0,0 +1,213 @@
+
+
+
+
+ Test for HTML serializer
+
+
+
+
+Mozilla Bug
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug424359-2.html b/dom/base/test/test_bug424359-2.html
new file mode 100644
index 0000000000..37445aca43
--- /dev/null
+++ b/dom/base/test/test_bug424359-2.html
@@ -0,0 +1,301 @@
+
+
+
+
+ Test HTML serializer with entities
+
+
+
+
+Mozilla Bug
+
+
+
+
+
+
+
+
+
+
This is a draggable bit of text.
+
+
+
+
+
+ Lorem ipsum dolor
+ sit amet, consectetuer
+ adipiscing elit
+ Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
+ aptent taciti
+
+
+
+
+
+
+
+
+
+
aaa
+
+
+
lorem ipsum
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug426308.html b/dom/base/test/test_bug426308.html
new file mode 100644
index 0000000000..6587a6f2f3
--- /dev/null
+++ b/dom/base/test/test_bug426308.html
@@ -0,0 +1,42 @@
+
+
+
+
+ Test for Bug 426308
+
+
+
+
+Mozilla Bug 426308
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug426646.html b/dom/base/test/test_bug426646.html
new file mode 100644
index 0000000000..d5a0a18c01
--- /dev/null
+++ b/dom/base/test/test_bug426646.html
@@ -0,0 +1,41 @@
+
+
+
+
+ Test for Bug 426646
+
+
+
+
+Mozilla Bug 426646
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/base/test/test_bug428847.html b/dom/base/test/test_bug428847.html
new file mode 100644
index 0000000000..e34eb183bf
--- /dev/null
+++ b/dom/base/test/test_bug428847.html
@@ -0,0 +1,33 @@
+
+
+
+
+ Test for Bug 428847
+
+
+
+
+Mozilla Bug 428847
+
+