forked from mirrors/gecko-dev
MozReview-Commit-ID: BFaOv5i5Tun --HG-- extra : rebase_source : 5c2b5d1867eb5b48c56725b87d71dae72a83eb34
97 lines
2.5 KiB
HTML
97 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug </title>
|
|
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<script type="application/javascript" src="./director-helpers.js"></script>
|
|
<script type="application/javascript">
|
|
"use strict";
|
|
|
|
window.onload = function () {
|
|
Task.spawn(function* () {
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
let tests = [
|
|
runPropagateDirectorScriptsToChildTest,
|
|
].map((testCase) => {
|
|
return function* () {
|
|
setup();
|
|
yield testCase().then(null, (e) => {
|
|
ok(false, "Exception during testCase run: "
|
|
+ [e, e.fileName, e.lineNumber].join("\n\t"));
|
|
});
|
|
|
|
teardown();
|
|
};
|
|
});
|
|
|
|
for (let test of tests) {
|
|
yield test();
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
});
|
|
};
|
|
|
|
function setup() {
|
|
if (!DebuggerServer.initialized) {
|
|
DebuggerServer.init(() => true);
|
|
DebuggerServer.addBrowserActors();
|
|
SimpleTest.registerCleanupFunction(function () {
|
|
DebuggerServer.destroy();
|
|
});
|
|
}
|
|
}
|
|
|
|
function teardown() {
|
|
purgeInstalledDirectorScripts();
|
|
DebuggerServer.destroy();
|
|
}
|
|
|
|
function runPropagateDirectorScriptsToChildTest() {
|
|
let iframe = document.createElement("iframe");
|
|
iframe.mozbrowser = true;
|
|
|
|
document.body.appendChild(iframe);
|
|
|
|
return Task.spawn(function* () {
|
|
let { client, root, transport } = yield newConnectedDebuggerClient();
|
|
|
|
let directorRegistryClient = new DirectorRegistryFront(client, root);
|
|
|
|
// install a director script
|
|
yield directorRegistryClient.install("testPropagatedDirectorScript", {
|
|
scriptCode: "console.log('director script test');",
|
|
scriptOptions: {}
|
|
});
|
|
|
|
let conn = transport._serverConnection;
|
|
let childActor = yield DebuggerServer.connectToChild(conn, iframe);
|
|
|
|
ok(typeof childActor.directorManagerActor !== "undefined",
|
|
"childActor.directorActor should be defined");
|
|
|
|
let childDirectorManagerClient = new DirectorManagerFront(client, childActor);
|
|
|
|
let directorScriptList = yield childDirectorManagerClient.list();
|
|
|
|
ok(directorScriptList.installed.length === 1 &&
|
|
directorScriptList.installed[0] === "testPropagatedDirectorScript",
|
|
"director scripts propagated correctly");
|
|
|
|
yield client.close();
|
|
});
|
|
}
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|