Commit afc2a4ab authored by Joshua Bell's avatar Joshua Bell Committed by Commit Bot

WPT: Fix bogus use of assert_object_equals()

This test was converted from js-test.js to testharness.js in
https://crrev.com/625734 and incorrectly used assert_object_equals.

* assert_object_equals() will assert that enumerable properties are
  the same. Since `new Number(42)` doesn't have any own properties,
  nothing useful was actually being asserted!
* assert_equals() is sufficient for an object identity test.
* The original test used `new Number(42)` to mint an object that would
  serialize as something distinct. This isn't necessary with
  testharness.js assertions - using {} is good enough.

assert_object_equals() has lots of non-intuitive behavior, see
https://github.com/web-platform-tests/wpt/issues/2033 for more.

Change-Id: I202f27c228c7ec65407d9eae724af21181e6e684
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067565
Auto-Submit: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743523}
parent 24d1cda8
//META: global=!default, worker
test(() => {
proto = new Number(42)
const proto = {};
assert_equals(String(Object.getPrototypeOf(WorkerLocation)).replace(/\n/g, " ").replace(/\s\s+/g, " "), "function () { [native code] }");
WorkerLocation.__proto__ = proto;
assert_object_equals(Object.getPrototypeOf(WorkerLocation), Object(42));
assert_equals(Object.getPrototypeOf(WorkerLocation), proto);
}, 'Tests that setting the proto of a built in constructor is not reset.');
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment