Commit 9facfb32 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

v8binding: Changes @@unscopables's prototype to ES null.

Implements step 8.1. of
https://heycam.github.io/webidl/#create-an-interface-prototype-object

Bug: 811029
Change-Id: I0feb1c16cf12585db8847c82d4efa342701bebcb
Reviewed-on: https://chromium-review.googlesource.com/1098914
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567580}
parent b73563e6
This is a testharness.js-based test.
FAIL The class string of an interface prototype object is the concatenation of the interface's identifier and the string 'Prototype'. assert_equals: expected "[object DocumentPrototype]" but got "[object Document]"
PASS [Unscopable] extended attribute makes @@unscopables object on the prototype object, whose prototype is null.
Harness: the test ran to completion.
......@@ -16,4 +16,12 @@ test(function() {
assert_equals(Document.prototype[Symbol.toStringTag], "DocumentPrototype");
}, "The class string of an interface prototype object is the concatenation of " +
"the interface's identifier and the string 'Prototype'.");
test(function() {
// https://heycam.github.io/webidl/#create-an-interface-prototype-object
assert_own_property(Element.prototype, Symbol.unscopables, "Element.prototype has @@unscopables.");
let unscopables = Element.prototype[Symbol.unscopables];
assert_equals(typeof unscopables, "object", "@@unscopables is an Object.");
assert_equals(Object.getPrototypeOf(unscopables), null, "@@unscopables's prototype is null.");
}, "[Unscopable] extended attribute makes @@unscopables object on the prototype object, whose prototype is null.");
</script>
......@@ -985,7 +985,12 @@ void {{v8_class_or_partial}}::InstallConditionalFeatures(
if (prototypeObject->HasOwnProperty(context, unscopablesSymbol).To(&has_unscopables) && has_unscopables) {
unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked().As<v8::Object>();
} else {
// Web IDL 3.6.3. Interface prototype object
// https://heycam.github.io/webidl/#create-an-interface-prototype-object
// step 8.1. Let unscopableObject be the result of performing
// ! ObjectCreate(null).
unscopables = v8::Object::New(isolate);
unscopables->SetPrototype(context, v8::Null(isolate)).ToChecked();
}
{% for name, runtime_enabled_feature_name in unscopables %}
{% filter runtime_enabled(runtime_enabled_feature_name) %}
......
......@@ -13828,7 +13828,12 @@ void V8TestObject::InstallConditionalFeatures(
if (prototypeObject->HasOwnProperty(context, unscopablesSymbol).To(&has_unscopables) && has_unscopables) {
unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked().As<v8::Object>();
} else {
// Web IDL 3.6.3. Interface prototype object
// https://heycam.github.io/webidl/#create-an-interface-prototype-object
// step 8.1. Let unscopableObject be the result of performing
// ! ObjectCreate(null).
unscopables = v8::Object::New(isolate);
unscopables->SetPrototype(context, v8::Null(isolate)).ToChecked();
}
unscopables->CreateDataProperty(
context, V8AtomicString(isolate, "unscopableLongAttribute"), v8::True(isolate))
......
......@@ -568,7 +568,12 @@ void V8TestInterfacePartial::InstallConditionalFeatures(
if (prototypeObject->HasOwnProperty(context, unscopablesSymbol).To(&has_unscopables) && has_unscopables) {
unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked().As<v8::Object>();
} else {
// Web IDL 3.6.3. Interface prototype object
// https://heycam.github.io/webidl/#create-an-interface-prototype-object
// step 8.1. Let unscopableObject be the result of performing
// ! ObjectCreate(null).
unscopables = v8::Object::New(isolate);
unscopables->SetPrototype(context, v8::Null(isolate)).ToChecked();
}
unscopables->CreateDataProperty(
context, V8AtomicString(isolate, "unscopableVoidMethod"), v8::True(isolate))
......
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