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 722c8284e2b5a742b60990b9152e97693839e4b0..7f0788bc711ca7c03527a04ecbd3b1b797296995 100644 |
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp |
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp |
@@ -114,71 +114,26 @@ static void MEASURED_CONSTANTConstantGetterCallback(v8::Local<v8::Name>, const v |
static void FEATURE1_ORIGIN_TRIAL_ENABLED_CONST1ConstantGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureName1Enabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
v8SetReturnValueInt(info, 1); |
} |
static void FEATURE1_ORIGIN_TRIAL_ENABLED_CONST2ConstantGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureName1Enabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
v8SetReturnValueInt(info, 2); |
} |
static void FEATURE2_ORIGIN_TRIAL_ENABLED_CONST1ConstantGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureName2Enabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
v8SetReturnValueInt(info, 3); |
} |
static void FEATURE2_ORIGIN_TRIAL_ENABLED_CONST2ConstantGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureName2Enabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
v8SetReturnValueInt(info, 4); |
} |
static void FEATURE3_ORIGIN_TRIAL_ENABLED_CONST1ConstantGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureName3Enabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
v8SetReturnValueInt(info, 5); |
} |
@@ -2699,15 +2654,6 @@ static void notEnumerableLongAttributeAttributeSetterCallback(const v8::Function |
static void originTrialEnabledLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
v8::Local<v8::Object> holder = info.Holder(); |
TestObject* impl = V8TestObject::toImpl(holder); |
v8SetReturnValueInt(info, impl->originTrialEnabledLongAttribute()); |
@@ -2715,15 +2661,6 @@ static void originTrialEnabledLongAttributeAttributeGetter(const v8::FunctionCal |
static void originTrialEnabledLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
TestObjectV8Internal::originTrialEnabledLongAttributeAttributeGetter(info); |
} |
@@ -4595,15 +4532,6 @@ static void unscopeableLongAttributeAttributeSetterCallback(const v8::FunctionCa |
static void unscopeableOriginTrialEnabledLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
v8::Local<v8::Object> holder = info.Holder(); |
TestObject* impl = V8TestObject::toImpl(holder); |
v8SetReturnValueInt(info, impl->unscopeableOriginTrialEnabledLongAttribute()); |
@@ -4611,15 +4539,6 @@ static void unscopeableOriginTrialEnabledLongAttributeAttributeGetter(const v8:: |
static void unscopeableOriginTrialEnabledLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
TestObjectV8Internal::unscopeableOriginTrialEnabledLongAttributeAttributeGetter(info); |
} |
@@ -9867,15 +9786,6 @@ static void originTrialEnabledVoidMethodMethod(const v8::FunctionCallbackInfo<v8 |
static void originTrialEnabledVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
TestObjectV8Internal::originTrialEnabledVoidMethodMethod(info); |
} |
@@ -9887,15 +9797,6 @@ static void perWorldBindingsOriginTrialEnabledVoidMethodMethod(const v8::Functio |
static void perWorldBindingsOriginTrialEnabledVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
TestObjectV8Internal::perWorldBindingsOriginTrialEnabledVoidMethodMethod(info); |
} |
@@ -9907,15 +9808,6 @@ static void perWorldBindingsOriginTrialEnabledVoidMethodMethodForMainWorld(const |
static void perWorldBindingsOriginTrialEnabledVoidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
- ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
- String errorMessage; |
- if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { |
- v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
- if (!errorMessage.isEmpty()) { |
- executionContext->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
- } |
- return; |
- } |
TestObjectV8Internal::perWorldBindingsOriginTrialEnabledVoidMethodMethodForMainWorld(info); |
} |
@@ -11599,7 +11491,6 @@ const V8DOMConfiguration::AccessorConfiguration V8TestObjectAccessors[] = { |
{"customSetterImplementedAsLongAttribute", TestObjectV8Internal::customSetterImplementedAsLongAttributeAttributeGetterCallback, TestObjectV8Internal::customSetterImplementedAsLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"measureAsLongAttribute", TestObjectV8Internal::measureAsLongAttributeAttributeGetterCallback, TestObjectV8Internal::measureAsLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"notEnumerableLongAttribute", TestObjectV8Internal::notEnumerableLongAttributeAttributeGetterCallback, TestObjectV8Internal::notEnumerableLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
- {"originTrialEnabledLongAttribute", TestObjectV8Internal::originTrialEnabledLongAttributeAttributeGetterCallback, TestObjectV8Internal::originTrialEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"perWorldBindingsReadonlyTestInterfaceEmptyAttribute", TestObjectV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback, 0, TestObjectV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackForMainWorld, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"activityLoggingAccessPerWorldBindingsLongAttribute", TestObjectV8Internal::activityLoggingAccessPerWorldBindingsLongAttributeAttributeGetterCallback, TestObjectV8Internal::activityLoggingAccessPerWorldBindingsLongAttributeAttributeSetterCallback, TestObjectV8Internal::activityLoggingAccessPerWorldBindingsLongAttributeAttributeGetterCallbackForMainWorld, TestObjectV8Internal::activityLoggingAccessPerWorldBindingsLongAttributeAttributeSetterCallbackForMainWorld, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttribute", TestObjectV8Internal::activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeGetterCallback, TestObjectV8Internal::activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeSetterCallback, TestObjectV8Internal::activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeGetterCallbackForMainWorld, TestObjectV8Internal::activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeSetterCallbackForMainWorld, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
@@ -11652,7 +11543,6 @@ const V8DOMConfiguration::AccessorConfiguration V8TestObjectAccessors[] = { |
{"sameObjectAttribute", TestObjectV8Internal::sameObjectAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"saveSameObjectAttribute", TestObjectV8Internal::saveSameObjectAttributeAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"unscopeableLongAttribute", TestObjectV8Internal::unscopeableLongAttributeAttributeGetterCallback, TestObjectV8Internal::unscopeableLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
- {"unscopeableOriginTrialEnabledLongAttribute", TestObjectV8Internal::unscopeableOriginTrialEnabledLongAttributeAttributeGetterCallback, TestObjectV8Internal::unscopeableOriginTrialEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"testInterfaceAttribute", TestObjectV8Internal::testInterfaceAttributeAttributeGetterCallback, TestObjectV8Internal::testInterfaceAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"testInterfaceGarbageCollectedAttribute", TestObjectV8Internal::testInterfaceGarbageCollectedAttributeAttributeGetterCallback, TestObjectV8Internal::testInterfaceGarbageCollectedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
{"testInterfaceGarbageCollectedOrNullAttribute", TestObjectV8Internal::testInterfaceGarbageCollectedOrNullAttributeAttributeGetterCallback, TestObjectV8Internal::testInterfaceGarbageCollectedOrNullAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}, |
@@ -12042,6 +11932,33 @@ static void installV8TestObjectTemplate(v8::Isolate* isolate, const DOMWrapperWo |
V8DOMConfiguration::installMethod(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, partiallyRuntimeEnabledOverloadedVoidMethodMethodConfiguration); |
} |
+ |
+void V8TestObject::installFeatureName(ScriptState* scriptState, v8::Local<v8::Object> instance) |
+{ |
+ v8::Local<v8::Object> prototype = instance->GetPrototype()->ToObject(scriptState->isolate()); |
+ v8::Local<v8::Signature> signature; |
+ // This parameter is required for installAccessor, to install static |
+ // attributes on existing interfaces. This is not currently supported in |
+ // origin trials, and this parameter is unused by installAccessor. (An |
+ // assertion in the bindings generation code ensures this.) |
+ // TODO(iclelland): Replace this with the actual interface, to allow origin |
+ // trials on static attributes. (crbug.com/614352) |
+ v8::Local<v8::Function> interface = v8::Function::New(scriptState->context(), nullptr).ToLocalChecked(); |
+ const V8DOMConfiguration::AccessorConfiguration accessororiginTrialEnabledLongAttributeConfiguration = \ |
+ {"originTrialEnabledLongAttribute", TestObjectV8Internal::originTrialEnabledLongAttributeAttributeGetterCallback, TestObjectV8Internal::originTrialEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
+ V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->world(), instance, prototype, interface, signature, accessororiginTrialEnabledLongAttributeConfiguration); |
+ v8::Local<v8::Signature> signature; |
+ // This parameter is required for installAccessor, to install static |
+ // attributes on existing interfaces. This is not currently supported in |
+ // origin trials, and this parameter is unused by installAccessor. (An |
+ // assertion in the bindings generation code ensures this.) |
+ // TODO(iclelland): Replace this with the actual interface, to allow origin |
+ // trials on static attributes. (crbug.com/614352) |
+ v8::Local<v8::Function> interface = v8::Function::New(scriptState->context(), nullptr).ToLocalChecked(); |
+ const V8DOMConfiguration::AccessorConfiguration accessorunscopeableOriginTrialEnabledLongAttributeConfiguration = \ |
+ {"unscopeableOriginTrialEnabledLongAttribute", TestObjectV8Internal::unscopeableOriginTrialEnabledLongAttributeAttributeGetterCallback, TestObjectV8Internal::unscopeableOriginTrialEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
+ V8DOMConfiguration::installAccessor(scriptState->isolate(), scriptState->world(), instance, prototype, interface, signature, accessorunscopeableOriginTrialEnabledLongAttributeConfiguration); |
+} |
v8::Local<v8::FunctionTemplate> V8TestObject::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) |
{ |
return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestObjectTemplate); |