Commit f49052ad authored by Marina Sakai's avatar Marina Sakai Committed by Commit Bot

Remove a macro-generated function for a private property of DOMException

This CL removes a macro-generated fucntion for a private property of DOMException, and replaces it with the new API GetSymbol, which uses an instance address of V8PrivateProperty::SymbolKey as a key to get Symbol.

Bug: 715418
Change-Id: Ic11d5b0528ce909faa641ec01047ec2ef4d88775
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890404
Commit-Queue: Marina Sakai <marinasakai@google.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711672}
parent 455d36b1
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_error_event.h" #include "third_party/blink/renderer/bindings/core/v8/v8_error_event.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_idle_task_runner.h" #include "third_party/blink/renderer/bindings/core/v8/v8_idle_task_runner.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.h" #include "third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
...@@ -65,7 +66,6 @@ ...@@ -65,7 +66,6 @@
#include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_context_data.h" #include "third_party/blink/renderer/platform/bindings/v8_per_context_data.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scheduler/public/cooperative_scheduling_manager.h" #include "third_party/blink/renderer/platform/scheduler/public/cooperative_scheduling_manager.h"
...@@ -263,7 +263,8 @@ static void PromiseRejectHandler(v8::PromiseRejectMessage data, ...@@ -263,7 +263,8 @@ static void PromiseRejectHandler(v8::PromiseRejectMessage data,
// Try to get the stack & location from a wrapped exception object (e.g. // Try to get the stack & location from a wrapped exception object (e.g.
// DOMException). // DOMException).
DCHECK(exception->IsObject()); DCHECK(exception->IsObject());
auto private_error = V8PrivateProperty::GetDOMExceptionError(isolate); auto private_error = V8PrivateProperty::GetSymbol(
isolate, kPrivatePropertyDOMExceptionError);
v8::Local<v8::Value> error; v8::Local<v8::Value> error;
if (private_error.GetOrUndefined(exception.As<v8::Object>()) if (private_error.GetOrUndefined(exception.As<v8::Object>())
.ToLocal(&error) && .ToLocal(&error) &&
......
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
#include "third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" #include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h"
#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink { namespace blink {
// extern
const V8PrivateProperty::SymbolKey kPrivatePropertyDOMExceptionError;
// static // static
void V8ThrowDOMException::Init() { void V8ThrowDOMException::Init() {
ExceptionState::SetCreateDOMExceptionFunction( ExceptionState::SetCreateDOMExceptionFunction(
...@@ -70,7 +72,8 @@ v8::Local<v8::Value> V8ThrowDOMException::CreateOrEmpty( ...@@ -70,7 +72,8 @@ v8::Local<v8::Value> V8ThrowDOMException::CreateOrEmpty(
DomExceptionStackSetter, error) DomExceptionStackSetter, error)
.ToChecked(); .ToChecked();
auto private_error = V8PrivateProperty::GetDOMExceptionError(isolate); auto private_error =
V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyDOMExceptionError);
private_error.Set(exception_obj, error); private_error.Set(exception_obj, error);
return exception_obj; return exception_obj;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h" #include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
...@@ -33,6 +34,8 @@ class CORE_EXPORT V8ThrowDOMException { ...@@ -33,6 +34,8 @@ class CORE_EXPORT V8ThrowDOMException {
const String& unsanitized_message = String()); const String& unsanitized_message = String());
}; };
extern const V8PrivateProperty::SymbolKey kPrivatePropertyDOMExceptionError;
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_THROW_DOM_EXCEPTION_H_ #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_THROW_DOM_EXCEPTION_H_
...@@ -24,7 +24,6 @@ class ScriptWrappable; ...@@ -24,7 +24,6 @@ class ScriptWrappable;
// e.g. IDBCursor.Request. // e.g. IDBCursor.Request.
// Apply |X| for each pair of (InterfaceName, PrivateKeyName). // Apply |X| for each pair of (InterfaceName, PrivateKeyName).
#define V8_PRIVATE_PROPERTY_FOR_EACH(X) \ #define V8_PRIVATE_PROPERTY_FOR_EACH(X) \
X(DOMException, Error) \
X(MessageEvent, CachedData) \ X(MessageEvent, CachedData) \
// The getter's name for a private property. // The getter's name for a private property.
......
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