Bug 1523562 [wpt PR 14847] - Make named constructors' |prototype|s have the right property descriptor, a=testonly

Automatic update from web-platform-tests
Make named constructors' |prototype|s have the right property descriptor

As per https://heycam.github.io/webidl/#named-constructors, a named
constructors "prototype" property should NOT be writable, configurable or
enumerable, yet we were creating a property with the opposite
characteristics.

Call v8::Object::DefineOwnProperty() rather than v8::Object::Set() so we can
pass the property descriptor values we want.

More tests for named constructors are coming in
https://github.com/web-platform-tests/wpt/pull/14841

While here, do some minor cleanups suggested in the review:
* Rename |interfacePrototype| to |interface_prototype| to follow Chromium's
  coding style
* Replace an if check for |result| with a CHECK(), as we are already calling
  ToChecked() when setting it.

Bug: 921633
Change-Id: Ie1f31c7eb456f45e113cff3048f43aea7e05e8ba
Reviewed-on: https://chromium-review.googlesource.com/c/1409552
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622814}

--

wpt-commits: f40783e7833ae7587fbbcae474c7bafaf9c79b83
wpt-pr: 14847
This commit is contained in:
Raphael Kubo da Costa 2019-01-31 18:55:30 +00:00 коммит произвёл James Graham
Родитель bec02ddd8d
Коммит 585d792d3f
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -32,6 +32,11 @@
assert_equals(Image.prototype, HTMLImageElement.prototype, "Image.prototype is same as HTMLImageElement.prototype");
assert_equals(new Image().__proto__, HTMLImageElement.prototype, "Image __proto__ is HTMLImageElement prototype ");
assert_equals(Image.prototype.__proto__, HTMLElement.prototype, "Image.prototype __proto__ is HTMLElement prototype");
const desc = Object.getOwnPropertyDescriptor(Image, "prototype");
assert_false(desc.configurable, "Image.prototype is not configurable");
assert_false(desc.enumerable, "Image.prototype is not enumerable");
assert_false(desc.writable, "Image.prototype is not writable");
}, "NamedConstructor creates the correct object structure.");
</script>