summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/bindings/modules
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/bindings/modules')
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/BUILD.gn13
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn39
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/custom/custom.gni3
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/custom/v8_extendable_message_event_custom.cc102
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni41
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc164
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h8
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc134
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h4
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc85
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc9
-rw-r--r--chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h3
12 files changed, 204 insertions, 401 deletions
diff --git a/chromium/third_party/blink/renderer/bindings/modules/BUILD.gn b/chromium/third_party/blink/renderer/bindings/modules/BUILD.gn
index d0ff4117cff..4d47a971b0e 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/BUILD.gn
+++ b/chromium/third_party/blink/renderer/bindings/modules/BUILD.gn
@@ -39,7 +39,6 @@ generate_event_interfaces("modules_bindings_generated_event_interfaces") {
"//third_party/blink/renderer/modules/mediarecorder/blob_event.idl",
"//third_party/blink/renderer/modules/mediastream/media_stream_event.idl",
"//third_party/blink/renderer/modules/mediastream/media_stream_track_event.idl",
- "//third_party/blink/renderer/modules/nfc/ndef_error_event.idl",
"//third_party/blink/renderer/modules/nfc/ndef_reading_event.idl",
"//third_party/blink/renderer/modules/notifications/notification_event.idl",
"//third_party/blink/renderer/modules/payments/abort_payment_event.idl",
@@ -87,9 +86,7 @@ generate_event_interfaces("modules_bindings_generated_event_interfaces") {
make_event_factory("event_modules") {
visibility = [ ":*" ]
in_files = [ "$blink_modules_output_dir/event_interface_modules_names.json5" ]
- outputs = [
- "$blink_modules_output_dir/event_modules_factory.cc",
- ]
+ outputs = [ "$blink_modules_output_dir/event_modules_factory.cc" ]
deps = make_core_generated_deps + [ "//third_party/blink/renderer/bindings/modules:modules_bindings_generated_event_interfaces" ]
}
@@ -127,9 +124,7 @@ compute_global_objects("modules_global_objects") {
sources = modules_idl_files
sources_generated = [ "$bindings_core_output_dir/global_objects_core.pickle" ]
output_file = "$bindings_modules_output_dir/global_objects_modules.pickle"
- deps = [
- "//third_party/blink/renderer/bindings/core:core_global_objects",
- ]
+ deps = [ "//third_party/blink/renderer/bindings/core:core_global_objects" ]
}
generate_global_constructors("modules_global_constructors_idls") {
@@ -140,9 +135,7 @@ generate_global_constructors("modules_global_constructors_idls") {
basenames = modules_global_constructors_original_interface_basenames
component = "modules"
output_dir = blink_modules_output_dir
- deps = [
- ":modules_global_objects",
- ]
+ deps = [ ":modules_global_objects" ]
}
# Compile the sources produced above. This will get linked into "modules".
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn b/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn
index 7f20ac335de..0d451eff74d 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn
@@ -2,12 +2,20 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//third_party/blink/renderer/bindings/bindings.gni")
+import("//third_party/blink/renderer/bindings/generated_in_modules.gni")
import("//third_party/blink/renderer/bindings/modules/v8/generated.gni")
import("//third_party/blink/renderer/bindings/scripts/scripts.gni")
import("//third_party/blink/renderer/modules/modules.gni")
import("//third_party/blink/renderer/modules/modules_idl_files.gni")
-visibility = [ "//third_party/blink/*" ]
+visibility = [ "//third_party/blink/renderer/*" ]
+
+blink_modules_sources("generated") {
+ sources = generated_enumeration_sources_in_modules
+ deps =
+ [ "//third_party/blink/renderer/bindings:generate_bindings_enumeration" ]
+}
group("bindings_modules_v8_generated") {
public_deps = [
@@ -17,18 +25,26 @@ group("bindings_modules_v8_generated") {
":generate_bindings_modules_v8_partial_interfaces",
":generate_bindings_modules_v8_partial_interfaces_for_testing",
":generate_v8_context_snapshot_external_references",
+ "//third_party/blink/renderer/bindings:generate_v8_bindings",
]
}
idl_compiler("generate_bindings_modules_v8_interfaces") {
sources = modules_definition_idl_files
+ if (use_v8_bind_gen_for_dictionary) {
+ sources -= modules_dictionary_idl_files
+ }
output_dir = bindings_modules_v8_output_dir
output_name_suffix = ""
target_component = "modules"
}
idl_impl("bindings_modules_impl_generated") {
- dict_idls = modules_dictionary_idl_files
+ if (use_v8_bind_gen_for_dictionary) {
+ dict_idls = []
+ } else {
+ dict_idls = modules_dictionary_idl_files
+ }
non_dict_outputs = bindings_modules_generated_union_type_files +
generated_modules_callback_function_files
non_dict_output_dir = bindings_modules_v8_output_dir
@@ -64,12 +80,8 @@ generate_origin_trial_features("bindings_modules_origin_trial_features") {
action("bindings_modules_v8_generated_init_partial") {
script = "$bindings_scripts_dir/generate_init_partial_interfaces.py"
- inputs = [
- "$bindings_output_dir/interfaces_info.pickle",
- ]
- outputs = [
- bindings_modules_generated_init_partial_interfaces_file,
- ]
+ inputs = [ "$bindings_output_dir/interfaces_info.pickle" ]
+ outputs = [ bindings_modules_generated_init_partial_interfaces_file ]
# Put the IDL file list in a response file to avoid command-line limits.
response_file_contents =
@@ -83,9 +95,7 @@ action("bindings_modules_v8_generated_init_partial") {
root_build_dir),
]
- deps = [
- "//third_party/blink/renderer/bindings:interfaces_info",
- ]
+ deps = [ "//third_party/blink/renderer/bindings:interfaces_info" ]
}
# Note that this intentionally depends on the generator target of the mojom
@@ -121,10 +131,13 @@ blink_modules_sources("bindings_modules_impl") {
get_target_outputs(":bindings_modules_v8_generated_init_partial") +
get_target_outputs(":bindings_modules_origin_trial_features")
+ sources += generated_modules_dictionary_files
+
deps = [
":bindings_modules_origin_trial_features",
":bindings_modules_v8_generated",
":generate_mojo_bindings",
+ "//third_party/blink/renderer/bindings:generate_v8_bindings",
"//third_party/blink/renderer/modules/mediarecorder:buildflags",
"//third_party/dawn/src/dawn:dawn_headers",
]
@@ -137,9 +150,7 @@ action("generate_v8_context_snapshot_external_references") {
output = bindings_generated_v8_context_snapshot_external_references_file
inputs = idl_files + [ script ]
- outputs = [
- output,
- ]
+ outputs = [ output ]
response_file_contents = rebase_path(idl_files, root_build_dir)
args = [
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/custom/custom.gni b/chromium/third_party/blink/renderer/bindings/modules/v8/custom/custom.gni
index d47363301a6..2b8700cd118 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/custom/custom.gni
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/custom/custom.gni
@@ -3,5 +3,4 @@
# found in the LICENSE file.
# Make the files absolute so they can be imported to anywhere.
-bindings_modules_v8_custom_files =
- get_path_info([ "v8_extendable_message_event_custom.cc" ], "abspath")
+bindings_modules_v8_custom_files = get_path_info([], "abspath")
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/custom/v8_extendable_message_event_custom.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/custom/v8_extendable_message_event_custom.cc
deleted file mode 100644
index 43f29083f27..00000000000
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/custom/v8_extendable_message_event_custom.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "third_party/blink/renderer/bindings/modules/v8/v8_extendable_message_event.h"
-
-#include "third_party/blink/renderer/bindings/modules/v8/v8_extendable_message_event_init.h"
-#include "third_party/blink/renderer/core/events/message_event.h"
-#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
-
-namespace blink {
-
-void V8ExtendableMessageEvent::ConstructorCustom(
- const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Isolate* isolate = info.GetIsolate();
- ExceptionState exception_state(isolate, ExceptionState::kConstructionContext,
- "ExtendableMessageEvent");
- if (UNLIKELY(info.Length() < 1)) {
- exception_state.ThrowTypeError(
- ExceptionMessages::NotEnoughArguments(1, info.Length()));
- return;
- }
-
- V8StringResource<> type = info[0];
- if (!type.Prepare())
- return;
-
- ExtendableMessageEventInit* event_init_dict =
- ExtendableMessageEventInit::Create();
- if (!IsUndefinedOrNull(info[1])) {
- if (!info[1]->IsObject()) {
- exception_state.ThrowTypeError(
- "parameter 2 ('eventInitDict') is not an object.");
- return;
- }
- V8ExtendableMessageEventInit::ToImpl(isolate, info[1], event_init_dict,
- exception_state);
- if (exception_state.HadException())
- return;
- }
-
- ExtendableMessageEvent* impl =
- ExtendableMessageEvent::Create(type, event_init_dict);
- v8::Local<v8::Object> wrapper = info.Holder();
- wrapper = impl->AssociateWithWrapper(
- isolate, V8ExtendableMessageEvent::GetWrapperTypeInfo(), wrapper);
-
- // TODO(bashi): Workaround for http://crbug.com/529941. We need to store
- // |data| as a private value to avoid cyclic references.
- if (event_init_dict->hasData()) {
- v8::Local<v8::Value> v8_data = event_init_dict->data().V8Value();
- V8PrivateProperty::GetSymbol(isolate,
- kPrivatePropertyMessageEventCachedData)
- .Set(wrapper, v8_data);
- if (DOMWrapperWorld::Current(isolate).IsIsolatedWorld()) {
- impl->SetSerializedData(
- SerializedScriptValue::SerializeAndSwallowExceptions(isolate,
- v8_data));
- }
- }
- V8SetReturnValue(info, wrapper);
-}
-
-void V8ExtendableMessageEvent::DataAttributeGetterCustom(
- const v8::FunctionCallbackInfo<v8::Value>& info) {
- ExtendableMessageEvent* event =
- V8ExtendableMessageEvent::ToImpl(info.Holder());
- v8::Isolate* isolate = info.GetIsolate();
- auto private_cached_data = V8PrivateProperty::GetSymbol(
- isolate, kPrivatePropertyMessageEventCachedData);
- v8::Local<v8::Value> result;
- if (private_cached_data.GetOrUndefined(info.Holder()).ToLocal(&result) &&
- !result->IsUndefined()) {
- V8SetReturnValue(info, result);
- return;
- }
-
- v8::Local<v8::Value> data;
- if (SerializedScriptValue* serialized_value = event->SerializedData()) {
- MessagePortArray ports = event->ports();
- SerializedScriptValue::DeserializeOptions options;
- options.message_ports = &ports;
- data = serialized_value->Deserialize(isolate, options);
- } else if (DOMWrapperWorld::Current(isolate).IsIsolatedWorld()) {
- v8::Local<v8::Value> main_world_data;
- if (private_cached_data.GetFromMainWorld(event).ToLocal(&main_world_data) &&
- !main_world_data->IsUndefined()) {
- // TODO(bashi): Enter the main world's ScriptState::Scope while
- // serializing the main world's value.
- event->SetSerializedData(
- SerializedScriptValue::SerializeAndSwallowExceptions(
- info.GetIsolate(), main_world_data));
- data = event->SerializedData()->Deserialize(isolate);
- }
- }
- if (data.IsEmpty())
- data = v8::Null(isolate);
- private_cached_data.Set(info.Holder(), data);
- V8SetReturnValue(info, data);
-}
-
-} // namespace blink
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni b/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni
index c0c91059fed..a090ea5085c 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni
@@ -4,6 +4,7 @@
import("//build/config/chrome_build.gni")
import("//third_party/blink/renderer/bindings/bindings.gni")
+import("//third_party/blink/renderer/bindings/scripts/scripts.gni")
import("//third_party/blink/renderer/core/core_idl_files.gni")
import("//third_party/blink/renderer/modules/modules_idl_files.gni")
@@ -16,14 +17,16 @@ bindings_modules_generated_init_partial_interfaces_file =
bindings_modules_generated_union_type_files = [
"$bindings_modules_v8_output_dir/animation_effect_or_animation_effect_sequence.cc",
"$bindings_modules_v8_output_dir/animation_effect_or_animation_effect_sequence.h",
- "$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_dictionary.cc",
- "$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_dictionary.h",
+ "$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_blob_or_usv_string_or_write_params.cc",
+ "$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_blob_or_usv_string_or_write_params.h",
+ "$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_json_web_key.cc",
+ "$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_json_web_key.h",
"$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_string.cc",
"$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_string.h",
"$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_usv_string.cc",
"$bindings_modules_v8_output_dir/array_buffer_or_array_buffer_view_or_usv_string.h",
- "$bindings_modules_v8_output_dir/array_buffer_view_or_blob_or_string_or_form_data.cc",
- "$bindings_modules_v8_output_dir/array_buffer_view_or_blob_or_string_or_form_data.h",
+ "$bindings_modules_v8_output_dir/array_buffer_view_or_blob_or_string_or_form_data_or_readable_stream.cc",
+ "$bindings_modules_v8_output_dir/array_buffer_view_or_blob_or_string_or_form_data_or_readable_stream.h",
"$bindings_modules_v8_output_dir/audio_context_latency_category_or_double.cc",
"$bindings_modules_v8_output_dir/audio_context_latency_category_or_double.h",
"$bindings_modules_v8_output_dir/boolean_or_constrain_boolean_parameters.cc",
@@ -34,8 +37,6 @@ bindings_modules_generated_union_type_files = [
"$bindings_modules_v8_output_dir/canvas_image_source.h",
"$bindings_modules_v8_output_dir/client_or_service_worker_or_message_port.cc",
"$bindings_modules_v8_output_dir/client_or_service_worker_or_message_port.h",
- "$bindings_modules_v8_output_dir/dictionary_or_string.cc",
- "$bindings_modules_v8_output_dir/dictionary_or_string.h",
"$bindings_modules_v8_output_dir/document_timeline_or_scroll_timeline.cc",
"$bindings_modules_v8_output_dir/document_timeline_or_scroll_timeline.h",
"$bindings_modules_v8_output_dir/dom_exception_or_overconstrained_error.cc",
@@ -44,18 +45,18 @@ bindings_modules_generated_union_type_files = [
"$bindings_modules_v8_output_dir/double_or_constrain_double_range.h",
"$bindings_modules_v8_output_dir/double_sequence_or_gpu_color_dict.cc",
"$bindings_modules_v8_output_dir/double_sequence_or_gpu_color_dict.h",
- "$bindings_modules_v8_output_dir/worklet_animation_effect_or_worklet_group_effect.cc",
- "$bindings_modules_v8_output_dir/worklet_animation_effect_or_worklet_group_effect.h",
"$bindings_modules_v8_output_dir/float32_array_or_float64_array_or_dom_matrix.cc",
"$bindings_modules_v8_output_dir/float32_array_or_float64_array_or_dom_matrix.h",
- "$bindings_modules_v8_output_dir/gpu_out_of_memory_error_or_gpu_validation_error.cc",
- "$bindings_modules_v8_output_dir/gpu_out_of_memory_error_or_gpu_validation_error.h",
+ "$bindings_modules_v8_output_dir/gpu_buffer_or_array_buffer.cc",
+ "$bindings_modules_v8_output_dir/gpu_buffer_or_array_buffer.h",
"$bindings_modules_v8_output_dir/gpu_load_op_or_double_sequence_or_gpu_color_dict.cc",
"$bindings_modules_v8_output_dir/gpu_load_op_or_double_sequence_or_gpu_color_dict.h",
"$bindings_modules_v8_output_dir/gpu_load_op_or_float.cc",
"$bindings_modules_v8_output_dir/gpu_load_op_or_float.h",
"$bindings_modules_v8_output_dir/gpu_load_op_or_unsigned_long.cc",
"$bindings_modules_v8_output_dir/gpu_load_op_or_unsigned_long.h",
+ "$bindings_modules_v8_output_dir/gpu_out_of_memory_error_or_gpu_validation_error.cc",
+ "$bindings_modules_v8_output_dir/gpu_out_of_memory_error_or_gpu_validation_error.h",
"$bindings_modules_v8_output_dir/gpu_sampler_or_gpu_texture_view_or_gpu_buffer_binding.cc",
"$bindings_modules_v8_output_dir/gpu_sampler_or_gpu_texture_view_or_gpu_buffer_binding.h",
"$bindings_modules_v8_output_dir/html_canvas_element_or_offscreen_canvas.cc",
@@ -70,6 +71,8 @@ bindings_modules_generated_union_type_files = [
"$bindings_modules_v8_output_dir/long_or_constrain_long_range.h",
"$bindings_modules_v8_output_dir/media_stream_track_or_string.cc",
"$bindings_modules_v8_output_dir/media_stream_track_or_string.h",
+ "$bindings_modules_v8_output_dir/object_or_string.cc",
+ "$bindings_modules_v8_output_dir/object_or_string.h",
"$bindings_modules_v8_output_dir/offscreen_rendering_context.cc",
"$bindings_modules_v8_output_dir/offscreen_rendering_context.h",
"$bindings_modules_v8_output_dir/password_credential_data_or_html_form_element.cc",
@@ -102,6 +105,8 @@ bindings_modules_generated_union_type_files = [
"$bindings_modules_v8_output_dir/unsigned_long_sequence_or_gpu_origin_3d_dict.h",
"$bindings_modules_v8_output_dir/webgl_rendering_context_or_webgl2_rendering_context.cc",
"$bindings_modules_v8_output_dir/webgl_rendering_context_or_webgl2_rendering_context.h",
+ "$bindings_modules_v8_output_dir/worklet_animation_effect_or_worklet_group_effect.cc",
+ "$bindings_modules_v8_output_dir/worklet_animation_effect_or_worklet_group_effect.h",
]
generated_modules_callback_function_files = [
@@ -155,11 +160,27 @@ generated_modules_callback_function_files = [
"$bindings_modules_v8_output_dir/v8_storage_quota_callback.h",
"$bindings_modules_v8_output_dir/v8_storage_usage_callback.cc",
"$bindings_modules_v8_output_dir/v8_storage_usage_callback.h",
+ "$bindings_modules_v8_output_dir/v8_video_decoder_output_callback.cc",
+ "$bindings_modules_v8_output_dir/v8_video_decoder_output_callback.h",
"$bindings_modules_v8_output_dir/v8_video_frame_request_callback.cc",
"$bindings_modules_v8_output_dir/v8_video_frame_request_callback.h",
+ "$bindings_modules_v8_output_dir/v8_web_codecs_error_callback.cc",
+ "$bindings_modules_v8_output_dir/v8_web_codecs_error_callback.h",
"$bindings_modules_v8_output_dir/v8_xr_frame_request_callback.cc",
"$bindings_modules_v8_output_dir/v8_xr_frame_request_callback.h",
]
bindings_generated_v8_context_snapshot_external_references_file =
"$bindings_modules_v8_output_dir/v8_context_snapshot_external_references.cc"
+
+generated_modules_dictionary_files = []
+
+if (use_v8_bind_gen_for_dictionary) {
+ generated_modules_dictionary_files +=
+ process_file_template(
+ modules_dictionary_idl_files,
+ [
+ "$bindings_modules_v8_output_dir/v8_{{source_name_part}}.cc",
+ "$bindings_modules_v8_output_dir/v8_{{source_name_part}}.h",
+ ])
+}
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc
index d52684807ba..7b07f628307 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc
@@ -14,15 +14,14 @@
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/crypto/crypto_key.h"
#include "third_party/blink/renderer/modules/filesystem/dom_file_system.h"
-#include "third_party/blink/renderer/modules/imagecapture/point_2d.h"
#include "third_party/blink/renderer/modules/native_file_system/native_file_system_directory_handle.h"
#include "third_party/blink/renderer/modules/native_file_system/native_file_system_file_handle.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_certificate.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h"
-#include "third_party/blink/renderer/modules/shapedetection/detected_barcode.h"
-#include "third_party/blink/renderer/modules/shapedetection/detected_face.h"
-#include "third_party/blink/renderer/modules/shapedetection/detected_text.h"
-#include "third_party/blink/renderer/modules/shapedetection/landmark.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_frame.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_frame_delegate.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h"
namespace blink {
@@ -70,65 +69,10 @@ ScriptWrappable* V8ScriptValueDeserializerForModules::ReadDOMObject(
return nullptr;
return MakeGarbageCollected<RTCCertificate>(std::move(certificate));
}
- case kDetectedBarcodeTag: {
- String raw_value;
- if (!ReadUTF8String(&raw_value))
- return nullptr;
- DOMRectReadOnly* bounding_box = ReadDOMRectReadOnly();
- if (!bounding_box)
- return nullptr;
- // TODO(crbug.com/938663): add deserialization for |format|.
- shape_detection::mojom::BarcodeFormat format =
- shape_detection::mojom::BarcodeFormat::UNKNOWN;
- uint32_t corner_points_length;
- if (!ReadUint32(&corner_points_length))
- return nullptr;
- HeapVector<Member<Point2D>> corner_points;
- for (uint32_t i = 0; i < corner_points_length; i++) {
- Point2D* point = Point2D::Create();
- if (!ReadPoint2D(point))
- return nullptr;
- corner_points.push_back(point);
- }
- return MakeGarbageCollected<DetectedBarcode>(raw_value, bounding_box,
- format, corner_points);
- }
- case kDetectedFaceTag: {
- DOMRectReadOnly* bounding_box = ReadDOMRectReadOnly();
- if (!bounding_box)
- return nullptr;
- uint32_t landmarks_length;
- if (!ReadUint32(&landmarks_length))
- return nullptr;
- HeapVector<Member<Landmark>> landmarks;
- for (uint32_t i = 0; i < landmarks_length; i++) {
- Landmark* landmark = Landmark::Create();
- if (!ReadLandmark(landmark))
- return nullptr;
- landmarks.push_back(landmark);
- }
- return MakeGarbageCollected<DetectedFace>(bounding_box, landmarks);
- }
- case kDetectedTextTag: {
- String raw_value;
- if (!ReadUTF8String(&raw_value))
- return nullptr;
- DOMRectReadOnly* bounding_box = ReadDOMRectReadOnly();
- if (!bounding_box)
- return nullptr;
- uint32_t corner_points_length;
- if (!ReadUint32(&corner_points_length))
- return nullptr;
- HeapVector<Member<Point2D>> corner_points;
- for (uint32_t i = 0; i < corner_points_length; i++) {
- Point2D* point = Point2D::Create();
- if (!ReadPoint2D(point))
- return nullptr;
- corner_points.push_back(point);
- }
- return MakeGarbageCollected<DetectedText>(raw_value, bounding_box,
- corner_points);
- }
+ case kRTCEncodedAudioFrameTag:
+ return ReadRTCEncodedAudioFrame();
+ case kRTCEncodedVideoFrameTag:
+ return ReadRTCEncodedVideoFrame();
default:
break;
}
@@ -363,38 +307,11 @@ CryptoKey* V8ScriptValueDeserializerForModules::ReadCryptoKey() {
return MakeGarbageCollected<CryptoKey>(key);
}
-bool V8ScriptValueDeserializerForModules::ReadLandmark(Landmark* landmark) {
- String type;
- if (!ReadUTF8String(&type))
- return false;
- uint32_t locations_length;
- if (!ReadUint32(&locations_length))
- return false;
- HeapVector<Member<Point2D>> locations;
- for (uint32_t i = 0; i < locations_length; i++) {
- Point2D* location = Point2D::Create();
- if (!ReadPoint2D(location))
- return false;
- locations.push_back(location);
- }
- landmark->setType(type);
- landmark->setLocations(locations);
- return true;
-}
-
-bool V8ScriptValueDeserializerForModules::ReadPoint2D(Point2D* point) {
- double x = 0, y = 0;
- if (!ReadDouble(&x) || !ReadDouble(&y))
- return false;
- point->setX(x);
- point->setY(y);
- return true;
-}
-
NativeFileSystemHandle*
V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle(
SerializationTag tag) {
- if (!RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled()) {
+ if (!RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled(
+ ExecutionContext::From(GetScriptState()))) {
return nullptr;
}
@@ -410,12 +327,19 @@ V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle(
if (token_index >= tokens_array.size()) {
return nullptr;
}
- mojo::PendingRemote<mojom::blink::NativeFileSystemTransferToken> token(
+
+ // IndexedDB code assumes that deserializing a SSV is non-destructive. So
+ // rather than consuming the token here instead we clone it.
+ mojo::Remote<mojom::blink::NativeFileSystemTransferToken> token(
std::move(tokens_array[token_index]));
if (!token) {
return nullptr;
}
+ mojo::PendingRemote<mojom::blink::NativeFileSystemTransferToken> token_clone;
+ token->Clone(token_clone.InitWithNewPipeAndPassReceiver());
+ tokens_array[token_index] = std::move(token_clone);
+
// Use the NativeFileSystemManager to redeem the token to clone the
// FileSystemHandle.
ExecutionContext* execution_context =
@@ -431,7 +355,7 @@ V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle(
mojo::PendingRemote<mojom::blink::NativeFileSystemFileHandle> file_handle;
native_file_system_manager->GetFileHandleFromToken(
- std::move(token), file_handle.InitWithNewPipeAndPassReceiver());
+ token.Unbind(), file_handle.InitWithNewPipeAndPassReceiver());
return MakeGarbageCollected<NativeFileSystemFileHandle>(
execution_context, name, std::move(file_handle));
@@ -441,7 +365,7 @@ V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle(
directory_handle;
native_file_system_manager->GetDirectoryHandleFromToken(
- std::move(token), directory_handle.InitWithNewPipeAndPassReceiver());
+ token.Unbind(), directory_handle.InitWithNewPipeAndPassReceiver());
return MakeGarbageCollected<NativeFileSystemDirectoryHandle>(
execution_context, name, std::move(directory_handle));
@@ -453,4 +377,52 @@ V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle(
}
}
+RTCEncodedAudioFrame*
+V8ScriptValueDeserializerForModules::ReadRTCEncodedAudioFrame() {
+ if (!RuntimeEnabledFeatures::RTCInsertableStreamsEnabled(
+ ExecutionContext::From(GetScriptState()))) {
+ return nullptr;
+ }
+
+ uint32_t index;
+ if (!ReadUint32(&index))
+ return nullptr;
+
+ const auto* attachment =
+ GetSerializedScriptValue()
+ ->GetAttachmentIfExists<RTCEncodedAudioFramesAttachment>();
+ if (!attachment)
+ return nullptr;
+
+ const auto& frames = attachment->EncodedAudioFrames();
+ if (index >= frames.size())
+ return nullptr;
+
+ return MakeGarbageCollected<RTCEncodedAudioFrame>(frames[index]);
+}
+
+RTCEncodedVideoFrame*
+V8ScriptValueDeserializerForModules::ReadRTCEncodedVideoFrame() {
+ if (!RuntimeEnabledFeatures::RTCInsertableStreamsEnabled(
+ ExecutionContext::From(GetScriptState()))) {
+ return nullptr;
+ }
+
+ uint32_t index;
+ if (!ReadUint32(&index))
+ return nullptr;
+
+ const auto* attachment =
+ GetSerializedScriptValue()
+ ->GetAttachmentIfExists<RTCEncodedVideoFramesAttachment>();
+ if (!attachment)
+ return nullptr;
+
+ const auto& frames = attachment->EncodedVideoFrames();
+ if (index >= frames.size())
+ return nullptr;
+
+ return MakeGarbageCollected<RTCEncodedVideoFrame>(frames[index]);
+}
+
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h
index c1277c72034..fd08855f9be 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h
@@ -11,9 +11,9 @@
namespace blink {
class CryptoKey;
-class Landmark;
class NativeFileSystemHandle;
-class Point2D;
+class RTCEncodedAudioFrame;
+class RTCEncodedVideoFrame;
// Extends V8ScriptValueSerializer with support for modules/ types.
class MODULES_EXPORT V8ScriptValueDeserializerForModules final
@@ -45,9 +45,9 @@ class MODULES_EXPORT V8ScriptValueDeserializerForModules final
return true;
}
CryptoKey* ReadCryptoKey();
- bool ReadLandmark(Landmark* landmark);
- bool ReadPoint2D(Point2D* point);
NativeFileSystemHandle* ReadNativeFileSystemHandle(SerializationTag tag);
+ RTCEncodedAudioFrame* ReadRTCEncodedAudioFrame();
+ RTCEncodedVideoFrame* ReadRTCEncodedVideoFrame();
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc
index 4907145c5c5..2e88d05de51 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc
@@ -12,15 +12,18 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_rect_read_only.h"
#include "third_party/blink/renderer/bindings/modules/v8/serialization/web_crypto_sub_tags.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_crypto_key.h"
-#include "third_party/blink/renderer/bindings/modules/v8/v8_detected_barcode.h"
-#include "third_party/blink/renderer/bindings/modules/v8/v8_detected_face.h"
-#include "third_party/blink/renderer/bindings/modules/v8/v8_detected_text.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_dom_file_system.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_file_system_directory_handle.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_file_system_file_handle.h"
+#include "third_party/blink/renderer/bindings/modules/v8/v8_landmark.h"
+#include "third_party/blink/renderer/bindings/modules/v8/v8_point_2d.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_certificate.h"
-#include "third_party/blink/renderer/modules/imagecapture/point_2d.h"
-#include "third_party/blink/renderer/modules/shapedetection/landmark.h"
+#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_encoded_audio_frame.h"
+#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_encoded_video_frame.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_frame.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_frame_delegate.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink {
@@ -56,25 +59,15 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject(
return true;
}
if (wrapper_type_info == V8FileSystemFileHandle::GetWrapperTypeInfo() &&
- RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled()) {
- if (IsForStorage()) {
- exception_state.ThrowDOMException(
- DOMExceptionCode::kDataCloneError,
- "A NativeFileSystemFileHandle can not be serialized for storage.");
- return false;
- }
+ RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled(
+ ExecutionContext::From(GetScriptState()))) {
return WriteNativeFileSystemHandle(
kNativeFileSystemFileHandleTag,
wrappable->ToImpl<NativeFileSystemHandle>());
}
if (wrapper_type_info == V8FileSystemDirectoryHandle::GetWrapperTypeInfo() &&
- RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled()) {
- if (IsForStorage()) {
- exception_state.ThrowDOMException(DOMExceptionCode::kDataCloneError,
- "A NativeFileSystemDirectoryHandle can "
- "not be serialized for storage.");
- return false;
- }
+ RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled(
+ ExecutionContext::From(GetScriptState()))) {
return WriteNativeFileSystemHandle(
kNativeFileSystemDirectoryHandleTag,
wrappable->ToImpl<NativeFileSystemHandle>());
@@ -87,62 +80,27 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject(
WriteUTF8String(pem.certificate().c_str());
return true;
}
- if (wrapper_type_info == V8DetectedBarcode::GetWrapperTypeInfo()) {
- DetectedBarcode* detected_barcode = wrappable->ToImpl<DetectedBarcode>();
- WriteTag(kDetectedBarcodeTag);
- WriteUTF8String(detected_barcode->rawValue());
- DOMRectReadOnly* bounding_box = detected_barcode->boundingBox();
- WriteDouble(bounding_box->x());
- WriteDouble(bounding_box->y());
- WriteDouble(bounding_box->width());
- WriteDouble(bounding_box->height());
- const HeapVector<Member<Point2D>>& corner_points =
- detected_barcode->cornerPoints();
- WriteUint32(static_cast<uint32_t>(corner_points.size()));
- for (const auto& corner_point : corner_points) {
- WriteDouble(corner_point->x());
- WriteDouble(corner_point->y());
- }
- return true;
- }
- if (wrapper_type_info == V8DetectedFace::GetWrapperTypeInfo()) {
- DetectedFace* detected_face = wrappable->ToImpl<DetectedFace>();
- WriteTag(kDetectedFaceTag);
- DOMRectReadOnly* bounding_box = detected_face->boundingBox();
- WriteDouble(bounding_box->x());
- WriteDouble(bounding_box->y());
- WriteDouble(bounding_box->width());
- WriteDouble(bounding_box->height());
- const HeapVector<Member<Landmark>>& landmarks = detected_face->landmarks();
- WriteUint32(static_cast<uint32_t>(landmarks.size()));
- for (const auto& landmark : landmarks) {
- WriteUTF8String(landmark->type());
- const HeapVector<Member<Point2D>>& locations = landmark->locations();
- WriteUint32(static_cast<uint32_t>(locations.size()));
- for (const auto& location : locations) {
- WriteDouble(location->x());
- WriteDouble(location->y());
- }
+ if (wrapper_type_info == V8RTCEncodedAudioFrame::GetWrapperTypeInfo() &&
+ RuntimeEnabledFeatures::RTCInsertableStreamsEnabled(
+ ExecutionContext::From(GetScriptState()))) {
+ if (IsForStorage()) {
+ exception_state.ThrowDOMException(DOMExceptionCode::kDataCloneError,
+ "An RTCEncodedAudioFrame cannot be "
+ "serialized for storage.");
+ return false;
}
- return true;
+ return WriteRTCEncodedAudioFrame(wrappable->ToImpl<RTCEncodedAudioFrame>());
}
- if (wrapper_type_info == V8DetectedText::GetWrapperTypeInfo()) {
- DetectedText* detected_text = wrappable->ToImpl<DetectedText>();
- WriteTag(kDetectedTextTag);
- WriteUTF8String(detected_text->rawValue());
- DOMRectReadOnly* bounding_box = detected_text->boundingBox();
- WriteDouble(bounding_box->x());
- WriteDouble(bounding_box->y());
- WriteDouble(bounding_box->width());
- WriteDouble(bounding_box->height());
- const HeapVector<Member<Point2D>>& corner_points =
- detected_text->cornerPoints();
- WriteUint32(static_cast<uint32_t>(corner_points.size()));
- for (const auto& corner_point : corner_points) {
- WriteDouble(corner_point->x());
- WriteDouble(corner_point->y());
+ if (wrapper_type_info == V8RTCEncodedVideoFrame::GetWrapperTypeInfo() &&
+ RuntimeEnabledFeatures::RTCInsertableStreamsEnabled(
+ ExecutionContext::From(GetScriptState()))) {
+ if (IsForStorage()) {
+ exception_state.ThrowDOMException(DOMExceptionCode::kDataCloneError,
+ "An RTCEncodedVideoFrame cannot be "
+ "serialized for storage.");
+ return false;
}
- return true;
+ return WriteRTCEncodedVideoFrame(wrappable->ToImpl<RTCEncodedVideoFrame>());
}
return false;
}
@@ -183,6 +141,10 @@ uint32_t AlgorithmIdForWireFormat(WebCryptoAlgorithmId id) {
return kHkdfTag;
case kWebCryptoAlgorithmIdPbkdf2:
return kPbkdf2Tag;
+ // TODO(crbug.com/1032821): Handle them explicitly for Lint.
+ case kWebCryptoAlgorithmIdEd25519:
+ case kWebCryptoAlgorithmIdX25519:
+ return 0;
}
NOTREACHED() << "Unknown algorithm ID " << id;
return 0;
@@ -338,4 +300,32 @@ bool V8ScriptValueSerializerForModules::WriteNativeFileSystemHandle(
return true;
}
+bool V8ScriptValueSerializerForModules::WriteRTCEncodedAudioFrame(
+ RTCEncodedAudioFrame* audio_frame) {
+ auto* attachment =
+ GetSerializedScriptValue()
+ ->GetOrCreateAttachment<RTCEncodedAudioFramesAttachment>();
+ auto& frames = attachment->EncodedAudioFrames();
+ frames.push_back(audio_frame->Delegate());
+ const uint32_t index = static_cast<uint32_t>(frames.size() - 1);
+
+ WriteTag(kRTCEncodedAudioFrameTag);
+ WriteUint32(index);
+ return true;
+}
+
+bool V8ScriptValueSerializerForModules::WriteRTCEncodedVideoFrame(
+ RTCEncodedVideoFrame* video_frame) {
+ auto* attachment =
+ GetSerializedScriptValue()
+ ->GetOrCreateAttachment<RTCEncodedVideoFramesAttachment>();
+ auto& frames = attachment->EncodedVideoFrames();
+ frames.push_back(video_frame->Delegate());
+ const uint32_t index = static_cast<uint32_t>(frames.size() - 1);
+
+ WriteTag(kRTCEncodedVideoFrameTag);
+ WriteUint32(index);
+ return true;
+}
+
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h
index 6405202e0cb..eda1434b359 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h
@@ -12,6 +12,8 @@
namespace blink {
class NativeFileSystemHandle;
+class RTCEncodedAudioFrame;
+class RTCEncodedVideoFrame;
class WebCryptoKey;
// Extends V8ScriptValueSerializer with support for modules/ types.
@@ -32,6 +34,8 @@ class MODULES_EXPORT V8ScriptValueSerializerForModules final
bool WriteNativeFileSystemHandle(
SerializationTag tag,
NativeFileSystemHandle* native_file_system_handle);
+ bool WriteRTCEncodedAudioFrame(RTCEncodedAudioFrame*);
+ bool WriteRTCEncodedVideoFrame(RTCEncodedVideoFrame*);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc
index 7dfcc8274d6..6e3442cc80e 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc
@@ -20,18 +20,13 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_rect_read_only.h"
#include "third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_crypto_key.h"
-#include "third_party/blink/renderer/bindings/modules/v8/v8_detected_barcode.h"
-#include "third_party/blink/renderer/bindings/modules/v8/v8_detected_face.h"
-#include "third_party/blink/renderer/bindings/modules/v8/v8_detected_text.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_dom_file_system.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_certificate.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
#include "third_party/blink/renderer/modules/crypto/crypto_result_impl.h"
#include "third_party/blink/renderer/modules/filesystem/dom_file_system.h"
-#include "third_party/blink/renderer/modules/imagecapture/point_2d.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_certificate.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h"
-#include "third_party/blink/renderer/modules/shapedetection/landmark.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
@@ -985,85 +980,5 @@ TEST(V8ScriptValueSerializerForModulesTest, DecodeInvalidDOMFileSystem) {
->IsNull());
}
-TEST(V8ScriptValueSerializerForModulesTest, DecodeDetectedBarcode) {
- V8TestingScope scope;
- ScriptState* script_state = scope.GetScriptState();
- scoped_refptr<SerializedScriptValue> input = SerializedValue(
- {0xff, 0x13, 0xff, 0x0d, 0x5c, 'B', 0x04, 0x74, 0x65, 0x78, 0x74, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40});
- v8::Local<v8::Value> result =
- V8ScriptValueDeserializerForModules(script_state, input).Deserialize();
- ASSERT_TRUE(V8DetectedBarcode::HasInstance(result, scope.GetIsolate()));
- DetectedBarcode* detected_barcode =
- V8DetectedBarcode::ToImpl(result.As<v8::Object>());
- EXPECT_EQ("text", detected_barcode->rawValue());
- DOMRectReadOnly* bounding_box = detected_barcode->boundingBox();
- EXPECT_EQ(1, bounding_box->x());
- EXPECT_EQ(2, bounding_box->y());
- EXPECT_EQ(3, bounding_box->width());
- EXPECT_EQ(4, bounding_box->height());
- const HeapVector<Member<Point2D>>& corner_points =
- detected_barcode->cornerPoints();
- EXPECT_EQ(1u, corner_points.size());
- EXPECT_EQ(1, corner_points[0]->x());
- EXPECT_EQ(2, corner_points[0]->y());
-}
-
-TEST(V8ScriptValueSerializerForModulesTest, DecodeDetectedFace) {
- V8TestingScope scope;
- ScriptState* script_state = scope.GetScriptState();
- scoped_refptr<SerializedScriptValue> input = SerializedValue(
- {0xff, 0x13, 0xff, 0x0d, 0x5c, 'F', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x40, 0x01, 0x03, 0x65, 0x79, 0x65, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40});
- v8::Local<v8::Value> result =
- V8ScriptValueDeserializerForModules(script_state, input).Deserialize();
- ASSERT_TRUE(V8DetectedFace::HasInstance(result, scope.GetIsolate()));
- DetectedFace* detected_face = V8DetectedFace::ToImpl(result.As<v8::Object>());
- DOMRectReadOnly* bounding_box = detected_face->boundingBox();
- EXPECT_EQ(1, bounding_box->x());
- EXPECT_EQ(2, bounding_box->y());
- EXPECT_EQ(3, bounding_box->width());
- EXPECT_EQ(4, bounding_box->height());
- const HeapVector<Member<Landmark>>& landmarks = detected_face->landmarks();
- EXPECT_EQ(1u, landmarks.size());
- EXPECT_EQ("eye", landmarks[0]->type());
- const HeapVector<Member<Point2D>>& locations = landmarks[0]->locations();
- EXPECT_EQ(1u, locations.size());
- EXPECT_EQ(1, locations[0]->x());
- EXPECT_EQ(2, locations[0]->y());
-}
-
-TEST(V8ScriptValueSerializerForModulesTest, DecodeDetectedText) {
- V8TestingScope scope;
- ScriptState* script_state = scope.GetScriptState();
- scoped_refptr<SerializedScriptValue> input = SerializedValue(
- {0xff, 0x13, 0xff, 0x0d, 0x5c, 't', 0x04, 0x74, 0x65, 0x78, 0x74, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40});
- v8::Local<v8::Value> result =
- V8ScriptValueDeserializerForModules(script_state, input).Deserialize();
- ASSERT_TRUE(V8DetectedText::HasInstance(result, scope.GetIsolate()));
- DetectedText* detected_text = V8DetectedText::ToImpl(result.As<v8::Object>());
- EXPECT_EQ("text", detected_text->rawValue());
- DOMRectReadOnly* bounding_box = detected_text->boundingBox();
- EXPECT_EQ(1, bounding_box->x());
- EXPECT_EQ(2, bounding_box->y());
- EXPECT_EQ(3, bounding_box->width());
- EXPECT_EQ(4, bounding_box->height());
- const HeapVector<Member<Point2D>>& corner_points =
- detected_text->cornerPoints();
- EXPECT_EQ(1u, corner_points.size());
- EXPECT_EQ(1, corner_points[0]->x());
- EXPECT_EQ(2, corner_points[0]->y());
-}
-
} // namespace
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc
index d2b27a0289b..03110a4c22c 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc
@@ -540,9 +540,12 @@ static v8::Local<v8::Value> DeserializeIDBValueData(v8::Isolate* isolate,
scoped_refptr<SerializedScriptValue> serialized_value =
value->CreateSerializedValue();
+
+ serialized_value->NativeFileSystemTokens() =
+ std::move(const_cast<IDBValue*>(value)->NativeFileSystemTokens());
+
SerializedScriptValue::DeserializeOptions options;
options.blob_info = &value->BlobInfo();
- options.read_wasm_from_stream = true;
// deserialize() returns null when serialization fails. This is sub-optimal
// because IndexedDB values can be null, so an application cannot distinguish
@@ -758,8 +761,7 @@ bool CanInjectIDBKeyIntoScriptValue(v8::Isolate* isolate,
ScriptValue DeserializeScriptValue(ScriptState* script_state,
SerializedScriptValue* serialized_value,
- const Vector<WebBlobInfo>* blob_info,
- bool read_wasm_from_stream) {
+ const Vector<WebBlobInfo>* blob_info) {
v8::Isolate* isolate = script_state->GetIsolate();
v8::HandleScope handle_scope(isolate);
if (!serialized_value)
@@ -767,7 +769,6 @@ ScriptValue DeserializeScriptValue(ScriptState* script_state,
SerializedScriptValue::DeserializeOptions options;
options.blob_info = blob_info;
- options.read_wasm_from_stream = read_wasm_from_stream;
return ScriptValue(isolate, serialized_value->Deserialize(isolate, options));
}
diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h b/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h
index 78321321dab..3a44e6c38e8 100644
--- a/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h
+++ b/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h
@@ -34,8 +34,7 @@ MODULES_EXPORT bool CanInjectIDBKeyIntoScriptValue(v8::Isolate*,
const IDBKeyPath&);
ScriptValue DeserializeScriptValue(ScriptState*,
SerializedScriptValue*,
- const Vector<WebBlobInfo>*,
- bool read_wasm_from_stream);
+ const Vector<WebBlobInfo>*);
#if DCHECK_IS_ON()
void AssertPrimaryKeyValidOrInjectable(ScriptState*, const IDBValue*);