mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-02-20 20:29:15 +00:00
40 lines
971 B
HTML
40 lines
971 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test for SpecialPowers extension</title>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var url = SimpleTest.getTestFileURL("SpecialPowersLoadChromeScript.js");
|
|
var script = SpecialPowers.loadChromeScript(url);
|
|
|
|
var MESSAGE = { bar: true };
|
|
script.addMessageListener("bar", function (message) {
|
|
is(JSON.stringify(message), JSON.stringify(MESSAGE),
|
|
"received back message from the chrome script");
|
|
|
|
checkAssert();
|
|
});
|
|
|
|
function checkAssert() {
|
|
script.sendAsyncMessage("valid-assert");
|
|
script.addMessageListener("valid-assert-done", endOfTest);
|
|
}
|
|
|
|
function endOfTest() {
|
|
script.destroy();
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
script.sendAsyncMessage("foo", MESSAGE);
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|