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

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

Issue 2733763003: Reimplement [PutForwards] per spec (Closed)
Patch Set: Created 3 years, 9 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 c2a0e5943e1391e0b004e34300633040757996f2..66b8d5b13b7138ff574bf3cf2eaee80b3a2d88df 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -2220,18 +2220,15 @@ static void locationAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& i
}
static void locationAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->location());
- if (!impl)
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestObject", "location");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationWithExceptionAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2243,20 +2240,15 @@ static void locationWithExceptionAttributeGetter(const v8::FunctionCallbackInfo<
}
static void locationWithExceptionAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->locationWithException());
- if (!impl)
- return;
-
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "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()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "hrefThrows"), v8Value).IsNothing();
}
static void locationWithCallWithAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2268,20 +2260,15 @@ static void locationWithCallWithAttributeGetter(const v8::FunctionCallbackInfo<v
}
static void locationWithCallWithAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->locationWithCallWith());
- if (!impl)
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestObject", "locationWithCallWith");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), 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(info.GetIsolate());
-
- impl->setHrefCallWith(executionContext, currentDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue);
+ }
+ target.As<v8::Object>()->Set(info.GetIsolate()->GetEnteredContext(), v8String(info.GetIsolate(), "hrefCallWith"), v8Value).IsNothing();
}
static void locationByteStringAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2293,20 +2280,15 @@ static void locationByteStringAttributeGetter(const v8::FunctionCallbackInfo<v8:
}
static void locationByteStringAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->locationByteString());
- if (!impl)
- return;
-
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestObject", "locationByteString");
-
- // Prepare the value to be set.
- V8StringResource<> cppValue = toByteString(info.GetIsolate(), v8Value, exceptionState);
- if (exceptionState.hadException())
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "hrefByteString"), v8Value).IsNothing();
}
static void locationWithPerWorldBindingsAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2318,18 +2300,15 @@ static void locationWithPerWorldBindingsAttributeGetter(const v8::FunctionCallba
}
static void locationWithPerWorldBindingsAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->locationWithPerWorldBindings());
- if (!impl)
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestObject", "locationWithPerWorldBindings");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationWithPerWorldBindingsAttributeGetterForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2341,18 +2320,15 @@ static void locationWithPerWorldBindingsAttributeGetterForMainWorld(const v8::Fu
}
static void locationWithPerWorldBindingsAttributeSetterForMainWorld(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->locationWithPerWorldBindings());
- if (!impl)
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestObject", "locationWithPerWorldBindings");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationLegacyInterfaceTypeCheckingAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2364,18 +2340,15 @@ static void locationLegacyInterfaceTypeCheckingAttributeGetter(const v8::Functio
}
static void locationLegacyInterfaceTypeCheckingAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->locationLegacyInterfaceTypeChecking());
- if (!impl)
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestObject", "locationLegacyInterfaceTypeChecking");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void locationGarbageCollectedAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -2397,24 +2370,15 @@ static void locationGarbageCollectedAttributeGetter(const v8::FunctionCallbackIn
}
static void locationGarbageCollectedAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestInterfaceGarbageCollected* impl = WTF::getPtr(proxyImpl->locationGarbageCollected());
- if (!impl)
- return;
-
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "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()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "attr1"), v8Value).IsNothing();
}
static void raisesExceptionLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -3120,18 +3084,15 @@ static void locationPutForwardsAttributeGetter(const v8::FunctionCallbackInfo<v8
}
static void locationPutForwardsAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info) {
- v8::Local<v8::Object> holder = info.Holder();
- TestObject* proxyImpl = V8TestObject::toImpl(holder);
- TestNode* impl = WTF::getPtr(proxyImpl->locationPutForwards());
- if (!impl)
+ ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestObject", "locationPutForwards");
+ v8::Local<v8::Value> target;
+ if (!info.Holder()->Get(info.GetIsolate()->GetEnteredContext(), 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()->GetEnteredContext(), v8String(info.GetIsolate(), "href"), v8Value).IsNothing();
}
static void runtimeEnabledLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {

Powered by Google App Engine
This is Rietveld 408576698