| Index: third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp b/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp
|
| similarity index 92%
|
| copy from third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
|
| copy to third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp
|
| index 91a12d24b57bbacdd9b99e5e7160490c90d658d5..5f2eb69322a19a8ed731ad6f2401cbd32153b565 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingForCore.cpp
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
|
| + * Copyright (C) 2017 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -28,7 +28,7 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#include "bindings/core/v8/V8Binding.h"
|
| +#include "bindings/core/v8/V8BindingForCore.h"
|
|
|
| #include "bindings/core/v8/ScriptController.h"
|
| #include "bindings/core/v8/V8AbstractEventListener.h"
|
| @@ -201,9 +201,10 @@ static inline T ToSmallerInt(v8::Isolate* isolate,
|
| }
|
| DCHECK(!number_object.IsEmpty());
|
|
|
| - if (configuration == kEnforceRange)
|
| + if (configuration == kEnforceRange) {
|
| return EnforceRange(number_object->Value(), LimitsTrait::kMinValue,
|
| LimitsTrait::kMaxValue, type_name, exception_state);
|
| + }
|
|
|
| double number_value = number_object->Value();
|
| if (std::isnan(number_value) || !number_value)
|
| @@ -261,9 +262,10 @@ static inline T ToSmallerUInt(v8::Isolate* isolate,
|
| }
|
| DCHECK(!number_object.IsEmpty());
|
|
|
| - if (configuration == kEnforceRange)
|
| + if (configuration == kEnforceRange) {
|
| return EnforceRange(number_object->Value(), 0, LimitsTrait::kMaxValue,
|
| type_name, exception_state);
|
| + }
|
|
|
| double number_value = number_object->Value();
|
|
|
| @@ -330,9 +332,10 @@ int32_t ToInt32Slow(v8::Isolate* isolate,
|
| DCHECK(!number_object.IsEmpty());
|
|
|
| double number_value = number_object->Value();
|
| - if (configuration == kEnforceRange)
|
| + if (configuration == kEnforceRange) {
|
| return EnforceRange(number_value, kMinInt32, kMaxInt32, "long",
|
| exception_state);
|
| + }
|
|
|
| if (std::isnan(number_value))
|
| return 0;
|
| @@ -381,9 +384,10 @@ uint32_t ToUInt32Slow(v8::Isolate* isolate,
|
| }
|
| DCHECK(!number_object.IsEmpty());
|
|
|
| - if (configuration == kEnforceRange)
|
| + if (configuration == kEnforceRange) {
|
| return EnforceRange(number_object->Value(), 0, kMaxUInt32, "unsigned long",
|
| exception_state);
|
| + }
|
|
|
| double number_value = number_object->Value();
|
|
|
| @@ -423,9 +427,10 @@ int64_t ToInt64Slow(v8::Isolate* isolate,
|
|
|
| double number_value = number_object->Value();
|
|
|
| - if (configuration == kEnforceRange)
|
| + if (configuration == kEnforceRange) {
|
| return EnforceRange(number_value, -kJSMaxInteger, kJSMaxInteger,
|
| "long long", exception_state);
|
| + }
|
|
|
| if (std::isnan(number_value) || std::isinf(number_value))
|
| return 0;
|
| @@ -442,7 +447,7 @@ uint64_t ToUInt64Slow(v8::Isolate* isolate,
|
| ExceptionState& exception_state) {
|
| DCHECK(!value->IsUint32());
|
| if (value->IsInt32()) {
|
| - ASSERT(configuration != kNormalConversion);
|
| + DCHECK(configuration != kNormalConversion);
|
| int32_t result = value.As<v8::Int32>()->Value();
|
| if (result >= 0)
|
| return result;
|
| @@ -467,9 +472,10 @@ uint64_t ToUInt64Slow(v8::Isolate* isolate,
|
|
|
| double number_value = number_object->Value();
|
|
|
| - if (configuration == kEnforceRange)
|
| + if (configuration == kEnforceRange) {
|
| return EnforceRange(number_value, 0, kJSMaxInteger, "unsigned long long",
|
| exception_state);
|
| + }
|
|
|
| if (std::isnan(number_value))
|
| return 0;
|
| @@ -581,7 +587,7 @@ static bool HasUnmatchedSurrogates(const String& string) {
|
| continue;
|
| if (U16_IS_TRAIL(c))
|
| return true;
|
| - ASSERT(U16_IS_LEAD(c));
|
| + DCHECK(U16_IS_LEAD(c));
|
| if (i == length - 1)
|
| return true;
|
| UChar d = characters[i + 1];
|
| @@ -697,11 +703,12 @@ String ToUSVString(v8::Isolate* isolate,
|
| XPathNSResolver* ToXPathNSResolver(ScriptState* script_state,
|
| v8::Local<v8::Value> value) {
|
| XPathNSResolver* resolver = nullptr;
|
| - if (V8XPathNSResolver::hasInstance(value, script_state->GetIsolate()))
|
| + if (V8XPathNSResolver::hasInstance(value, script_state->GetIsolate())) {
|
| resolver = V8XPathNSResolver::toImpl(v8::Local<v8::Object>::Cast(value));
|
| - else if (value->IsObject())
|
| + } else if (value->IsObject()) {
|
| resolver =
|
| V8CustomXPathNSResolver::Create(script_state, value.As<v8::Object>());
|
| + }
|
| return resolver;
|
| }
|
|
|
| @@ -865,13 +872,6 @@ bool IsValidEnum(const Vector<String>& values,
|
| return true;
|
| }
|
|
|
| -v8::Local<v8::Function> GetBoundFunction(v8::Local<v8::Function> function) {
|
| - v8::Local<v8::Value> bound_function = function->GetBoundFunction();
|
| - return bound_function->IsFunction()
|
| - ? v8::Local<v8::Function>::Cast(bound_function)
|
| - : function;
|
| -}
|
| -
|
| v8::Local<v8::Object> GetEsIterator(v8::Isolate* isolate,
|
| v8::Local<v8::Object> object,
|
| ExceptionState& exception_state) {
|
| @@ -921,41 +921,6 @@ bool HasCallableIteratorSymbol(v8::Isolate* isolate,
|
| return iterator_getter->IsFunction();
|
| }
|
|
|
| -bool AddHiddenValueToArray(v8::Isolate* isolate,
|
| - v8::Local<v8::Object> object,
|
| - v8::Local<v8::Value> value,
|
| - int array_index) {
|
| - DCHECK(!value.IsEmpty());
|
| - v8::Local<v8::Value> array_value = object->GetInternalField(array_index);
|
| - if (array_value->IsNull() || array_value->IsUndefined()) {
|
| - array_value = v8::Array::New(isolate);
|
| - object->SetInternalField(array_index, array_value);
|
| - }
|
| -
|
| - v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(array_value);
|
| - return V8CallBoolean(array->CreateDataProperty(isolate->GetCurrentContext(),
|
| - array->Length(), value));
|
| -}
|
| -
|
| -void RemoveHiddenValueFromArray(v8::Isolate* isolate,
|
| - v8::Local<v8::Object> object,
|
| - v8::Local<v8::Value> value,
|
| - int array_index) {
|
| - v8::Local<v8::Value> array_value = object->GetInternalField(array_index);
|
| - if (!array_value->IsArray())
|
| - return;
|
| - v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(array_value);
|
| - for (int i = array->Length() - 1; i >= 0; --i) {
|
| - v8::Local<v8::Value> item;
|
| - if (!array->Get(isolate->GetCurrentContext(), i).ToLocal(&item))
|
| - return;
|
| - if (item->StrictEquals(value)) {
|
| - array->Delete(isolate->GetCurrentContext(), i).ToChecked();
|
| - return;
|
| - }
|
| - }
|
| -}
|
| -
|
| void MoveEventListenerToNewWrapper(v8::Isolate* isolate,
|
| v8::Local<v8::Object> object,
|
| EventListener* old_value,
|
| @@ -967,9 +932,10 @@ void MoveEventListenerToNewWrapper(v8::Isolate* isolate,
|
| if (old_listener) {
|
| v8::Local<v8::Object> old_listener_object =
|
| old_listener->GetExistingListenerObject();
|
| - if (!old_listener_object.IsEmpty())
|
| + if (!old_listener_object.IsEmpty()) {
|
| RemoveHiddenValueFromArray(isolate, object, old_listener_object,
|
| array_index);
|
| + }
|
| }
|
| }
|
| // Non-callable input is treated as null and ignored
|
| @@ -988,15 +954,6 @@ v8::Isolate* ToIsolate(LocalFrame* frame) {
|
| return frame->GetWindowProxyManager()->GetIsolate();
|
| }
|
|
|
| -v8::Local<v8::Value> FreezeV8Object(v8::Local<v8::Value> value,
|
| - v8::Isolate* isolate) {
|
| - value.As<v8::Object>()
|
| - ->SetIntegrityLevel(isolate->GetCurrentContext(),
|
| - v8::IntegrityLevel::kFrozen)
|
| - .ToChecked();
|
| - return value;
|
| -}
|
| -
|
| v8::Local<v8::Value> FromJSONString(v8::Isolate* isolate,
|
| const String& stringified_json,
|
| ExceptionState& exception_state) {
|
|
|