Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(800)

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp

Issue 2733763003: Reimplement [PutForwards] per spec (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
index 772a548ec04c0232d7720b026dcb2db7b7b224a4..2b32f19731e6a1263aa8c80b6a9503960c8fcf69 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -2549,18 +2549,15 @@ static void locationAttributeSetter(v8::Local<v8::Value> v8Value, const v8::Func
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->location());
- if (!impl)
+ ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "location");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "location")).ToLocal(&target))
return;
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.Prepare())
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
return;
-
- impl->setHref(cppValue);
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationWithExceptionAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2575,20 +2572,15 @@ static void locationWithExceptionAttributeSetter(v8::Local<v8::Value> v8Value, c
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->locationWithException());
- if (!impl)
- return;
-
ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationWithException");
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.Prepare())
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationWithException")).ToLocal(&target))
return;
-
- impl->setHrefThrows(cppValue, exceptionState);
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
+ return;
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "hrefThrows"), v8Value).IsNothing();
}
static void locationWithCallWithAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2603,20 +2595,15 @@ static void locationWithCallWithAttributeSetter(v8::Local<v8::Value> v8Value, co
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->locationWithCallWith());
- if (!impl)
+ ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationWithCallWith");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationWithCallWith")).ToLocal(&target))
return;
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.Prepare())
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
return;
-
- ExecutionContext* executionContext = CurrentExecutionContext(isolate);
-
- impl->setHrefCallWith(executionContext, CurrentDOMWindow(info.GetIsolate()), EnteredDOMWindow(info.GetIsolate()), cppValue);
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "hrefCallWith"), v8Value).IsNothing();
}
static void locationByteStringAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2631,20 +2618,15 @@ static void locationByteStringAttributeSetter(v8::Local<v8::Value> v8Value, cons
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->locationByteString());
- if (!impl)
- return;
-
ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationByteString");
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = NativeValueTraits<IDLByteString>::NativeValue(info.GetIsolate(), v8Value, exceptionState);
- if (exceptionState.HadException())
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationByteString")).ToLocal(&target))
return;
-
- impl->setHrefByteString(cppValue);
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
+ return;
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "hrefByteString"), v8Value).IsNothing();
}
static void locationWithPerWorldBindingsAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2659,18 +2641,15 @@ static void locationWithPerWorldBindingsAttributeSetter(v8::Local<v8::Value> v8V
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->locationWithPerWorldBindings());
- if (!impl)
+ ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationWithPerWorldBindings");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationWithPerWorldBindings")).ToLocal(&target))
return;
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.Prepare())
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
return;
-
- impl->setHref(cppValue);
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationWithPerWorldBindingsAttributeGetterForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2685,18 +2664,15 @@ static void locationWithPerWorldBindingsAttributeSetterForMainWorld(v8::Local<v8
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->locationWithPerWorldBindings());
- if (!impl)
+ ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationWithPerWorldBindings");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationWithPerWorldBindings")).ToLocal(&target))
return;
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.Prepare())
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
return;
-
- impl->setHref(cppValue);
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationLegacyInterfaceTypeCheckingAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2711,18 +2687,15 @@ static void locationLegacyInterfaceTypeCheckingAttributeSetter(v8::Local<v8::Val
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->locationLegacyInterfaceTypeChecking());
- if (!impl)
+ ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationLegacyInterfaceTypeChecking");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationLegacyInterfaceTypeChecking")).ToLocal(&target))
return;
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.Prepare())
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
return;
-
- impl->setHref(cppValue);
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationGarbageCollectedAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2748,24 +2721,15 @@ static void locationGarbageCollectedAttributeSetter(v8::Local<v8::Value> v8Value
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestInterfaceGarbageCollected* impl = WTF::GetPtr(proxyImpl->locationGarbageCollected());
- if (!impl)
- return;
-
ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationGarbageCollected");
-
- // Prepare the value to be set.
- TestInterfaceGarbageCollected* cppValue = V8TestInterfaceGarbageCollected::toImplWithTypeCheck(info.GetIsolate(), v8Value);
-
- // Type check per: http://heycam.github.io/webidl/#es-interface
- if (!cppValue) {
- exceptionState.ThrowTypeError("The provided value is not of type 'TestInterfaceGarbageCollected'.");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationGarbageCollected")).ToLocal(&target))
+ return;
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
return;
}
-
- impl->setAttr1(cppValue);
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "attr1"), v8Value).IsNothing();
}
static void raisesExceptionLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -3547,18 +3511,15 @@ static void locationPutForwardsAttributeSetter(v8::Local<v8::Value> v8Value, con
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::GetPtr(proxyImpl->locationPutForwards());
- if (!impl)
+ ExceptionState exceptionState(isolate, ExceptionState::kSetterContext, "TestObject", "locationPutForwards");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "locationPutForwards")).ToLocal(&target))
return;
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.Prepare())
+ if (!target->IsObject()) {
+ exceptionState.ThrowTypeError("The attribute value is not an object");
return;
-
- impl->setHref(cppValue);
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetCurrentContext(), V8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void runtimeEnabledLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {

Powered by Google App Engine
This is Rietveld 408576698