Bug 1467712 - Simplify calls to ok to use only 2 arguments;r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D10416

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2018-11-01 11:09:48 +00:00
Родитель 636020d26c
Коммит b50a5ba4dc
27 изменённых файлов: 105 добавлений и 81 удалений

Просмотреть файл

@ -105,9 +105,9 @@ function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMetho
var nameMatches = position && position.name == aIdOrNameOrAcc; var nameMatches = position && position.name == aIdOrNameOrAcc;
var accMatches = position == aIdOrNameOrAcc; var accMatches = position == aIdOrNameOrAcc;
SimpleTest.ok(idMatches || nameMatches || accMatches, "id or name matches", SimpleTest.ok(idMatches || nameMatches || accMatches,
"expecting " + prettyName(aIdOrNameOrAcc) + ", got '" + "id or name matches - expecting " +
prettyName(position)); prettyName(aIdOrNameOrAcc) + ", got '" + prettyName(position));
SimpleTest.is(aEvent.isFromUserInput, aIsFromUserInput, SimpleTest.is(aEvent.isFromUserInput, aIsFromUserInput,
"Expected user input is " + aIsFromUserInput + "\n"); "Expected user input is " + aIsFromUserInput + "\n");

Просмотреть файл

@ -20,13 +20,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
if (event.data != 'childIframe') { if (event.data != 'childIframe') {
ok(false, "event.data: got '" + event.data + "', expected 'childIframe'"); ok(false, "event.data: got '" + event.data + "', expected 'childIframe'");
} }
ok(!testCase.shouldBeBlocked, testCase.desc, "child navigation was NOT blocked"); ok(!testCase.shouldBeBlocked, testCase.desc + " - child navigation was NOT blocked");
runNextTest(); runNextTest();
}; };
try { try {
window["parentIframe"].eval(testCase.script); window["parentIframe"].eval(testCase.script);
} catch(e) { } catch(e) {
ok(testCase.shouldBeBlocked, testCase.desc, e.message); ok(testCase.shouldBeBlocked, testCase.desc + " - " + e.message);
runNextTest(); runNextTest();
} }
} }

Просмотреть файл

@ -18,13 +18,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
if (event.data != "otherWindow") { if (event.data != "otherWindow") {
ok(false, "event.data: got '" + event.data + "', expected 'otherWindow'"); ok(false, "event.data: got '" + event.data + "', expected 'otherWindow'");
} }
ok(false, testCase.desc, "auxiliary navigation was NOT blocked"); ok(false, testCase.desc + " - auxiliary navigation was NOT blocked");
runNextTest(); runNextTest();
}; };
try { try {
window["testIframe"].eval(testCase.script); window["testIframe"].eval(testCase.script);
} catch(e) { } catch(e) {
ok(true, testCase.desc, e.message); ok(true, testCase.desc + " - " + e.message);
runNextTest(); runNextTest();
} }
} }

Просмотреть файл

@ -18,13 +18,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
if (event.data != "ourWindow") { if (event.data != "ourWindow") {
ok(false, "event.data: got '" + event.data + "', expected 'ourWindow'"); ok(false, "event.data: got '" + event.data + "', expected 'ourWindow'");
} }
ok(!testCase.shouldBeBlocked, testCase.desc, "auxiliary navigation was NOT blocked"); ok(!testCase.shouldBeBlocked, testCase.desc + " - auxiliary navigation was NOT blocked");
runNextTest(); runNextTest();
}; };
try { try {
SpecialPowers.wrap(window["testIframe"]).eval(testCase.script); SpecialPowers.wrap(window["testIframe"]).eval(testCase.script);
} catch(e) { } catch(e) {
ok(testCase.shouldBeBlocked, testCase.desc, SpecialPowers.wrap(e).message); ok(testCase.shouldBeBlocked, testCase.desc + " - " + SpecialPowers.wrap(e).message);
runNextTest(); runNextTest();
} }
} }

Просмотреть файл

