Bug 844783 - Tests. r=bz

This commit is contained in:
Bobby Holley 2013-03-21 09:33:35 -07:00
parent d4b32e491e
commit 480265d53e
3 changed files with 94 additions and 0 deletions

View File

@ -40,6 +40,8 @@ MOCHITEST_FILES = \
test_bug790265.xhtml \
test_bug821850.html \
file_bug821850.xhtml \
test_bug844783.html \
file_bug844783.xhtml \
$(NULL)
MOCHITEST_CHROME_FILES = \

View File

@ -0,0 +1,54 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=844783
-->
<head>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="testBinding">
<implementation>
<constructor>
is(windowExpando, 42, "Expandos show up without explicit waiving");
someFunction();
ok(called, "Function called");
go();
</constructor>
</implementation>
<handlers>
<handler event="testevent" action="is(boundExpando, 11, 'See expandos on |this|'); SimpleTest.finish();"/>
</handlers>
</binding>
</bindings>
<script type="application/javascript">
<![CDATA[
is = parent.is;
ok = parent.ok;
SimpleTest = parent.SimpleTest;
window.windowExpando = 42;
window.someFunction = function() { ok(true, "Called"); window.called = true; };
function go() {
var bound = document.getElementById('bound');
bound.boundExpando = 11;
bound.dispatchEvent(new CustomEvent('testevent'));
}
function setup() {
// When the bindings are applied, the constructor will be invoked and the
// test will continue.
document.getElementById('bound').style.MozBinding = 'url(#testBinding)';
}
]]>
</script>
</head>
<body onload="setup()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=844783">Mozilla Bug 844783</a>
<p id="display"></p>
<div id="content">
<div id="bound">Bound element</div>
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=844783
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 844783</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for XBL running in content scope for XUL-whitelisted domains. **/
SimpleTest.waitForExplicitFinish();
// Disable the automation pref before loading the test to make sure we load
// the proper configuration.
function setup() {
SpecialPowers.pushPrefEnv({clear: [['dom.use_xbl_scopes_for_remote_xul']] }, continueSetup);
}
// Embed the real test. It will take care of everything else.
function continueSetup() {
$('ifr').setAttribute('src', 'file_bug844783.xhtml');
}
</script>
</head>
<body onload="setup();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=844783">Mozilla Bug 844783</a>
<p id="display"></p>
<div id="content">
<iframe id="ifr"></iframe>
</div>
<pre id="test">
</pre>
</body>
</html>