mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 11:37:43 -10:00
This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 1` argument. Differential Revision: https://phabricator.services.mozilla.com/D26812
94 lines
2.2 KiB
HTML
94 lines
2.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf8">
|
|
<title>Test for the other command helpers</title>
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="common.js"></script>
|
|
<!-- Any copyright is dedicated to the Public Domain.
|
|
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
</head>
|
|
<body>
|
|
<p>Test for the querySelector / querySelectorAll helpers</p>
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
let gState;
|
|
let gWin;
|
|
let tests;
|
|
|
|
function evaluateJS(input) {
|
|
return gState.client.evaluateJS(input);
|
|
}
|
|
|
|
function startTest() {
|
|
info ("Content window opened, attaching console to it");
|
|
|
|
let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal);
|
|
ok (!gWin.document.nodePrincipal.equals(systemPrincipal),
|
|
"The test document is not using the system principal");
|
|
|
|
attachConsoleToTab([], state => {
|
|
gState = state;
|
|
runTests(tests, testEnd);
|
|
});
|
|
}
|
|
|
|
tests = [
|
|
async function keys() {
|
|
let response = await evaluateJS("keys({foo: 'bar'})");
|
|
checkObject(response, {
|
|
from: gState.actor,
|
|
result: {
|
|
class: "Array",
|
|
preview: {
|
|
items: ["foo"]
|
|
}
|
|
}
|
|
});
|
|
nextTest();
|
|
},
|
|
async function values() {
|
|
let response = await evaluateJS("values({foo: 'bar'})");
|
|
checkObject(response, {
|
|
from: gState.actor,
|
|
result: {
|
|
class: "Array",
|
|
preview: {
|
|
items: ["bar"]
|
|
}
|
|
}
|
|
});
|
|
nextTest();
|
|
},
|
|
];
|
|
|
|
function testEnd() {
|
|
gWin.close();
|
|
gWin = null;
|
|
closeDebugger(gState, function() {
|
|
gState = null;
|
|
SimpleTest.finish();
|
|
});
|
|
}
|
|
|
|
let load = async function () {
|
|
removeEventListener("load", load);
|
|
|
|
await new Promise(resolve => {
|
|
SpecialPowers.pushPrefEnv({"set": [
|
|
["security.data_uri.unique_opaque_origin", false],
|
|
]}, resolve);
|
|
});
|
|
|
|
// Open a content window to test XRay functionality on built in functions.
|
|
gWin = window.open("data:text/html,");
|
|
info ("Waiting for content window to load");
|
|
gWin.onload = startTest;
|
|
};
|
|
addEventListener("load", load);
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|