mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1490783 [wpt PR 12976] - [testharness.js] Remove deprecated API, a=testonly
Automatic update from web-platform-tests[testharness.js] Remove deprecated API (#12976) [testharness.js] Remove deprecated API The testharness.js functions `assert_exists` and `assert_not_exists` have been labeled "deprecated" since 2012-01-31 [1]. Remove the functions and replace all existing references with equivalent assertions. [1] 1780607fc4582b65b7fcdded3e39e79e95c8d915 -- wpt-commits: efa1c1e224cf7910008d37477beb954d41448ace wpt-pr: 12976
This commit is contained in:
parent
9ae519eb8b
commit
9f27d208c1
@ -793,14 +793,6 @@ asserts that one `assert_func(actual, expected_array_N, extra_arg1, ..., extra_a
|
||||
allows multiple behaviours. Test authors should not use this method simply to hide
|
||||
UA bugs.
|
||||
|
||||
### `assert_exists(object, property_name, description)`
|
||||
**deprecated**
|
||||
asserts that object has an own property `property_name`
|
||||
|
||||
### `assert_not_exists(object, property_name, description)`
|
||||
**deprecated**
|
||||
assert that object does not have own property `property_name`
|
||||
|
||||
## Metadata ##
|
||||
|
||||
It is possible to add optional metadata to tests; this can be done in
|
||||
|
@ -12,7 +12,7 @@
|
||||
EventSource.prototype.ReturnTrue = function() { return true }
|
||||
var source = new EventSource("resources/message.py")
|
||||
assert_true(source.ReturnTrue())
|
||||
assert_exists(window, "EventSource")
|
||||
assert_own_property(window, "EventSource")
|
||||
source.close()
|
||||
})
|
||||
</scrIpt>
|
||||
|
@ -19,7 +19,7 @@ async_test(function(t) {
|
||||
}
|
||||
|
||||
function step2_processSubframeMsg(msg) {
|
||||
assert_not_exists(msg, 'error');
|
||||
assert_false(msg.hasOwnProperty('error'), 'unexpected property found: "error"');
|
||||
assert_equals(msg.blob_type, 'text/html');
|
||||
assert_equals(msg.blob_size, 147);
|
||||
|
||||
|
@ -44,7 +44,7 @@ function reportload() {
|
||||
test(function () {
|
||||
assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' );
|
||||
}, 'history.length should update when setting location.hash');
|
||||
test(function () { assert_true( !!history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist'); //assert_exists does not allow prototype inheritance
|
||||
test(function () { assert_true( !!history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist'); //assert_own_property does not allow prototype inheritance
|
||||
test(function () { assert_true( !!iframe.contentWindow.history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist within iframes');
|
||||
test(function () {
|
||||
assert_equals( iframe.contentWindow.history.state, null );
|
||||
@ -250,7 +250,7 @@ function reportload() {
|
||||
assert_equals( ev.state.numdata, 1, 'state numeric data was not correct' );
|
||||
assert_equals( ev.state.strdata, 'string data', 'state string data was not correct' );
|
||||
assert_true( !!ev.state.datedata.getTime, 'state date data was not correct' );
|
||||
assert_exists( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_own_property( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_equals( ev.state.regdata.source, 'a', 'state regex pattern data was not correct' );
|
||||
assert_true( ev.state.regdata.global, 'state regex flag data was not correct' );
|
||||
assert_equals( ev.state.regdata.lastIndex, 0, 'state regex lastIndex data was not correct' );
|
||||
|
@ -43,7 +43,7 @@ function reportload() {
|
||||
test(function () {
|
||||
assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' );
|
||||
}, 'history.length should update when setting location.hash');
|
||||
test(function () { assert_true( !!history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist'); //assert_exists does not allow prototype inheritance
|
||||
test(function () { assert_true( !!history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist'); //assert_own_property does not allow prototype inheritance
|
||||
test(function () { assert_true( !!iframe.contentWindow.history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist within iframes');
|
||||
test(function () {
|
||||
assert_equals( iframe.contentWindow.history.state, null );
|
||||
@ -225,7 +225,7 @@ function reportload() {
|
||||
assert_equals( ev.state.numdata, 1, 'state numeric data was not correct' );
|
||||
assert_equals( ev.state.strdata, 'string data', 'state string data was not correct' );
|
||||
assert_true( !!ev.state.datedata.getTime, 'state date data was not correct' );
|
||||
assert_exists( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_own_property( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_equals( ev.state.regdata.source, 'a', 'state regex pattern data was not correct' );
|
||||
assert_true( ev.state.regdata.global, 'state regex flag data was not correct' );
|
||||
assert_equals( ev.state.regdata.lastIndex, 0, 'state regex lastIndex data was not correct' );
|
||||
|
@ -15,7 +15,7 @@ async_test(function(t) {
|
||||
video.textTracks.onchange = t.step_func_done(function() {
|
||||
assert_equals(event.target, video.textTracks);
|
||||
assert_true(event instanceof Event, 'instanceof');
|
||||
assert_not_exists(event, 'track');
|
||||
assert_false(event.hasOwnProperty('track'), 'unexpected property found: "track"');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -147,8 +147,8 @@
|
||||
var A = function(){this.a = "a"}
|
||||
A.prototype = {b:"b"}
|
||||
var a = new A();
|
||||
assert_exists(a, "a");
|
||||
assert_not_exists(a, "b");
|
||||
assert_own_property(a, "a");
|
||||
assert_false(a.hasOwnProperty("b"), "unexpected property found: \"b\"");
|
||||
assert_inherits(a, "b");
|
||||
}
|
||||
test(testAssertInherits, "test for assert[_not]_exists and insert_inherits")
|
||||
|
@ -1255,24 +1255,12 @@ policies and contribution forms [3].
|
||||
expose(assert_class_string, "assert_class_string");
|
||||
|
||||
|
||||
function _assert_own_property(name) {
|
||||
return function(object, property_name, description)
|
||||
{
|
||||
assert(object.hasOwnProperty(property_name),
|
||||
name, description,
|
||||
"expected property ${p} missing", {p:property_name});
|
||||
};
|
||||
function assert_own_property(object, property_name, description) {
|
||||
assert(object.hasOwnProperty(property_name),
|
||||
"assert_own_property", description,
|
||||
"expected property ${p} missing", {p:property_name});
|
||||
}
|
||||
expose(_assert_own_property("assert_exists"), "assert_exists");
|
||||
expose(_assert_own_property("assert_own_property"), "assert_own_property");
|
||||
|
||||
function assert_not_exists(object, property_name, description)
|
||||
{
|
||||
assert(!object.hasOwnProperty(property_name),
|
||||
"assert_not_exists", description,
|
||||
"unexpected property ${p} found", {p:property_name});
|
||||
}
|
||||
expose(assert_not_exists, "assert_not_exists");
|
||||
expose(assert_own_property, "assert_own_property");
|
||||
|
||||
function _assert_inherits(name) {
|
||||
return function (object, property_name, description)
|
||||
|
@ -71,7 +71,7 @@ This test uses data only, and thus does not require fake media devices.
|
||||
assert_not_equals(report, null, 'No report');
|
||||
let sessionStat = getStatsRecordByType(report, 'peer-connection');
|
||||
assert_not_equals(sessionStat, null, 'Did not find peer-connection stats');
|
||||
assert_exists(sessionStat, 'dataChannelsOpened', 'no dataChannelsOpened stat');
|
||||
assert_own_property(sessionStat, 'dataChannelsOpened', 'no dataChannelsOpened stat');
|
||||
// Once every 4000 or so tests, the datachannel won't be opened when the getStats
|
||||
// function is done, so allow both 0 and 1 datachannels.
|
||||
assert_true(sessionStat.dataChannelsOpened == 1 || sessionStat.dataChannelsOpened == 0,
|
||||
|
@ -26,7 +26,7 @@ module.exports = {
|
||||
assert_unreached: true,
|
||||
assert_throws: true,
|
||||
assert_idl_attribute: true,
|
||||
assert_exists: true,
|
||||
assert_own_property: true,
|
||||
assert_greater_than: true,
|
||||
assert_less_than: true,
|
||||
assert_greater_than_equal: true,
|
||||
|
@ -2,8 +2,8 @@ self.importScripts('/resources/testharness.js');
|
||||
|
||||
test(function() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
assert_not_exists(xhr, "responseXML", "responseXML should not be available on instances.");
|
||||
assert_not_exists(XMLHttpRequest.prototype, "responseXML", "responseXML should not be on the prototype.");
|
||||
assert_false(xhr.hasOwnProperty("responseXML"), "responseXML should not be available on instances.");
|
||||
assert_false(XMLHttpRequest.prototype.hasOwnProperty("responseXML"), "responseXML should not be on the prototype.");
|
||||
}, "XMLHttpRequest's responseXML property should not be exposed in workers.");
|
||||
|
||||
done();
|
||||
|
Loading…
Reference in New Issue
Block a user