@ -18,13 +18,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
if (event.data != "parentIframe") { if (event.data != "parentIframe") {
ok(false, "event.data: got '" + event.data + "', expected 'parentIframe'"); ok(false, "event.data: got '" + event.data + "', expected 'parentIframe'");
} }
ok(false, testCase.desc, "parent navigation was NOT blocked"); ok(false, testCase.desc + " - parent navigation was NOT blocked");
runNextTest(); runNextTest();
}; };
try { try {
window["parentIframe"]["childIframe"].eval(testCase.script); window["parentIframe"]["childIframe"].eval(testCase.script);
} catch(e) { } catch(e) {
ok(true, testCase.desc, e.message); ok(true, testCase.desc + " - " + e.message);
runNextTest(); runNextTest();
} }
} }

Просмотреть файл

@ -19,14 +19,14 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
ok(false, "event.data: got '" + event.data + "', expected 'siblingIframe'"); ok(false, "event.data: got '" + event.data + "', expected 'siblingIframe'");
} }
ok(false, testCase.desc, "sibling navigation was NOT blocked"); ok(false, testCase.desc + " - sibling navigation was NOT blocked");
runNextTest(); runNextTest();
}; };
try { try {
window["testIframe"].eval(testCase.script); window["testIframe"].eval(testCase.script);
} catch(e) { } catch(e) {
ok(true, testCase.desc, e.message); ok(true, testCase.desc + " - " + e.message);
runNextTest(); runNextTest();
} }
} }

Просмотреть файл

@ -19,13 +19,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
if (event.data != "newTop") { if (event.data != "newTop") {
ok(false, "event.data: got '" + event.data + "', expected 'newTop'"); ok(false, "event.data: got '" + event.data + "', expected 'newTop'");
} }
ok(!testCase.shouldBeBlocked, testCase.desc, "top navigation was NOT blocked"); ok(!testCase.shouldBeBlocked, testCase.desc + " - top navigation was NOT blocked");
runNextTest(); runNextTest();
}; };
try { try {
SpecialPowers.wrap(testWin[testCase.iframeName]).eval(testCase.script); SpecialPowers.wrap(testWin[testCase.iframeName]).eval(testCase.script);
} catch(e) { } catch(e) {
ok(testCase.shouldBeBlocked, testCase.desc, SpecialPowers.wrap(e).message); ok(testCase.shouldBeBlocked, testCase.desc + " - " + SpecialPowers.wrap(e).message);
runNextTest(); runNextTest();
} }
} }

Просмотреть файл

@ -20,13 +20,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
ok(false, "event.data.name: got '" + event.data.name + "', expected 'newWindow'"); ok(false, "event.data.name: got '" + event.data.name + "', expected 'newWindow'");
} }
var diag = "top navigation was " + (event.data.blocked ? "" : "NOT ") + "blocked"; var diag = "top navigation was " + (event.data.blocked ? "" : "NOT ") + "blocked";
ok((testCase.shouldBeBlocked == event.data.blocked), testCase.desc, diag); ok((testCase.shouldBeBlocked == event.data.blocked), testCase.desc + " - " + diag);
runNextTest(); runNextTest();
}; };
try { try {
testWin[testCase.iframeName].eval(testCase.script); testWin[testCase.iframeName].eval(testCase.script);
} catch(e) { } catch(e) {
ok(testCase.shouldBeBlocked, testCase.desc, e.message); ok(testCase.shouldBeBlocked, testCase.desc + " - " + e.message);
runNextTest(); runNextTest();
} }
} }

Просмотреть файл

