зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1467712) for multiple failures with: Too many arguments passed to ok. CLOSED TREE
Backed out changeset 9ce0ac2b9d71 (bug 1467712) Backed out changeset 026eb1f6dc6e (bug 1467712) Backed out changeset 0088a09d869a (bug 1467712) Backed out changeset 1b19ea76aad6 (bug 1467712)
This commit is contained in:
Родитель
e8ccc57b1e
Коммит
faba2c8c15
|
@ -105,9 +105,9 @@ function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMetho
|
|||
var nameMatches = position && position.name == aIdOrNameOrAcc;
|
||||
var accMatches = position == aIdOrNameOrAcc;
|
||||
|
||||
SimpleTest.ok(idMatches || nameMatches || accMatches,
|
||||
"id or name matches - expecting " +
|
||||
prettyName(aIdOrNameOrAcc) + ", got '" + prettyName(position));
|
||||
SimpleTest.ok(idMatches || nameMatches || accMatches, "id or name matches",
|
||||
"expecting " + prettyName(aIdOrNameOrAcc) + ", got '" +
|
||||
prettyName(position));
|
||||
|
||||
SimpleTest.is(aEvent.isFromUserInput, aIsFromUserInput,
|
||||
"Expected user input is " + aIsFromUserInput + "\n");
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
BrowserTestUtils.addTab(gBrowser, "data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>");
|
||||
}
|
||||
|
||||
function recordEvent(aName) {
|
||||
function record(aName) {
|
||||
info("got " + aName);
|
||||
if (!actual.includes(aName))
|
||||
actual.push(aName);
|
||||
|
@ -31,20 +31,20 @@ function recordEvent(aName) {
|
|||
|
||||
function TabOpen(aEvent) {
|
||||
if (aEvent.target == tab)
|
||||
recordEvent("TabOpen");
|
||||
record("TabOpen");
|
||||
}
|
||||
|
||||
var progressListener = {
|
||||
onLocationChange: function onLocationChange(aBrowser) {
|
||||
if (aBrowser == tab.linkedBrowser)
|
||||
recordEvent("onLocationChange");
|
||||
record("onLocationChange");
|
||||
},
|
||||
onStateChange: function onStateChange(aBrowser) {
|
||||
if (aBrowser == tab.linkedBrowser)
|
||||
recordEvent("onStateChange");
|
||||
record("onStateChange");
|
||||
},
|
||||
onLinkIconAvailable: function onLinkIconAvailable(aBrowser) {
|
||||
if (aBrowser == tab.linkedBrowser)
|
||||
recordEvent("onLinkIconAvailable");
|
||||
record("onLinkIconAvailable");
|
||||
},
|
||||
};
|
||||
|
|
|
@ -20,13 +20,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
|
|||
if (event.data != '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();
|
||||
};
|
||||
try {
|
||||
window["parentIframe"].eval(testCase.script);
|
||||
} catch(e) {
|
||||
ok(testCase.shouldBeBlocked, testCase.desc + " - " + e.message);
|
||||
ok(testCase.shouldBeBlocked, testCase.desc, e.message);
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
|
|||
if (event.data != "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();
|
||||
};
|
||||
try {
|
||||
window["testIframe"].eval(testCase.script);
|
||||
} catch(e) {
|
||||
ok(true, testCase.desc + " - " + e.message);
|
||||
ok(true, testCase.desc, e.message);
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
|
|||
if (event.data != "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();
|
||||
};
|
||||
try {
|
||||
SpecialPowers.wrap(window["testIframe"]).eval(testCase.script);
|
||||
} catch(e) {
|
||||
ok(testCase.shouldBeBlocked, testCase.desc + " - " + SpecialPowers.wrap(e).message);
|
||||
ok(testCase.shouldBeBlocked, testCase.desc, SpecialPowers.wrap(e).message);
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
|
|||
if (event.data != "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();
|
||||
};
|
||||
try {
|
||||
window["parentIframe"]["childIframe"].eval(testCase.script);
|
||||
} catch(e) {
|
||||
ok(true, testCase.desc + " - " + e.message);
|
||||
ok(true, testCase.desc, e.message);
|
||||
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, testCase.desc + " - sibling navigation was NOT blocked");
|
||||
ok(false, testCase.desc, "sibling navigation was NOT blocked");
|
||||
runNextTest();
|
||||
};
|
||||
|
||||
try {
|
||||
window["testIframe"].eval(testCase.script);
|
||||
} catch(e) {
|
||||
ok(true, testCase.desc + " - " + e.message);
|
||||
ok(true, testCase.desc, e.message);
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ html5 sandboxed iframe should not be able to perform top navigation with scripts
|
|||
if (event.data != "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();
|
||||
};
|
||||
try {
|
||||
SpecialPowers.wrap(testWin[testCase.iframeName]).eval(testCase.script);
|
||||
} catch(e) {
|
||||
ok(testCase.shouldBeBlocked, testCase.desc + " - " + SpecialPowers.wrap(e).message);
|
||||
ok(testCase.shouldBeBlocked, testCase.desc, SpecialPowers.wrap(e).message);
|
||||
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'");
|
||||
}
|
||||
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();
|
||||
};
|
||||
try {
|
||||
testWin[testCase.iframeName].eval(testCase.script);
|
||||
} catch(e) {
|
||||
ok(testCase.shouldBeBlocked, testCase.desc + " - " + e.message);
|
||||
ok(testCase.shouldBeBlocked, testCase.desc, e.message);
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=352728
|
|||
-->
|
||||
<head>
|
||||
<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" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=352728">Mozilla Bug 352728</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<!-- First make sure that a script consisting of multiple CDATA sections is
|
||||
|
@ -45,11 +45,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=352728
|
|||
function checkTypes(aNode, aNodeType, aTypeArray)
|
||||
{
|
||||
for (var i = 0; i < aTypeArray.length; ++i) {
|
||||
ok(
|
||||
aNode instanceof aTypeArray[i],
|
||||
aNodeType + " type test " + i + " - " +
|
||||
aNodeType + " should be a " + aTypeArray[i]
|
||||
);
|
||||
ok(aNode instanceof aTypeArray[i], aNodeType + " type test " + i,
|
||||
aNodeType + " should be a " + aTypeArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +54,7 @@ function checkInterfaces(aNode, aNodeType, aInterfaceArray)
|
|||
{
|
||||
for (var i = 0; i < aInterfaceArray.length; ++i) {
|
||||
ok(aNode instanceof SpecialPowers.Ci[aInterfaceArray[i]],
|
||||
aNodeType + " interface test " + i + " - " +
|
||||
aNodeType + " interface test " + i,
|
||||
aNodeType + " should be a " + aInterfaceArray[i]);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +82,7 @@ function testComment(aText)
|
|||
is(comment.nodeName, "#comment", "Check nodeName");
|
||||
is(comment.nodeType, Node.COMMENT_NODE, "Check nodeType");
|
||||
} catch (e) {
|
||||
ok(false, "Correct functioning of comment stuff - something broke: " + e);
|
||||
ok(0, "Correct functioning of comment stuff", "something broke: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,15 +101,15 @@ function testCDATASection(aText, aShouldSucceed)
|
|||
is(cdataSection.nodeType, Node.CDATA_SECTION_NODE, "Check nodeType");
|
||||
|
||||
if (!aShouldSucceed) {
|
||||
ok(0, "Invalid CDATA section creation - " +
|
||||
ok(0, "Invalid CDATA section creation",
|
||||
]]>
|
||||
"Shouldn't create CDATA section with embedded \"]]>\"");
|
||||
<![CDATA[
|
||||
}
|
||||
} catch (e) {
|
||||
if (aShouldSucceed) {
|
||||
ok(false,
|
||||
"Correct functioning of CDATA section stuff - something broke: " + e);
|
||||
ok(0, "Correct functioning of CDATA section stuff",
|
||||
"something broke: " + e);
|
||||
} else {
|
||||
is(e.name, "InvalidCharacterError", "Check exception");
|
||||
is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
|
||||
|
@ -136,16 +133,15 @@ function testPI(aTarget, aData, aShouldSucceed, aReason)
|
|||
is(pi.nodeValue, aData, "Check nodeValue");
|
||||
is(pi.localName, undefined, "Check localName")
|
||||
is(pi.namespaceURI, undefined, "Check namespaceURI");
|
||||
|
||||
|
||||
is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType");
|
||||
|
||||
if (!aShouldSucceed) {
|
||||
ok(false, "Invalid processing instruction creation - " + aReason);
|
||||
ok(0, "Invalid processing instruction creation", aReason);
|
||||
}
|
||||
} catch (e) {
|
||||
if (aShouldSucceed) {
|
||||
ok(false,
|
||||
"Correct functioning of processing instruction stuff - " +
|
||||
ok(0, "Correct functioning of processing instruction stuff",
|
||||
"something broke: " + e);
|
||||
} else {
|
||||
is(e.name, "InvalidCharacterError", "Check exception");
|
||||
|
|
|
@ -5,14 +5,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=379120
|
|||
-->
|
||||
<head>
|
||||
<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" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=379120">Mozilla Bug 379120</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=379120
|
|||
var parser = new DOMParser();
|
||||
var originalDoc = parser.parseFromString(originalString, "text/xml");
|
||||
|
||||
var stylesheetText =
|
||||
var stylesheetText =
|
||||
"<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' " +
|
||||
"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' /> " +
|
||||
|
||||
"<xsl:template match='/'>" +
|
||||
"<div onload='var i = 1'/>" +
|
||||
"<div onload='var i = 1'/>" +
|
||||
"<xsl:apply-templates />" +
|
||||
"</xsl:template>" +
|
||||
"</xsl:stylesheet>";
|
||||
|
@ -47,7 +47,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=379120
|
|||
var transformedDocument = processor.transformToDocument (originalDoc);
|
||||
is(transformedDocument.documentElement.getAttribute("onload"),
|
||||
"var i = 1");
|
||||
is(transformedDocument.documentElement.onload, null, "Shouldn't have onload handler");
|
||||
ok(transformedDocument.documentElement.onload === null,
|
||||
"Shouldn't have onload handler",
|
||||
"got " + repr(transformedDocument.documentElement.onload) +
|
||||
", expected null");;
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -41,7 +41,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=388794
|
|||
<iframe name="test6" id="test6"></iframe>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
@ -91,11 +91,8 @@ addLoadEvent(function() {
|
|||
});
|
||||
|
||||
function frameLoaded(frame) {
|
||||
ok(
|
||||
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
|
||||
);
|
||||
ok(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) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ function* testHarnessSteps() {
|
|||
let message = event.data;
|
||||
switch (message.op) {
|
||||
case "ok":
|
||||
SimpleTest.ok(message.condition, `${message.name}: ${message.diag}`);
|
||||
ok(message.condition, message.name, message.diag);
|
||||
break;
|
||||
|
||||
case "todo":
|
||||
|
|
|
@ -265,11 +265,7 @@ function checkResampledBuffer(buffer, test, callback) {
|
|||
}
|
||||
// Take into account the resampling when checking the size
|
||||
var expectedLength = test.frames * buffer.sampleRate / test.sampleRate;
|
||||
SimpleTest.ok(
|
||||
Math.abs(buffer.length - expectedLength) < 1.0,
|
||||
"Correct length - got " + buffer.length +
|
||||
", expected about " + expectedLength
|
||||
);
|
||||
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
|
||||
// original rate and compare with the decoded buffer without resampling.
|
||||
|
|
|
@ -11,16 +11,8 @@
|
|||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function runTests() {
|
||||
ok(
|
||||
document.getElementById('plugin1').pluginFoundElement,
|
||||
"plugin1.pluginFoundElement (NPNVPluginElementNPObject) - " +
|
||||
document.getElementById('plugin1').pluginFoundElement
|
||||
);
|
||||
ok(
|
||||
window.pluginFoundWindow,
|
||||
"window.pluginFoundWindow (NPNVWindowNPObject) - " +
|
||||
window.pluginFoundWindow
|
||||
);
|
||||
ok(document.getElementById('plugin1').pluginFoundElement, "plugin1.pluginFoundElement (NPNVPluginElementNPObject)", document.getElementById('plugin1').pluginFoundElement);
|
||||
ok(window.pluginFoundWindow, "window.pluginFoundWindow (NPNVWindowNPObject)", window.pluginFoundWindow);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ function* testHarnessSteps()
|
|||
let message = event.data;
|
||||
switch (message.op) {
|
||||
case "ok":
|
||||
ok(message.condition, message.name + " - " + message.diag);
|
||||
ok(message.condition, message.name, message.diag);
|
||||
break;
|
||||
|
||||
case "todo":
|
||||
|
|
|
@ -89,10 +89,9 @@ Bug 671389 - Implement CSP sandbox directive
|
|||
try {
|
||||
var actual = getSandboxFlags(SpecialPowers.wrap(iframe).contentDocument);
|
||||
ok(eqFlags(actual, this_.expected),
|
||||
this_.desc + ' - expected: "' + this_.expected + '", got: "' + actual + '"');
|
||||
this_.desc, 'expected: "' + this_.expected + '", got: "' + actual + '"');
|
||||
} catch (e) {
|
||||
ok(false,
|
||||
this_.desc + ' - expected: "' + this_.expected + '", failed with: "' + e + '"');
|
||||
ok(false, this_.desc, 'expected: "' + this_.expected + '", failed with: "' + e + '"');
|
||||
}
|
||||
runNextTest();
|
||||
};
|
||||
|
|
|
@ -26,8 +26,7 @@ function run()
|
|||
|
||||
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) {
|
||||
|
|
|
@ -145,7 +145,7 @@ function test(name, callback, nowait) {
|
|||
} else good++;
|
||||
|
||||
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");
|
||||
|
|
|
@ -33,16 +33,7 @@ SimpleTest._stopOnLoad = true;
|
|||
/**
|
||||
* Something like assert.
|
||||
**/
|
||||
SimpleTest.ok = function (condition, name) {
|
||||
if (arguments.length > 2) {
|
||||
const diag = "Too many arguments passed to `ok(condition, name)`";
|
||||
SimpleTest.record(false, name, diag);
|
||||
} else {
|
||||
SimpleTest.record(condition, name);
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.record = function (condition, name, diag) {
|
||||
SimpleTest.ok = function (condition, name, diag) {
|
||||
var test = {'result': !!condition, 'name': name, 'diag': diag || ""};
|
||||
if (SimpleTest._logEnabled)
|
||||
SimpleTest._logResult(test, "TEST-PASS", "TEST-UNEXPECTED-FAIL");
|
||||
|
@ -54,12 +45,12 @@ SimpleTest.record = function (condition, name, diag) {
|
|||
**/
|
||||
SimpleTest.is = function (a, b, name) {
|
||||
var repr = MochiKit.Base.repr;
|
||||
SimpleTest.record(a == b, name, "got " + repr(a) + ", expected " + repr(b));
|
||||
SimpleTest.ok(a == b, name, "got " + repr(a) + ", expected " + repr(b));
|
||||
};
|
||||
|
||||
SimpleTest.isnot = function (a, b, name) {
|
||||
var repr = MochiKit.Base.repr;
|
||||
SimpleTest.record(a != b, name, "Didn't expect " + repr(a) + ", but got it.");
|
||||
SimpleTest.ok(a != b, name, "Didn't expect " + repr(a) + ", but got it.");
|
||||
};
|
||||
|
||||
// --------------- Test.Builder/Test.More todo() -----------------
|
||||
|
@ -433,11 +424,11 @@ SimpleTest.isa = function (object, clas) {
|
|||
};
|
||||
|
||||
if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
|
||||
var oldRecord = SimpleTest.record;
|
||||
var oldOK = SimpleTest.ok;
|
||||
|
||||
SimpleTest.record = function(condition, name, diag, stack) {
|
||||
parent.SimpleTest.record( condition, name, diag, stack );
|
||||
return oldRecord( condition, name, diag, stack );
|
||||
SimpleTest.ok = function(condition, name, diag) {
|
||||
parent.SimpleTest.ok( condition, name, diag );
|
||||
return oldOK( condition, name, diag );
|
||||
};
|
||||
|
||||
var oldFinish = SimpleTest.finish;
|
||||
|
@ -450,7 +441,6 @@ if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
|
|||
|
||||
// Global symbols:
|
||||
var ok = SimpleTest.ok;
|
||||
var record = SimpleTest.record;
|
||||
var is = SimpleTest.is;
|
||||
var isnot = SimpleTest.isnot;
|
||||
var todo = SimpleTest.todo;
|
||||
|
|
|
@ -175,12 +175,9 @@ finish: function()
|
|||
//
|
||||
// Mochitest wrappers - These forward tests to the proper mochitest window.
|
||||
//
|
||||
ok: function(condition, name)
|
||||
ok: function(condition, name, diag)
|
||||
{
|
||||
// Forward all arguments to SimpleTest.ok where we will check that ok() was
|
||||
// called with at most 2 arguments.
|
||||
return this._masterWindow.SimpleTest.ok.apply(this._masterWindow.SimpleTest,
|
||||
arguments);
|
||||
return this._masterWindow.SimpleTest.ok(condition, name, diag);
|
||||
},
|
||||
|
||||
is: function(a, b, name)
|
||||
|
|
|
@ -591,7 +591,7 @@ Test.Unit.Testcase = Class.create(Test.Unit.Assertions, {
|
|||
if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
|
||||
var finish = Test.Unit.Logger.prototype.finish;
|
||||
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 );
|
||||
};
|
||||
|
||||
|
|
|
@ -571,10 +571,10 @@ if ( parent.SimpleTest && parent.runAJAXTest ) (function(){
|
|||
var pass = match[1] - fail;
|
||||
|
||||
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++ )
|
||||
parent.SimpleTest.ok( false, `${this.testName}: ${summary}` );
|
||||
parent.SimpleTest.ok( false, this.testName, summary );
|
||||
|
||||
return finish.apply( this, arguments );
|
||||
};
|
||||
|
|
|
@ -5,14 +5,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=159849
|
|||
-->
|
||||
<head>
|
||||
<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" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159849">Mozilla Bug 159849</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
@ -28,11 +28,10 @@ with (c) {
|
|||
}
|
||||
|
||||
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");
|
||||
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");
|
||||
is(window.fooExpando, testFunc, "Expando should have been set on window");
|
||||
</script>
|
||||
|
|
|
@ -263,12 +263,7 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
|
|||
w.isApzSubtest = true;
|
||||
w.SimpleTest = SimpleTest;
|
||||
w.is = function(a, b, msg) { return is(a, b, aFile + " | " + msg); };
|
||||
w.ok = function(cond, msg) {
|
||||
arguments[1] = aFile + " | " + msg;
|
||||
// Forward all arguments to SimpleTest.ok where we will check that ok() was
|
||||
// called with at most 2 arguments.
|
||||
return SimpleTest.ok.apply(SimpleTest, arguments);
|
||||
};
|
||||
w.ok = function(cond, name, diag) { return ok(cond, aFile + " | " + name, diag); };
|
||||
if (test.onload) {
|
||||
w.addEventListener('load', function(e) { test.onload(w); }, { once: true });
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=390488
|
|||
</div>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
@ -30,13 +30,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=390488
|
|||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
function getStack2() {
|
||||
var stack = new Error().stack;
|
||||
// Remove the two lines due to calling this
|
||||
return stack.substring(stack.indexOf("\n", stack.indexOf("\n")+1)+1);
|
||||
}
|
||||
|
||||
|
||||
function simulateClick() {
|
||||
var evt = document.createEvent("MouseEvents");
|
||||
evt.initMouseEvent("click", true, true, window,
|
||||
|
@ -45,8 +45,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=390488
|
|||
}
|
||||
|
||||
function matches(s, p, name) {
|
||||
ok(s.match(p) != null,
|
||||
name + " - got " + uneval(s) + ", expected a string matching " + uneval(p));
|
||||
ok(s.match(p) != null, name,
|
||||
"got " + uneval(s) + ", expected a string matching " + uneval(p));
|
||||
}
|
||||
|
||||
function checkForStacks() {
|
||||
|
|
|
@ -33,17 +33,17 @@ addLoadEvent(function() {
|
|||
|
||||
var equal, str1, str2;
|
||||
[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);
|
||||
|
||||
var viewer =
|
||||
SpecialPowers.wrap($("ourFrame")).contentWindow.docShell.contentViewer;
|
||||
viewer.fullZoom = 2;
|
||||
|
||||
|
||||
s3 = snapshotWindow(window);
|
||||
|
||||
[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);
|
||||
|
||||
$("display").style.display = "none";
|
||||
|
|
|
@ -312,13 +312,11 @@ function runTest() {
|
|||
sheet.deleteRule(0);
|
||||
sheet.insertRule(testset[curTest].rule, 0);
|
||||
} catch (e) {
|
||||
ok(
|
||||
e.name == "SyntaxError"
|
||||
&& e instanceof DOMException
|
||||
&& e.code == DOMException.SYNTAX_ERR
|
||||
&& !('d' in testset[curTest]),
|
||||
testset[curTest].rule + " syntax error thrown - " + e
|
||||
);
|
||||
ok(e.name == "SyntaxError"
|
||||
&& e instanceof DOMException
|
||||
&& e.code == DOMException.SYNTAX_ERR
|
||||
&& !('d' in testset[curTest]),
|
||||
testset[curTest].rule + " syntax error thrown", e);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -341,11 +339,8 @@ function runTest() {
|
|||
// nothing else is set
|
||||
is(s.length, n, testset[curTest].rule + "prop count");
|
||||
for (var i = 0; i < s.length; i++) {
|
||||
ok(
|
||||
s[i] in d,
|
||||
testset[curTest].rule +
|
||||
" - Unexpected item #" + i + ": " + s[i]
|
||||
);
|
||||
ok(s[i] in d, testset[curTest].rule,
|
||||
"Unexpected item #" + i + ": " + s[i]);
|
||||
}
|
||||
|
||||
// round-tripping of cssText
|
||||
|
@ -368,7 +363,7 @@ function runTest() {
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
ok(false, testset[curTest].rule + " - During test: " + e);
|
||||
ok(false, testset[curTest].rule, "During test: " + e);
|
||||
}
|
||||
}
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -77,15 +77,15 @@
|
|||
// nothing else is set
|
||||
is(s.length, n, testset[curTest].rule + " prop count");
|
||||
for (var i = 0; i < s.length; i++) {
|
||||
ok(s[i] in expected, testset[curTest].rule +
|
||||
" - Unexpected item #" + i + ": " + s[i]);
|
||||
ok(s[i] in expected, testset[curTest].rule,
|
||||
"Unexpected item #" + i + ": " + s[i]);
|
||||
}
|
||||
} else {
|
||||
is(Object.keys(sheet.cssRules[0].style).length, 0,
|
||||
testset[curTest].rule + " rule has no properties");
|
||||
}
|
||||
} catch (e) {
|
||||
ok(false, testset[curTest].rule + " - During test: " + e);
|
||||
ok(false, testset[curTest].rule, "During test: " + e);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -113,7 +113,7 @@ var ContentMessageListener = {
|
|||
}
|
||||
} else if (aMessage.name == "content-task:test-result") {
|
||||
let data = aMessage.data;
|
||||
ContentTask._testScope.record(data.condition, data.name, null, data.stack);
|
||||
ContentTask._testScope.ok(data.condition, data.name, null, data.stack);
|
||||
} else if (aMessage.name == "content-task:test-info") {
|
||||
ContentTask._testScope.info(aMessage.data.name);
|
||||
} else if (aMessage.name == "content-task:test-todo") {
|
||||
|
|
|
@ -17,7 +17,7 @@ ChromeUtils.defineModuleGetter(this, "ContentSearch",
|
|||
"resource:///modules/ContentSearch.jsm");
|
||||
|
||||
const SIMPLETEST_OVERRIDES =
|
||||
["ok", "record", "is", "isnot", "todo", "todo_is", "todo_isnot", "info", "expectAssertions", "requestCompleteLog"];
|
||||
["ok", "is", "isnot", "todo", "todo_is", "todo_isnot", "info", "expectAssertions", "requestCompleteLog"];
|
||||
|
||||
setTimeout(testInit, 0);
|
||||
|
||||
|
@ -1289,15 +1289,7 @@ function testScope(aTester, aTest, expected) {
|
|||
aTest.allowFailure = expected == "fail";
|
||||
|
||||
var self = this;
|
||||
this.ok = function test_ok(condition, name) {
|
||||
if (arguments.length > 2) {
|
||||
const ex = "Too many arguments passed to ok(condition, name)`.";
|
||||
self.record(false, name, ex);
|
||||
} else {
|
||||
self.record(condition, name);
|
||||
}
|
||||
};
|
||||
this.record = function test_record(condition, name, ex, stack) {
|
||||
this.ok = function test_ok(condition, name, ex, stack) {
|
||||
aTest.addResult(new testResult({
|
||||
name, pass: condition, ex,
|
||||
stack: stack || Components.stack.caller,
|
||||
|
@ -1305,11 +1297,11 @@ function testScope(aTester, aTest, expected) {
|
|||
}));
|
||||
};
|
||||
this.is = function test_is(a, b, name) {
|
||||
self.record(a == b, name, "Got " + a + ", expected " + b, false,
|
||||
self.ok(a == b, name, "Got " + a + ", expected " + b, false,
|
||||
Components.stack.caller);
|
||||
};
|
||||
this.isnot = function test_isnot(a, b, name) {
|
||||
self.record(a != b, name, "Didn't expect " + a + ", but got it", false,
|
||||
self.ok(a != b, name, "Didn't expect " + a + ", but got it", false,
|
||||
Components.stack.caller);
|
||||
};
|
||||
this.todo = function test_todo(condition, name, ex, stack) {
|
||||
|
|
|
@ -23,21 +23,20 @@ function starttest() {
|
|||
function() {
|
||||
//test log
|
||||
info("Logging some info")
|
||||
|
||||
|
||||
//basic usage
|
||||
ok(true, "test ok");
|
||||
SimpleTest.record(true, "test ok", "diagnostic information");
|
||||
ok(true, "test ok", "This should be true");
|
||||
is(0, 0, "is() test failed");
|
||||
isnot(0, 1, "isnot() test failed");
|
||||
|
||||
|
||||
//todo tests
|
||||
todo(false, "test todo", "todo() test should not pass");
|
||||
todo_is(false, true, "test todo_is");
|
||||
todo_isnot(true, true, "test todo_isnot");
|
||||
|
||||
|
||||
//misc
|
||||
SimpleTest.requestLongerTimeout(1);
|
||||
|
||||
|
||||
//note: this test may alter runtimes as it waits
|
||||
var check = false;
|
||||
$('textB').focus();
|
||||
|
@ -56,7 +55,7 @@ function starttest() {
|
|||
manipulateElements();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
//use helper functions
|
||||
function manipulateElements()
|
||||
{
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
var captureFailure = false;
|
||||
var capturedFailures = [];
|
||||
window.ok = function (cond, name) {
|
||||
window.ok = function (cond, name, diag) {
|
||||
if (!captureFailure) {
|
||||
SimpleTest.ok(cond, name);
|
||||
SimpleTest.ok(cond, name, diag);
|
||||
} else {
|
||||
if (cond) {
|
||||
SimpleTest.ok(false, `Expect a failure with "${name}"`);
|
||||
|
|
|
@ -55,19 +55,19 @@ ExtensionTestUtils.loadExtension = function(ext)
|
|||
|
||||
function testHandler(kind, pass, msg, ...args) {
|
||||
if (kind == "test-eq") {
|
||||
let [expected, actual] = args;
|
||||
SimpleTest.ok(pass, `${msg} - Expected: ${expected}, Actual: ${actual}`);
|
||||
let [expected, actual, stack] = args;
|
||||
SimpleTest.ok(pass, `${msg} - Expected: ${expected}, Actual: ${actual}`, undefined, stack);
|
||||
} else if (kind == "test-log") {
|
||||
SimpleTest.info(msg);
|
||||
} else if (kind == "test-result") {
|
||||
SimpleTest.ok(pass, msg);
|
||||
SimpleTest.ok(pass, msg, undefined, args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
var handler = {
|
||||
testResult(kind, pass, msg, ...args) {
|
||||
if (kind == "test-done") {
|
||||
SimpleTest.ok(pass, msg);
|
||||
SimpleTest.ok(pass, msg, undefined, args[0]);
|
||||
return testResolve(msg);
|
||||
}
|
||||
testHandler(kind, pass, msg, ...args);
|
||||
|
|
|
@ -267,16 +267,8 @@ SimpleTest.setExpected();
|
|||
/**
|
||||
* Something like assert.
|
||||
**/
|
||||
SimpleTest.ok = function (condition, name) {
|
||||
if (arguments.length > 2) {
|
||||
const diag = "Too many arguments passed to `ok(condition, name)`";
|
||||
SimpleTest.record(false, name, diag);
|
||||
} else {
|
||||
SimpleTest.record(condition, name);
|
||||
}
|
||||
};
|
||||
SimpleTest.ok = function (condition, name, diag, stack = null) {
|
||||
|
||||
SimpleTest.record = function (condition, name, diag, stack) {
|
||||
var test = {'result': !!condition, 'name': name, 'diag': diag};
|
||||
if (SimpleTest.expected == 'fail') {
|
||||
if (!test.result) {
|
||||
|
@ -317,19 +309,19 @@ SimpleTest.is = function (a, b, name) {
|
|||
// Be lazy and use Object.is til we want to test a browser without it.
|
||||
var pass = Object.is(a, b);
|
||||
var diag = pass ? "" : "got " + repr(a) + ", expected " + repr(b)
|
||||
SimpleTest.record(pass, name, diag);
|
||||
SimpleTest.ok(pass, name, diag);
|
||||
};
|
||||
|
||||
SimpleTest.isfuzzy = function (a, b, epsilon, name) {
|
||||
var pass = (a >= b - epsilon) && (a <= b + epsilon);
|
||||
var diag = pass ? "" : "got " + repr(a) + ", expected " + repr(b) + " epsilon: +/- " + repr(epsilon)
|
||||
SimpleTest.record(pass, name, diag);
|
||||
SimpleTest.ok(pass, name, diag);
|
||||
};
|
||||
|
||||
SimpleTest.isnot = function (a, b, name) {
|
||||
var pass = !Object.is(a, b);
|
||||
var diag = pass ? "" : "didn't expect " + repr(a) + ", but got it";
|
||||
SimpleTest.record(pass, name, diag);
|
||||
SimpleTest.ok(pass, name, diag);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1585,9 +1577,9 @@ SimpleTest.isDeeply = function (it, as, name) {
|
|||
var stack = [{ vals: [it, as] }];
|
||||
var seen = [];
|
||||
if ( SimpleTest._deepCheck(it, as, stack, seen)) {
|
||||
SimpleTest.record(true, name);
|
||||
SimpleTest.ok(true, name);
|
||||
} else {
|
||||
SimpleTest.record(false, name, SimpleTest._formatStack(stack));
|
||||
SimpleTest.ok(false, name, SimpleTest._formatStack(stack));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1610,7 +1602,6 @@ SimpleTest.isa = function (object, clas) {
|
|||
|
||||
// Global symbols:
|
||||
var ok = SimpleTest.ok;
|
||||
var record = SimpleTest.record;
|
||||
var is = SimpleTest.is;
|
||||
var isfuzzy = SimpleTest.isfuzzy;
|
||||
var isnot = SimpleTest.isnot;
|
||||
|
@ -1640,9 +1631,8 @@ window.onerror = function simpletestOnerror(errorMsg, url, lineNumber,
|
|||
}
|
||||
if (!SimpleTest._ignoringAllUncaughtExceptions) {
|
||||
// Don't log if SimpleTest.finish() is already called, it would cause failures
|
||||
if (!SimpleTest._alreadyFinished) {
|
||||
SimpleTest.record(isExpected, message, error);
|
||||
}
|
||||
if (!SimpleTest._alreadyFinished)
|
||||
SimpleTest.ok(isExpected, message, error);
|
||||
SimpleTest._expectingUncaughtException = false;
|
||||
} else {
|
||||
SimpleTest.todo(false, message + ": " + error);
|
||||
|
|
|
@ -228,11 +228,7 @@ proto.report = function(failed, actual, expected, message, operator, truncate =
|
|||
* (string) Short explanation of the expected result
|
||||
*/
|
||||
proto.ok = function(value, message) {
|
||||
if (arguments.length > 2) {
|
||||
this.report(true, false, true, "Too many arguments passed to `Assert.ok()`", "==");
|
||||
} else {
|
||||
this.report(!value, value, true, message, "==");
|
||||
}
|
||||
this.report(!value, value, true, message, "==");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,6 @@ module.exports = {
|
|||
"isnot": false,
|
||||
"ok": false,
|
||||
"privateNoteIntentionalCrash": false,
|
||||
"record": false,
|
||||
"registerCleanupFunction": false,
|
||||
"requestLongerTimeout": false,
|
||||
"setExpectedFailuresForSelfTest": false,
|
||||
|
|
Загрузка…
Ссылка в новой задаче