Bug 1490783 [wpt PR 12976] - [testharness.js] Remove deprecated API, a=testonly
authorjugglinmike <mike@mikepennisi.com>
Wed, 26 Sep 2018 10:47:28 +0000
changeset 438489 035a01951ed71adf70e0b7f8b2bf74c7bcf7d28f
parent 438488 464e373e9af07bbc79b67190dc79bcabaa9a5f64
child 438490 8f6a1c926ee842cb8764cbe59cf6a9005a28c50b
push id108320
push userwptsync@mozilla.com
push dateThu, 27 Sep 2018 09:58:16 +0000
treeherdermozilla-inbound@541b5d1ac630 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1490783, 12976
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/web-platform/tests/docs/_writing-tests/testharness-api.md
testing/web-platform/tests/eventsource/eventsource-prototype.htm
testing/web-platform/tests/fetch/corb/script-html-via-cross-origin-blob-url.sub.html
testing/web-platform/tests/html/browsers/history/the-history-interface/001.html
testing/web-platform/tests/html/browsers/history/the-history-interface/002.html
testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-change-event.html
testing/web-platform/tests/resources/test/tests/functional/api-tests-1.html
testing/web-platform/tests/resources/testharness.js
testing/web-platform/tests/webrtc/getstats.html
testing/web-platform/tests/webrtc/tools/.eslintrc.js
testing/web-platform/tests/xhr/resources/responseXML-unavailable-in-worker.js
--- a/testing/web-platform/tests/docs/_writing-tests/testharness-api.md
+++ b/testing/web-platform/tests/docs/_writing-tests/testharness-api.md
@@ -788,22 +788,14 @@ an event does not fire.
 ### `assert_any(assert_func, actual, expected_array, extra_arg_1, ... extra_arg_N)`
 asserts that one `assert_func(actual, expected_array_N, extra_arg1, ..., extra_arg_N)`
   is true for some `expected_array_N` in `expected_array`. This only works for `assert_func`
   with signature `assert_func(actual, expected, args_1, ..., args_N)`. Note that tests
   with multiple allowed pass conditions are bad practice unless the spec specifically
   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
 one of two ways; either by adding `<meta>` elements to the head of the
 document containing the tests, or by adding the metadata to individual
 `[async_]test` calls, as properties.
--- a/testing/web-platform/tests/eventsource/eventsource-prototype.htm
+++ b/testing/web-platform/tests/eventsource/eventsource-prototype.htm
@@ -7,15 +7,15 @@
   </heaD>
   <boDy>
     <diV iD="log"></Div>
     <sCript>
       test(function() {
         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>
   </bOdy>
 </htMl>
 
--- a/testing/web-platform/tests/fetch/corb/script-html-via-cross-origin-blob-url.sub.html
+++ b/testing/web-platform/tests/fetch/corb/script-html-via-cross-origin-blob-url.sub.html
@@ -14,17 +14,17 @@ async_test(function(t) {
     });
     var subframe = document.createElement("iframe")
     // www1 is cross-origin, to ensure that the received blob will be cross-origin.
     subframe.src = 'http://{{domains[www1]}}:{{ports[http][0]}}/fetch/corb/resources/subframe-that-posts-html-containing-blob-url-to-parent.html';
     document.body.appendChild(subframe);
   }
 
   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);
 
     // With and without CORB loading of a cross-origin blob should be blocked
     // (this is verified by expecting |script.onerror|, but not |script.onload|
     // below).
     var script = document.createElement("script")
     script.src = msg.blob_url;
