summaryrefslogtreecommitdiffstats
path: root/layout/reftests/xul-document-load
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/reftests/xul-document-load
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/reftests/xul-document-load')
-rw-r--r--layout/reftests/xul-document-load/readme.txt63
-rw-r--r--layout/reftests/xul-document-load/reference-green-window.xul7
-rw-r--r--layout/reftests/xul-document-load/reftest-stylo.list46
-rw-r--r--layout/reftests/xul-document-load/reftest.list23
-rw-r--r--layout/reftests/xul-document-load/subdir/test011-overlay.xul8
-rw-r--r--layout/reftests/xul-document-load/subdir/test011.css6
-rw-r--r--layout/reftests/xul-document-load/subdir/test014-overlay-2.xul8
-rw-r--r--layout/reftests/xul-document-load/subdir/test014-overlay.xul8
-rw-r--r--layout/reftests/xul-document-load/subdir/test015-overlay.xul8
-rw-r--r--layout/reftests/xul-document-load/subdir/test015.js8
-rw-r--r--layout/reftests/xul-document-load/test001-overlay.xul7
-rw-r--r--layout/reftests/xul-document-load/test001.css6
-rw-r--r--layout/reftests/xul-document-load/test001.xul8
-rw-r--r--layout/reftests/xul-document-load/test002-overlay-1.xul7
-rw-r--r--layout/reftests/xul-document-load/test002-overlay-2.xul7
-rw-r--r--layout/reftests/xul-document-load/test002.css6
-rw-r--r--layout/reftests/xul-document-load/test002.xul8
-rw-r--r--layout/reftests/xul-document-load/test003.css6
-rw-r--r--layout/reftests/xul-document-load/test003.xul10
-rw-r--r--layout/reftests/xul-document-load/test004.css6
-rw-r--r--layout/reftests/xul-document-load/test004.xul14
-rw-r--r--layout/reftests/xul-document-load/test005.css6
-rw-r--r--layout/reftests/xul-document-load/test005.js4
-rw-r--r--layout/reftests/xul-document-load/test005.xul10
-rw-r--r--layout/reftests/xul-document-load/test006-007.js11
-rw-r--r--layout/reftests/xul-document-load/test006.css6
-rw-r--r--layout/reftests/xul-document-load/test006.xul12
-rw-r--r--layout/reftests/xul-document-load/test007-overlay.xul8
-rw-r--r--layout/reftests/xul-document-load/test007.xul12
-rw-r--r--layout/reftests/xul-document-load/test008.xul9
-rw-r--r--layout/reftests/xul-document-load/test009.xul9
-rw-r--r--layout/reftests/xul-document-load/test010-overlay.xul8
-rw-r--r--layout/reftests/xul-document-load/test010.css6
-rw-r--r--layout/reftests/xul-document-load/test010.xul30
-rw-r--r--layout/reftests/xul-document-load/test011.xul8
-rw-r--r--layout/reftests/xul-document-load/test012-1.css6
-rw-r--r--layout/reftests/xul-document-load/test012-2.css6
-rw-r--r--layout/reftests/xul-document-load/test012.xul8
-rw-r--r--layout/reftests/xul-document-load/test013-1-import.css6
-rw-r--r--layout/reftests/xul-document-load/test013-1.css7
-rw-r--r--layout/reftests/xul-document-load/test013-2.css6
-rw-r--r--layout/reftests/xul-document-load/test013.xul8
-rw-r--r--layout/reftests/xul-document-load/test014.xul9
-rw-r--r--layout/reftests/xul-document-load/test015.xul9
-rw-r--r--layout/reftests/xul-document-load/test016-overlay.xul14
-rw-r--r--layout/reftests/xul-document-load/test016.xul9
-rw-r--r--layout/reftests/xul-document-load/test017-020.js13
-rw-r--r--layout/reftests/xul-document-load/test017-overlay-2.xul10
-rw-r--r--layout/reftests/xul-document-load/test017-overlay.xul8
-rw-r--r--layout/reftests/xul-document-load/test017.xul12
-rw-r--r--layout/reftests/xul-document-load/test018-overlay-2.xul10
-rw-r--r--layout/reftests/xul-document-load/test018-overlay.xul10
-rw-r--r--layout/reftests/xul-document-load/test018.xul12
-rw-r--r--layout/reftests/xul-document-load/test019-overlay.xul8
-rw-r--r--layout/reftests/xul-document-load/test019.css6
-rw-r--r--layout/reftests/xul-document-load/test019.xul12
-rw-r--r--layout/reftests/xul-document-load/test020-overlay.xul10
-rw-r--r--layout/reftests/xul-document-load/test020.css6
-rw-r--r--layout/reftests/xul-document-load/test020.xul12
-rw-r--r--layout/reftests/xul-document-load/test021-overlay.xul12
-rw-r--r--layout/reftests/xul-document-load/test021.xul9
-rw-r--r--layout/reftests/xul-document-load/test022.xul17
62 files changed, 664 insertions, 0 deletions
diff --git a/layout/reftests/xul-document-load/readme.txt b/layout/reftests/xul-document-load/readme.txt
new file mode 100644
index 000000000..8879e9d4b
--- /dev/null
+++ b/layout/reftests/xul-document-load/readme.txt
@@ -0,0 +1,63 @@
+This directory contains various XUL document (mozilla/dom/xul/document) testcases for reftest.
+
+test001: Checks that stylesheets referenced from an overlay via an
+ xml-stylesheet PI are applied to the master document appropriately.
+
+test002: Same as #1, but there's additional overlay between the master doc and
+ the overlay with the stylesheet.
+
+test003: Checks that dynamically removing the stylesheet PI from an inline
+ script has expected effect.
+
+test004: Same as test003, but removing the stylesheet PI happens from a "load"
+ event handler.
+
+test005: Same as test003, but removing the stylesheet PI happens from a top-level
+ script in an external JS file.
+
+test006: Simple <?xml-stylesheet ?> instruction in the prolog has an effect and exists
+ in the DOM.
+
+test007: Same as #006 for xul-overlay PI.
+
+test008: Handle stylesheet PIs pointing to nonexistent resources gracefully.
+
+test009: Same as #008 for xul-overlay PIs
+
+test010: PIs in the master document, outside the prolog, don't have any effect but get
+ added to the DOM.
+
+test011: (bug 363406) Relative URIs in overlay's <?xml-stylesheet ?> PI are
+ resolved against overlay's URI, not the document URI.
+
+test012: Tests that sheets references from <?xml-stylesheet ?> PIs are added to the
+ document in the same order as the PIs themselves are in - the simple case.
+
+test013: Tests the same thing as #012, but for the case when the first sheet contains
+ an @import statement, which makes it -finish- loading earlier than the
+ second sheet.
+
+test014: (bug 363406) Relative URIs in overlay's <?xul-overlay ?> PI are resolved
+ against overlay's URI, not the document URI.
+
+test015: Relative URIs in overlay's <xul:script> are resolved against overlay's
+ URI, not the document URI.
+
+test016: Non-XUL elements work in overlays.
+
+test017: (bug 359959) <?xul-overlay ?> used as a direct child of <overlay>
+ should be inserted into the DOM, but not cause the overlay to be
+ applied.
+
+test018: <?xul-overlay ?> used deep inside another overlay (i.e. as a child of
+ a 'hookup' node) should be inserted into the DOM, but not cause the
+ overlay to be applied.
+
+test019: Same as #017 for <?xml-stylesheet ?>
+
+test020: Same as #018 for <?xml-stylesheet ?>
+
+test021: (bug 363419) Non-XUL elements directly underneath <overlay> should
+ be merged correctly into the base document.
+
+test022: (bug 369828) <html:style> works in XUL documents
diff --git a/layout/reftests/xul-document-load/reference-green-window.xul b/layout/reftests/xul-document-load/reference-green-window.xul
new file mode 100644
index 000000000..4c6ca1987
--- /dev/null
+++ b/layout/reftests/xul-document-load/reference-green-window.xul
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: green"/>
diff --git a/layout/reftests/xul-document-load/reftest-stylo.list b/layout/reftests/xul-document-load/reftest-stylo.list
new file mode 100644
index 000000000..dbd58425e
--- /dev/null
+++ b/layout/reftests/xul-document-load/reftest-stylo.list
@@ -0,0 +1,46 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+skip-if((B2G&&browserIsRemote)||Mulet) == test001.xul test001.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test002.xul test002.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test003.xul test003.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test004.xul test004.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test005.xul test005.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test006.xul test006.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test007.xul test007.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test008.xul test008.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test009.xul test009.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test010.xul test010.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test011.xul test011.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test012.xul test012.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+# skip-if((B2G&&browserIsRemote)||Mulet) == test013.xul test013.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test014.xul test014.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+# Disabled due to compartments for now.
+#skip-if((B2G&&browserIsRemote)||Mulet) == test015.xul test015.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test016.xul test016.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test017.xul test017.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test018.xul test018.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test019.xul test019.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test020.xul test020.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test021.xul test021.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if((B2G&&browserIsRemote)||Mulet) == test022.xul test022.xul
+# Initial mulet triage: parity with B2G/B2G Desktop
diff --git a/layout/reftests/xul-document-load/reftest.list b/layout/reftests/xul-document-load/reftest.list
new file mode 100644
index 000000000..a726e216f
--- /dev/null
+++ b/layout/reftests/xul-document-load/reftest.list
@@ -0,0 +1,23 @@
+== test001.xul reference-green-window.xul
+== test002.xul reference-green-window.xul
+== test003.xul reference-green-window.xul
+== test004.xul reference-green-window.xul
+== test005.xul reference-green-window.xul
+== test006.xul reference-green-window.xul
+== test007.xul reference-green-window.xul
+== test008.xul reference-green-window.xul
+== test009.xul reference-green-window.xul
+== test010.xul reference-green-window.xul
+== test011.xul reference-green-window.xul
+== test012.xul reference-green-window.xul
+== test013.xul reference-green-window.xul
+== test014.xul reference-green-window.xul
+# Disabled due to compartments for now.
+#== test015.xul reference-green-window.xul
+== test016.xul reference-green-window.xul
+== test017.xul reference-green-window.xul
+== test018.xul reference-green-window.xul
+== test019.xul reference-green-window.xul
+== test020.xul reference-green-window.xul
+== test021.xul reference-green-window.xul
+== test022.xul reference-green-window.xul
diff --git a/layout/reftests/xul-document-load/subdir/test011-overlay.xul b/layout/reftests/xul-document-load/subdir/test011-overlay.xul
new file mode 100644
index 000000000..561ec86a9
--- /dev/null
+++ b/layout/reftests/xul-document-load/subdir/test011-overlay.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test011.css" type="text/css"?>
+
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
diff --git a/layout/reftests/xul-document-load/subdir/test011.css b/layout/reftests/xul-document-load/subdir/test011.css
new file mode 100644
index 000000000..9cf783629
--- /dev/null
+++ b/layout/reftests/xul-document-load/subdir/test011.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: green !important;
+}
diff --git a/layout/reftests/xul-document-load/subdir/test014-overlay-2.xul b/layout/reftests/xul-document-load/subdir/test014-overlay-2.xul
new file mode 100644
index 000000000..249e73786
--- /dev/null
+++ b/layout/reftests/xul-document-load/subdir/test014-overlay-2.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <window id="main" style="background-color: green"/>
+</overlay>
diff --git a/layout/reftests/xul-document-load/subdir/test014-overlay.xul b/layout/reftests/xul-document-load/subdir/test014-overlay.xul
new file mode 100644
index 000000000..e25aebcd8
--- /dev/null
+++ b/layout/reftests/xul-document-load/subdir/test014-overlay.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test014-overlay-2.xul"?>
+
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
diff --git a/layout/reftests/xul-document-load/subdir/test015-overlay.xul b/layout/reftests/xul-document-load/subdir/test015-overlay.xul
new file mode 100644
index 000000000..82bf43963
--- /dev/null
+++ b/layout/reftests/xul-document-load/subdir/test015-overlay.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="test015.js"/>
+</overlay>
diff --git a/layout/reftests/xul-document-load/subdir/test015.js b/layout/reftests/xul-document-load/subdir/test015.js
new file mode 100644
index 000000000..7184beaa5
--- /dev/null
+++ b/layout/reftests/xul-document-load/subdir/test015.js
@@ -0,0 +1,8 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+function onLoad() {
+ document.documentElement.style.backgroundColor = "green";
+}
+
+addEventListener("load", onLoad, false);
diff --git a/layout/reftests/xul-document-load/test001-overlay.xul b/layout/reftests/xul-document-load/test001-overlay.xul
new file mode 100644
index 000000000..d2dfa0eb5
--- /dev/null
+++ b/layout/reftests/xul-document-load/test001-overlay.xul
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test001.css" type="text/css"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
diff --git a/layout/reftests/xul-document-load/test001.css b/layout/reftests/xul-document-load/test001.css
new file mode 100644
index 000000000..9cf783629
--- /dev/null
+++ b/layout/reftests/xul-document-load/test001.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: green !important;
+}
diff --git a/layout/reftests/xul-document-load/test001.xul b/layout/reftests/xul-document-load/test001.xul
new file mode 100644
index 000000000..3f7b1f2b5
--- /dev/null
+++ b/layout/reftests/xul-document-load/test001.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test001-overlay.xul" ?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: red"/>
diff --git a/layout/reftests/xul-document-load/test002-overlay-1.xul b/layout/reftests/xul-document-load/test002-overlay-1.xul
new file mode 100644
index 000000000..95bef532d
--- /dev/null
+++ b/layout/reftests/xul-document-load/test002-overlay-1.xul
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test002-overlay-2.xul"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
diff --git a/layout/reftests/xul-document-load/test002-overlay-2.xul b/layout/reftests/xul-document-load/test002-overlay-2.xul
new file mode 100644
index 000000000..831fc26e6
--- /dev/null
+++ b/layout/reftests/xul-document-load/test002-overlay-2.xul
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test002.css" type="text/css"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
diff --git a/layout/reftests/xul-document-load/test002.css b/layout/reftests/xul-document-load/test002.css
new file mode 100644
index 000000000..9cf783629
--- /dev/null
+++ b/layout/reftests/xul-document-load/test002.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: green !important;
+}
diff --git a/layout/reftests/xul-document-load/test002.xul b/layout/reftests/xul-document-load/test002.xul
new file mode 100644
index 000000000..3258e1488
--- /dev/null
+++ b/layout/reftests/xul-document-load/test002.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test002-overlay-1.xul" ?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: red"/>
diff --git a/layout/reftests/xul-document-load/test003.css b/layout/reftests/xul-document-load/test003.css
new file mode 100644
index 000000000..3b18aff8b
--- /dev/null
+++ b/layout/reftests/xul-document-load/test003.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: red !important;
+}
diff --git a/layout/reftests/xul-document-load/test003.xul b/layout/reftests/xul-document-load/test003.xul
new file mode 100644
index 000000000..fea3a0565
--- /dev/null
+++ b/layout/reftests/xul-document-load/test003.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test003.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: green">
+<script type="text/javascript">document.removeChild(document.firstChild);</script>
+</window> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test004.css b/layout/reftests/xul-document-load/test004.css
new file mode 100644
index 000000000..3b18aff8b
--- /dev/null
+++ b/layout/reftests/xul-document-load/test004.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: red !important;
+}
diff --git a/layout/reftests/xul-document-load/test004.xul b/layout/reftests/xul-document-load/test004.xul
new file mode 100644
index 000000000..ccb030ba1
--- /dev/null
+++ b/layout/reftests/xul-document-load/test004.xul
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test004.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: green" onload="handleOnLoad();">
+<script type="text/javascript">
+function handleOnLoad() {
+ document.removeChild(document.firstChild);
+}
+</script>
+</window> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test005.css b/layout/reftests/xul-document-load/test005.css
new file mode 100644
index 000000000..3b18aff8b
--- /dev/null
+++ b/layout/reftests/xul-document-load/test005.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: red !important;
+}
diff --git a/layout/reftests/xul-document-load/test005.js b/layout/reftests/xul-document-load/test005.js
new file mode 100644
index 000000000..21ae23e64
--- /dev/null
+++ b/layout/reftests/xul-document-load/test005.js
@@ -0,0 +1,4 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+document.removeChild(document.firstChild);
diff --git a/layout/reftests/xul-document-load/test005.xul b/layout/reftests/xul-document-load/test005.xul
new file mode 100644
index 000000000..76adc6086
--- /dev/null
+++ b/layout/reftests/xul-document-load/test005.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test005.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: green">
+<script src="test005.js"/>
+</window> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test006-007.js b/layout/reftests/xul-document-load/test006-007.js
new file mode 100644
index 000000000..96fd74fe4
--- /dev/null
+++ b/layout/reftests/xul-document-load/test006-007.js
@@ -0,0 +1,11 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+function checkDOM(target, data) {
+ // assuming whitespace and the XML declaration are not in the DOM.
+ var piNode = document.firstChild;
+ if (!piNode || piNode.nodeType != Node.PROCESSING_INSTRUCTION_NODE ||
+ piNode.target != target || piNode.data != data) {
+ document.documentElement.style.backgroundColor = "red";
+ }
+}
diff --git a/layout/reftests/xul-document-load/test006.css b/layout/reftests/xul-document-load/test006.css
new file mode 100644
index 000000000..9cf783629
--- /dev/null
+++ b/layout/reftests/xul-document-load/test006.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: green !important;
+}
diff --git a/layout/reftests/xul-document-load/test006.xul b/layout/reftests/xul-document-load/test006.xul
new file mode 100644
index 000000000..82137d20d
--- /dev/null
+++ b/layout/reftests/xul-document-load/test006.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test006.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red"
+ onload="checkDOM('xml-stylesheet', 'href=&quot;test006.css&quot; type=&quot;text/css&quot;');">
+ <script src="test006-007.js"/>
+</window> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test007-overlay.xul b/layout/reftests/xul-document-load/test007-overlay.xul
new file mode 100644
index 000000000..249e73786
--- /dev/null
+++ b/layout/reftests/xul-document-load/test007-overlay.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <window id="main" style="background-color: green"/>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test007.xul b/layout/reftests/xul-document-load/test007.xul
new file mode 100644
index 000000000..8c64bc400
--- /dev/null
+++ b/layout/reftests/xul-document-load/test007.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test007-overlay.xul"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red"
+ onload="checkDOM('xul-overlay', 'href=&quot;test007-overlay.xul&quot;');">
+ <script src="test006-007.js"/>
+</window> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test008.xul b/layout/reftests/xul-document-load/test008.xul
new file mode 100644
index 000000000..edb5810fb
--- /dev/null
+++ b/layout/reftests/xul-document-load/test008.xul
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="not-existing.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: green">
+</window>
diff --git a/layout/reftests/xul-document-load/test009.xul b/layout/reftests/xul-document-load/test009.xul
new file mode 100644
index 000000000..1b8167d0e
--- /dev/null
+++ b/layout/reftests/xul-document-load/test009.xul
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="not-existing.css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: green">
+</window>
diff --git a/layout/reftests/xul-document-load/test010-overlay.xul b/layout/reftests/xul-document-load/test010-overlay.xul
new file mode 100644
index 000000000..8078f4e73
--- /dev/null
+++ b/layout/reftests/xul-document-load/test010-overlay.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <window id="main" style="background-color: red !important"/>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test010.css b/layout/reftests/xul-document-load/test010.css
new file mode 100644
index 000000000..3b18aff8b
--- /dev/null
+++ b/layout/reftests/xul-document-load/test010.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: red !important;
+}
diff --git a/layout/reftests/xul-document-load/test010.xul b/layout/reftests/xul-document-load/test010.xul
new file mode 100644
index 000000000..a092475d5
--- /dev/null
+++ b/layout/reftests/xul-document-load/test010.xul
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<window id="main"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: green">
+ <?xml-stylesheet href="test010.css" type="text/css"?>
+ <?xul-overlay href="test010-overlay.xul" ?>
+ <script>
+ function assert(x, msg) {
+ if(!x) {
+ dump("assertion failed! " + msg + "\n");
+ document.getElementById("main").style.backgroundColor = "red";
+ }
+ }
+
+ try {
+ assert(document.firstChild.id == "main", "nothing in prolog");
+ var winEl = document.documentElement;
+ assert(winEl.childNodes[0].nodeName == "xml-stylesheet", "xml-stylesheet PI is in the correct place");
+ assert(winEl.childNodes[1].nodeName == "xul-overlay", "xul-overlay PI is in the correct place");
+ } catch(e) {
+ dump(e);
+ assert(false, e);
+ throw e;
+ }
+ </script>
+</window> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test011.xul b/layout/reftests/xul-document-load/test011.xul
new file mode 100644
index 000000000..b623fcc85
--- /dev/null
+++ b/layout/reftests/xul-document-load/test011.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="subdir/test011-overlay.xul"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: red;"/>
diff --git a/layout/reftests/xul-document-load/test012-1.css b/layout/reftests/xul-document-load/test012-1.css
new file mode 100644
index 000000000..ed5e68c18
--- /dev/null
+++ b/layout/reftests/xul-document-load/test012-1.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: red;
+}
diff --git a/layout/reftests/xul-document-load/test012-2.css b/layout/reftests/xul-document-load/test012-2.css
new file mode 100644
index 000000000..ff59288db
--- /dev/null
+++ b/layout/reftests/xul-document-load/test012-2.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: green;
+}
diff --git a/layout/reftests/xul-document-load/test012.xul b/layout/reftests/xul-document-load/test012.xul
new file mode 100644
index 000000000..7f9c64791
--- /dev/null
+++ b/layout/reftests/xul-document-load/test012.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test012-1.css" type="text/css"?>
+<?xml-stylesheet href="test012-2.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
diff --git a/layout/reftests/xul-document-load/test013-1-import.css b/layout/reftests/xul-document-load/test013-1-import.css
new file mode 100644
index 000000000..b7eafb32d
--- /dev/null
+++ b/layout/reftests/xul-document-load/test013-1-import.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: yellow;
+}
diff --git a/layout/reftests/xul-document-load/test013-1.css b/layout/reftests/xul-document-load/test013-1.css
new file mode 100644
index 000000000..dae0aa589
--- /dev/null
+++ b/layout/reftests/xul-document-load/test013-1.css
@@ -0,0 +1,7 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+@import url(test013-1-import.css);
+window {
+ background-color: red;
+}
diff --git a/layout/reftests/xul-document-load/test013-2.css b/layout/reftests/xul-document-load/test013-2.css
new file mode 100644
index 000000000..ff59288db
--- /dev/null
+++ b/layout/reftests/xul-document-load/test013-2.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: green;
+}
diff --git a/layout/reftests/xul-document-load/test013.xul b/layout/reftests/xul-document-load/test013.xul
new file mode 100644
index 000000000..d04a54fd3
--- /dev/null
+++ b/layout/reftests/xul-document-load/test013.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xml-stylesheet href="test013-1.css" type="text/css"?>
+<?xml-stylesheet href="test013-2.css" type="text/css"?>
+<window id="main" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
diff --git a/layout/reftests/xul-document-load/test014.xul b/layout/reftests/xul-document-load/test014.xul
new file mode 100644
index 000000000..f10fca0c8
--- /dev/null
+++ b/layout/reftests/xul-document-load/test014.xul
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="subdir/test014-overlay.xul"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red;"/>
diff --git a/layout/reftests/xul-document-load/test015.xul b/layout/reftests/xul-document-load/test015.xul
new file mode 100644
index 000000000..afdbb1ea0
--- /dev/null
+++ b/layout/reftests/xul-document-load/test015.xul
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="subdir/test015-overlay.xul"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red;"/>
diff --git a/layout/reftests/xul-document-load/test016-overlay.xul b/layout/reftests/xul-document-load/test016-overlay.xul
new file mode 100644
index 000000000..af6883539
--- /dev/null
+++ b/layout/reftests/xul-document-load/test016-overlay.xul
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<window id="main">
+ <style xmlns="http://www.w3.org/1999/xhtml">
+ window {
+ background-color: green !important;
+ }
+ </style>
+</window>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test016.xul b/layout/reftests/xul-document-load/test016.xul
new file mode 100644
index 000000000..c0bae9d52
--- /dev/null
+++ b/layout/reftests/xul-document-load/test016.xul
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test016-overlay.xul"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red;"/>
diff --git a/layout/reftests/xul-document-load/test017-020.js b/layout/reftests/xul-document-load/test017-020.js
new file mode 100644
index 000000000..415a015e8
--- /dev/null
+++ b/layout/reftests/xul-document-load/test017-020.js
@@ -0,0 +1,13 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+// check that the second node under the document element is a PI with the
+// specified .target and .data
+function checkDOM(target, data) {
+ // assume there are no whitespace nodes in XUL
+ var piNode = document.documentElement.childNodes[1];
+ if (!piNode || piNode.nodeType != Node.PROCESSING_INSTRUCTION_NODE ||
+ piNode.target != target || piNode.data != data) {
+ document.documentElement.style.backgroundColor = "red";
+ }
+}
diff --git a/layout/reftests/xul-document-load/test017-overlay-2.xul b/layout/reftests/xul-document-load/test017-overlay-2.xul
new file mode 100644
index 000000000..7bf90679c
--- /dev/null
+++ b/layout/reftests/xul-document-load/test017-overlay-2.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red"/>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test017-overlay.xul b/layout/reftests/xul-document-load/test017-overlay.xul
new file mode 100644
index 000000000..8b2d9aecb
--- /dev/null
+++ b/layout/reftests/xul-document-load/test017-overlay.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <?xul-overlay href="test017-overlay-2.xul"?>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test017.xul b/layout/reftests/xul-document-load/test017.xul
new file mode 100644
index 000000000..1edbdab7f
--- /dev/null
+++ b/layout/reftests/xul-document-load/test017.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test017-overlay.xul" ?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: green"
+ onload="checkDOM('xul-overlay', 'href=&quot;test017-overlay-2.xul&quot;');">
+ <script src="test017-020.js"/>
+</window>
diff --git a/layout/reftests/xul-document-load/test018-overlay-2.xul b/layout/reftests/xul-document-load/test018-overlay-2.xul
new file mode 100644
index 000000000..7bf90679c
--- /dev/null
+++ b/layout/reftests/xul-document-load/test018-overlay-2.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red"/>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test018-overlay.xul b/layout/reftests/xul-document-load/test018-overlay.xul
new file mode 100644
index 000000000..cec878a5d
--- /dev/null
+++ b/layout/reftests/xul-document-load/test018-overlay.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <window id="main">
+ <?xul-overlay href="test018-overlay-2.xul"?>
+ </window>
+</overlay> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test018.xul b/layout/reftests/xul-document-load/test018.xul
new file mode 100644
index 000000000..3cd75e2de
--- /dev/null
+++ b/layout/reftests/xul-document-load/test018.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test018-overlay.xul" ?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: green"
+ onload="checkDOM('xul-overlay', 'href=&quot;test018-overlay-2.xul&quot;');">
+ <script src="test017-020.js"/>
+</window> \ No newline at end of file
diff --git a/layout/reftests/xul-document-load/test019-overlay.xul b/layout/reftests/xul-document-load/test019-overlay.xul
new file mode 100644
index 000000000..ac31476fe
--- /dev/null
+++ b/layout/reftests/xul-document-load/test019-overlay.xul
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <?xml-stylesheet href="test019.css" type="text/css"?>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test019.css b/layout/reftests/xul-document-load/test019.css
new file mode 100644
index 000000000..3b18aff8b
--- /dev/null
+++ b/layout/reftests/xul-document-load/test019.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: red !important;
+}
diff --git a/layout/reftests/xul-document-load/test019.xul b/layout/reftests/xul-document-load/test019.xul
new file mode 100644
index 000000000..73ca14f42
--- /dev/null
+++ b/layout/reftests/xul-document-load/test019.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test019-overlay.xul" ?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: green"
+ onload="checkDOM('xml-stylesheet', 'href=&quot;test019.css&quot; type=&quot;text/css&quot;');">
+ <script src="test017-020.js"/>
+</window>
diff --git a/layout/reftests/xul-document-load/test020-overlay.xul b/layout/reftests/xul-document-load/test020-overlay.xul
new file mode 100644
index 000000000..7cd83accc
--- /dev/null
+++ b/layout/reftests/xul-document-load/test020-overlay.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <window id="main">
+ <?xml-stylesheet href="test020.css" type="text/css"?>
+ </window>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test020.css b/layout/reftests/xul-document-load/test020.css
new file mode 100644
index 000000000..3b18aff8b
--- /dev/null
+++ b/layout/reftests/xul-document-load/test020.css
@@ -0,0 +1,6 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/ */
+
+window {
+ background-color: red !important;
+}
diff --git a/layout/reftests/xul-document-load/test020.xul b/layout/reftests/xul-document-load/test020.xul
new file mode 100644
index 000000000..0f5039652
--- /dev/null
+++ b/layout/reftests/xul-document-load/test020.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test020-overlay.xul" ?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: green"
+ onload="checkDOM('xml-stylesheet', 'href=&quot;test020.css&quot; type=&quot;text/css&quot;');">
+ <script src="test017-020.js"/>
+</window>
diff --git a/layout/reftests/xul-document-load/test021-overlay.xul b/layout/reftests/xul-document-load/test021-overlay.xul
new file mode 100644
index 000000000..cb48a0f98
--- /dev/null
+++ b/layout/reftests/xul-document-load/test021-overlay.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <style xmlns="http://www.w3.org/1999/xhtml">
+ window {
+ background-color: green !important;
+ }
+ </style>
+</overlay>
diff --git a/layout/reftests/xul-document-load/test021.xul b/layout/reftests/xul-document-load/test021.xul
new file mode 100644
index 000000000..e4b906bb7
--- /dev/null
+++ b/layout/reftests/xul-document-load/test021.xul
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<?xul-overlay href="test021-overlay.xul"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="main"
+ style="background-color: red;"/>
diff --git a/layout/reftests/xul-document-load/test022.xul b/layout/reftests/xul-document-load/test022.xul
new file mode 100644
index 000000000..75dbbdd78
--- /dev/null
+++ b/layout/reftests/xul-document-load/test022.xul
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!--
+Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/licenses/publicdomain/
+-->
+<window title="Testcase for bug 369828 - html:style doesn't work in XUL documents"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ style="background-color: red">
+
+<html:style type="text/css">
+ window {
+ background-color: green !important;
+ }
+</html:style>
+
+</window>