Bug 949614 - Use === for SimpleTest.is; r=Waldo

This is more likely to be correct, and a necessary step in case we ever want
to move to Object.is.

This keeps ise as an alias for is, and introduces is_loosely for the old
behaviour.
This commit is contained in:
Ms2ger 2015-04-14 15:28:13 +02:00
parent 786fbbeb50
commit 82c2faeae3
142 changed files with 544 additions and 534 deletions

View File

@ -425,9 +425,9 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags)
for (var offset in accTree[prop]) {
if (prevOffset !=- 1) {
var attrs = accTree[prop][prevOffset];
testTextAttrs(acc, prevOffset, attrs, { }, prevOffset, offset, true);
testTextAttrs(acc, prevOffset, attrs, { }, prevOffset, +offset, true);
}
prevOffset = offset;
prevOffset = +offset;
}
if (prevOffset != -1) {

View File

@ -20,8 +20,8 @@
////////////////////////////////////////////////////////////////////////////
// Invokers
const kRemoval = 0;
const kInsertion = 1;
const kRemoval = false;
const kInsertion = true;
const kUnexpected = true;
function changeText(aContainerID, aValue, aEventList)

View File

@ -82,7 +82,7 @@
try {
var endCol = propBag.getPropertyAsInt32("endcolumn");
} catch (e if e.name == 'NS_ERROR_NOT_AVAILABLE') {
startCol = null;
endCol = null;
}
is(endCol, aEndCol,
"Wrong 'endcolumn' of 'treeInvalidated' event on " + aMsg);

View File

@ -52,7 +52,7 @@ const EXT_STATE_SUPPORTS_AUTOCOMPLETION =
nsIAccessibleStates.EXT_STATE_SUPPORTS_AUTOCOMPLETION;
const EXT_STATE_VERTICAL = nsIAccessibleStates.EXT_STATE_VERTICAL;
const kOrdinalState = 0;
const kOrdinalState = false;
const kExtraState = 1;
////////////////////////////////////////////////////////////////////////////////

View File

@ -77,7 +77,7 @@
aId + ": wrong number of selected columns");
if (!aSelIndexesArray) {
is(selCols.value, null,
is(selCols.value, undefined,
aId + ": no columns should be selected");
} else {
for (var i = 0; i < selCols.length; i++) {
@ -116,7 +116,7 @@
aId + ": wrong number of selected rows");
if (!aSelIndexesArray) {
is(selCols.value, null,
is(selCols.value, undefined,
aId + ": no row should be selected");
} else {
for (var i = 0; i < selCols.length; i++) {
@ -159,7 +159,7 @@
aId + ": wrong number of selected cells");
if (!aSelIndexesArray) {
is(selCols.value, null,
is(selCols.value, undefined,
aId + ": no cells should be selected");
} else {
for (var i = 0; i < selCols.length; i++) {

View File

@ -19,19 +19,19 @@
.securityUI;
var loadedMixedActive = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT);
is(loadedMixedActive, false, "OK: Should not load mixed active content!");
var blockedMixedActive = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT);
is(blockedMixedActive, false, "OK: Should not block mixed active content!");
var loadedMixedDisplay = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT);
is(loadedMixedDisplay, false, "OK: Should not load mixed display content!");
var blockedMixedDisplay = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT);
is(blockedMixedDisplay, false, "OK: Should not block mixed display content!");
var newValue = "Verifying MCB does not trigger warning/error for an http page with https css that includes http font";

View File

@ -19,19 +19,19 @@
.securityUI;
var loadedMixedActive = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT);
is(loadedMixedActive, false, "OK: Should not load mixed active content!");
var blockedMixedActive = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT);
is(blockedMixedActive, false, "OK: Should not block mixed active content!");
var loadedMixedDisplay = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT);
is(loadedMixedDisplay, false, "OK: Should not load mixed display content!");
var blockedMixedDisplay = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT);
is(blockedMixedDisplay, false, "OK: Should not block mixed display content!");
var newValue = "Verifying MCB does not trigger warning/error for an http page ";

View File

@ -19,19 +19,19 @@
.securityUI;
var loadedMixedActive = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT);
is(loadedMixedActive, false, "OK: Should not load mixed active content!");
var blockedMixedActive = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT);
is(blockedMixedActive, false, "OK: Should not block mixed active content!");
var loadedMixedDisplay = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT);
is(loadedMixedDisplay, false, "OK: Should not load mixed display content!");
var blockedMixedDisplay = ui &&
(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT);
!!(ui.state & SpecialPowers.Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_DISPLAY_CONTENT);
is(blockedMixedDisplay, false, "OK: Should not block mixed display content!");
var newValue = "Verifying MCB does not trigger warning/error for an http page with https css that includes http image";

View File

@ -58,7 +58,7 @@ Bug 901519 - [app manager] data store for connections
connection.port = 42;
is(host.textContent, "foobar", "host updated");
is(port.textContent, 42, "port updated");
is(port.textContent, "42", "port updated");
let been_through_connecting = false;
let been_through_connected = false;

View File

@ -102,18 +102,18 @@ function addNewFieldInteger() {
if (newField) {
found = true;
is(newField.type, "number", "Custom type is a number");
is(newField.value, 1, "Custom integer value is correct");
is(newField.value, "1", "Custom integer value is correct");
}
ok(found, "Found new integer field line");
is(customName.value, "", "Custom integer name reset");
is(customValue.value, 0, "Custom integer value reset");
is(customValue.value, "", "Custom integer value reset");
}
let editFieldInteger = Task.async(function*() {
// Edit existing custom integer preference
newField.value = 3;
newField.click();
is(newField.value, 3, "Custom integer existing value is correct");
is(newField.value, "3", "Custom integer existing value is correct");
// Reset a custom field
let resetBtn = doc.querySelector("#btn-new-integer-field");

View File

@ -77,7 +77,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840488
// We need to append 'name' to avoid running afoul of recursive frame detection.
let frameURI = uri + "?name=" + name;
navigateFrame(ifr, frameURI).then(function() {
is(ifr.contentWindow.location, frameURI, "Successful load");
is(String(ifr.contentWindow.location), frameURI, "Successful load");
is(!!ifr.contentWindow.wrappedJSObject.gFiredOnload, expectOnload,
"onload should only fire when scripts are enabled");
deferred.resolve();

View File

@ -59,7 +59,7 @@ var nextTest =function() {
}
var step1 =function() {
window.is(testWindow.location, gTallRedBoxURI, "Ensure red page loaded.");
window.is(String(testWindow.location), gTallRedBoxURI, "Ensure red page loaded.");
// Navigate down and up.
is(testWindow.document.body.scrollTop, 0,
@ -87,7 +87,7 @@ var step1 =function() {
var step2 =function() {
window.is(testWindow.location, gTallBlueBoxURI, "Ensure blue page loaded.");
window.is(String(testWindow.location), gTallBlueBoxURI, "Ensure blue page loaded.");
// Scroll around a bit.
is(testWindow.document.body.scrollTop, 0,
@ -111,7 +111,7 @@ var step2 =function() {
}
var step3 =function() {
window.is(testWindow.location, gTallRedBoxURI,
window.is(String(testWindow.location), gTallRedBoxURI,
"Ensure red page restored from history.");
// Check we can still scroll with the keys.

View File

@ -229,7 +229,7 @@ function runTest() {
size: 0,
readyToApplyDownload: false
};
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, 2, expected,
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, "2", expected,
true, false, continueTest);
};
};

View File

@ -58,24 +58,6 @@ function checkUninstallApp(aApp) {
};
}
function checkInstalledApp(aMiniManifestURL,
aVersion,
aExpectedApp,
aLaunchable,
aCb) {
var req = navigator.mozApps.checkInstalled(aMiniManifestURL);
req.onsuccess = function(evt) {
ok(req.result, "The app is installed");
if (!req.result) {
PackagedTestHelper.finish();
}
PackagedTestHelper.checkAppState(evt.application, aVersion, aExpectedApp,
aLaunchable, false, aCb);
};
}
var gIconData =
"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" +
"\x00\x00\x00\x0F\x00\x00\x00\x0F\x08\x03\x00\x00\x00\x0C\x08\x65" +
@ -240,7 +222,7 @@ var steps = [
size: 0,
readyToApplyDownload: false
};
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, 2, expected,
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, "2", expected,
true, false, PackagedTestHelper.next);
};
};
@ -327,7 +309,7 @@ var steps = [
size: 0,
readyToApplyDownload: alreadyCanceled
};
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, 3, expected,
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, "3", expected,
true, false, function() {});
};
@ -345,7 +327,7 @@ var steps = [
size: 0,
readyToApplyDownload: false
};
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, 3, expected,
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, "3", expected,
true, false, PackagedTestHelper.next);
}

View File

