mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -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
90 lines
2.5 KiB
HTML
90 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf8">
|
|
<title>Web Console throw tests</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>Web Console throw tests</p>
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function startTest()
|
|
{
|
|
removeEventListener("load", startTest);
|
|
attachConsoleToTab([], onAttach);
|
|
}
|
|
|
|
function onAttach(aState, aResponse)
|
|
{
|
|
let tests = [];
|
|
|
|
let falsyValues = ["-0", "null", "undefined", "Infinity", "-Infinity", "NaN"];
|
|
falsyValues.forEach(function(value) {
|
|
tests.push(async function() {
|
|
const aResponse = await aState.client.evaluateJS("throw " + value + ";")
|
|
let type = aResponse.exception.type;
|
|
is(type, value, "exception.type for throw " + value);
|
|
nextTest();
|
|
});
|
|
});
|
|
|
|
let identityTestValues = [false, 0];
|
|
identityTestValues.forEach(function(value) {
|
|
tests.push(async function() {
|
|
const aResponse = await aState.client.evaluateJS("throw " + value + ";")
|
|
let exception = aResponse.exception;
|
|
is(exception, value, "response.exception for throw " + value);
|
|
nextTest();
|
|
});
|
|
});
|
|
|
|
let longString = Array(DebuggerServer.LONG_STRING_LENGTH + 1).join("a"),
|
|
shortedString = longString.substring(0,
|
|
DebuggerServer.LONG_STRING_INITIAL_LENGTH
|
|
);
|
|
tests.push(async function() {
|
|
const aResponse = await aState.client.evaluateJS("throw '" + longString + "';")
|
|
is(aResponse.exception.initial, shortedString,
|
|
"exception.initial for throw longString"
|
|
);
|
|
is(aResponse.exceptionMessage.initial, shortedString,
|
|
"exceptionMessage.initial for throw longString"
|
|
);
|
|
nextTest();
|
|
});
|
|
|
|
let symbolTestValues = [
|
|
["Symbol.iterator", "Symbol(Symbol.iterator)"],
|
|
["Symbol('foo')", "Symbol(foo)"],
|
|
["Symbol()", "Symbol()"],
|
|
];
|
|
symbolTestValues.forEach(function([expr, message]) {
|
|
tests.push(async function() {
|
|
const aResponse = await aState.client.evaluateJS("throw " + expr + ";");
|
|
is(aResponse.exceptionMessage, message,
|
|
"response.exception for throw " + expr);
|
|
nextTest();
|
|
});
|
|
});
|
|
|
|
runTests(tests, endTest.bind(null, aState));
|
|
}
|
|
|
|
function endTest(aState)
|
|
{
|
|
closeDebugger(aState, function() {
|
|
SimpleTest.finish();
|
|
});
|
|
}
|
|
|
|
addEventListener("load", startTest);
|
|
</script>
|
|
</body>
|
|
</html>
|