@ -4,14 +4,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=352728
--> -->
<head> <head>
<title>Test for Bug 352728</title> <title>Test for Bug 352728</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head> </head>
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=352728">Mozilla Bug 352728</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=352728">Mozilla Bug 352728</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"> <div id="content" style="display: none">
</div> </div>
<pre id="test"> <pre id="test">
<!-- First make sure that a script consisting of multiple CDATA sections is <!-- First make sure that a script consisting of multiple CDATA sections is
@ -45,8 +45,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=352728
function checkTypes(aNode, aNodeType, aTypeArray) function checkTypes(aNode, aNodeType, aTypeArray)
{ {
for (var i = 0; i < aTypeArray.length; ++i) { for (var i = 0; i < aTypeArray.length; ++i) {
ok(aNode instanceof aTypeArray[i], aNodeType + " type test " + i, ok(
aNodeType + " should be a " + aTypeArray[i]); aNode instanceof aTypeArray[i],
aNodeType + " type test " + i + " - " +
aNodeType + " should be a " + aTypeArray[i]
);
} }
} }
@ -54,7 +57,7 @@ function checkInterfaces(aNode, aNodeType, aInterfaceArray)
{ {
for (var i = 0; i < aInterfaceArray.length; ++i) { for (var i = 0; i < aInterfaceArray.length; ++i) {
ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]], ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]],
aNodeType + " interface test " + i, aNodeType + " interface test " + i + " - " +
aNodeType + " should be a " + aInterfaceArray[i]); aNodeType + " should be a " + aInterfaceArray[i]);
} }
} }
@ -82,7 +85,7 @@ function testComment(aText)
is(comment.nodeName, "#comment", "Check nodeName"); is(comment.nodeName, "#comment", "Check nodeName");
is(comment.nodeType, Node.COMMENT_NODE, "Check nodeType"); is(comment.nodeType, Node.COMMENT_NODE, "Check nodeType");
} catch (e) { } catch (e) {
ok(0, "Correct functioning of comment stuff", "something broke: " + e); ok(false, "Correct functioning of comment stuff - something broke: " + e);
} }
} }
@ -101,15 +104,15 @@ function testCDATASection(aText, aShouldSucceed)
is(cdataSection.nodeType, Node.CDATA_SECTION_NODE, "Check nodeType"); is(cdataSection.nodeType, Node.CDATA_SECTION_NODE, "Check nodeType");
if (!aShouldSucceed) { if (!aShouldSucceed) {
ok(0, "Invalid CDATA section creation", ok(0, "Invalid CDATA section creation - " +
]]> ]]>
"Shouldn't create CDATA section with embedded \"]]&gt;\""); "Shouldn't create CDATA section with embedded \"]]&gt;\"");
<![CDATA[ <![CDATA[
} }
} catch (e) { } catch (e) {
if (aShouldSucceed) { if (aShouldSucceed) {
ok(0, "Correct functioning of CDATA section stuff", ok(false,
"something broke: " + e); "Correct functioning of CDATA section stuff - something broke: " + e);
} else { } else {
is(e.name, "InvalidCharacterError", "Check exception"); is(e.name, "InvalidCharacterError", "Check exception");
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code"); is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
@ -133,15 +136,16 @@ function testPI(aTarget, aData, aShouldSucceed, aReason)
is(pi.nodeValue, aData, "Check nodeValue"); is(pi.nodeValue, aData, "Check nodeValue");
is(pi.localName, undefined, "Check localName") is(pi.localName, undefined, "Check localName")
is(pi.namespaceURI, undefined, "Check namespaceURI"); is(pi.namespaceURI, undefined, "Check namespaceURI");
is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType"); is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType");
if (!aShouldSucceed) { if (!aShouldSucceed) {
ok(0, "Invalid processing instruction creation", aReason); ok(false, "Invalid processing instruction creation - " + aReason);
} }
} catch (e) { } catch (e) {
if (aShouldSucceed) { if (aShouldSucceed) {
ok(0, "Correct functioning of processing instruction stuff", ok(false,
"Correct functioning of processing instruction stuff - " +
"something broke: " + e); "something broke: " + e);
} else { } else {
is(e.name, "InvalidCharacterError", "Check exception"); is(e.name, "InvalidCharacterError", "Check exception");

Просмотреть файл

@ -5,14 +5,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=379120
--> -->
<head> <head>
<title>Test for Bug 379120</title> <title>Test for Bug 379120</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head> </head>
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=379120">Mozilla Bug 379120</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=379120">Mozilla Bug 379120</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"> <div id="content" style="display: none">
</div> </div>
<pre id="test"> <pre id="test">
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=379120
var parser = new DOMParser(); var parser = new DOMParser();
var originalDoc = parser.parseFromString(originalString, "text/xml"); var originalDoc = parser.parseFromString(originalString, "text/xml");
var stylesheetText = var stylesheetText =
"<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' " + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' " +
"version='1.0' xmlns='http://www.w3.org/1999/xhtml'> " + "version='1.0' xmlns='http://www.w3.org/1999/xhtml'> " +
@ -34,7 +34,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=379120
"doctype-public='-//W3C//DTD XHTML 1.0 Transitional//EN' /> " + "doctype-public='-//W3C//DTD XHTML 1.0 Transitional//EN' /> " +
"<xsl:template match='/'>" + "<xsl:template match='/'>" +
"<div onload='var i = 1'/>" + "<div onload='var i = 1'/>" +
"<xsl:apply-templates />" + "<xsl:apply-templates />" +
"</xsl:template>" + "</xsl:template>" +
"</xsl:stylesheet>"; "</xsl:stylesheet>";
@ -47,10 +47,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=379120
var transformedDocument = processor.transformToDocument (originalDoc); var transformedDocument = processor.transformToDocument (originalDoc);
is(transformedDocument.documentElement.getAttribute("onload"), is(transformedDocument.documentElement.getAttribute("onload"),
"var i = 1"); "var i = 1");
ok(transformedDocument.documentElement.onload === null, is(transformedDocument.documentElement.onload, null, "Shouldn't have onload handler");
"Shouldn't have onload handler",
"got " + repr(transformedDocument.documentElement.onload) +
", expected null");;
</script> </script>
</pre> </pre>
</body> </body>

Просмотреть файл

@ -41,7 +41,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=388794
<iframe name="test6" id="test6"></iframe> <iframe name="test6" id="test6"></iframe>
</p> </p>
<div id="content" style="display: none"> <div id="content" style="display: none">
</div> </div>
<pre id="test"> <pre id="test">
<script type="application/javascript"> <script type="application/javascript">
@ -91,8 +91,11 @@ addLoadEvent(function() {
}); });
function frameLoaded(frame) { function frameLoaded(frame) {
ok(hrefs[frame.name].test(frame.contentWindow.location.href), ok(
"Unexpected href for frame " + frame.name, "expected to match: " + hrefs[frame.name].toString() + " got: " + frame.contentWindow.location.href); hrefs[frame.name].test(frame.contentWindow.location.href),
"Unexpected href for frame " + frame.name + " - " +
"expected to match: " + hrefs[frame.name].toString() + " got: " + frame.contentWindow.location.href
);
if (--pendingLoads == 0) { if (--pendingLoads == 0) {
SimpleTest.finish(); SimpleTest.finish();
} }

Просмотреть файл

@ -125,7 +125,7 @@ function* testHarnessSteps() {
let message = event.data; let message = event.data;
switch (message.op) { switch (message.op) {
case "ok": case "ok":
ok(message.condition, message.name, message.diag); SimpleTest.ok(message.condition, `${message.name}: ${message.diag}`);
break; break;
case "todo": case "todo":

Просмотреть файл

@ -265,7 +265,11 @@ function checkResampledBuffer(buffer, test, callback) {
} }
// Take into account the resampling when checking the size // Take into account the resampling when checking the size
var expectedLength = test.frames * buffer.sampleRate / test.sampleRate; var expectedLength = test.frames * buffer.sampleRate / test.sampleRate;
ok(Math.abs(buffer.length - expectedLength) < 1.0, "Correct length", "got " + buffer.length + ", expected about " + expectedLength); SimpleTest.ok(
Math.abs(buffer.length - expectedLength) < 1.0,
"Correct length - got " + buffer.length +
", expected about " + expectedLength
);
// Playback the buffer in the original context, to resample back to the // Playback the buffer in the original context, to resample back to the
// original rate and compare with the decoded buffer without resampling. // original rate and compare with the decoded buffer without resampling.

Просмотреть файл

@ -11,8 +11,16 @@
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
function runTests() { function runTests() {
ok(document.getElementById('plugin1').pluginFoundElement, "plugin1.pluginFoundElement (NPNVPluginElementNPObject)", document.getElementById('plugin1').pluginFoundElement); ok(
ok(window.pluginFoundWindow, "window.pluginFoundWindow (NPNVWindowNPObject)", window.pluginFoundWindow); document.getElementById('plugin1').pluginFoundElement,
"plugin1.pluginFoundElement (NPNVPluginElementNPObject) - " +
document.getElementById('plugin1').pluginFoundElement
);
ok(
window.pluginFoundWindow,
"window.pluginFoundWindow (NPNVWindowNPObject) - " +
window.pluginFoundWindow
);
SimpleTest.finish(); SimpleTest.finish();
} }

Просмотреть файл

@ -96,7 +96,7 @@ function* testHarnessSteps()
let message = event.data; let message = event.data;
switch (message.op) { switch (message.op) {
case "ok": case "ok":
ok(message.condition, message.name, message.diag); ok(message.condition, message.name + " - " + message.diag);
break; break;
case "todo": case "todo":

Просмотреть файл

@ -89,9 +89,10 @@ Bug 671389 - Implement CSP sandbox directive
try { try {
var actual = getSandboxFlags(SpecialPowers.wrap(iframe).contentDocument); var actual = getSandboxFlags(SpecialPowers.wrap(iframe).contentDocument);
ok(eqFlags(actual, this_.expected), ok(eqFlags(actual, this_.expected),
this_.desc, 'expected: "' + this_.expected + '", got: "' + actual + '"'); this_.desc + ' - expected: "' + this_.expected + '", got: "' + actual + '"');
} catch (e) { } catch (e) {
ok(false, this_.desc, 'expected: "' + this_.expected + '", failed with: "' + e + '"'); ok(false,
this_.desc + ' - expected: "' + this_.expected + '", failed with: "' + e + '"');
} }
runNextTest(); runNextTest();
}; };

Просмотреть файл

@ -26,7 +26,8 @@ function run()
function isFuzzy(a, b, error, name) function isFuzzy(a, b, error, name)
{ {
ok(!(Math.abs(a - b) > error), name, "got " + a + ", expected " + b + " (within " + error + ")"); ok(!(Math.abs(a - b) > error),
name + " - got " + a + ", expected " + b + " (within " + error + ")");
} }
function getBBox(id) { function getBBox(id) {

Просмотреть файл

@ -145,7 +145,7 @@ function test(name, callback, nowait) {
} else good++; } else good++;
if ( parent.SimpleTest ){ if ( parent.SimpleTest ){
parent.SimpleTest.ok( _config.Test[i][0], name, _config.Test[i][1] );} parent.SimpleTest.ok( _config.Test[i][0], `${name}: ${_config.Test[i][1]}` );}
} }
var li = document.createElement("li"); var li = document.createElement("li");

Просмотреть файл

@ -591,7 +591,7 @@ Test.Unit.Testcase = Class.create(Test.Unit.Assertions, {
if ( parent.SimpleTest && parent.runAJAXTest ) (function(){ if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
var finish = Test.Unit.Logger.prototype.finish; var finish = Test.Unit.Logger.prototype.finish;
Test.Unit.Logger.prototype.finish = function(status,summary){ Test.Unit.Logger.prototype.finish = function(status,summary){
parent.SimpleTest.ok( status == "passed", this.testName, summary ); parent.SimpleTest.ok( status == "passed", `${this.testName}: ${summary}` );
return finish.apply( this, arguments ); return finish.apply( this, arguments );
}; };

Просмотреть файл

@ -571,10 +571,10 @@ if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
var pass = match[1] - fail; var pass = match[1] - fail;
for ( var i = 0; i < pass; i++ ) for ( var i = 0; i < pass; i++ )
parent.SimpleTest.ok( true, this.testName, summary ); parent.SimpleTest.ok( true, `${this.testName}: ${summary}` );
for ( var i = 0; i < fail; i++ ) for ( var i = 0; i < fail; i++ )
parent.SimpleTest.ok( false, this.testName, summary ); parent.SimpleTest.ok( false, `${this.testName}: ${summary}` );
return finish.apply( this, arguments ); return finish.apply( this, arguments );
}; };

Просмотреть файл

@ -5,14 +5,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=159849
--> -->
<head> <head>
<title>Test for Bug 159849</title> <title>Test for Bug 159849</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head> </head>
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159849">Mozilla Bug 159849</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159849">Mozilla Bug 159849</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"> <div id="content" style="display: none">
</div> </div>
<pre id="test"> <pre id="test">
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
@ -28,10 +28,11 @@ with (c) {
} }
is(c.onmouseover, testFunc, "Event handler should have been set on node"); is(c.onmouseover, testFunc, "Event handler should have been set on node");
ok(c.fooExpando === undefined, "Expando should not have been set on node", ok(c.fooExpando === undefined,
"Expando should not have been set on node - " +
"got " + repr(c.fooExpando) + ", expected undefined"); "got " + repr(c.fooExpando) + ", expected undefined");
ok(window.onmouseover === null, ok(window.onmouseover === null,
"Event handler should not have been set on window", "Event handler should not have been set on window - " +
"got " + repr(window.onmouseover) + ", expected undefined"); "got " + repr(window.onmouseover) + ", expected undefined");
is(window.fooExpando, testFunc, "Expando should have been set on window"); is(window.fooExpando, testFunc, "Expando should have been set on window");
</script> </script>

Просмотреть файл

@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=390488
</div> </div>
</p> </p>
<div id="content" style="display: none"> <div id="content" style="display: none">
</div> </div>
<pre id="test"> <pre id="test">
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
@ -30,13 +30,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=390488
} }
return stack; return stack;
} }
function getStack2() { function getStack2() {
var stack = new Error().stack; var stack = new Error().stack;
// Remove the two lines due to calling this // Remove the two lines due to calling this
return stack.substring(stack.indexOf("\n", stack.indexOf("\n")+1)+1); return stack.substring(stack.indexOf("\n", stack.indexOf("\n")+1)+1);
} }
function simulateClick() { function simulateClick() {
var evt = document.createEvent("MouseEvents"); var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, evt.initMouseEvent("click", true, true, window,
@ -45,8 +45,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=390488
} }
function matches(s, p, name) { function matches(s, p, name) {
ok(s.match(p) != null, name, ok(s.match(p) != null,
"got " + uneval(s) + ", expected a string matching " + uneval(p)); name + " - got " + uneval(s) + ", expected a string matching " + uneval(p));
} }
function checkForStacks() { function checkForStacks() {

Просмотреть файл

@ -33,17 +33,17 @@ addLoadEvent(function() {
var equal, str1, str2; var equal, str1, str2;
[equal, str1, str2] = compareSnapshots(s1, s2, true); [equal, str1, str2] = compareSnapshots(s1, s2, true);
ok(equal, "Show/hide should have no effect", ok(equal, "Show/hide should have no effect - " +
"got " + str1 + " but expected " + str2); "got " + str1 + " but expected " + str2);
var viewer = var viewer =
SpecialPowers.wrap($("ourFrame")).contentWindow.docShell.contentViewer; SpecialPowers.wrap($("ourFrame")).contentWindow.docShell.contentViewer;
viewer.fullZoom = 2; viewer.fullZoom = 2;
s3 = snapshotWindow(window); s3 = snapshotWindow(window);
[equal, str1, str2] = compareSnapshots(s1, s3, true); [equal, str1, str2] = compareSnapshots(s1, s3, true);
ok(equal, "Zoom should have no effect", ok(equal, "Zoom should have no effect - " +
"got " + str1 + " but expected " + str2); "got " + str1 + " but expected " + str2);
$("display").style.display = "none"; $("display").style.display = "none";

Просмотреть файл

@ -312,11 +312,13 @@ function runTest() {
sheet.deleteRule(0); sheet.deleteRule(0);
sheet.insertRule(testset[curTest].rule, 0); sheet.insertRule(testset[curTest].rule, 0);
} catch (e) { } catch (e) {
ok(e.name == "SyntaxError" ok(
&& e instanceof DOMException e.name == "SyntaxError"
&& e.code == DOMException.SYNTAX_ERR && e instanceof DOMException
&& !('d' in testset[curTest]), && e.code == DOMException.SYNTAX_ERR
testset[curTest].rule + " syntax error thrown", e); && !('d' in testset[curTest]),
testset[curTest].rule + " syntax error thrown - " + e
);
} }
try { try {
@ -339,8 +341,11 @@ function runTest() {
// nothing else is set // nothing else is set
is(s.length, n, testset[curTest].rule + "prop count"); is(s.length, n, testset[curTest].rule + "prop count");
for (var i = 0; i < s.length; i++) { for (var i = 0; i < s.length; i++) {
ok(s[i] in d, testset[curTest].rule, ok(
"Unexpected item #" + i + ": " + s[i]); s[i] in d,
testset[curTest].rule +
" - Unexpected item #" + i + ": " + s[i]
);
} }
// round-tripping of cssText // round-tripping of cssText
@ -363,7 +368,7 @@ function runTest() {
} }
} }
} catch (e) { } catch (e) {
ok(false, testset[curTest].rule, "During test: " + e); ok(false, testset[curTest].rule + " - During test: " + e);
} }
} }
SimpleTest.finish(); SimpleTest.finish();

Просмотреть файл

@ -77,15 +77,15 @@
// nothing else is set // nothing else is set
is(s.length, n, testset[curTest].rule + " prop count"); is(s.length, n, testset[curTest].rule + " prop count");
for (var i = 0; i < s.length; i++) { for (var i = 0; i < s.length; i++) {
ok(s[i] in expected, testset[curTest].rule, ok(s[i] in expected, testset[curTest].rule +
"Unexpected item #" + i + ": " + s[i]); " - Unexpected item #" + i + ": " + s[i]);
} }
} else { } else {
is(Object.keys(sheet.cssRules[0].style).length, 0, is(Object.keys(sheet.cssRules[0].style).length, 0,
testset[curTest].rule + " rule has no properties"); testset[curTest].rule + " rule has no properties");
} }
} catch (e) { } catch (e) {
ok(false, testset[curTest].rule, "During test: " + e); ok(false, testset[curTest].rule + " - During test: " + e);
} }
} }
</script> </script>

