https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 8f1ef70886a1443ccd9980448031c88a44c3faea authored by Ben Pastene on 13 April 2018, 17:03:33 UTC
Revert "Reland: Use PostTask to schedule cross-process postMessage forwarding."
Tip revision: 8f1ef70
Object.prototype.hasOwnProperty-prototype-chain.html
<!doctype html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].

[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<meta charset="utf-8">
<title>Object.prototype.hasOwnProperty: Check prototype chain</title>
<link rel="author" title="Masaya Iseki" href="mailto:iseki.m.aa@gmail.com">
<link rel="help" href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.hasownproperty">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test(function() {
  [{}, []].forEach(function(that) {
  	that.prop = 'exists';
  	assert_true(that.hasOwnProperty('prop'));
  	assert_true('hasOwnProperty' in that);
  	assert_false(that.hasOwnProperty('hasOwnProperty'));
  });
});

test(function() {
  ['foo', 42].forEach(function(that) {
  	assert_false(that.hasOwnProperty('hasOwnProperty'));
  });
});

test(function() {
  [null, undefined].forEach(function(that) {
    assert_throws(new TypeError(),
        function() { that.hasOwnProperty('hasOwnProperty'); });
  });
});
</script>

</body>
</html>
back to top