@ -173,7 +173,7 @@ var steps = [
};
PackagedTestHelper.gApp.ondownloadsuccess =
checkLastAppState.bind(undefined, miniManifestURL, false, false,
2, PackagedTestHelper.next);
"2", PackagedTestHelper.next);
};
var request = navigator.mozApps.installPackage(miniManifestURL);
@ -232,7 +232,7 @@ var steps = [
},
function() {
info("== TEST == Update packaged app");
updateApp(true, 2, 3);
updateApp(true, "2", "3");
},
function() {
info("== TEST == Check that saved permissions were kept");
@ -251,14 +251,14 @@ var steps = [
},
function() {
info("== TEST == Check that name changes in an update are ignored");
updateApp(true, 3, 4);
updateApp(true, "3", "4");
},
function() {
PackagedTestHelper.setAppVersion(5, PackagedTestHelper.next, true);
},
function() {
info("== TEST == Update packaged app - same package");
updateApp(false, 4, 4, true);
updateApp(false, "4", "4", true);
},
function() {
info("== TEST == Check for Update after getting the same package");

View File

@ -60,7 +60,7 @@ window.checkResults = function(reportObj) {
is(cspReport["script-sample"], "\n var foo = \"propEscFoo\";\n var bar...",
"Incorrect script-sample");
is(cspReport["line-number"], "7", "Incorrect line-number");
is(cspReport["line-number"], 7, "Incorrect line-number");
}
// This is used to watch requests go out so we can see if the report is

View File

@ -25,8 +25,8 @@ function doe3() {
}
function doe4() {
opener.is(window.frames[0].location, url1, "History.go(-1) didn't work?");
opener.is(window.frames[1].location, "about:blank",
opener.is(String(window.frames[0].location), url1, "History.go(-1) didn't work?");
opener.is(String(window.frames[1].location), "about:blank",
"History.go(-1) didn't work?");
close();
}

View File

@ -55,7 +55,7 @@ function doe4() {
}
function doe5() {
opener.is(win0.location, url1, "History.go(-1) didn't work?");
opener.is(String(win0.location), url1, "History.go(-1) didn't work?");
close();
}
</script>

View File

@ -55,7 +55,7 @@ function testFile(file, contents, test) {
file.type ? file.type : null,
"request content-type in XMLHttpRequest send of " + test);
is(event.target.getResponseHeader("Result-Content-Length"),
file.size,
String(file.size),
"request content-length in XMLHttpRequest send of " + test);
};
xhr.addEventListener("load",

View File

@ -694,7 +694,7 @@ function runTest() {
is(res.responseHeaders[header], null,
"|xhr.getResponseHeader()|wrong response header (" + header + ") in test for " +
test.toSource());
is(res.allResponseHeaders[header], null,
is(res.allResponseHeaders[header], undefined,
"|xhr.getAllResponseHeaderss()|wrong response header (" + header + ") in test for " +
test.toSource());
}

View File

@ -232,7 +232,9 @@ try {
}
if (test.resContentLength) {
is(xhr.getResponseHeader("Result-Content-Length"), test.resContentLength, "Wrong Content-Length sent");
is(xhr.getResponseHeader("Result-Content-Length"),
String(test.resContentLength),
"Wrong Content-Length sent");
}
if (test.resType == "arraybuffer") {

View File

@ -23,10 +23,10 @@ function runTest() {
is(utils.audioVolume, 1.0, "By default utils.audioVolume is 1.0");
utils.audioVolume = 0.4;
is(utils.audioVolume.toFixed(2), 0.4, "utils.audioVolume is ok");
is(utils.audioVolume.toFixed(2), "0.40", "utils.audioVolume is ok");
utils.audioMuted = true;
is(utils.audioMuted, true, "utils.audioMuted is true");
is(utils.audioVolume.toFixed(2), 0.4, "utils.audioVolume is ok");
is(utils.audioVolume.toFixed(2), "0.40", "utils.audioVolume is ok");
utils.audioMuted = false;
utils.audioVolume = 2.0;
@ -60,10 +60,10 @@ function runTest() {
is(utils.audioVolume, 1.0, "By default utils.audioVolume is 1.0");
utils.audioVolume = 0.4;
is(utils.audioVolume.toFixed(2), 0.4, "utils.audioVolume is ok");
is(utils.audioVolume.toFixed(2), "0.40", "utils.audioVolume is ok");
utils.audioMuted = true;
is(utils.audioMuted, true, "utils.audioMuted is true");
is(utils.audioVolume.toFixed(2), 0.4, "utils.audioVolume is ok");
is(utils.audioVolume.toFixed(2), "0.40", "utils.audioVolume is ok");
utils.audioMuted = false;
utils.audioVolume = 2.0;

View File

@ -25,9 +25,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=346485
* This test is testing DOMSettableTokenList used by the output element.
*/
function checkHtmlFor(htmlFor, list, msg) {
var length = htmlFor.length;
is(length, list.length, htmlFor + ": incorrect htmlFor length (" + msg + ")");
for (var i = 0; i < length; ++i) {
is(htmlFor[i], list[i], htmlFor + ": wrong element at " + i + " (" + msg + ")");
}
}
var o = document.getElementById('o');
is(o.htmlFor, 'a b',
is(String(o.htmlFor), 'a b',
"htmlFor IDL attribute should reflect for content attribute");
is(o.htmlFor.value, 'a b',
@ -42,32 +50,25 @@ is(o.htmlFor.item(0), 'a', "First item is 'a' token'");
is(o.htmlFor.item(42), null, "Out-of-range should return null");
o.htmlFor.add('c');
is(o.htmlFor, 'a b c', "'c' token should have been added");
is(o.htmlFor.length, 3, "Size should be '3'");
checkHtmlFor(o.htmlFor, ['a', 'b', 'c'], "'c' token should have been added");
o.htmlFor.add('a');
is(o.htmlFor, 'a b c', "Nothing should have changed");
is(o.htmlFor.length, 3, "Size should be '3'");
checkHtmlFor(o.htmlFor, ['a', 'b', 'c'], "Nothing should have changed");
o.htmlFor.remove('a');
is(o.htmlFor, 'b c', "'a' token should have been removed");
is(o.htmlFor.length, 2, "Size should be '2'");
checkHtmlFor(o.htmlFor, ['b', 'c'], "'a' token should have been removed");
o.htmlFor.remove('d');
is(o.htmlFor, 'b c', "Nothing should have been removed");
is(o.htmlFor.length, 2, "Size should be '2'");
checkHtmlFor(o.htmlFor, ['b', 'c'], "Nothing should have been removed");
o.htmlFor.toggle('a');
is(o.htmlFor, 'b c a', "'a' token should have been added");
is(o.htmlFor.length, 3, "Size should be '3'");
checkHtmlFor(o.htmlFor, ['b', 'c', 'a'], "'a' token should have been added");
o.htmlFor.toggle('b');
is(o.htmlFor, 'c a', "Nothing should have changed");
is(o.htmlFor.length, 2, "Size should be '2'");
checkHtmlFor(o.htmlFor, ['c', 'a'], "Nothing should have changed");
o.htmlFor.value = "foo bar";
is(o.htmlFor, 'foo bar', "The underlying string should have changed");
is(o.htmlFor.length, 2, "Size should be '2'");
checkHtmlFor(o.htmlFor, ['foo', 'bar'], "The underlying string should have changed");
ok(o.htmlFor.contains('foo'), "It should contain 'foo'");
</script>

View File

@ -26,7 +26,7 @@ function done() {
nodes = document.getElementsByTagName('span');
is(nodes.length, 3, "wrong length");
for (i = 0; i < nodes.length; ++i) {
is(nodes[i].textContent, i+1, "wrong order");
is(nodes[i].textContent, String(i + 1), "wrong order");
}
SimpleTest.finish();
}

View File

@ -30,13 +30,13 @@ function innerLoaded(inner) {
// Here, we're being called through inner's onload handler, so our referrer
// should be inner's URL.
var referrer = inner.doXHR();
is (referrer, inner.document.location, 'Expected inner frame location');
is (referrer, String(inner.document.location), 'Expected inner frame location');
// Now change the location of the inner frame. This should be reflected in
// the XHR's referrer.
inner.history.pushState('', '', Math.random());
referrer = inner.doXHR();
is (referrer, inner.document.location, 'Expected inner frame location after pushstate');
is (referrer, String(inner.document.location), 'Expected inner frame location after pushstate');
innerFinishedLoading = true;
}
@ -50,11 +50,11 @@ function callXHR() {
if (innerFinishedLoading && dataWindowFinishedLoading) {
var inner = document.getElementById('iframe').contentWindow;
var referrer = inner.doXHR();
is (referrer, inner.document.location,
is (referrer, String(inner.document.location),
'Expected inner frame location when called from outer frame.');
var referrer = inner.doXHR(new XMLHttpRequest());
is (referrer, document.location,
is (referrer, String(document.location),
"Expected outer frame location when called with outer's XHR object.");
// Now do a request within the inner window using an XMLHttpRequest
@ -62,7 +62,7 @@ function callXHR() {
// data: URI.
var dataWindow = document.getElementById('dataWindow').contentWindow;
var referrer = inner.doXHR(dataWindow.getXHRObject());
is (referrer, document.location,
is (referrer, String(document.location),
"Expected outer frame location when called with data's XHR object.");
// Now do that test again, but after having changed the outer window's URI.
@ -71,7 +71,7 @@ function callXHR() {
history.replaceState('', '', Math.random());
var referrer = inner.doXHR(dataWindow.getXHRObject());
todo_is (referrer, document.location,
todo_is (referrer, String(document.location),
"Expected outer frame location when called with data's XHR object " +
"after replaceState.");

View File

@ -43,9 +43,9 @@
* Init & destroy.
*/
function initDOMRequestHelperTest(aMessages) {
is(dummy._requests, undefined, "Request is undefined");
is_loosely(dummy._requests, undefined, "Request is undefined");
is(dummy._messages, undefined, "Messages is undefined");
is(dummy._window, undefined, "Window is undefined");
is_loosely(dummy._window, undefined, "Window is undefined");
dummy.initDOMRequestHelper(window, aMessages);
@ -59,9 +59,9 @@
function destroyDOMRequestHelperTest() {
dummy.destroyDOMRequestHelper();
is(dummy._requests, undefined, "Request is undefined");
is_loosely(dummy._requests, undefined, "Request is undefined");
is(dummy._messages, undefined, "Messages is undefined");
is(dummy._window, undefined, "Window is undefined");
is_loosely(dummy._window, undefined, "Window is undefined");
}
/**
@ -388,7 +388,7 @@
is(req, req_, "Got correct request");
dummy.removeRequest(id);
req = dummy.getRequest(id);
is(req, null, "No request");
is(req, undefined, "No request");
next();
},
function() {

View File

@ -311,7 +311,7 @@
url = new URL("http://localhost/");
url.host = "[2001::1]:30";
is(url.hostname, "[2001::1]", "IPv6 hostname");
is(url.port, 30, "Port");
is(url.port, "30", "Port");
is(url.host, "[2001::1]:30", "IPv6 host");
url = new URL("http://localhost/");

View File

@ -24,14 +24,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=930450
<script type="application/javascript">
var url = new URL('http://www.example.com:8080');
is(url.port, 8080, 'URL.port is 8080');
is(url.port, '8080', 'URL.port is 8080');
url.port = '';
ise(url.port, '', 'URL.port is \'\'');
url.port = 0;
ise(url.port, '0', 'URL.port is 0');
var link = document.getElementById("link");
is(link.port, 8080, 'URL.port is 8080');
is(link.port, '8080', 'URL.port is 8080');
link.port = '';
is(link.href, 'http://www.example.com/', "link.href matches");
ise(link.port, '', 'URL.port is \'\'');
@ -40,7 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=930450
ise(link.port, '0', 'URL.port is 0');
var area = document.getElementById("area");
is(area.port, 8080, 'URL.port is 8080');
is(area.port, '8080', 'URL.port is 8080');
area.port = '';
is(area.href, 'http://www.example.com/', "area.href matches");
ise(area.port, '', 'URL.port is \'\'');

View File

@ -22,7 +22,7 @@ function runTest()
var numPrompts = 0;
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
is(e.detail.message, numPrompts, "prompt message");
is(e.detail.message, String(numPrompts), "prompt message");
if (numPrompts / 10 < 1) {
is(e.detail.promptType, 'alert');
}

View File

@ -18,15 +18,15 @@ function runTest() {
document.body.appendChild(iframe);
var prompts = [
{msg: 1, type: 'alert', rv: 42, expected: 'undefined'},
{msg: 2, type: 'confirm', rv: true, expected: 'true'},
{msg: 3, type: 'confirm', rv: false, expected: 'false'},
{msg: '1', type: 'alert', rv: 42, expected: 'undefined'},
{msg: '2', type: 'confirm', rv: true, expected: 'true'},
{msg: '3', type: 'confirm', rv: false, expected: 'false'},
// rv == 42 should be coerced to 'true' for confirm.
{msg: 4, type: 'confirm', rv: 42, expected: 'true'},
{msg: 5, type: 'prompt', rv: 'worked', expected: 'worked'},
{msg: 6, type: 'prompt', rv: null, expected: 'null'},
{msg: 7, type: 'prompt', rv: '', expected: ''}
{msg: '4', type: 'confirm', rv: 42, expected: 'true'},
{msg: '5', type: 'prompt', rv: 'worked', expected: 'worked'},
{msg: '6', type: 'prompt', rv: null, expected: 'null'},
{msg: '7', type: 'prompt', rv: '', expected: ''}
];
iframe.addEventListener("mozbrowsershowmodalprompt", function(e) {

View File

@ -100,7 +100,7 @@ function runTest() {
is(e.detail.message, expectedMessage.message);
is(e.detail.buttons.length, 2);
is(e.detail.showCheckbox, false);
is(e.detail.checkMessage, null);
is(e.detail.checkboxMessage, null);
e.detail.unblock();
if (!doRepost) {

View File

@ -52,7 +52,7 @@ function runTest() {
// increased by one.
var p = Promise.all([
expectProcessCreated('FOREGROUND'),
expectPriorityWithLRUSet(childID, 'FOREGROUND', 1)
expectPriorityWithLRUSet(childID, 'FOREGROUND', '1')
]);
document.body.appendChild(iframe2);
@ -61,7 +61,7 @@ function runTest() {
}).then(function() {
// Now hide the second and third processes, this will send them into the
// background and make the first process LRU value to be decreased.
var p = expectPriorityWithLRUSet(childID, 'FOREGROUND', 0)
var p = expectPriorityWithLRUSet(childID, 'FOREGROUND', '0')
iframe2.setVisible(false);

View File

@ -150,7 +150,7 @@ var steps = [
// Some manual testing. Testint the testfunctions
// tel: [{type: ["work"], value: "123456", carrier: "testCarrier"} , {type: ["home", "fax"], value: "+55 (31) 9876-3456"}],
is(findResult1.tel[0].carrier, "testCarrier", "Same Carrier");
is(findResult1.tel[0].type, "work", "Same type");
is(String(findResult1.tel[0].type), "work", "Same type");
is(findResult1.tel[0].value, "123456", "Same Value");
is(findResult1.tel[1].type[1], "fax", "Same type");
is(findResult1.tel[1].value, "+55 (31) 9876-3456", "Same Value");
@ -158,7 +158,7 @@ var steps = [
is(findResult1.adr[0].countryName, "country 1", "Same country");
// email: [{type: ["work"], value: "x@y.com"}]
is(findResult1.email[0].type, "work", "Same Type");
is(String(findResult1.email[0].type), "work", "Same Type");
is(findResult1.email[0].value, "x@y.com", "Same Value");
next();
};

View File

@ -230,7 +230,7 @@ var steps = [
ok(cloned.id, "The contact now has an ID.");
is(cloned.email[0].value, "new email!", "Same Email");
isnot(createResult1.email[0].value, cloned.email[0].value, "Clone has different email");
is(cloned.givenName, "Tom", "New Name");
is(String(cloned.givenName), "Tom", "New Name");
next();
}
req.onerror = onFailure;

View File

@ -31,7 +31,7 @@ is(div.onscroll.toString(), "function onscroll(event) {\ndiv\n}",
div.setAttribute("onpopstate", "div");
is(window.onpopstate, null, "div should not forward onpopstate");
is(div.onpopstate, null, "div should not have onpopstate handler");
is("onpopstate" in div, false, "div should not have onpopstate handler");
var body = document.createElement("body");
body.setAttribute("onclick", "body");

View File

@ -168,7 +168,7 @@ function test_DataTransfer(dt)
is(dt.getData(""), "", "invalid type getData"),
dt.mozSetDataAt("", "Invalid Type", 0);
is(dt.types.length, 0, "invalid type setDataAt");
is(dt.mozGetDataAt("", 0), null, "invalid type getDataAt"),
is(dt.mozGetDataAt("", 0), undefined, "invalid type getDataAt"),
// similar with clearDataAt and getDataAt
expectError(function() dt.mozGetDataAt("text/plain", 1),
@ -501,8 +501,8 @@ function checkOneDataItem(dt, expectedtypes, expecteddata, index, testid)
checkTypes(dt, expectedtypes, index, testid);
for (var f = 0; f < expectedtypes.length; f++) {
if (index == 0)
is(dt.getData(expectedtypes[f]), expecteddata[f], testid + " getData " + expectedtypes[f]);
is(dt.mozGetDataAt(expectedtypes[f], index), expecteddata[f] ? expecteddata[f] : null,
is_loosely(dt.getData(expectedtypes[f]), expecteddata[f], testid + " getData " + expectedtypes[f]);
is_loosely(dt.mozGetDataAt(expectedtypes[f], index), expecteddata[f] ? expecteddata[f] : null,
testid + " getDataAt " + expectedtypes[f]);
}
}

View File

@ -39,7 +39,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294
is(e.data, 'data' in test ? test.data : undefined, 'MessageEvent.data is ok');
is(e.origin, 'origin' in test ? test.origin : '', 'MessageEvent.origin is ok');
is(e.lastEventId, 'lastEventId' in test ? test.lastEventId : '', 'MessageEvent.lastEventId is ok');
is(e.source, 'source' in test ? test.source : undefined, 'MessageEvent.source is ok');
is(e.source, 'source' in test ? test.source : null, 'MessageEvent.source is ok');
if (test.ports != undefined) {
is(e.ports.length, test.ports.length, 'MessageEvent.ports is ok');

View File

@ -182,7 +182,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=722599
is(numberChange, 0, "Change event shouldn't be dispatched on number input element for keyboard input until it loses focus");
number.blur();
is(numberChange, 1, "Change event should be dispatched on number input element on blur");
is(number.value, 12, "Sanity check that number keys were actually handled");
is(number.value, "12", "Sanity check that number keys were actually handled");
if (isDesktop) { // up/down arrow keys not supported on android/b2g
number.value = "";
number.focus();
@ -190,7 +190,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=722599
synthesizeKey("VK_UP", {});
synthesizeKey("VK_DOWN", {});
is(numberChange, 4, "Change event should be dispatched on number input element for up/down arrow keys (a special case)");
is(number.value, 1, "Sanity check that number and arrow keys were actually handled");
is(number.value, "1", "Sanity check that number and arrow keys were actually handled");
}
// Special case type=range

View File

@ -191,11 +191,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=851780
number.focus();
synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
is(numberInput, 1, "input event should be dispatched for up/down arrow key keypress");
is(number.value, 1, "sanity check value of number control after keypress");
is(number.value, "1", "sanity check value of number control after keypress");
synthesizeKey("KEY_ArrowDown", { code: "ArrowDown", repeat: 3 });
is(numberInput, 4, "input event should be dispatched for each up/down arrow key keypress event, even when rapidly repeated");
is(number.value, -2, "sanity check value of number control after multiple keydown events");
is(number.value, "-2", "sanity check value of number control after multiple keydown events");
number.blur();
is(numberInput, 4, "input event shouldn't be dispatched on blur");

View File

@ -159,34 +159,34 @@ function test() {
oldVal = elem.value = -1;
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control with value set between min/max (" + oldVal + ")");
is(elem.value, String(expectedVal), "Test " + key + " for number control with value set between min/max (" + oldVal + ")");
// Same again:
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for number control");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for number control");
// Start at maximum:
oldVal = elem.value = elem.max;
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control with value set to the maximum (" + oldVal + ")");
is(elem.value, String(expectedVal), "Test " + key + " for number control with value set to the maximum (" + oldVal + ")");
// Same again:
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for number control");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for number control");
// Start at minimum:
oldVal = elem.value = elem.min;
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control with value set to the minimum (" + oldVal + ")");
is(elem.value, String(expectedVal), "Test " + key + " for number control with value set to the minimum (" + oldVal + ")");
// Same again:
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for number control");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for number control");
// Test preventDefault():
elem.addEventListener("keypress", function(evt) {
@ -196,7 +196,7 @@ function test() {
oldVal = elem.value = 0;
expectedVal = 0;
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control where scripted preventDefault() should prevent the value changing");
is(elem.value, String(expectedVal), "Test " + key + " for number control where scripted preventDefault() should prevent the value changing");
// Test step="any" behavior:
var oldStep = elem.step;
@ -204,7 +204,7 @@ function test() {
oldVal = elem.value = 0;
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control with value set to the midpoint and step='any' (" + oldVal + ")");
is(elem.value, String(expectedVal), "Test " + key + " for number control with value set to the midpoint and step='any' (" + oldVal + ")");
elem.step = oldStep; // restore
// Test that invalid input blocks UI initiated stepping:
@ -220,12 +220,12 @@ function test() {
elem.select();
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control with value set to the empty string and with the 'required' attribute set");
is(elem.value, String(expectedVal), "Test " + key + " for number control with value set to the empty string and with the 'required' attribute set");
// Same again:
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for number control");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for number control");
// Reset 'required' attribute:
elem.removeAttribute("required");

View File

@ -40,13 +40,13 @@ function runTest(test) {
elem.focus();
elem.select();
sendString(test.inputWithGrouping);
is(elem.value, test.value, "Test " + test.desc + " ('" + test.langTag +
"') localization with grouping separator");
is(elem.value, String(test.value), "Test " + test.desc + " ('" + test.langTag +
"') localization with grouping separator");
elem.value = 0;
elem.select();
sendString(test.inputWithoutGrouping);
is(elem.value, test.value, "Test " + test.desc + " ('" + test.langTag +
"') localization without grouping separator");
is(elem.value, String(test.value), "Test " + test.desc + " ('" + test.langTag +
"') localization without grouping separator");
}
function startTests() {

View File

@ -53,28 +53,28 @@ function test() {
// Test click on spin-up button:
synthesizeMouse(input, SPIN_UP_X, SPIN_UP_Y, { type: "mousedown" });
is(input.value, 1, "Test step-up on mousedown on spin-up button");
is(input.value, "1", "Test step-up on mousedown on spin-up button");
synthesizeMouse(input, SPIN_UP_X, SPIN_UP_Y, { type: "mouseup" });
is(input.value, 1, "Test mouseup on spin-up button");
is(input.value, "1", "Test mouseup on spin-up button");
// Test click on spin-down button:
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mousedown" });
is(input.value, 0, "Test step-down on mousedown on spin-down button");
is(input.value, "0", "Test step-down on mousedown on spin-down button");
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mouseup" });
is(input.value, 0, "Test mouseup on spin-down button");
is(input.value, "0", "Test mouseup on spin-down button");
// Test step="any" behavior:
input.value = 0;
var oldStep = input.step;
input.step = "any";
synthesizeMouse(input, SPIN_UP_X, SPIN_UP_Y, { type: "mousedown" });
is(input.value, 1, "Test step-up on mousedown on spin-up button with step='any'");
is(input.value, "1", "Test step-up on mousedown on spin-up button with step='any'");
synthesizeMouse(input, SPIN_UP_X, SPIN_UP_Y, { type: "mouseup" });
is(input.value, 1, "Test mouseup on spin-up button with step='any'");
is(input.value, "1", "Test mouseup on spin-up button with step='any'");
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mousedown" });
is(input.value, 0, "Test step-down on mousedown on spin-down button with step='any'");
is(input.value, "0", "Test step-down on mousedown on spin-down button with step='any'");
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mouseup" });
is(input.value, 0, "Test mouseup on spin-down button with step='any'");
is(input.value, "0", "Test mouseup on spin-down button with step='any'");
input.step = oldStep; // restore
// Test that preventDefault() works:
@ -84,9 +84,9 @@ function test() {
input.value = 1;
input.addEventListener("mousedown", preventDefault, false);
synthesizeMouse(input, SPIN_UP_X, SPIN_UP_Y, {});
is(input.value, 1, "Test that preventDefault() works for click on spin-up button");
is(input.value, "1", "Test that preventDefault() works for click on spin-up button");
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, {});
is(input.value, 1, "Test that preventDefault() works for click on spin-down button");
is(input.value, "1", "Test that preventDefault() works for click on spin-down button");
input.removeEventListener("mousedown", preventDefault, false);
// Run the spin tests:
@ -113,10 +113,10 @@ var spinTests = [
input.addEventListener("input", function(evt) {
++inputEventCount;
if (inputEventCount == 3) {
ok(input.value, 3, "Testing spin-up button");
is(input.value, "3", "Testing spin-up button");
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mousemove" });
} else if (inputEventCount == 6) {
ok(input.value, 0, "Testing spin direction is reversed after mouse moves from spin-up button to spin-down button");
is(input.value, "0", "Testing spin direction is reversed after mouse moves from spin-up button to spin-down button");
input.removeEventListener("input", arguments.callee, false);
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mouseup" });
runNextSpinTest();
@ -133,10 +133,10 @@ var spinTests = [
input.addEventListener("input", function(evt) {
++inputEventCount;
if (inputEventCount == 3) {
ok(input.value, -3, "Testing spin-down button");
is(input.value, "-3", "Testing spin-down button");
synthesizeMouse(input, SPIN_UP_X, SPIN_UP_Y, { type: "mousemove" });
} else if (inputEventCount == 6) {
ok(input.value, 0, "Testing spin direction is reversed after mouse moves from spin-down button to spin-up button");
is(input.value, "0", "Testing spin direction is reversed after mouse moves from spin-down button to spin-up button");
input.removeEventListener("input", arguments.callee, false);
synthesizeMouse(input, SPIN_UP_X, SPIN_UP_Y, { type: "mouseup" });
runNextSpinTest();
@ -156,8 +156,8 @@ var spinTests = [
synthesizeMouse(input, -1, -1, { type: "mousemove" });
var eventHandler = arguments.callee;
setTimeout(function() {
ok(input.value, 3, "Testing moving the mouse outside the spin buttons stops the spin");
ok(inputEventCount, 3, "Testing moving the mouse outside the spin buttons stops the spin input events");
is(input.value, "3", "Testing moving the mouse outside the spin buttons stops the spin");
is(inputEventCount, 3, "Testing moving the mouse outside the spin buttons stops the spin input events");
input.removeEventListener("input", eventHandler, false);
synthesizeMouse(input, -1, -1, { type: "mouseup" });
runNextSpinTest();
@ -177,8 +177,8 @@ var spinTests = [
input.type = "text"
var eventHandler = arguments.callee;
setTimeout(function() {
ok(input.value, 3, "Testing changing input type during a spin stops the spin");
ok(inputEventCount, 3, "Testing changing input type during a spin stops the spin input events");
is(input.value, "-3", "Testing changing input type during a spin stops the spin");
is(inputEventCount, 3, "Testing changing input type during a spin stops the spin input events");
input.removeEventListener("input", eventHandler, false);
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mouseup" });
input.type = "number"; // restore

View File

@ -158,46 +158,46 @@ function test() {
elem.value = oldVal = defaultValue(elem);
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for " + dir + " range with value set to the midpoint (" + oldVal + ")");
is(elem.value, String(expectedVal), "Test " + key + " for " + dir + " range with value set to the midpoint (" + oldVal + ")");
// Same again:
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for " + dir + " range");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for " + dir + " range");
// Start at maximum:
elem.value = oldVal = maximum(elem);
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for " + dir + " range with value set to the maximum (" + oldVal + ")");
is(elem.value, String(expectedVal), "Test " + key + " for " + dir + " range with value set to the maximum (" + oldVal + ")");
// Same again:
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for " + dir + " range");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for " + dir + " range");
// Start at minimum:
elem.value = oldVal = minimum(elem);
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for " + dir + " range with value set to the minimum (" + oldVal + ")");
is(elem.value, String(expectedVal), "Test " + key + " for " + dir + " range with value set to the minimum (" + oldVal + ")");
// Same again:
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for " + dir + " range");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for " + dir + " range");
// Test for a step value that is greater than 10% of the range:
elem.step = 20;
elem.value = 60;
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for " + dir + " range with a step that is greater than 10% of the range (step=" + elem.step + ")");
is(elem.value, String(expectedVal), "Test " + key + " for " + dir + " range with a step that is greater than 10% of the range (step=" + elem.step + ")");
// Same again:
expectedVal = expectedFunc(elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for " + dir + " range");
is(elem.value, String(expectedVal), "Test repeat of " + key + " for " + dir + " range");
// reset step:
elem.step = 2;

View File

@ -43,11 +43,11 @@ SimpleTest.waitForFocus(function() {
SimpleTest.finish();
});
const MIDDLE_OF_RANGE = 50;
const MINIMUM_OF_RANGE = 0;
const MAXIMUM_OF_RANGE = 100;
const QUARTER_OF_RANGE = 25;
const THREE_QUARTERS_OF_RANGE = 75;
const MIDDLE_OF_RANGE = "50";
const MINIMUM_OF_RANGE = "0";
const MAXIMUM_OF_RANGE = "100";
const QUARTER_OF_RANGE = "25";
const THREE_QUARTERS_OF_RANGE = "75";
function flush() {
// Flush style, specifically to flush the 'direction' property so that the

View File

@ -47,16 +47,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=597650
testControl(label, inputH, type, true);
testControl(labelForH, inputH, type, true);
} else {
testControl(label, inputI, type, false);
testControl(labelForH, undefined, type, false);
testControl(label, inputI, type, false);
testControl(labelForH, null, type, false);
inputH.type = "text";
testControl(label, inputH, "text", true);
testControl(labelForH, inputH, "text", true);
inputH.type = type;
testControl(label, inputI, type, false);
testControl(labelForH, undefined, type, false);
testControl(label, inputI, type, false);
testControl(labelForH, null, type, false);
label.removeChild(inputH);
testControl(label, inputI, "text", true);

View File

@ -31,7 +31,7 @@ function checkFormIDLAttribute(aElement)
function checkAttribute(aElement, aAttribute, aNewValue, aExpectedValueForIDL)
{
var expectedValueForIDL = aNewValue;
var expectedValueForContent = aNewValue;
var expectedValueForContent = String(aNewValue);
if (aExpectedValueForIDL !== undefined) {
expectedValueForIDL = aExpectedValueForIDL;
@ -53,8 +53,8 @@ function checkAttribute(aElement, aAttribute, aNewValue, aExpectedValueForIDL)
}
} else {
aElement.removeAttribute(aAttribute);
is(aElement.getAttribute(aAttribute), expectedValueForContent,
aAttribute + " content attribute should be " + expectedValueForContent);
is(aElement.getAttribute(aAttribute), null,
aAttribute + " content attribute should be null");
is(aElement[aAttribute], expectedValueForIDL,
aAttribute + " IDL attribute should be " + expectedValueForIDL);
}

View File

@ -106,12 +106,12 @@ function checkFormIDLAttribute(element)
function checkHtmlForIDLAttribute(element)
{
is(element.htmlFor, 'a b',
is(String(element.htmlFor), 'a b',
"htmlFor IDL attribute should reflect the for content attribute");
// DOMSettableTokenList is tested in another bug so we just test assignation
element.htmlFor.value = 'a b c';
is(element.htmlFor, 'a b c', "htmlFor should have changed");
is(String(element.htmlFor), 'a b c', "htmlFor should have changed");
}
function submitForm()

View File

@ -35,7 +35,7 @@ function checkFormIDLAttribute(aElement)
function checkAttribute(aElement, aAttribute, aNewValue, aExpectedValueForIDL)
{
var expectedValueForIDL = aNewValue;
var expectedValueForContent = aNewValue;
var expectedValueForContent = String(aNewValue);
if (aExpectedValueForIDL !== undefined) {
expectedValueForIDL = aExpectedValueForIDL;
@ -57,8 +57,8 @@ function checkAttribute(aElement, aAttribute, aNewValue, aExpectedValueForIDL)
}
} else {
aElement.removeAttribute(aAttribute);
is(aElement.getAttribute(aAttribute), expectedValueForContent,
aAttribute + " content attribute should be " + expectedValueForContent);
is(aElement.getAttribute(aAttribute), null,
aAttribute + " content attribute should be null");
is(aElement[aAttribute], expectedValueForIDL,
aAttribute + " IDL attribute should be " + expectedValueForIDL);
}

View File

@ -423,44 +423,44 @@ for (var test of data) {
// When step=0, the allowed value step is 1.
input.step = '0';
input.value = '1.2';
is(input.value, 1, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '1', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.value = '1';
is(input.value, 1, "check that the value coincides with a step");
is(input.value, '1', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = '0';
is(input.value, 0, "check that the value coincides with a step");
is(input.value, '0', "check that the value coincides with a step");
checkValidity(input, true, apply);
// When step is NaN, the allowed step value is 1.
input.step = 'foo';
input.value = '1';
is(input.value, 1, "check that the value coincides with a step");
is(input.value, '1', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = '1.5';
is(input.value, 2, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '2', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
// When step is negative, the allowed step value is 1.
input.step = '-0.1';
is(input.value, 2, "check that the value still coincides with a step");
is(input.value, '2', "check that the value still coincides with a step");
checkValidity(input, true, apply);
input.value = '1';
is(input.value, 1, "check that the value coincides with a step");
is(input.value, '1', "check that the value coincides with a step");
checkValidity(input, true, apply);
// When step is missing, the allowed step value is 1.
input.removeAttribute('step');
input.value = '1.5';
is(input.value, 2, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '2', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.value = '1';
is(input.value, 1, "check that the value coincides with a step");
is(input.value, '1', "check that the value coincides with a step");
checkValidity(input, true, apply);
// When step is 'any', all values are fine wrt to step.
@ -469,132 +469,132 @@ for (var test of data) {
input.step = 'aNy';
input.value = '97';
is(input.value, 97, "check that the value for step=aNy is unchanged");
is(input.value, '97', "check that the value for step=aNy is unchanged");
checkValidity(input, true, apply);
input.step = 'AnY';
input.value = '0.1';
is(input.value, 0.1, "check that a positive fractional value with step=AnY is unchanged");
is(input.value, '0.1', "check that a positive fractional value with step=AnY is unchanged");
checkValidity(input, true, apply);
input.step = 'ANY';
input.min = -100;
input.value = '-13.37';
is(input.value, -13.37, "check that a negative fractional value with step=ANY is unchanged");
is(input.value, '-13.37', "check that a negative fractional value with step=ANY is unchanged");
checkValidity(input, true, apply);
// When min is set to a valid float, there is a step base.
input.min = '1'; // the step base
input.step = '2';
input.value = '3';
is(input.value, 3, "check that the value coincides with a step");
is(input.value, '3', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = '2';
is(input.value, 3, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '3', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.value = '1.99';
is(input.value, 1, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '1', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.removeAttribute('step'); // step = 1
input.min = '0.5'; // step base
input.value = '5.5';
is(input.value, 5.5, "check that the value coincides with a step");
is(input.value, '5.5', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = '1';
is(input.value, 1.5, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '1.5', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.min = '-0.1'; // step base
input.step = '1';
input.value = '0.9';
is(input.value, 0.9, "the value should be a valid step");
is(input.value, '0.9', "the value should be a valid step");
checkValidity(input, true, apply);
input.value = '0.1';
is(input.value, -0.1, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '-0.1', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
// When min is set to NaN, the step base is the value.
input.min = 'foo';
input.step = '1';
input.value = '1';
is(input.value, 1, "check that the value coincides with a step");
is(input.value, '1', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = '0.5';
is(input.value, 1, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '1', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.min = '';
input.value = '1';
is(input.value, 1, "check that the value coincides with a step");
is(input.value, '1', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = '0.5';
is(input.value, 1, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '1', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.removeAttribute('min');
// Test when the value isn't a number
input.value = '';
is(input.value, 50, "value be should default to the value midway between the minimum (0) and the maximum (100)");
is(input.value, '50', "value be should default to the value midway between the minimum (0) and the maximum (100)");
checkValidity(input, true, apply);
// Regular situations.
input.step = '2';
input.value = '1.5';
is(input.value, 2, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '2', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.value = '42.0';
is(input.value, 42, "check that the value coincides with a step");
is(input.value, '42.0', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.step = '0.1';
input.value = '-0.1';
is(input.value, 0, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '0', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.step = '2';
input.removeAttribute('min');
input.max = '10';
input.value = '-9';
is(input.value, 0, "check the value is clamped to the minimum's default of zero");
is(input.value, '0', "check the value is clamped to the minimum's default of zero");
checkValidity(input, true, apply);
// If @value is defined but not @min, the step base is @value.
input = getFreshElement(test.type);
input.setAttribute('value', '1');
input.step = 2;
is(input.value, 1, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '1', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
input.value = 3;
is(input.value, 3, "check that the value coincides with a step");
is(input.value, '3', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = 2;
is(input.value, 3, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '3', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
// Should also work with defaultValue.
input = getFreshElement(test.type);
input.defaultValue = 1;
input.step = 2;
is(input.value, 1, "check that the value coincides with a step");
is(input.value, '1', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = 3;
is(input.value, 3, "check that the value coincides with a step");
is(input.value, '3', "check that the value coincides with a step");
checkValidity(input, true, apply);
input.value = 2;
is(input.value, 3, "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
is(input.value, '3', "check that the value changes to the nearest valid step, choosing the higher step if both are equally close");
checkValidity(input, true, apply);
// Check contrived error case where there are no valid steps in range:
@ -604,7 +604,7 @@ for (var test of data) {
input.step = '3';
input.max = '1';
input.defaultValue = '-1';
is(input.value, 0, "the value should have been clamped to the default minimum, zero");
is(input.value, '0', "the value should have been clamped to the default minimum, zero");
checkValidity(input, false, apply, {low: -1, high: -1});
// Check that when the closest of the two steps that the value is between
@ -614,7 +614,7 @@ for (var test of data) {
input.min = '1';
input.max = '10.9';
input.value = '10.8'; // closest step in 11, but 11 > maximum
is(input.value, 9, "check that the value coincides with a step");
is(input.value, '9', "check that the value coincides with a step");
// The way that step base is defined, the converse (the value not being
// on a step, and the nearest step being a value that would be underflow)

View File

@ -185,9 +185,15 @@ function checkDateGet()
for (data of invalidData) {
element.value = data[0];
is(element.valueAsDate, data[1] ? "Invalid Date" : null,
"valueAsDate should return null " +
"when the element value is not a valid date");
if (data[1]) {
is(String(element.valueAsDate), "Invalid Date",
"valueAsDate should return an invalid Date object " +
"when the element value is not a valid date");
} else {
is(element.valueAsDate, null,
"valueAsDate should return null " +
"when the element value is not a valid date");
}
}
}

View File

@ -150,11 +150,11 @@ function checkNumberSet()
// Setting a string will set NaN.
["foo", ""],
// "" is converted to 0.
["", 0],
["", "0"],
[42, "42"], // Keep this here, it is used by the next test.
// Setting Infinity should throw and not change the current value.
[Infinity, 42, true],
[-Infinity, 42, true],
[Infinity, "42", true],
[-Infinity, "42", true],
// Setting NaN should change the value to the empty string.
[NaN, ""],
];
@ -225,7 +225,7 @@ function checkRangeSet()
{
var min = -200;
var max = 200;
var defaultValue = min + (max - min)/2;
var defaultValue = String(min + (max - min)/2);
var testData =
[

View File

@ -34,7 +34,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1045270
SimpleTest.executeSoon(function() {
synthesizeKey("2", {});
SimpleTest.executeSoon(function() {
is(input.value, 12, "Reframe should restore focus and selection properly");
is(input.value, "12", "Reframe should restore focus and selection properly");
SimpleTest.finish();
});
});

View File

@ -25,12 +25,12 @@
form2.insertBefore(newInput, F2I2);
form1.insertBefore(newInput, form1.firstChild);
is(form1.elements.length, "3", "Form 1 has the correct length");
is(form1.elements.length, 3, "Form 1 has the correct length");
is(form1.elements[0].value, "13", "Form 1 element 1 is correct");
is(form1.elements[1].value, "11", "Form 1 element 2 is correct");
is(form1.elements[2].value, "12", "Form 1 element 3 is correct");
is(form2.elements.length, "2", "Form 2 has the correct length");
is(form2.elements.length, 2, "Form 2 has the correct length");
is(form2.elements[0].value, "21", "Form 2 element 1 is correct");
is(form2.elements[1].value, "22", "Form 2 element 2 is correct");
</script>

View File

@ -45,11 +45,11 @@
var form1 = document.getElementById("form1");
var form2 = document.getElementById("form2");
is(form1.elements.length, "2", "Form 1 has the correct length");
is(form1.elements.length, 2, "Form 1 has the correct length");
is(form1.elements[0].value, "12", "Form 1 element 1 is correct");
is(form1.elements[1].value, "10", "Form 1 element 2 is correct");
is(form2.elements.length, "3", "Form 2 has the correct length");
is(form2.elements.length, 3, "Form 2 has the correct length");
is(form2.elements[0].value, "11", "Form 2 element 1 is correct");
is(form2.elements[1].value, "21", "Form 2 element 2 is correct");
is(form2.elements[2].value, "22", "Form 2 element 2 is correct");

View File

@ -16,7 +16,7 @@
var form1 = document.getElementById("form1");
form1.insertBefore(input2, input1);
is(form1.elements["input"].length, "3", "Form 1 'input' has the correct length");
is(form1.elements["input"].length, 3, "Form 1 'input' has the correct length");
is(form1.elements["input"][0].value, "2", "Form 1 element 1 is correct");
is(form1.elements["input"][1].value, "1", "Form 1 element 2 is correct");
is(form1.elements["input"][2].value, "3", "Form 1 element 3 is correct");

View File

@ -16,7 +16,7 @@
var form1 = document.getElementById("form1");
form1.insertBefore(input2, input1);
is(form1.elements["input"].length, "3", "Form 1 'input' has the correct length");
is(form1.elements["input"].length, 3, "Form 1 'input' has the correct length");
is(form1.elements["input"][0].value, "2", "Form 1 element 1 is correct");
is(form1.elements["input"][1].value, "1", "Form 1 element 2 is correct");
is(form1.elements["input"][2].value, "3", "Form 1 element 3 is correct");

View File

@ -16,7 +16,7 @@
var form1 = document.getElementById("form1");
form1.insertBefore(input2, input1);
is(form1.elements["input"].length, "3", "Form 1 'input' has the correct length");
is(form1.elements["input"].length, 3, "Form 1 'input' has the correct length");
is(form1.elements["input"][0].value, "2", "Form 1 element 1 is correct");
is(form1.elements["input"][1].value, "1", "Form 1 element 2 is correct");

View File

@ -41,7 +41,7 @@
form1.insertBefore(input8, input4);
form1.insertBefore(input9, input2);
is(form1.elements["input"].length, "10", "Form 1 'input' has the correct length");
is(form1.elements["input"].length, 10, "Form 1 'input' has the correct length");
is(form1.elements["input"][0].value, "9", "Form 1 element 1 is correct");
is(form1.elements["input"][1].value, "2", "Form 1 element 2 is correct");
is(form1.elements["input"][2].value, "1", "Form 1 element 3 is correct");

View File

@ -28,7 +28,7 @@ sel.options.remove(0);
sel.options.remove(1000);
sel.options.remove(-1);
is(sel.length, 1, "Unexpected option collection length");
is(sel[0].value, 10, "Unexpected remained option");
is(sel[0].value, "10", "Unexpected remained option");
</script>
</pre>
</body>

View File

@ -28,7 +28,7 @@ function checkNegativeMaxLength(element)
element.setAttribute('maxLength', -15);
is(element.maxLength, -1, "negative maxLength is not processed correctly when set dynamically");
is(element.getAttribute('maxLength'), -15, "maxLength attribute doesn't return the correct value");
is(element.getAttribute('maxLength'), "-15", "maxLength attribute doesn't return the correct value");
element.setAttribute('maxLength', 0);
is(element.maxLength, 0, "negative maxLength is not processed correctly");

View File

@ -40,7 +40,7 @@ function checkNegativeMaxLengthException(element)
}
ok(caught, "Setting negative maxLength from the DOM should throw an exception");
is(element.getAttribute('maxLength'), -10, "When the exception is raised, the maxLength attribute shouldn't change");
is(element.getAttribute('maxLength'), "-10", "When the exception is raised, the maxLength attribute shouldn't change");
}
/* TODO: correct behavior may be checked for email, telephone, url and search input types */

View File

@ -32,25 +32,25 @@ function checkSizeReflection(element, defaultValue)
element.setAttribute('size', -15);
is(element.size, defaultValue,
"The reflecting IDL attribute should return the default value when content attribute value is invalid");
is(element.getAttribute('size'), -15,
is(element.getAttribute('size'), "-15",
"The content attribute should containt the previously set value");
element.setAttribute('size', 0);
is(element.size, 0,
"0 should be considered as a valid value");
is(element.getAttribute('size'), 0,
is(element.getAttribute('size'), "0",
"The content attribute should containt the previously set value");
element.setAttribute('size', 2147483647); /* PR_INT32_MAX */
is(element.size, 2147483647,
"PR_INT32_MAX should be considered as a valid value");
is(element.getAttribute('size'), 2147483647,
is(element.getAttribute('size'), "2147483647",
"The content attribute should containt the previously set value");
element.setAttribute('size', -2147483648); /* PR_INT32_MIN */
is(element.size, defaultValue,
"The reflecting IDL attribute should return the default value when content attribute value is invalid");
is(element.getAttribute('size'), -2147483648,
is(element.getAttribute('size'), "-2147483648",
"The content attribute should containt the previously set value");
element.setAttribute('size', 'non-numerical-value');
@ -62,13 +62,13 @@ function checkSizeReflection(element, defaultValue)
element.setAttribute('size', 4294967294); /* PR_INT32_MAX * 2 */
is(element.size, defaultValue,
"Value greater than PR_INT32_MAX should be considered as invalid");
is(element.getAttribute('size'), 4294967294,
is(element.getAttribute('size'), "4294967294",
"The content attribute should containt the previously set value");
element.setAttribute('size', -4294967296); /* PR_INT32_MIN * 2 */
is(element.size, defaultValue,
"The reflecting IDL attribute should return the default value when content attribute value is invalid");
is(element.getAttribute('size'), -4294967296,
is(element.getAttribute('size'), "-4294967296",
"The content attribute should containt the previously set value");
element.size = defaultValue + 1;
@ -135,7 +135,7 @@ function checkSizeWhenChangeMultiple(element, aDefaultNonMultiple, aDefaultMulti
s.multiple = true;
is(s.size, aDefaultMultiple, "Size IDL attribute should be 4");
is(s.getAttribute('size'), -1, "Size content attribute should be -1");
is(s.getAttribute('size'), "-1", "Size content attribute should be -1");
s.setAttribute('size', -2);
is(s.size, aDefaultMultiple, "Size IDL attribute should be 4");
@ -143,7 +143,7 @@ function checkSizeWhenChangeMultiple(element, aDefaultNonMultiple, aDefaultMulti
s.multiple = false;
is(s.size, aDefaultNonMultiple, "Size IDL attribute should be 1");
is(s.getAttribute('size'), -2, "Size content attribute should be -2");
is(s.getAttribute('size'), "-2", "Size content attribute should be -2");
}
var s = document.getElementById('s');

View File

@ -26,18 +26,18 @@ addLoadEvent(runTests);
var testData = [
// Object 0
[ 0, null, "-1" ],
[ 0, "1", "1" ],
[ 0, "-1", "-1" ],
[ 0, "0", "0" ],
[ 0, "foo", "-1" ],
[ 0, null, -1 ],
[ 0, "1", 1 ],
[ 0, "-1", -1 ],
[ 0, "0", 0 ],
[ 0, "foo", -1 ],
// Object 1
[ 1, null, "-1" ],
[ 1, "1", "1" ],
[ 1, null, -1 ],
[ 1, "1", 1 ],
// Object 2
[ 2, null, "0" ],
[ 2, "1", "1" ],
[ 2, "-1", "-1" ],
[ 2, null, 0 ],
[ 2, "1", 1 ],
[ 2, "-1", -1 ],
];
var objects = document.getElementsByTagName("object");

Binary file not shown.

View File

@ -31,7 +31,8 @@ p = document.getElementById("content");
// Test that several elements with the same id or name behave correctly
function testNumSame() {
is(document.all.id0, null, "no ids");
is(document.all.id0, undefined, "no ids");
is(document.all.namedItem("id0"), null, "no ids");
is(document.all.id1, p.children[0], "one id");
is(document.all.id2[0], p.children[1], "two ids");
is(document.all.id2[1], p.children[2], "two ids");
@ -79,7 +80,8 @@ id3list = document.all.id3;
rC(child[3]);
is(id3list.length, 1, "now one length");
rC(child[5]);
is(document.all.id3, null, "now none");
is(document.all.id3, undefined, "now none");
is(document.all.namedItem("id3"), null, "now none (namedItem)");
is(id3list.length, 0, "now none length");
// Give an element both a name and id and check that it appears in two lists
@ -135,7 +137,8 @@ elementNames.forEach(function (name) {
hasName.shift();
}
else {
is(document.all[nameval], null, "shouldn't have name");
is(document.all[nameval], undefined, "shouldn't have name");
is(document.all.namedItem(nameval), null, "shouldn't have name (namedItem)");
}
});
is(hasName.length, 0, "found all names");

View File

@ -332,7 +332,7 @@ function workerScript() {
return "undefined";
}
if (o === null) {
if (_thing_ === null) {
return "null";
}

View File

@ -71,7 +71,7 @@
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, null, "Got no data");
is(event.target.result, undefined, "Got no data");
request = objectStore.add(data.value, data.key);
request.onsuccess = grabEventAndContinueHandler;

View File

@ -49,7 +49,7 @@ function testSteps()
event = yield undefined;
is(event.type, "success", "expect a success event");
is(event.target, request, "event has right target");
is(event.target.result, null, "event should have no result");
is(event.target.result, undefined, "event should have no result");
openRequest.onsuccess = grabEventAndContinueHandler;

View File

@ -202,7 +202,7 @@ function testSteps()
cursor.continue();
}
event = yield undefined;
is(event.target.result, undefined, "no more results expected");
is(event.target.result, null, "no more results expected");
var nan = 0/0;
var invalidKeys = [

View File

@ -90,7 +90,7 @@ function testSteps()
req.result.continue();
}
e = yield undefined;
is(req.result, undefined, "exhausted indexes");
ok(req.result == null, "exhausted indexes");
let tempIndex = store.createIndex("temp index", "x", { multiEntry: true });
req = tempIndex.openKeyCursor();
@ -102,7 +102,7 @@ function testSteps()
req.result.continue();
}
e = yield undefined;
is(req.result, undefined, "exhausted temp index");
ok(req.result == null, "exhausted temp index");
store.deleteIndex("temp index");
}
@ -186,7 +186,7 @@ function testSteps()
req.result.continue();
}
e = yield undefined;
is(req.result, undefined, "exhausted indexes");
ok(req.result == null, "exhausted indexes");
let tempIndex = store.createIndex("temp index", "x", { multiEntry: true, unique: true });
req = tempIndex.openKeyCursor();
@ -198,7 +198,7 @@ function testSteps()
req.result.continue();
}
e = yield undefined;
is(req.result, undefined, "exhausted temp index");
ok(req.result == null, "exhausted temp index");
store.deleteIndex("temp index");
}

View File

@ -51,7 +51,7 @@ function testSteps()
request.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
is(event.target.result, null, "Got no data");
is(event.target.result, undefined, "Got no data");
request = objectStore.add(data.value, data.key);
request.onsuccess = grabEventAndContinueHandler;

View File

@ -73,7 +73,7 @@ function testSteps()
request = objectStore.openCursor();
request.onerror = errorHandler;
request.onsuccess = function(event) {
is(event.target.result, undefined, "ObjectStore shouldn't have any items");
is(event.target.result, null, "ObjectStore shouldn't have any items");
testGenerator.send(event);
}
event = yield undefined;

View File

@ -46,7 +46,6 @@ function testSteps()
event = yield undefined;
is(event.type, "abort", "Got transaction abort event");
is(event.target, transaction, "Right target");
is(event.target.transaction, null, "No transaction");
is(db.version, 0, "Correct version");
is(db.objectStoreNames.length, 0, "Correct objectStoreNames length");

View File

@ -35,7 +35,7 @@ function testSteps()
db1.addEventListener("versionchange", function(event) {
ok(true, "Got version change event");
ok(event instanceof IDBVersionChangeEvent, "Event is of the right type");
is(event.target.source, null, "Correct source");
is("source" in event.target, false, "Correct source");
is(event.target, db1, "Correct target");
is(event.target.version, 1, "Correct db version");
is(event.oldVersion, 1, "Correct event oldVersion");
@ -70,7 +70,7 @@ function testSteps()
db2.addEventListener("versionchange", function(event) {
ok(true, "Got version change event");
ok(event instanceof IDBVersionChangeEvent, "Event is of the right type");
is(event.target.source, null, "Correct source");
is("source" in event.target, false, "Correct source");
is(event.target, db2, "Correct target");
is(event.target.version, 2, "Correct db version");
is(event.oldVersion, 2, "Correct event oldVersion");

View File

@ -21,7 +21,7 @@ function startTest(test, token) {
manager.started(token);
var a1 = new Audio(test.name);
is(a1.getAttribute("preload"), "auto", "Preload automatically set to auto");
is(a1.src.match("/[^/]+$"), "/" + test.name, "src OK");
ok(a1.src.endsWith("/" + test.name), "src OK");
manager.finished(token);
}

View File

@ -24,10 +24,10 @@ var v1 = document.getElementById('v1');
var a1 = document.getElementById('a1');
var v2 = document.getElementById('v2');
var a2 = document.getElementById('a2');
is(v1.getAttribute("preload"), undefined, "video preload via getAttribute should be undefined by default");
is(a1.getAttribute("preload"), undefined, "video preload via getAttribute should be undefined by default");
is(v1.preload, "", "v1.preload should be undefined by default");
is(a1.preload, "", "a1.preload should be undefined by default");
is(v1.getAttribute("preload"), null, "video preload via getAttribute should be null by default");
is(a1.getAttribute("preload"), null, "video preload via getAttribute should be null by default");
is(v1.preload, "", "v1.preload should be empty by default");
is(a1.preload, "", "a1.preload should be empty by default");
is(v2.preload, "auto", "v2.preload should be auto");
is(a2.preload, "auto", "a2.preload should be auto");

View File

@ -187,7 +187,7 @@ SpecialPowers.pushPrefEnv({"set": [["media.webvtt.regions.enabled", true]]},
// Check that we can create and add new VTTCues
var vttCue = new VTTCue(3.999, 4, "foo");
is(vttCue.track, undefined, "Cue's track should be undefined.");
is(vttCue.track, null, "Cue's track should be null.");
trackElement.track.addCue(vttCue);
is(cue.track, trackElement.track, "Cue's track should be defined.");
is(cueList.length, 7, "Cue list length should now be 7.");

View File

@ -53,8 +53,8 @@ var commandsCheckDataChannel = [
},
function SEND_BLOB(test) {
var contents = ["At vero eos et accusam et justo duo dolores et ea rebum."];
var blob = new Blob(contents, { "type" : "text/plain" });
var contents = "At vero eos et accusam et justo duo dolores et ea rebum.";
var blob = new Blob([contents], { "type" : "text/plain" });
return test.send(blob).then(result => {
ok(result.data instanceof Blob, "Received data is of instance Blob");

View File

@ -33,7 +33,13 @@
is(reflector[prop], prop, "Property " + prop);
}
for (i = -10; i < 10; ++i) {
for (i = -10; i < 0; ++i) {
is(reflector[i], String(i), "Property " + i);
prop = "prop" + i;
is(reflector[prop], prop, "Property " + prop);
}
for (i = 0; i < 10; ++i) {
is(reflector[i], i, "Property " + i);
prop = "prop" + i;
is(reflector[prop], prop, "Property " + prop);

View File

@ -34,7 +34,7 @@
ok(isNaN(plugin.propertyAndMethod + 0), "Shouldn't be set yet!");
plugin.propertyAndMethod = 5;
is(plugin.propertyAndMethod, 5, "Should be set to 5!");
is(+plugin.propertyAndMethod, 5, "Should be set to 5!");
delete pluginProto.propertyAndMethod;
ok(isNaN(plugin.propertyAndMethod + 0), "Shouldn't be set any more!");

View File

@ -70,23 +70,23 @@ function equals(o1, o2) {
function observer1(setting) {
is(setting.settingName, "screen.brightness", "Same settingName");
is(setting.settingValue, "0.7", "Same settingvalue");
is(setting.settingValue, 0.7, "Same settingvalue");
};
function observer2(setting) {
is(setting.settingName, "screen.brightness", "Same settingName");
is(setting.settingValue, "0.7", "Same settingvalue");
is(setting.settingValue, 0.7, "Same settingvalue");
};
function observerWithNext(setting) {
is(setting.settingName, "screen.brightness", "Same settingName");
is(setting.settingValue, "0.7", "Same settingvalue");
is(setting.settingValue, 0.7, "Same settingvalue");
next();
};
function onsettingschangeWithNext(event) {
is(event.settingName, "screen.brightness", "Same settingName");
is(event.settingValue, "0.7", "Same settingvalue");
is(event.settingValue, 0.7, "Same settingvalue");
next();
};

View File

@ -38,13 +38,13 @@ function onFailure() {
function observer1(setting) {
dump("observer 1 called!\n");
is(setting.settingName, "screen.brightness", "Same settingName");
is(setting.settingValue, "0.7", "Same settingvalue");
is(setting.settingValue, 0.7, "Same settingvalue");
};
function observer2(setting) {
dump("observer 2 called!\n");
is(setting.settingName, "screen.brightness", "Same settingName");
is(setting.settingValue, "0.7", "Same settingvalue");
is(setting.settingValue, 0.7, "Same settingvalue");
};
var calls = 0;
@ -56,14 +56,14 @@ function observerOnlyCalledOnce(setting) {
function observerWithNext(setting) {
dump("observer with next called!\n");
is(setting.settingName, "screen.brightness", "Same settingName");
is(setting.settingValue, "0.7", "Same settingvalue");
is(setting.settingValue, 0.7, "Same settingvalue");
next();
};
function onsettingschangeWithNext(event) {
dump("onsettingschangewithnext called!\n");
is(event.settingName, "screen.brightness", "Same settingName");
is(event.settingValue, "0.7", "Same settingvalue");
is(event.settingValue, 0.7, "Same settingvalue");
next();
};

View File

@ -28,30 +28,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=302971
// ordinary
rect.setAttribute("stroke-width", "5");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 5, "Ordinary");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "5", "Ordinary");
// valid exponential notation
rect.setAttribute("stroke-width", "4E1");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 40, "Exponent");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "40", "Exponent");
rect.setAttribute("stroke-width", "6e1");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 60, "Lower-case Exponent");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "60", "Lower-case Exponent");
rect.setAttribute("stroke-width", "2E+1");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 20, "Positive Exponent");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "20", "Positive Exponent");
rect.setAttribute("stroke-width", "100E-1");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 10, "Negative Exponent");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "10", "Negative Exponent");
rect.setAttribute("stroke-width", "0.7E1");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 7, "Floating Point with Exponent");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "7", "Floating Point with Exponent");
rect.setAttribute("stroke-width", "50.0E-1");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 5, "Floating Point with Negative Exponent");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "5", "Floating Point with Negative Exponent");
rect.setAttribute("stroke-width", "0.8E+1");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), 8, "Floating Point with Positive Exponent");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "8", "Floating Point with Positive Exponent");
rect.setAttribute("stroke-width", "4E1px");
is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "40px", "Units");

View File

@ -97,16 +97,16 @@ function messageReceiver(evt) {
switch (testNumber) {
case 1:
is(testResult, 1, "Props on new window should be preserved when loading");
is(testResult, "1", "Props on new window should be preserved when loading");
break;
case 2:
is(testResult, 2, "Props on new window should be preserved when writing");
is(testResult, "2", "Props on new window should be preserved when writing");
break;
case 3:
is(testResult, 3, "Props on window opened from new window should be preserved when loading");
is(testResult, "3", "Props on window opened from new window should be preserved when loading");
break;
case 4:
is(testResult, 4, "Props on window opened from new window should be preserved when writing");
is(testResult, "4", "Props on window opened from new window should be preserved when writing");
break;
case 5:
is(testResult, "undefined", "Props on new window's child should go away when loading");
@ -115,7 +115,7 @@ function messageReceiver(evt) {
is(testResult, "undefined", "Props on new window's child should go away when writing");
break;
case 7:
is(testResult, 7, "Props on different-domain window opened from different-domain new window can stay");
is(testResult, "7", "Props on different-domain window opened from different-domain new window can stay");
break;
case 9:
is(testResult, "undefined", "Props on different-domain new window's child should go away when loading");

View File

@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=437361
is(true, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
var rv = window.showModalDialog( // should be blocked without exception
"data:text/html,<html><body onload='close(); returnValue = 1;' /></html>");
is(rv, undefined, "Modal dialog opened unexpectedly.");
is(rv, null, "Modal dialog opened unexpectedly.");
}
function testModalDialogAllowed() {

View File

@ -30,7 +30,7 @@ function runTest() {
result = window.showModalDialog("http://test1.example.com/tests/dom/tests/mochitest/bugs/file_bug504862.html", "my args");
is(result, null, "Able to see return value from cross origin dialog.");
is(result, undefined, "Able to see return value from cross origin dialog.");
SimpleTest.finish();
}

View File

@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=531176
var errorCount = 0;
function errorHandler(msg, filename, linenr) {
is(msg, "SyntaxError: expected expression, got ';'", "Wrong error!");
is(filename, window.location, "Wrong filename!");
is(filename, String(window.location), "Wrong filename!");
is(linenr, 1, "Wrong linenr!");
++errorCount;
}
@ -35,7 +35,7 @@ is(errorCount, 1, "Error handler should have been called! (1)");
function recursiveHandler(msg, filename, linenr) {
is(msg, "SyntaxError: expected expression, got ';'", "Wrong error!");
is(filename, window.location, "Wrong filename!");
is(filename, String(window.location), "Wrong filename!");
is(linenr, 1, "Wrong linenr!");
++errorCount;
document.body.setAttribute("onclick", "var z=;");

View File

@ -21,7 +21,7 @@ SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
/** Test for Bug 581072 **/
var longTimerFired = 0;
var longTimerFired = false;
// Set up a one-hour timeout
setTimeout(function() { longTimerFired = true; }, 3600000);

View File

@ -42,7 +42,7 @@ function iframeLoaded(identifier) {
}
else if (loadCount == 2) {
// Test 1: Check that this page is the referer.
is(iframeCw.document.referrer, document.location, 'outer iframe referrer');
is(iframeCw.document.referrer, String(document.location), 'outer iframe referrer');
// Test 2: file_bug593174_2.html itself contains an iframe, whose src is a
// data: uri. Call into that inner iframe and have it set its
@ -53,7 +53,7 @@ function iframeLoaded(identifier) {
iframeCw.navigateInnerIframe();
}
else if (loadCount == 3) {
is(iframeCw.getInnerIframeReferrer(), iframeCw.location, 'inner iframe referrer');
is(iframeCw.getInnerIframeReferrer(), String(iframeCw.location), 'inner iframe referrer');
// Now do the test again, this time with a popup.
popup = window.open('file_bug593174_1.html');
@ -66,11 +66,11 @@ function iframeLoaded(identifier) {
popup.location = 'file_bug593174_2.html';
}
else if (loadCount == 5) {
is(popup.document.referrer, document.location, 'popup referrer after replaceState');
is(popup.document.referrer, String(document.location), 'popup referrer after replaceState');
popup.navigateInnerIframe();
}
else if (loadCount == 6) {
is(popup.getInnerIframeReferrer(), popup.location, 'popup/inner iframe referrer');
is(popup.getInnerIframeReferrer(), String(popup.location), 'popup/inner iframe referrer');
popup.close();
history.replaceState('', '', kOriginalLocation);
SimpleTest.finish();

View File

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=862540
/** Test for Bug 862540 **/
window.status = 5;
is(window.status, 5, "Should be able to get 5");
is(window.status, "5", "Should be able to get 5");
window.status = { toString: function() { return "foo"; } };
ok(window.status === "foo", "Should be coercing window.status to string");

View File

@ -22,16 +22,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=743049
/** Test for Bug 743049 **/
var expected = [
{ name: "Error", message: "foo", filename: location, lineNumber: 45 },
{ name: "Error", message: "foo", filename: String(location), lineNumber: 45 },
{ name: "Error", message: "foo", filename: "bar", lineNumber: 123 },
{ name: "", message: "uncaught exception: [object Object]" },
{ name: "DuckError", message: "foo", filename: "bar", lineNumber: 123 },
{ name: "", message: "uncaught exception: [object Object]" },
{ name: "", message: "foo", filename: "baz", lineNumber: 123 },
{ name: "", message: "uncaught exception: [object Object]" },
{ name: "InvalidStateError", message: "An attempt was made to use an object that is not, or is no longer, usable", filename: location, lineNumber: 62 },
{ name: "ReferenceError", message: "xxx is not defined", filename: location, lineNumber: 64 },
{ name: "ReferenceError", message: "xxx is not defined", filename: location, lineNumber: 66 }
{ name: "InvalidStateError", message: "An attempt was made to use an object that is not, or is no longer, usable", filename: String(location), lineNumber: 62 },
{ name: "ReferenceError", message: "xxx is not defined", filename: String(location), lineNumber: 64 },
{ name: "ReferenceError", message: "xxx is not defined", filename: String(location), lineNumber: 66 }
];
var counter = 0;

View File

@ -34,7 +34,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
try {
var css = Components.utils.evalInSandbox("CSSStyleDeclaration", sandbox);
is(css.prototype, "[object CSSStyleDeclarationPrototype]", "'CSSStyleDeclaration.prototype' in a sandbox should return the CSSStyleDeclaration interface prototype object");
is(String(css.prototype), "[object CSSStyleDeclarationPrototype]",
"'CSSStyleDeclaration.prototype' in a sandbox should return the CSSStyleDeclaration interface prototype object");
} catch (e) {
ok(false, "'CSSStyleDeclaration' shouldn't throw in a sandbox");
}
@ -84,7 +85,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
}
try {
var xhr = Components.utils.evalInSandbox("XMLHttpRequest", sandbox);
is(xhr, XMLHttpRequest + "", "'XMLHttpRequest' in a sandbox should return the XMLHttpRequest interface object");
is(String(xhr), String(XMLHttpRequest), "'XMLHttpRequest' in a sandbox should return the XMLHttpRequest interface object");
ok(isXrayWrapper(xhr.prototype), "Getting the prototype property on an Xray wrapper of an interface object should return an Xray wrapper");
isnot(Object.getOwnPropertyDescriptor(xhr, "UNSENT"), undefined,
"We should claim to have an UNSENT constant");

View File

@ -79,8 +79,8 @@ function doTest() {
privateWin.content.localStorage.removeItem("empty");
is(privateWin.content.localStorage.length, 0, "The storage has no keys");
is(privateWin.content.localStorage.getItem("empty"), null, "empty item is null (getItem())");
is(privateWin.content.localStorage["empty"], null, "empty item is undefined (array access)");
is(privateWin.content.localStorage.empty, null, "empty item is undefined (property access)");
is(privateWin.content.localStorage["empty"], undefined, "empty item is undefined (array access)");
is(privateWin.content.localStorage.empty, undefined, "empty item is undefined (property access)");
is(typeof privateWin.content.localStorage.getItem("empty"), "object", "getItem('empty') is object");
is(typeof privateWin.content.localStorage["empty"], "undefined", "['empty'] is undefined");
is(typeof privateWin.content.localStorage.empty, "undefined", "empty is undefined");

View File

@ -40,7 +40,7 @@ function startTest() {
// Removes the stored item.
localStorage.removeItem("item");
is(localStorage.getItem("item"), undefined,
is(localStorage.getItem("item"), null,
"getItem() after removing the item");
// Fails storing a new item.
@ -50,7 +50,7 @@ function startTest() {
} catch(e) {
ok(true, "Got an expected exception " + e);
} finally {
is(localStorage.getItem("newItem"), undefined,
is(localStorage.getItem("newItem"), null,
"setItem while device storage is low");
}

View File

@ -55,8 +55,8 @@ function install(next) {
ok(app.installTime <= Date.now() + fuzzySpan, "install time is before install success");
is(app.manifestURL, url, "manifest URL");
is(app.manifest.name, "Basic App", "manifest.name");
is(app.manifest.installs_allowed_from, "*",
"manifest.installs_allowed_from");
is(app.manifest.installs_allowed_from.length, 1, "allowed-from length must be 1");
is(app.manifest.installs_allowed_from[0], "*", "allowed from anywhere");
next();
}

View File

@ -55,8 +55,8 @@ function install(next) {
ok(app.installTime <= Date.now() + fuzzySpan, "install time is before install success");
is(app.manifestURL, url, "manifest URL");
is(app.manifest.name, "Basic App with Launch Paths", "manifest.name");
is(app.manifest.installs_allowed_from, "*",
"manifest.installs_allowed_from");
is(app.manifest.installs_allowed_from.length, 1, "allowed-from length must be 1");
is(app.manifest.installs_allowed_from[0], "*", "allowed from anywhere");
next();
}

View File

@ -58,7 +58,7 @@
if (finished) {
return;
}
is(iframe.location, "about:blank", "Wrong url!");
is(String(iframe.location), "about:blank", "Wrong url!");
is(suspended, true, "Not suspended?");
is(resumed, false, "Already resumed?!");
is(lastCount, oldMessageCount, "Received a message while suspended!");
@ -81,7 +81,7 @@
if (finished) {
return;
}
is(iframe.location, "about:blank", "Wrong url!");
is(String(iframe.location), "about:blank", "Wrong url!");
is(suspended, false, "Already suspended?");
is(resumed, false, "Already resumed?");
setCachePref(false);

View File

@ -14,17 +14,17 @@
<![CDATA[
var tests = [
[["One", "Two", "Three", "Four"], "", ["Four One Three Two"]],
[["One", "Two", "Three", "Four"], "integer", ["Four One Three Two"]],
[["One", "Two", "Three", "Four"], "descending", ["Two Three One Four"]],
[["One", "Two", "Three", "Four"], "descending integer", ["Two Three One Four"]],
[["One", "Two", "Three", "Four"], "integer cat descending", ["Two Three One Four"]],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "", ["1 12 13 170 2 2 222 240 7 98"]],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer", ["1 2 2 7 12 13 98 170 222 240"]],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "ascending integer", ["1 2 2 7 12 13 98 170 222 240"]],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer descending", ["240 222 170 98 13 12 7 2 2 1"]],
[["Cat", "cat", "Candy", "candy"], "comparecase", ["Candy Cat candy cat"]],
[["1", "102", "22", "One", "40", "Two"], "integer", ["1 22 40 102 One Two"]],
[["One", "Two", "Three", "Four"], "", "Four One Three Two"],
[["One", "Two", "Three", "Four"], "integer", "Four One Three Two"],
[["One", "Two", "Three", "Four"], "descending", "Two Three One Four"],
[["One", "Two", "Three", "Four"], "descending integer", "Two Three One Four"],
[["One", "Two", "Three", "Four"], "integer cat descending", "Two Three One Four"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "", "1 12 13 170 2 2 222 240 7 98"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer", "1 2 2 7 12 13 98 170 222 240"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "ascending integer", "1 2 2 7 12 13 98 170 222 240"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer descending", "240 222 170 98 13 12 7 2 2 1"],
[["Cat", "cat", "Candy", "candy"], "comparecase", "Candy Cat candy cat"],
[["1", "102", "22", "One", "40", "Two"], "integer", "1 22 40 102 One Two"],
];
SimpleTest.waitForExplicitFinish();

View File

@ -5,14 +5,14 @@ function isSpellingCheckOk(aEditor, aMisspelledWords) {
is(numWords, aMisspelledWords.length, "Correct number of misspellings and words.");
if (numWords != aMisspelledWords.length) {
if (numWords !== aMisspelledWords.length) {
return false;
}
for (var i = 0; i < numWords; ++i) {
var word = sel.getRangeAt(i);
var word = String(sel.getRangeAt(i));
is(word, aMisspelledWords[i], "Misspelling is what we think it is.");
if (word != aMisspelledWords[i]) {
if (word !== aMisspelledWords[i]) {
return false;
}
}

View File

@ -38,8 +38,8 @@ SimpleTest.waitForFocus(function() {
var sel = getSpellCheckSelection();
is(sel.rangeCount, 2, "We should have two misspelled words");
is(sel.getRangeAt(0), "fivee", "Correct misspelled word");
is(sel.getRangeAt(1), "sixx", "Correct misspelled word");
is(String(sel.getRangeAt(0)), "fivee", "Correct misspelled word");
is(String(sel.getRangeAt(1)), "sixx", "Correct misspelled word");
SimpleTest.finish();
},0);

Some files were not shown because too many files have changed in this diff Show More