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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/V8TestInterface.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
index 9c237a3dad70f479cb53aca8a302bb046eb48605..6478b836be4393344eb34a352289e5b7932ef572 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp
@@ -31,6 +31,7 @@
#include "bindings/tests/idls/core/TestPartialInterfaceImplementation.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
+#include "core/experiments/Experiments.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/ConsoleMessage.h"
@@ -1541,6 +1542,8 @@ static void overloadMethodWithExposedAndRuntimeEnabledFlag3Method(const v8::Func
static void overloadMethodWithExposedAndRuntimeEnabledFlagMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadMethodWithExposedAndRuntimeEnabledFlag", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 1:
@@ -1948,6 +1951,8 @@ static void partial2StaticVoidMethod1Method(const v8::FunctionCallbackInfo<v8::V
static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 0:
@@ -1980,6 +1985,8 @@ static void voidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackIn
static void staticVoidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticVoidMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 0:
@@ -2004,6 +2011,8 @@ static void staticVoidMethodPartialOverloadMethodCallback(const v8::FunctionCall
static void promiseMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "promiseMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 0:
@@ -2032,6 +2041,8 @@ static void promiseMethodPartialOverloadMethodCallback(const v8::FunctionCallbac
static void staticPromiseMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticPromiseMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 0:
@@ -2056,6 +2067,8 @@ static void staticPromiseMethodPartialOverloadMethodCallback(const v8::FunctionC
static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2VoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 0:
@@ -2080,6 +2093,8 @@ static void partial2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::
static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2StaticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
switch (std::min(1, info.Length())) {
case 0:
@@ -2396,10 +2411,20 @@ void V8TestInterface::installV8TestInterfaceTemplate(v8::Local<v8::FunctionTempl
if (!RuntimeEnabledFeatures::featureNameEnabled())
defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterface", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount, 0, 0, 0, 0, 0, 0);
else
- defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterface", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount,
- V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes),
- V8TestInterfaceAccessors, WTF_ARRAY_LENGTH(V8TestInterfaceAccessors),
- V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods));
+ {
+ ExecutionContext* ec = currentExecutionContext(isolate);
+ ALLOW_UNUSED_LOCAL(ec);
+ String errorMessage;
+ if (!Experiments::isApiEnabled(ec, "ExperimentName", errorMessage)) {
+ defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterface", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount, 0, 0, 0, 0, 0, 0);
+ }
+ else
+ defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterface", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterface::internalFieldCount,
+ V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes),
+ V8TestInterfaceAccessors, WTF_ARRAY_LENGTH(V8TestInterfaceAccessors),
+ V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods));
+ }
+
v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
ALLOW_UNUSED_LOCAL(instanceTemplate);
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
@@ -2465,6 +2490,10 @@ void V8TestInterface::installV8TestInterfaceTemplate(v8::Local<v8::FunctionTempl
{"PARTIAL2_UNSIGNED_SHORT", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort},
};
V8DOMConfiguration::installConstants(isolate, functionTemplate, prototypeTemplate, V8TestInterfaceConstants, WTF_ARRAY_LENGTH(V8TestInterfaceConstants));
+ ExecutionContext* ec = currentExecutionContext(isolate);
+ ALLOW_UNUSED_LOCAL(ec);
+ String constantsErrorMessage;
+ ALLOW_UNUSED_LOCAL(constantsErrorMessage);
if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
const V8DOMConfiguration::ConstantConfiguration constantPartialUnsignedShortConfiguration = {"PARTIAL_UNSIGNED_SHORT", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort};
V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate, constantPartialUnsignedShortConfiguration);
@@ -2475,6 +2504,8 @@ void V8TestInterface::installV8TestInterfaceTemplate(v8::Local<v8::FunctionTempl
instanceTemplate->SetHandler(indexedPropertyHandlerConfig);
v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestInterfaceImplementationV8Internal::namedPropertyGetterCallback, TestInterfaceImplementationV8Internal::namedPropertySetterCallback, TestInterfaceImplementationV8Internal::namedPropertyQueryCallback, TestInterfaceImplementationV8Internal::namedPropertyDeleterCallback, TestInterfaceImplementationV8Internal::namedPropertyEnumeratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFlags::kAllCanRead) | int(v8::PropertyHandlerFlags::kNonMasking)));
instanceTemplate->SetHandler(namedPropertyHandlerConfig);
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8Internal::iteratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype };
V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignature, symbolKeyedIteratorConfiguration);
functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface::legacyCallCustom);
@@ -2557,6 +2588,8 @@ void V8TestInterface::preparePrototypeAndInterfaceObject(v8::Local<v8::Context>
v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate));
ExecutionContext* executionContext = toExecutionContext(prototypeObject->CreationContext());
ASSERT(executionContext);
+ String errorMessage;
+ ALLOW_UNUSED_LOCAL(errorMessage);
if (executionContext && (executionContext->isWorkerGlobalScope())) {
const V8DOMConfiguration::MethodConfiguration workerExposedMethodMethodConfiguration = {"workerExposedMethod", TestInterfaceImplementationV8Internal::workerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObject, interfaceObject, defaultSignature, workerExposedMethodMethodConfiguration);

Powered by Google App Engine
This is Rietveld 408576698