diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/xul/test/test_import_xul_to_content.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'dom/xul/test/test_import_xul_to_content.xul')
-rw-r--r-- | dom/xul/test/test_import_xul_to_content.xul | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/dom/xul/test/test_import_xul_to_content.xul b/dom/xul/test/test_import_xul_to_content.xul new file mode 100644 index 000000000..a0b26fa96 --- /dev/null +++ b/dom/xul/test/test_import_xul_to_content.xul @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/css" href="chrome://global/skin"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> +<window title="Mozilla Importing XUL into Content" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1027299" + target="_blank">Mozilla Bug 1027299</a> + </body> + + <browser id="browserelt" src="about:blank" type="content"/> + + <!-- test code goes here --> + <script type="application/javascript"> + <![CDATA[ + + Components.utils.import("resource://gre/modules/Services.jsm"); + + SimpleTest.waitForExplicitFinish(); + + function expectWarning(expected, when, f) { + Services.console.reset(); + + f(); + + var sawWarning = false; + var msgs = Services.console.getMessageArray(); + for (var i = 0; i < msgs.length; i++) { + var msg = msgs[i]; + if (!msg || !(msg instanceof Components.interfaces.nsIScriptError)) { + continue; + } + + if (msg.category.includes("DOM") && msg.errorMessage.includes("Importing XUL")) { + sawWarning = true; + } + } + + ok(sawWarning == expected, "correct warning condition when " + when); + } + + var browser = document.getElementById("browserelt"); + browser.addEventListener("load", function() { + var doc = browser.contentDocument; + + // We add a <video> element, which contains anonymous XUL content. This should not warn. + var video = doc.createElement("video"); + expectWarning(false, "appending video", function() { + doc.documentElement.appendChild(video); + // Force a layout flush to make sure the anonymous content is added. + let dummy = doc.documentElement.offsetLeft; + }); + + // We add some XUL to a content document. This should generate a warning. + var elt = document.createElement("label"); + var newElt = doc.importNode(elt, false); + expectWarning(true, "appending XUL", function() { + doc.documentElement.appendChild(newElt); + }); + + SimpleTest.finish(); + }); + + ]]> + </script> +</window> |