--- a/testing/web-platform/tests/html/browsers/history/the-history-interface/001.html
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/001.html
@@ -39,17 +39,17 @@ function reportload() {
     function tests1() {
         //Firefox may fail when reloading, because it recovers iframe state, and therefore does not see the need to alter history length
         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 loading pages in an iframe');
         histlength = history.length;
         iframe.contentWindow.location.hash = 'test'; //should be synchronous **SEE COMMENT AT TOP OF FILE
         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 );
         }, 'initial history.state should be null');
         test(function () {
             histlength = history.length;
             iframe.contentWindow.history.pushState('','');
             assert_equals( history.length, histlength + 1 );
@@ -245,17 +245,17 @@ function reportload() {
             assert_true( !!ev && typeof(ev.state) != 'undefined', 'state information was not passed' );
             assert_true( !!ev.state, 'state information does not contain the expected value - browser is probably stuck in the wrong history position' );
             assert_equals( ev.state.nulldata, null, 'state null data was not correct' );
             assert_equals( ev.state.udefdata, window.undefined, 'state undefined data was not correct' );
             assert_true( ev.state.booldata, 'state boolean data was not correct' );
             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' );
             assert_equals( ev.state.arrdata.length, 1, 'state array data was not correct' );
             assert_true( ev.state.boolobj.valueOf(), 'state boolean data was not correct' );
             assert_equals( ev.state.numobj.valueOf(), 1, 'state numeric data was not correct' );
             assert_equals( ev.state.strobj.valueOf(), 'string data', 'state string data was not correct' );
             if( canvassup ) {
--- a/testing/web-platform/tests/html/browsers/history/the-history-interface/002.html
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/002.html
@@ -38,17 +38,17 @@ function reportload() {
 
     function tests1() {
         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 loading pages in an iframe');
         histlength = history.length;
         iframe.contentWindow.location.hash = 'test'; //should be synchronous **SEE COMMENT AT TOP OF FILE
         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 );
         }, 'initial history.state should be null');
         iframe.contentWindow.location.hash = 'test2';
         history.back();
         setTimeout(tests2,50); //.go is queued to end of thread
     }
@@ -220,17 +220,17 @@ function reportload() {
             assert_true( !!ev && typeof(ev.state) != 'undefined', 'state information was not passed' );
             assert_true( !!ev.state, 'state information does not contain the expected value - browser is probably stuck in the wrong history position' );
             assert_equals( ev.state.nulldata, null, 'state null data was not correct' );
             assert_equals( ev.state.udefdata, window.undefined, 'state undefined data was not correct' );
             assert_true( ev.state.booldata, 'state boolean data was not correct' );
             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' );
             assert_equals( ev.state.arrdata.length, 1, 'state array data was not correct' );
             assert_true( ev.state.boolobj.valueOf(), 'state boolean data was not correct' );
             assert_equals( ev.state.numobj.valueOf(), 1, 'state numeric data was not correct' );
             assert_equals( ev.state.strobj.valueOf(), 'string data', 'state string data was not correct' );
             if( canvassup ) {
--- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-change-event.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-change-event.html
@@ -10,12 +10,12 @@ async_test(function(t) {
     // addTextTrack() defaults to "hidden", so settings
     // mode to "showing" should trigger a "change" event.
     track.mode = 'showing';
     assert_equals(video.textTracks.length, 1);
 
     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>
--- a/testing/web-platform/tests/resources/test/tests/functional/api-tests-1.html
+++ b/testing/web-platform/tests/resources/test/tests/functional/api-tests-1.html
@@ -142,18 +142,18 @@
         assert_greater_than_equal('10', 10, "'10' is not a number")
     }
     test(basicAssertLessThanEqual, "assert_less_than_equal expected to fail");
 
     function testAssertInherits() {
         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")
 
     test(function()
     {
         var a = document.createElement("a")
         var b = document.createElement("b")
--- a/testing/web-platform/tests/resources/testharness.js
+++ b/testing/web-platform/tests/resources/testharness.js
@@ -1250,34 +1250,22 @@ policies and contribution forms [3].
 
     function assert_class_string(object, class_string, description) {
         assert_equals({}.toString.call(object), "[object " + class_string + "]",
                       description);
     }
     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)
         {
             assert(typeof object === "object" || typeof object === "function",
                    name, description,
                    "provided value is not an object");
 
--- a/testing/web-platform/tests/webrtc/getstats.html
+++ b/testing/web-platform/tests/webrtc/getstats.html
@@ -66,17 +66,17 @@ This test uses data only, and thus does 
       for (let stats of report.values()) {
         reportDictionary[stats.id] = stats;
       }
       showStats.innerHTML = JSON.stringify(reportDictionary, null, 2);
       // Check the stats properties.
       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,
                   'dataChannelsOpened count wrong');
       test.done();
     })
     .catch(test.step_func(function(e) {
       assert_unreached(e.name + ': ' + e.message + ': ');
--- a/testing/web-platform/tests/webrtc/tools/.eslintrc.js
+++ b/testing/web-platform/tests/webrtc/tools/.eslintrc.js
@@ -21,17 +21,17 @@ module.exports = {
     assert_false: true,
     assert_equals: true,
     assert_not_equals: true,
     assert_array_equals: true,
     assert_in_array: true,
     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,
     assert_less_than_equal: true,
     assert_approx_equals: true,
 
 
     // WebRTC globals
--- a/testing/web-platform/tests/xhr/resources/responseXML-unavailable-in-worker.js
+++ b/testing/web-platform/tests/xhr/resources/responseXML-unavailable-in-worker.js
@@ -1,9 +1,9 @@
 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();