summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/test/xpcshell/data/file_document_write.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /toolkit/components/extensions/test/xpcshell/data/file_document_write.html
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/test/xpcshell/data/file_document_write.html')
-rw-r--r--toolkit/components/extensions/test/xpcshell/data/file_document_write.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/toolkit/components/extensions/test/xpcshell/data/file_document_write.html b/toolkit/components/extensions/test/xpcshell/data/file_document_write.html
new file mode 100644
index 0000000000..f8369ae574
--- /dev/null
+++ b/toolkit/components/extensions/test/xpcshell/data/file_document_write.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+ <iframe id="iframe"></iframe>
+
+ <script type="text/javascript">
+ "use strict";
+ addEventListener("load", () => {
+ // Send a heap-minimize observer notification so our script cache is
+ // cleared, and our content script isn't available for synchronous
+ // insertion.
+ window.dispatchEvent(new CustomEvent("MozHeapMinimize"));
+
+ let iframe = document.getElementById("iframe");
+ let doc = iframe.contentDocument;
+ let win = iframe.contentWindow;
+ doc.open("text/html");
+ // We need to do two writes here. The first creates the document element,
+ // which normally triggers parser blocking. The second triggers the
+ // creation of the element we're about to query for, which would normally
+ // happen asynchronously if the parser were blocked.
+ doc.write("<div id=meh>");
+ doc.write("<div id=beer></div>");
+
+ let elem = doc.getElementById("beer");
+ top.postMessage(elem instanceof win.HTMLDivElement ? "ok" : "fail",
+ "*");
+
+ doc.close();
+ }, {once: true});
+ </script>
+</body>
+</html>