Commit b7c2cdd8 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Port a temporary support of @@asyncIterator to the new impl

Ports a temporary support of @@asyncIterator introduced at
https://crrev.com/c/2248414 to the new IDL interface
implementation.

Bug: 839389
Change-Id: Ib0ea64ec8c8fbc582ba5472ab8d10ee4b43e0e07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2312456Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791719}
parent d23d024f
......@@ -4967,6 +4967,22 @@ ${prototype_object}->Delete(
nodes.append(
TextNode(_format(pattern, property_name=property_name)))
if class_like.identifier == "FileSystemDirectoryHandle":
pattern = """\
// Temporary @@asyncIterator support for FileSystemDirectoryHandle
// TODO(https://crbug.com/1087157): Replace with proper bindings support.
// @@asyncIterator == "{property_name}"
{{
v8::Local<v8::Value> v8_value = ${prototype_object}->Get(
${v8_context}, V8AtomicString(${isolate}, "{property_name}"))
.ToLocalChecked();
${prototype_object}->DefineOwnProperty(
${v8_context}, v8::Symbol::GetAsyncIterator(${isolate}), v8_value,
v8::DontEnum).ToChecked();
}}
"""
nodes.append(TextNode(_format(pattern, property_name="entries")))
if ("Global" in class_like.extended_attributes
and class_like.indexed_and_named_properties
and class_like.indexed_and_named_properties.has_named_properties):
......@@ -5101,6 +5117,23 @@ def make_install_interface_template(cg_context, function_name, class_name,
V8AtomicString(${isolate}, "prototype"), v8::kErrorPrototype);
${interface_template}->Inherit(intrinsic_error_prototype_interface_template);
}
"""))
if class_like.identifier == "NativeFileSystemDirectoryIterator":
body.append(
T("""\
// Temporary @@asyncIterator support for FileSystemDirectoryHandle
// TODO(https://crbug.com/1087157): Replace with proper bindings support.
{
v8::Local<v8::FunctionTemplate>
intrinsic_iterator_prototype_interface_template =
v8::FunctionTemplate::New(${isolate});
intrinsic_iterator_prototype_interface_template->RemovePrototype();
intrinsic_iterator_prototype_interface_template->SetIntrinsicDataProperty(
V8AtomicString(${isolate}, "prototype"), v8::kAsyncIteratorPrototype);
${interface_template}->Inherit(
intrinsic_iterator_prototype_interface_template);
}
"""))
if class_like.identifier == "HTMLAllCollection":
......
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