Просмотреть файл

@ -11,9 +11,9 @@
var captureFailure = false; var captureFailure = false;
var capturedFailures = []; var capturedFailures = [];
window.ok = function (cond, name, diag) { window.ok = function (cond, name) {
if (!captureFailure) { if (!captureFailure) {
SimpleTest.ok(cond, name, diag); SimpleTest.ok(cond, name);
} else { } else {
if (cond) { if (cond) {
SimpleTest.ok(false, `Expect a failure with "${name}"`); SimpleTest.ok(false, `Expect a failure with "${name}"`);

Просмотреть файл

@ -55,19 +55,19 @@ ExtensionTestUtils.loadExtension = function(ext)
function testHandler(kind, pass, msg, ...args) { function testHandler(kind, pass, msg, ...args) {
if (kind == "test-eq") { if (kind == "test-eq") {
let [expected, actual, stack] = args; let [expected, actual] = args;
SimpleTest.ok(pass, `${msg} - Expected: ${expected}, Actual: ${actual}`, undefined, stack); SimpleTest.ok(pass, `${msg} - Expected: ${expected}, Actual: ${actual}`);
} else if (kind == "test-log") { } else if (kind == "test-log") {
SimpleTest.info(msg); SimpleTest.info(msg);
} else if (kind == "test-result") { } else if (kind == "test-result") {
SimpleTest.ok(pass, msg, undefined, args[0]); SimpleTest.ok(pass, msg);
} }
} }
var handler = { var handler = {
testResult(kind, pass, msg, ...args) { testResult(kind, pass, msg, ...args) {
if (kind == "test-done") { if (kind == "test-done") {
SimpleTest.ok(pass, msg, undefined, args[0]); SimpleTest.ok(pass, msg);
return testResolve(msg); return testResolve(msg);
} }
testHandler(kind, pass, msg, ...args); testHandler(kind, pass, msg, ...args);