diff options
author | iclelland <iclelland@chromium.org> | 2016-02-02 07:00:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-02 15:01:56 +0000 |
commit | 5b27fa016f2736e2186984e5f737e805c2836d9c (patch) | |
tree | f2c48ffafec4d3d376a4df3cb013c3059251ab83 | |
parent | e72c97cfbd4829b5fbec934e67460886be345882 (diff) | |
download | chromium_src-5b27fa016f2736e2186984e5f737e805c2836d9c.zip chromium_src-5b27fa016f2736e2186984e5f737e805c2836d9c.tar.gz chromium_src-5b27fa016f2736e2186984e5f737e805c2836d9c.tar.bz2 |
Rename Experimental Framework classes and concepts
"Experiments" is far too generic a term to use for the trials enabled by the experimental framework, so this patch renames everything to (hopefully) more precise terms.
These changes are most prominent:
core::ExperimentalFeatures class => OriginTrials
core::Experiments class => OriginTrialContext
API Key => Trial Token (or "Token" where unambiguous)
API => Feature
/experiments/ directories => /origin_trials/
api_name (RuntimeEnabledFeatures) => origin_trial_feature_name
BUG=575808
Review URL: https://codereview.chromium.org/1635593004
Cr-Commit-Position: refs/heads/master@{#372943}
41 files changed, 774 insertions, 799 deletions
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index d798e5c..7671d05 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -1062,8 +1062,8 @@ blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { main_thread_task_runner_.get()); } -blink::WebApiKeyValidator* BlinkPlatformImpl::apiKeyValidator() { - return &api_key_validator_; +blink::WebTrialTokenValidator* BlinkPlatformImpl::trialTokenValidator() { + return &trial_token_validator_; } WebThemeEngine* BlinkPlatformImpl::themeEngine() { diff --git a/content/child/blink_platform_impl.h b/content/child/blink_platform_impl.h index 47787d5..1418689 100644 --- a/content/child/blink_platform_impl.h +++ b/content/child/blink_platform_impl.h @@ -15,7 +15,7 @@ #include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "components/webcrypto/webcrypto_impl.h" -#include "content/child/experiments/api_key_validator.h" +#include "content/child/origin_trials/trial_token_validator.h" #include "content/child/webfallbackthemeengine_impl.h" #include "content/common/content_export.h" #include "third_party/WebKit/public/platform/Platform.h" @@ -159,7 +159,7 @@ class CONTENT_EXPORT BlinkPlatformImpl blink::WebServicePortProviderClient*) override; blink::WebPermissionClient* permissionClient() override; blink::WebSyncProvider* backgroundSyncProvider() override; - blink::WebApiKeyValidator* apiKeyValidator() override; + blink::WebTrialTokenValidator* trialTokenValidator() override; blink::WebString domCodeStringFromEnum(int dom_code) override; int domEnumFromCodeString(const blink::WebString& codeString) override; @@ -197,7 +197,7 @@ class CONTENT_EXPORT BlinkPlatformImpl scoped_ptr<PermissionDispatcher> permission_client_; scoped_ptr<BackgroundSyncProvider> main_thread_sync_provider_; - ApiKeyValidator api_key_validator_; + TrialTokenValidator trial_token_validator_; scheduler::WebThreadBase* compositor_thread_; }; diff --git a/content/child/experiments/api_key_validator.cc b/content/child/experiments/api_key_validator.cc deleted file mode 100644 index 3d87ecfb..0000000 --- a/content/child/experiments/api_key_validator.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/child/experiments/api_key_validator.h" - -#include "base/time/time.h" -#include "content/common/experiments/api_key.h" - -namespace content { - -ApiKeyValidator::ApiKeyValidator() {} -ApiKeyValidator::~ApiKeyValidator() {} - -bool ApiKeyValidator::validateApiKey(const blink::WebString& apiKey, - const blink::WebString& origin, - const blink::WebString& apiName) { - bool result = false; - scoped_ptr<ApiKey> key = ApiKey::Parse(apiKey.utf8()); - if (key) { - result = (key->IsAppropriate(origin.utf8(), apiName.utf8()) && - key->IsValid(base::Time::Now())); - } - return result; -} - -} // namespace content diff --git a/content/child/experiments/api_key_validator.h b/content/child/experiments/api_key_validator.h deleted file mode 100644 index 1be8434..0000000 --- a/content/child/experiments/api_key_validator.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_CHILD_EXPERIMENTS_API_KEY_VALIDATOR_H_ -#define CONTENT_CHILD_EXPERIMENTS_API_KEY_VALIDATOR_H_ - -#include <string> -#include "third_party/WebKit/public/platform/WebApiKeyValidator.h" - -namespace content { - -// The ApiKeyValidator is called by the Experimental Framework code in Blink to -// validate tokens to enable experimental APIs. -// -// This class is thread-safe. -class ApiKeyValidator : public blink::WebApiKeyValidator { - public: - ApiKeyValidator(); - ~ApiKeyValidator() override; - - // blink::WebApiKeyValidator implementation - bool validateApiKey(const blink::WebString& apiKey, - const blink::WebString& origin, - const blink::WebString& apiName) override; - - private: - DISALLOW_COPY_AND_ASSIGN(ApiKeyValidator); -}; - -} // namespace content - -#endif // CONTENT_CHILD_EXPERIMENTS_API_KEY_VALIDATOR_H_ diff --git a/content/child/origin_trials/trial_token_validator.cc b/content/child/origin_trials/trial_token_validator.cc new file mode 100644 index 0000000..b1015c5 --- /dev/null +++ b/content/child/origin_trials/trial_token_validator.cc @@ -0,0 +1,24 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/child/origin_trials/trial_token_validator.h" + +#include "base/time/time.h" +#include "content/common/origin_trials/trial_token.h" + +namespace content { + +TrialTokenValidator::TrialTokenValidator() {} +TrialTokenValidator::~TrialTokenValidator() {} + +bool TrialTokenValidator::validateToken(const blink::WebString& token, + const blink::WebString& origin, + const blink::WebString& featureName) { + scoped_ptr<TrialToken> trialToken = TrialToken::Parse(token.utf8()); + return trialToken && + trialToken->IsAppropriate(origin.utf8(), featureName.utf8()) && + trialToken->IsValid(base::Time::Now()); +} + +} // namespace content diff --git a/content/child/origin_trials/trial_token_validator.h b/content/child/origin_trials/trial_token_validator.h new file mode 100644 index 0000000..2013bc1 --- /dev/null +++ b/content/child/origin_trials/trial_token_validator.h @@ -0,0 +1,33 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_CHILD_ORIGIN_TRIALS_TRIAL_TOKEN_VALIDATOR_H_ +#define CONTENT_CHILD_ORIGIN_TRIALS_TRIAL_TOKEN_VALIDATOR_H_ + +#include <string> +#include "third_party/WebKit/public/platform/WebTrialTokenValidator.h" + +namespace content { + +// The TrialTokenValidator is called by the Experimental Framework code in Blink +// to validate tokens to enable experimental features. +// +// This class is thread-safe. +class TrialTokenValidator : public blink::WebTrialTokenValidator { + public: + TrialTokenValidator(); + ~TrialTokenValidator() override; + + // blink::WebTrialTokenValidator implementation + bool validateToken(const blink::WebString& token, + const blink::WebString& origin, + const blink::WebString& featureName) override; + + private: + DISALLOW_COPY_AND_ASSIGN(TrialTokenValidator); +}; + +} // namespace content + +#endif // CONTENT_CHILD_ORIGIN_TRIALS_TRIAL_TOKEN_VALIDATOR_H_ diff --git a/content/common/experiments/api_key.h b/content/common/experiments/api_key.h deleted file mode 100644 index 1ad575a1..0000000 --- a/content/common/experiments/api_key.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_EXPERIMENTS_API_KEY_H_ -#define CONTENT_COMMON_EXPERIMENTS_API_KEY_H_ - -#include <string> - -#include "base/memory/scoped_ptr.h" -#include "base/strings/string_piece.h" -#include "base/time/time.h" -#include "content/common/content_export.h" -#include "url/gurl.h" - -namespace content { - -// The Experimental Framework (EF) provides limited access to experimental APIs, -// on a per-origin basis. This class defines the API key data structure, used -// to securely provide access to an experimental API. -// -// Experimental APIs are defined by string names, provided by the implementers. -// The EF code does not maintain an enum or constant list for experiment names. -// Instead, the EF validates the name provided by the API implementation against -// any provided API keys. -// -// More documentation on the key format can be found at -// https://docs.google.com/document/d/1v5fi0EUV_QHckVHVF2K4P72iNywnrJtNhNZ6i2NPt0M - -class CONTENT_EXPORT ApiKey { - public: - ~ApiKey(); - - // Returns a key object if the string represents a well-formed key, or - // nullptr otherwise. (This does not mean that the key is valid, just that it - // can be parsed.) - static scoped_ptr<ApiKey> Parse(const std::string& key_text); - - // Returns true if this API is appropriate for use by the given origin, for - // the given API name. This does not check whether the signature is valid, or - // whether the key itself has expired. - bool IsAppropriate(const std::string& origin, - const std::string& apiName) const; - - // Returns true if this API key has a valid signature, and has not expired. - bool IsValid(const base::Time& now) const; - - std::string signature() { return signature_; } - std::string data() { return data_; } - GURL origin() { return origin_; } - std::string api_name() { return api_name_; } - uint64_t expiry_timestamp() { return expiry_timestamp_; } - - protected: - friend class ApiKeyTest; - - bool ValidateOrigin(const std::string& origin) const; - bool ValidateApiName(const std::string& api_name) const; - bool ValidateDate(const base::Time& now) const; - bool ValidateSignature(const base::StringPiece& public_key) const; - - static bool ValidateSignature(const std::string& signature_text, - const std::string& data, - const base::StringPiece& public_key); - - private: - ApiKey(const std::string& signature, - const std::string& data, - const GURL& origin, - const std::string& api_name, - uint64_t expiry_timestamp); - - // The base64-encoded-signature portion of the key. For the key to be valid, - // this must be a valid signature for the data portion of the key, as verified - // by the public key in api_key.cc. - std::string signature_; - - // The portion of the key string which is signed, and whose signature is - // contained in the signature_ member. - std::string data_; - - // The origin for which this key is valid. Must be a secure origin. - GURL origin_; - - // The name of the API experiment which this key enables. - std::string api_name_; - - // The time until which this key should be considered valid, in UTC, as - // seconds since the Unix epoch. - uint64_t expiry_timestamp_; -}; - -} // namespace content - -#endif // CONTENT_COMMON_EXPERIMENTS_API_KEY_H_ diff --git a/content/common/experiments/api_key_unittest.cc b/content/common/experiments/api_key_unittest.cc deleted file mode 100644 index a70ffcc..0000000 --- a/content/common/experiments/api_key_unittest.cc +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/experiments/api_key.h" - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "base/strings/string_util.h" -#include "base/test/simple_test_clock.h" -#include "base/time/time.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace content { - -namespace { - -// This is a sample public key for testing the API. The corresponding private -// key (use this to generate new samples for this test file) is: -// -// 0x83, 0x67, 0xf4, 0xcd, 0x2a, 0x1f, 0x0e, 0x04, 0x0d, 0x43, 0x13, -// 0x4c, 0x67, 0xc4, 0xf4, 0x28, 0xc9, 0x90, 0x15, 0x02, 0xe2, 0xba, -// 0xfd, 0xbb, 0xfa, 0xbc, 0x92, 0x76, 0x8a, 0x2c, 0x4b, 0xc7, 0x75, -// 0x10, 0xac, 0xf9, 0x3a, 0x1c, 0xb8, 0xa9, 0x28, 0x70, 0xd2, 0x9a, -// 0xd0, 0x0b, 0x59, 0xe1, 0xac, 0x2b, 0xb7, 0xd5, 0xca, 0x1f, 0x64, -// 0x90, 0x08, 0x8e, 0xa8, 0xe0, 0x56, 0x3a, 0x04, 0xd0 -const uint8_t kTestPublicKey[] = { - 0x75, 0x10, 0xac, 0xf9, 0x3a, 0x1c, 0xb8, 0xa9, 0x28, 0x70, 0xd2, - 0x9a, 0xd0, 0x0b, 0x59, 0xe1, 0xac, 0x2b, 0xb7, 0xd5, 0xca, 0x1f, - 0x64, 0x90, 0x08, 0x8e, 0xa8, 0xe0, 0x56, 0x3a, 0x04, 0xd0, -}; - -// This is a good key, signed with the above test private key. -const char* kSampleAPIKey = - "UsEO0cNxoUtBnHDJdGPWTlXuLENjXcEIPL7Bs7sbvicPCcvAtyqhQuTJ9h/u1R3VZpWigtI+S" - "dUwk7Dyk/qbDw==|https://valid.example.com|Frobulate|1458766277"; -const char* kExpectedAPIKeySignature = - "UsEO0cNxoUtBnHDJdGPWTlXuLENjXcEIPL7Bs7sbvicPCcvAtyqhQuTJ9h/u1R3VZpWigtI+S" - "dUwk7Dyk/qbDw=="; -const char* kExpectedAPIKeyData = - "https://valid.example.com|Frobulate|1458766277"; -const char* kExpectedAPIName = "Frobulate"; -const char* kExpectedOrigin = "https://valid.example.com"; -const uint64_t kExpectedExpiry = 1458766277; - -// The key should not be valid for this origin, or for this API. -const char* kInvalidOrigin = "https://invalid.example.com"; -const char* kInsecureOrigin = "http://valid.example.com"; -const char* kInvalidAPIName = "Grokalyze"; - -// The key should be valid if the current time is kValidTimestamp or earlier. -double kValidTimestamp = 1458766276.0; - -// The key should be invalid if the current time is kInvalidTimestamp or later. -double kInvalidTimestamp = 1458766278.0; - -// Well-formed API key with an invalid signature. -const char* kInvalidSignatureAPIKey = - "CO8hDne98QeFeOJ0DbRZCBN3uE0nyaPgaLlkYhSWnbRoDfEAg+TXELaYfQPfEvKYFauBg/hnx" - "mba765hz0mXMc==|https://valid.example.com|Frobulate|1458766277"; - -// Various ill-formed API keys. These should all fail to parse. -const char* kInvalidAPIKeys[] = { - // Invalid - only one part - "abcde", - // Not enough parts - "https://valid.example.com|APIName|1458766277", - // Delimiter in API Name - "Signature|https://valid.example.com|API|Name|1458766277", - // Extra string field - "Signature|https://valid.example.com|APIName|1458766277|SomethingElse", - // Extra numeric field - "Signature|https://valid.example.com|APIName|1458766277|1458766277", - // Non-numeric expiry timestamp - "Signature|https://valid.example.com|APIName|abcdefghij", - "Signature|https://valid.example.com|APIName|1458766277x", - // Negative expiry timestamp - "Signature|https://valid.example.com|APIName|-1458766277", - // Origin not a proper origin URL - "Signature|abcdef|APIName|1458766277", - "Signature|data:text/plain,abcdef|APIName|1458766277", - "Signature|javascript:alert(1)|APIName|1458766277"}; -const size_t kNumInvalidAPIKeys = arraysize(kInvalidAPIKeys); - -} // namespace - -class ApiKeyTest : public testing::Test { - public: - ApiKeyTest() - : public_key_( - base::StringPiece(reinterpret_cast<const char*>(kTestPublicKey), - arraysize(kTestPublicKey))) {} - - protected: - bool ValidateOrigin(ApiKey* api_key, const char* origin) { - return api_key->ValidateOrigin(origin); - } - - bool ValidateApiName(ApiKey* api_key, const char* api_name) { - return api_key->ValidateApiName(api_name); - } - - bool ValidateDate(ApiKey* api_key, const base::Time& now) { - return api_key->ValidateDate(now); - } - - bool ValidateSignature(ApiKey* api_key, const base::StringPiece& public_key) { - return api_key->ValidateSignature(public_key); - } - - const base::StringPiece& public_key() { return public_key_; }; - - private: - base::StringPiece public_key_; -}; - -TEST_F(ApiKeyTest, ParseEmptyString) { - scoped_ptr<ApiKey> empty_key = ApiKey::Parse(""); - EXPECT_FALSE(empty_key); -} - -TEST_F(ApiKeyTest, ParseInvalidStrings) { - for (size_t i = 0; i < kNumInvalidAPIKeys; ++i) { - scoped_ptr<ApiKey> empty_key = ApiKey::Parse(kInvalidAPIKeys[i]); - EXPECT_FALSE(empty_key) << "Invalid API Key should not parse: " - << kInvalidAPIKeys[i]; - } -} - -TEST_F(ApiKeyTest, ParseValidKeyString) { - scoped_ptr<ApiKey> key = ApiKey::Parse(kSampleAPIKey); - ASSERT_TRUE(key); - EXPECT_EQ(kExpectedAPIName, key->api_name()); - EXPECT_EQ(kExpectedAPIKeySignature, key->signature()); - EXPECT_EQ(kExpectedAPIKeyData, key->data()); - EXPECT_EQ(GURL(kExpectedOrigin), key->origin()); - EXPECT_EQ(kExpectedExpiry, key->expiry_timestamp()); -} - -TEST_F(ApiKeyTest, ValidateValidKey) { - scoped_ptr<ApiKey> key = ApiKey::Parse(kSampleAPIKey); - ASSERT_TRUE(key); - EXPECT_TRUE(ValidateOrigin(key.get(), kExpectedOrigin)); - EXPECT_FALSE(ValidateOrigin(key.get(), kInvalidOrigin)); - EXPECT_FALSE(ValidateOrigin(key.get(), kInsecureOrigin)); - EXPECT_TRUE(ValidateApiName(key.get(), kExpectedAPIName)); - EXPECT_FALSE(ValidateApiName(key.get(), kInvalidAPIName)); - EXPECT_TRUE( - ValidateDate(key.get(), base::Time::FromDoubleT(kValidTimestamp))); - EXPECT_FALSE( - ValidateDate(key.get(), base::Time::FromDoubleT(kInvalidTimestamp))); -} - -TEST_F(ApiKeyTest, KeyIsAppropriateForOriginAndAPI) { - scoped_ptr<ApiKey> key = ApiKey::Parse(kSampleAPIKey); - ASSERT_TRUE(key); - EXPECT_TRUE(key->IsAppropriate(kExpectedOrigin, kExpectedAPIName)); - EXPECT_TRUE(key->IsAppropriate(kExpectedOrigin, - base::ToUpperASCII(kExpectedAPIName))); - EXPECT_TRUE(key->IsAppropriate(kExpectedOrigin, - base::ToLowerASCII(kExpectedAPIName))); - EXPECT_FALSE(key->IsAppropriate(kInvalidOrigin, kExpectedAPIName)); - EXPECT_FALSE(key->IsAppropriate(kInsecureOrigin, kExpectedAPIName)); - EXPECT_FALSE(key->IsAppropriate(kExpectedOrigin, kInvalidAPIName)); -} - -TEST_F(ApiKeyTest, ValidateValidSignature) { - scoped_ptr<ApiKey> key = ApiKey::Parse(kSampleAPIKey); - ASSERT_TRUE(key); - EXPECT_TRUE(ValidateSignature(key.get(), public_key())); -} - -TEST_F(ApiKeyTest, ValidateInvalidSignature) { - scoped_ptr<ApiKey> key = ApiKey::Parse(kInvalidSignatureAPIKey); - ASSERT_TRUE(key); - EXPECT_FALSE(ValidateSignature(key.get(), public_key())); -} - -TEST_F(ApiKeyTest, ValidateSignatureOnWrongKey) { - scoped_ptr<ApiKey> key = ApiKey::Parse(kSampleAPIKey); - ASSERT_TRUE(key); - // Signature will be invalid if tested against the real public key - EXPECT_FALSE(key->IsValid(base::Time::FromDoubleT(kValidTimestamp))); -} - -TEST_F(ApiKeyTest, ValidateWhenNotExpired) { - scoped_ptr<ApiKey> key = ApiKey::Parse(kSampleAPIKey); - ASSERT_TRUE(key); -} - -} // namespace content diff --git a/content/common/experiments/api_key.cc b/content/common/origin_trials/trial_token.cc index 9199d5d..5c64bcb 100644 --- a/content/common/experiments/api_key.cc +++ b/content/common/origin_trials/trial_token.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/experiments/api_key.h" +#include "content/common/origin_trials/trial_token.h" #include <openssl/curve25519.h> @@ -30,31 +30,30 @@ static const uint8_t kPublicKey[] = { 0x51, 0x14, 0x66, 0xaa, 0x02, 0x53, 0x4e, 0x33, 0xa1, 0x15, }; -const char* kApiKeyFieldSeparator = "|"; +const char* kFieldSeparator = "|"; } // namespace -ApiKey::~ApiKey() {} +TrialToken::~TrialToken() {} -scoped_ptr<ApiKey> ApiKey::Parse(const std::string& key_text) { - if (key_text.empty()) { +scoped_ptr<TrialToken> TrialToken::Parse(const std::string& token_text) { + if (token_text.empty()) { return nullptr; } - // API Key should resemble: - // signature|origin|api_name|expiry_timestamp - // TODO(iclelland): Add version code to API key format to identify key algo + // A valid token should resemble: + // signature|origin|feature_name|expiry_timestamp + // TODO(iclelland): Add version code to token format to identify key algo // https://crbug.com/570684 - std::vector<std::string> parts = - SplitString(key_text, kApiKeyFieldSeparator, base::KEEP_WHITESPACE, - base::SPLIT_WANT_ALL); + std::vector<std::string> parts = SplitString( + token_text, kFieldSeparator, base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); if (parts.size() != 4) { return nullptr; } const std::string& signature = parts[0]; const std::string& origin_string = parts[1]; - const std::string& api_name = parts[2]; + const std::string& feature_name = parts[2]; const std::string& expiry_string = parts[3]; uint64_t expiry_timestamp; @@ -68,30 +67,30 @@ scoped_ptr<ApiKey> ApiKey::Parse(const std::string& key_text) { return nullptr; } - // signed data is (origin + "|" + api_name + "|" + expiry). - std::string data = key_text.substr(signature.length() + 1); + // signed data is (origin + "|" + feature_name + "|" + expiry). + std::string data = token_text.substr(signature.length() + 1); - return make_scoped_ptr( - new ApiKey(signature, data, origin_url, api_name, expiry_timestamp)); + return make_scoped_ptr(new TrialToken(signature, data, origin_url, + feature_name, expiry_timestamp)); } -ApiKey::ApiKey(const std::string& signature, - const std::string& data, - const GURL& origin, - const std::string& api_name, - uint64_t expiry_timestamp) +TrialToken::TrialToken(const std::string& signature, + const std::string& data, + const GURL& origin, + const std::string& feature_name, + uint64_t expiry_timestamp) : signature_(signature), data_(data), origin_(origin), - api_name_(api_name), + feature_name_(feature_name), expiry_timestamp_(expiry_timestamp) {} -bool ApiKey::IsAppropriate(const std::string& origin, - const std::string& api_name) const { - return ValidateOrigin(origin) && ValidateApiName(api_name); +bool TrialToken::IsAppropriate(const std::string& origin, + const std::string& feature_name) const { + return ValidateOrigin(origin) && ValidateFeatureName(feature_name); } -bool ApiKey::IsValid(const base::Time& now) const { +bool TrialToken::IsValid(const base::Time& now) const { // TODO(iclelland): Allow for multiple signing keys, and iterate over all // active keys here. https://crbug.com/543220 return ValidateDate(now) && @@ -99,27 +98,27 @@ bool ApiKey::IsValid(const base::Time& now) const { reinterpret_cast<const char*>(kPublicKey), arraysize(kPublicKey))); } -bool ApiKey::ValidateOrigin(const std::string& origin) const { +bool TrialToken::ValidateOrigin(const std::string& origin) const { return GURL(origin) == origin_; } -bool ApiKey::ValidateApiName(const std::string& api_name) const { - return base::EqualsCaseInsensitiveASCII(api_name, api_name_); +bool TrialToken::ValidateFeatureName(const std::string& feature_name) const { + return base::EqualsCaseInsensitiveASCII(feature_name, feature_name_); } -bool ApiKey::ValidateDate(const base::Time& now) const { +bool TrialToken::ValidateDate(const base::Time& now) const { base::Time expiry_time = base::Time::FromDoubleT((double)expiry_timestamp_); return expiry_time > now; } -bool ApiKey::ValidateSignature(const base::StringPiece& public_key) const { +bool TrialToken::ValidateSignature(const base::StringPiece& public_key) const { return ValidateSignature(signature_, data_, public_key); } // static -bool ApiKey::ValidateSignature(const std::string& signature_text, - const std::string& data, - const base::StringPiece& public_key) { +bool TrialToken::ValidateSignature(const std::string& signature_text, + const std::string& data, + const base::StringPiece& public_key) { // Public key must be 32 bytes long for Ed25519. CHECK_EQ(public_key.length(), 32UL); diff --git a/content/common/origin_trials/trial_token.h b/content/common/origin_trials/trial_token.h new file mode 100644 index 0000000..bdb964b --- /dev/null +++ b/content/common/origin_trials/trial_token.h @@ -0,0 +1,96 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_ORIGIN_TRIALS_TRIAL_TOKEN_H_ +#define CONTENT_COMMON_ORIGIN_TRIALS_TRIAL_TOKEN_H_ + +#include <string> + +#include "base/memory/scoped_ptr.h" +#include "base/strings/string_piece.h" +#include "base/time/time.h" +#include "content/common/content_export.h" +#include "url/gurl.h" + +namespace content { + +// The Experimental Framework (EF) provides limited access to experimental +// features, on a per-origin basis (origin trials). This class defines the trial +// token data structure, used to securely provide access to an experimental +// feature. +// +// Features are defined by string names, provided by the implementers. The EF +// code does not maintain an enum or constant list for feature names. Instead, +// the EF validates the name provided by the feature implementation against any +// provided tokens. +// +// More documentation on the token format can be found at +// https://docs.google.com/document/d/1v5fi0EUV_QHckVHVF2K4P72iNywnrJtNhNZ6i2NPt0M + +class CONTENT_EXPORT TrialToken { + public: + ~TrialToken(); + + // Returns a token object if the string represents a well-formed token, or + // nullptr otherwise. (This does not mean that the token is valid, just that + // it can be parsed.) + static scoped_ptr<TrialToken> Parse(const std::string& token_text); + + // Returns true if this feature is appropriate for use by the given origin, + // for the given feature name. This does not check whether the signature is + // valid, or whether the token itself has expired. + bool IsAppropriate(const std::string& origin, + const std::string& featureName) const; + + // Returns true if this token has a valid signature, and has not expired. + bool IsValid(const base::Time& now) const; + + std::string signature() { return signature_; } + std::string data() { return data_; } + GURL origin() { return origin_; } + std::string feature_name() { return feature_name_; } + uint64_t expiry_timestamp() { return expiry_timestamp_; } + + protected: + friend class TrialTokenTest; + + bool ValidateOrigin(const std::string& origin) const; + bool ValidateFeatureName(const std::string& feature_name) const; + bool ValidateDate(const base::Time& now) const; + bool ValidateSignature(const base::StringPiece& public_key) const; + + static bool ValidateSignature(const std::string& signature_text, + const std::string& data, + const base::StringPiece& public_key); + + private: + TrialToken(const std::string& signature, + const std::string& data, + const GURL& origin, + const std::string& feature_name, + uint64_t expiry_timestamp); + + // The base64-encoded-signature portion of the token. For the token to be + // valid, this must be a valid signature for the data portion of the token, as + // verified by the public key in trial_token.cc. + std::string signature_; + + // The portion of the token string which is signed, and whose signature is + // contained in the signature_ member. + std::string data_; + + // The origin for which this token is valid. Must be a secure origin. + GURL origin_; + + // The name of the experimental feature which this token enables. + std::string feature_name_; + + // The time until which this token should be considered valid, in UTC, as + // seconds since the Unix epoch. + uint64_t expiry_timestamp_; +}; + +} // namespace content + +#endif // CONTENT_COMMON_ORIGIN_TRIALS_TRIAL_TOKEN_H_ diff --git a/content/common/origin_trials/trial_token_unittest.cc b/content/common/origin_trials/trial_token_unittest.cc new file mode 100644 index 0000000..c4426fd --- /dev/null +++ b/content/common/origin_trials/trial_token_unittest.cc @@ -0,0 +1,192 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/origin_trials/trial_token.h" + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "base/strings/string_util.h" +#include "base/test/simple_test_clock.h" +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +namespace { + +// This is a sample public key for testing the API. The corresponding private +// key (use this to generate new samples for this test file) is: +// +// 0x83, 0x67, 0xf4, 0xcd, 0x2a, 0x1f, 0x0e, 0x04, 0x0d, 0x43, 0x13, +// 0x4c, 0x67, 0xc4, 0xf4, 0x28, 0xc9, 0x90, 0x15, 0x02, 0xe2, 0xba, +// 0xfd, 0xbb, 0xfa, 0xbc, 0x92, 0x76, 0x8a, 0x2c, 0x4b, 0xc7, 0x75, +// 0x10, 0xac, 0xf9, 0x3a, 0x1c, 0xb8, 0xa9, 0x28, 0x70, 0xd2, 0x9a, +// 0xd0, 0x0b, 0x59, 0xe1, 0xac, 0x2b, 0xb7, 0xd5, 0xca, 0x1f, 0x64, +// 0x90, 0x08, 0x8e, 0xa8, 0xe0, 0x56, 0x3a, 0x04, 0xd0 +const uint8_t kTestPublicKey[] = { + 0x75, 0x10, 0xac, 0xf9, 0x3a, 0x1c, 0xb8, 0xa9, 0x28, 0x70, 0xd2, + 0x9a, 0xd0, 0x0b, 0x59, 0xe1, 0xac, 0x2b, 0xb7, 0xd5, 0xca, 0x1f, + 0x64, 0x90, 0x08, 0x8e, 0xa8, 0xe0, 0x56, 0x3a, 0x04, 0xd0, +}; + +// This is a good trial token, signed with the above test private key. +const char* kSampleToken = + "UsEO0cNxoUtBnHDJdGPWTlXuLENjXcEIPL7Bs7sbvicPCcvAtyqhQuTJ9h/u1R3VZpWigtI+S" + "dUwk7Dyk/qbDw==|https://valid.example.com|Frobulate|1458766277"; +const char* kExpectedSignature = + "UsEO0cNxoUtBnHDJdGPWTlXuLENjXcEIPL7Bs7sbvicPCcvAtyqhQuTJ9h/u1R3VZpWigtI+S" + "dUwk7Dyk/qbDw=="; +const char* kExpectedData = "https://valid.example.com|Frobulate|1458766277"; +const char* kExpectedFeatureName = "Frobulate"; +const char* kExpectedOrigin = "https://valid.example.com"; +const uint64_t kExpectedExpiry = 1458766277; + +// The token should not be valid for this origin, or for this feature. +const char* kInvalidOrigin = "https://invalid.example.com"; +const char* kInsecureOrigin = "http://valid.example.com"; +const char* kInvalidFeatureName = "Grokalyze"; + +// The token should be valid if the current time is kValidTimestamp or earlier. +double kValidTimestamp = 1458766276.0; + +// The token should be invalid if the current time is kInvalidTimestamp or +// later. +double kInvalidTimestamp = 1458766278.0; + +// Well-formed trial token with an invalid signature. +const char* kInvalidSignatureToken = + "CO8hDne98QeFeOJ0DbRZCBN3uE0nyaPgaLlkYhSWnbRoDfEAg+TXELaYfQPfEvKYFauBg/hnx" + "mba765hz0mXMc==|https://valid.example.com|Frobulate|1458766277"; + +// Various ill-formed trial tokens. These should all fail to parse. +const char* kInvalidTokens[] = { + // Invalid - only one part + "abcde", + // Not enough parts + "https://valid.example.com|FeatuerName|1458766277", + // Delimiter in feature name + "Signature|https://valid.example.com|Feature|Name|1458766277", + // Extra string field + "Signature|https://valid.example.com|FeatureName|1458766277|SomethingElse", + // Extra numeric field + "Signature|https://valid.example.com|FeatureName|1458766277|1458766277", + // Non-numeric expiry timestamp + "Signature|https://valid.example.com|FeatureName|abcdefghij", + "Signature|https://valid.example.com|FeatureName|1458766277x", + // Negative expiry timestamp + "Signature|https://valid.example.com|FeatureName|-1458766277", + // Origin not a proper origin URL + "Signature|abcdef|FeatureName|1458766277", + "Signature|data:text/plain,abcdef|FeatureName|1458766277", + "Signature|javascript:alert(1)|FeatureName|1458766277"}; +const size_t kNumInvalidTokens = arraysize(kInvalidTokens); + +} // namespace + +class TrialTokenTest : public testing::Test { + public: + TrialTokenTest() + : public_key_( + base::StringPiece(reinterpret_cast<const char*>(kTestPublicKey), + arraysize(kTestPublicKey))) {} + + protected: + bool ValidateOrigin(TrialToken* token, const char* origin) { + return token->ValidateOrigin(origin); + } + + bool ValidateFeatureName(TrialToken* token, const char* feature_name) { + return token->ValidateFeatureName(feature_name); + } + + bool ValidateDate(TrialToken* token, const base::Time& now) { + return token->ValidateDate(now); + } + + bool ValidateSignature(TrialToken* token, + const base::StringPiece& public_key) { + return token->ValidateSignature(public_key); + } + + const base::StringPiece& public_key() { return public_key_; }; + + private: + base::StringPiece public_key_; +}; + +TEST_F(TrialTokenTest, ParseEmptyString) { + scoped_ptr<TrialToken> empty_token = TrialToken::Parse(""); + EXPECT_FALSE(empty_token); +} + +TEST_F(TrialTokenTest, ParseInvalidStrings) { + for (size_t i = 0; i < kNumInvalidTokens; ++i) { + scoped_ptr<TrialToken> empty_token = TrialToken::Parse(kInvalidTokens[i]); + EXPECT_FALSE(empty_token) << "Invalid trial token should not parse: " + << kInvalidTokens[i]; + } +} + +TEST_F(TrialTokenTest, ParseValidToken) { + scoped_ptr<TrialToken> token = TrialToken::Parse(kSampleToken); + ASSERT_TRUE(token); + EXPECT_EQ(kExpectedFeatureName, token->feature_name()); + EXPECT_EQ(kExpectedSignature, token->signature()); + EXPECT_EQ(kExpectedData, token->data()); + EXPECT_EQ(GURL(kExpectedOrigin), token->origin()); + EXPECT_EQ(kExpectedExpiry, token->expiry_timestamp()); +} + +TEST_F(TrialTokenTest, ValidateValidToken) { + scoped_ptr<TrialToken> token = TrialToken::Parse(kSampleToken); + ASSERT_TRUE(token); + EXPECT_TRUE(ValidateOrigin(token.get(), kExpectedOrigin)); + EXPECT_FALSE(ValidateOrigin(token.get(), kInvalidOrigin)); + EXPECT_FALSE(ValidateOrigin(token.get(), kInsecureOrigin)); + EXPECT_TRUE(ValidateFeatureName(token.get(), kExpectedFeatureName)); + EXPECT_FALSE(ValidateFeatureName(token.get(), kInvalidFeatureName)); + EXPECT_TRUE( + ValidateDate(token.get(), base::Time::FromDoubleT(kValidTimestamp))); + EXPECT_FALSE( + ValidateDate(token.get(), base::Time::FromDoubleT(kInvalidTimestamp))); +} + +TEST_F(TrialTokenTest, TokenIsAppropriateForOriginAndFeature) { + scoped_ptr<TrialToken> token = TrialToken::Parse(kSampleToken); + ASSERT_TRUE(token); + EXPECT_TRUE(token->IsAppropriate(kExpectedOrigin, kExpectedFeatureName)); + EXPECT_TRUE(token->IsAppropriate(kExpectedOrigin, + base::ToUpperASCII(kExpectedFeatureName))); + EXPECT_TRUE(token->IsAppropriate(kExpectedOrigin, + base::ToLowerASCII(kExpectedFeatureName))); + EXPECT_FALSE(token->IsAppropriate(kInvalidOrigin, kExpectedFeatureName)); + EXPECT_FALSE(token->IsAppropriate(kInsecureOrigin, kExpectedFeatureName)); + EXPECT_FALSE(token->IsAppropriate(kExpectedOrigin, kInvalidFeatureName)); +} + +TEST_F(TrialTokenTest, ValidateValidSignature) { + scoped_ptr<TrialToken> token = TrialToken::Parse(kSampleToken); + ASSERT_TRUE(token); + EXPECT_TRUE(ValidateSignature(token.get(), public_key())); +} + +TEST_F(TrialTokenTest, ValidateInvalidSignature) { + scoped_ptr<TrialToken> token = TrialToken::Parse(kInvalidSignatureToken); + ASSERT_TRUE(token); + EXPECT_FALSE(ValidateSignature(token.get(), public_key())); +} + +TEST_F(TrialTokenTest, ValidateSignatureOnWrongKey) { + scoped_ptr<TrialToken> token = TrialToken::Parse(kSampleToken); + ASSERT_TRUE(token); + // Signature will be invalid if tested against the real public key + EXPECT_FALSE(token->IsValid(base::Time::FromDoubleT(kValidTimestamp))); +} + +TEST_F(TrialTokenTest, ValidateWhenNotExpired) { + scoped_ptr<TrialToken> token = TrialToken::Parse(kSampleToken); + ASSERT_TRUE(token); +} + +} // namespace content diff --git a/content/content_child.gypi b/content/content_child.gypi index 62d84ec..4718a75 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -86,8 +86,6 @@ 'child/dwrite_font_proxy/dwrite_font_proxy_win.h', 'child/dwrite_font_proxy/dwrite_localized_strings_win.cc', 'child/dwrite_font_proxy/dwrite_localized_strings_win.h', - 'child/experiments/api_key_validator.cc', - 'child/experiments/api_key_validator.h', 'child/file_info_util.cc', 'child/file_info_util.h', 'child/fileapi/file_system_dispatcher.cc', @@ -175,6 +173,8 @@ 'child/npapi/webplugin_ime_win.cc', 'child/npapi/webplugin_ime_win.h', 'child/npapi/webplugin_resource_client.h', + 'child/origin_trials/trial_token_validator.cc', + 'child/origin_trials/trial_token_validator.h', 'child/permissions/permission_dispatcher.cc', 'child/permissions/permission_dispatcher.h', 'child/permissions/permission_dispatcher_thread_proxy.cc', diff --git a/content/content_common.gypi b/content/content_common.gypi index 2330466..0c04506 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -257,8 +257,6 @@ 'common/dwrite_font_platform_win.cc', 'common/dwrite_font_proxy_messages.h', 'common/edit_command.h', - 'common/experiments/api_key.cc', - 'common/experiments/api_key.h', 'common/file_utilities_messages.h', 'common/fileapi/file_system_messages.h', 'common/fileapi/webblob_messages.h', @@ -469,6 +467,8 @@ 'common/notification_constants.h', 'common/one_writer_seqlock.cc', 'common/one_writer_seqlock.h', + 'common/origin_trials/trial_token.cc', + 'common/origin_trials/trial_token.h', 'common/origin_util.cc', 'common/p2p_messages.h', 'common/page_state_serialization.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 848231a..8cf840a 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -658,7 +658,6 @@ 'common/discardable_shared_memory_heap_unittest.cc', 'common/dom_storage/dom_storage_map_unittest.cc', 'common/dwrite_font_platform_win_unittest.cc', - 'common/experiments/api_key_unittest.cc', 'common/fileapi/file_system_util_unittest.cc', 'common/gpu/client/gpu_memory_buffer_impl_shared_memory_unittest.cc', 'common/gpu/gpu_channel_manager_unittest.cc', @@ -678,6 +677,7 @@ 'common/mac/attributed_string_coder_unittest.mm', 'common/mac/font_descriptor_unittest.mm', 'common/one_writer_seqlock_unittest.cc', + 'common/origin_trials/trial_token_unittest.cc', 'common/origin_util_unittest.cc', 'common/page_state_serialization_unittest.cc', 'common/page_zoom_unittest.cc', diff --git a/third_party/WebKit/Source/bindings/scripts/v8_attributes.py b/third_party/WebKit/Source/bindings/scripts/v8_attributes.py index cc047ef..c5f7d66 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_attributes.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_attributes.py @@ -95,8 +95,8 @@ def attribute_context(interface, attribute): includes.add('bindings/core/v8/V8HiddenValue.h') if 'APIExperimentEnabled' in extended_attributes: - includes.add('core/experiments/ExperimentalFeatures.h') includes.add('core/inspector/ConsoleMessage.h') + includes.add('core/origin_trials/OriginTrials.h') context = { 'access_control_list': access_control_list(interface, attribute), diff --git a/third_party/WebKit/Source/bindings/scripts/v8_interface.py b/third_party/WebKit/Source/bindings/scripts/v8_interface.py index 0b98230..5d33cee 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py @@ -163,8 +163,8 @@ def interface_context(interface): v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) if 'APIExperimentEnabled' in extended_attributes: - includes.add('core/experiments/ExperimentalFeatures.h') includes.add('core/inspector/ConsoleMessage.h') + includes.add('core/origin_trials/OriginTrials.h') context = { 'api_experiment_name': v8_utilities.api_experiment_name(interface), @@ -612,8 +612,8 @@ def constant_context(constant, interface): extended_attributes = constant.extended_attributes if 'APIExperimentEnabled' in extended_attributes: - includes.add('core/experiments/ExperimentalFeatures.h') includes.add('core/inspector/ConsoleMessage.h') + includes.add('core/origin_trials/OriginTrials.h') return { 'api_experiment_enabled': v8_utilities.api_experiment_enabled_function(constant), # [APIExperimentEnabled] diff --git a/third_party/WebKit/Source/bindings/scripts/v8_methods.py b/third_party/WebKit/Source/bindings/scripts/v8_methods.py index 3c24818..0992d6b 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_methods.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_methods.py @@ -119,8 +119,8 @@ def method_context(interface, method, is_visible=True): raise Exception('[LenientThis] is not supported for operations.') if 'APIExperimentEnabled' in extended_attributes: - includes.add('core/experiments/ExperimentalFeatures.h') includes.add('core/inspector/ConsoleMessage.h') + includes.add('core/origin_trials/OriginTrials.h') argument_contexts = [ argument_context(interface, method, argument, index, is_visible=is_visible) diff --git a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py index ce17ce3..e6fcb1d 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py @@ -387,7 +387,7 @@ def api_experiment_enabled_function(definition_or_member): feature_name = runtime_feature_name(definition_or_member) if not feature_name or not experiment_name: return - return 'ExperimentalFeatures::%sEnabled' % uncapitalize(feature_name) + return 'OriginTrials::%sEnabled' % uncapitalize(feature_name) # [RuntimeEnabled] @@ -403,8 +403,8 @@ def runtime_enabled_function_name(definition_or_member): # If an API experiment is on the method/attribute, it overrides the runtime # enabled status. For now, we are unconditionally installing experimental # attributes/methods, so we are acting as though the runtime enabled - # function doesn't exist. (It is checked in the generated - # ExperimentalFeatures function, instead) + # function doesn't exist. (It is checked in the generated OriginTrials + # function, instead) experiment_name = api_experiment_name(definition_or_member) if not feature_name or experiment_name: return 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 25bbd91..4fe305b 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp @@ -29,10 +29,10 @@ #include "bindings/tests/idls/core/TestPartialInterfaceImplementation.h" #include "core/dom/ContextFeatures.h" #include "core/dom/Document.h" -#include "core/experiments/ExperimentalFeatures.h" #include "core/frame/LocalFrame.h" #include "core/frame/UseCounter.h" #include "core/inspector/ConsoleMessage.h" +#include "core/origin_trials/OriginTrials.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/TraceEvent.h" @@ -93,7 +93,7 @@ static void testInterfaceAttributeAttributeGetter(const v8::FunctionCallbackInfo { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -109,7 +109,7 @@ static void testInterfaceAttributeAttributeGetterCallback(const v8::FunctionCall UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::V8TestInterface_TestInterfaceAttribute_AttributeGetter); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -158,7 +158,7 @@ static void doubleAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Va { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -173,7 +173,7 @@ static void doubleAttributeAttributeGetterCallback(const v8::FunctionCallbackInf TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -205,7 +205,7 @@ static void floatAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Val { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -220,7 +220,7 @@ static void floatAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -252,7 +252,7 @@ static void unrestrictedDoubleAttributeAttributeGetter(const v8::FunctionCallbac { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -267,7 +267,7 @@ static void unrestrictedDoubleAttributeAttributeGetterCallback(const v8::Functio TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -299,7 +299,7 @@ static void unrestrictedFloatAttributeAttributeGetter(const v8::FunctionCallback { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -314,7 +314,7 @@ static void unrestrictedFloatAttributeAttributeGetterCallback(const v8::Function TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -346,7 +346,7 @@ static void testEnumAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8:: { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -361,7 +361,7 @@ static void testEnumAttributeAttributeGetterCallback(const v8::FunctionCallbackI TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -403,7 +403,7 @@ static void stringOrDoubleAttributeAttributeGetter(const v8::FunctionCallbackInf { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -420,7 +420,7 @@ static void stringOrDoubleAttributeAttributeGetterCallback(const v8::FunctionCal TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -453,7 +453,7 @@ static void conditionalLongAttributeAttributeGetter(const v8::FunctionCallbackIn { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -468,7 +468,7 @@ static void conditionalLongAttributeAttributeGetterCallback(const v8::FunctionCa TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -500,7 +500,7 @@ static void conditionalReadOnlyLongAttributeAttributeGetter(const v8::FunctionCa { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -515,7 +515,7 @@ static void conditionalReadOnlyLongAttributeAttributeGetterCallback(const v8::Fu TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -528,7 +528,7 @@ static void staticStringAttributeAttributeGetter(const v8::FunctionCallbackInfo< { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -541,7 +541,7 @@ static void staticStringAttributeAttributeGetterCallback(const v8::FunctionCallb TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -570,7 +570,7 @@ static void staticReturnDOMWrapperAttributeAttributeGetter(const v8::FunctionCal { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -583,7 +583,7 @@ static void staticReturnDOMWrapperAttributeAttributeGetterCallback(const v8::Fun TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -617,7 +617,7 @@ static void staticReadOnlyStringAttributeAttributeGetter(const v8::FunctionCallb { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -630,7 +630,7 @@ static void staticReadOnlyStringAttributeAttributeGetterCallback(const v8::Funct TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -643,7 +643,7 @@ static void staticReadOnlyReturnDOMWrapperAttributeAttributeGetter(const v8::Fun { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -663,7 +663,7 @@ static void staticReadOnlyReturnDOMWrapperAttributeAttributeGetterCallback(const TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -676,7 +676,7 @@ static void staticConditionalReadOnlyLongAttributeAttributeGetter(const v8::Func { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -689,7 +689,7 @@ static void staticConditionalReadOnlyLongAttributeAttributeGetterCallback(const TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -702,7 +702,7 @@ static void legacyInterfaceTypeCheckingAttributeAttributeGetter(const v8::Functi { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -717,7 +717,7 @@ static void legacyInterfaceTypeCheckingAttributeAttributeGetterCallback(const v8 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -746,7 +746,7 @@ static void alwaysExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -761,7 +761,7 @@ static void alwaysExposedAttributeAttributeGetterCallback(const v8::FunctionCall TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -793,7 +793,7 @@ static void workerExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -808,7 +808,7 @@ static void workerExposedAttributeAttributeGetterCallback(const v8::FunctionCall TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -840,7 +840,7 @@ static void windowExposedAttributeAttributeGetter(const v8::FunctionCallbackInfo { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -855,7 +855,7 @@ static void windowExposedAttributeAttributeGetterCallback(const v8::FunctionCall TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -887,7 +887,7 @@ static void lenientThisAttributeAttributeGetter(const v8::FunctionCallbackInfo<v { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -904,7 +904,7 @@ static void lenientThisAttributeAttributeGetterCallback(const v8::FunctionCallba TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -935,7 +935,7 @@ static void implementsStaticReadOnlyLongAttributeAttributeGetter(const v8::Funct { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -948,7 +948,7 @@ static void implementsStaticReadOnlyLongAttributeAttributeGetterCallback(const v TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -961,7 +961,7 @@ static void implementsStaticStringAttributeAttributeGetter(const v8::FunctionCal { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -974,7 +974,7 @@ static void implementsStaticStringAttributeAttributeGetterCallback(const v8::Fun TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1003,7 +1003,7 @@ static void implementsReadonlyStringAttributeAttributeGetter(const v8::FunctionC { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1018,7 +1018,7 @@ static void implementsReadonlyStringAttributeAttributeGetterCallback(const v8::F TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1031,7 +1031,7 @@ static void implementsStringAttributeAttributeGetter(const v8::FunctionCallbackI { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1046,7 +1046,7 @@ static void implementsStringAttributeAttributeGetterCallback(const v8::FunctionC TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1077,7 +1077,7 @@ static void implementsNodeAttributeAttributeGetter(const v8::FunctionCallbackInf { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1092,7 +1092,7 @@ static void implementsNodeAttributeAttributeGetterCallback(const v8::FunctionCal TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1127,7 +1127,7 @@ static void implementsEventHandlerAttributeAttributeGetter(const v8::FunctionCal { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1143,7 +1143,7 @@ static void implementsEventHandlerAttributeAttributeGetterCallback(const v8::Fun TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1172,7 +1172,7 @@ static void implementsRuntimeEnabledNodeAttributeAttributeGetter(const v8::Funct { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1187,7 +1187,7 @@ static void implementsRuntimeEnabledNodeAttributeAttributeGetterCallback(const v TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1222,7 +1222,7 @@ static void implements2StaticStringAttributeAttributeGetter(const v8::FunctionCa { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1235,7 +1235,7 @@ static void implements2StaticStringAttributeAttributeGetterCallback(const v8::Fu TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1264,7 +1264,7 @@ static void implements2StringAttributeAttributeGetter(const v8::FunctionCallback { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1279,7 +1279,7 @@ static void implements2StringAttributeAttributeGetterCallback(const v8::Function TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1310,7 +1310,7 @@ static void implements3StringAttributeAttributeGetter(const v8::FunctionCallback { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1325,7 +1325,7 @@ static void implements3StringAttributeAttributeGetterCallback(const v8::Function TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1356,7 +1356,7 @@ static void implements3StaticStringAttributeAttributeGetter(const v8::FunctionCa { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1369,7 +1369,7 @@ static void implements3StaticStringAttributeAttributeGetterCallback(const v8::Fu TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1398,7 +1398,7 @@ static void partialLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1413,7 +1413,7 @@ static void partialLongAttributeAttributeGetterCallback(const v8::FunctionCallba TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1445,7 +1445,7 @@ static void partialStaticLongAttributeAttributeGetter(const v8::FunctionCallback { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1458,7 +1458,7 @@ static void partialStaticLongAttributeAttributeGetterCallback(const v8::Function TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1489,7 +1489,7 @@ static void partialCallWithExecutionContextLongAttributeAttributeGetter(const v8 { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1505,7 +1505,7 @@ static void partialCallWithExecutionContextLongAttributeAttributeGetterCallback( TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1538,7 +1538,7 @@ static void partialPartialEnumTypeAttributeAttributeGetter(const v8::FunctionCal { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1553,7 +1553,7 @@ static void partialPartialEnumTypeAttributeAttributeGetterCallback(const v8::Fun TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1593,7 +1593,7 @@ static void stringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Va { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1611,7 +1611,7 @@ static void stringAttributeAttributeGetterCallback(const v8::FunctionCallbackInf TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1642,7 +1642,7 @@ static void partial2LongAttributeAttributeGetter(const v8::FunctionCallbackInfo< { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1657,7 +1657,7 @@ static void partial2LongAttributeAttributeGetterCallback(const v8::FunctionCallb TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1689,7 +1689,7 @@ static void partial2StaticLongAttributeAttributeGetter(const v8::FunctionCallbac { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1702,7 +1702,7 @@ static void partial2StaticLongAttributeAttributeGetterCallback(const v8::Functio TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1752,7 +1752,7 @@ static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1788,7 +1788,7 @@ static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1824,7 +1824,7 @@ static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1866,7 +1866,7 @@ static void voidMethodTestEnumArgMethodCallback(const v8::FunctionCallbackInfo<v TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1886,7 +1886,7 @@ static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1906,7 +1906,7 @@ static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo< TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1926,7 +1926,7 @@ static void alwaysExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1946,7 +1946,7 @@ static void workerExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1966,7 +1966,7 @@ static void windowExposedMethodMethodCallback(const v8::FunctionCallbackInfo<v8: TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -1985,7 +1985,7 @@ static void alwaysExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2004,7 +2004,7 @@ static void workerExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2023,7 +2023,7 @@ static void windowExposedStaticMethodMethodCallback(const v8::FunctionCallbackIn TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2042,7 +2042,7 @@ static void staticReturnDOMWrapperMethodMethodCallback(const v8::FunctionCallbac TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2062,7 +2062,7 @@ static void methodWithExposedAndRuntimeEnabledFlagMethodCallback(const v8::Funct TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2167,7 +2167,7 @@ static void methodWithExposedHavingRuntimeEnabldFlagMethodCallback(const v8::Fun TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2187,7 +2187,7 @@ static void windowAndServiceWorkerExposedMethodMethodCallback(const v8::Function TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2264,7 +2264,7 @@ static void legacyInterfaceTypeCheckingMethodMethodCallback(const v8::FunctionCa TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2284,7 +2284,7 @@ static void implementsVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2329,7 +2329,7 @@ static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2343,7 +2343,7 @@ static void implementsCustomVoidMethodMethodCallback(const v8::FunctionCallbackI TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2362,7 +2362,7 @@ static void implementsStaticVoidMethodMethodCallback(const v8::FunctionCallbackI TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2382,7 +2382,7 @@ static void implements2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2402,7 +2402,7 @@ static void implements3VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2421,7 +2421,7 @@ static void implements3StaticVoidMethodMethodCallback(const v8::FunctionCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2441,7 +2441,7 @@ static void partialVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::V TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2460,7 +2460,7 @@ static void partialStaticVoidMethodMethodCallback(const v8::FunctionCallbackInfo TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2492,7 +2492,7 @@ static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInf TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2518,7 +2518,7 @@ static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallba TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2550,7 +2550,7 @@ static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2585,7 +2585,7 @@ static void shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2779,7 +2779,7 @@ static void toJSONMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2799,7 +2799,7 @@ static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -2826,7 +2826,7 @@ static void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -3315,7 +3315,7 @@ bool V8TestInterface::PrivateScript::stringAttributeAttributeGetter(LocalFrame* ExecutionContext* executionContext = currentExecutionContext(scriptState->isolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; 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 78e04a4e..ab4b350 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp @@ -60,7 +60,6 @@ #include "core/dom/MessagePort.h" #include "core/dom/TagCollection.h" #include "core/dom/custom/CustomElementProcessingStack.h" -#include "core/experiments/ExperimentalFeatures.h" #include "core/frame/ImageBitmap.h" #include "core/frame/LocalFrame.h" #include "core/frame/UseCounter.h" @@ -70,6 +69,7 @@ #include "core/html/HTMLTableRowsCollection.h" #include "core/inspector/ConsoleMessage.h" #include "core/inspector/ScriptArguments.h" +#include "core/origin_trials/OriginTrials.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/TraceEvent.h" @@ -117,7 +117,7 @@ static void FEATURE1_RUNTIME_AND_EXPERIMENT_ENABLED_CONST1ConstantGetterCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName1Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName1Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -131,7 +131,7 @@ static void FEATURE1_RUNTIME_AND_EXPERIMENT_ENABLED_CONST2ConstantGetterCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName1Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName1Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -145,7 +145,7 @@ static void FEATURE2_RUNTIME_AND_EXPERIMENT_ENABLED_CONST1ConstantGetterCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName2Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName2Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -159,7 +159,7 @@ static void FEATURE2_RUNTIME_AND_EXPERIMENT_ENABLED_CONST2ConstantGetterCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName2Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName2Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -173,7 +173,7 @@ static void FEATURE3_RUNTIME_AND_EXPERIMENT_ENABLED_CONST1ConstantGetterCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName3Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName3Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -2868,7 +2868,7 @@ static void experimentRuntimeEnabledLongAttributeAttributeGetter(const v8::Funct { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -2883,7 +2883,7 @@ static void experimentRuntimeEnabledLongAttributeAttributeGetterCallback(const v TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -5423,7 +5423,7 @@ static void unscopeableExperimentEnabledLongAttributeAttributeGetter(const v8::F { ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -5438,7 +5438,7 @@ static void unscopeableExperimentEnabledLongAttributeAttributeGetterCallback(con TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -10741,7 +10741,7 @@ static void experimentEnabledVoidMethodMethodCallback(const v8::FunctionCallback TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName1Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName1Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -10761,7 +10761,7 @@ static void perWorldBindingsExperimentEnabledVoidMethodMethodCallback(const v8:: TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName1Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName1Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; @@ -10781,7 +10781,7 @@ static void perWorldBindingsExperimentEnabledVoidMethodMethodCallbackForMainWorl TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String memberErrorMessage; - if (!ExperimentalFeatures::featureName1Enabled(executionContext, memberErrorMessage)) { + if (!OriginTrials::featureName1Enabled(executionContext, memberErrorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, memberErrorMessage)); return; diff --git a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp index 8d58e10..bdebb4a 100644 --- a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp @@ -17,9 +17,9 @@ #include "bindings/tests/idls/modules/TestPartialInterfaceImplementation3.h" #include "core/dom/ContextFeatures.h" #include "core/dom/Document.h" -#include "core/experiments/ExperimentalFeatures.h" #include "core/frame/LocalFrame.h" #include "core/inspector/ConsoleMessage.h" +#include "core/origin_trials/OriginTrials.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/TraceEvent.h" @@ -247,7 +247,7 @@ static void partialVoidTestEnumModulesArgMethodMethodCallback(const v8::Function TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; @@ -298,7 +298,7 @@ static void unscopeableVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); String errorMessage; - if (!ExperimentalFeatures::featureNameEnabled(executionContext, errorMessage)) { + if (!OriginTrials::featureNameEnabled(executionContext, errorMessage)) { v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); toDocument(executionContext)->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); return; diff --git a/third_party/WebKit/Source/build/scripts/make_experimental_features.py b/third_party/WebKit/Source/build/scripts/make_origin_trials.py index 3033d95..e949346 100755 --- a/third_party/WebKit/Source/build/scripts/make_experimental_features.py +++ b/third_party/WebKit/Source/build/scripts/make_origin_trials.py @@ -37,11 +37,11 @@ import template_expander # We want exactly the same parsing as RuntimeFeatureWriter # but generate different files. -class ExperimentalFeatureWriter(make_runtime_features.RuntimeFeatureWriter): - class_name = 'ExperimentalFeatures' +class OriginTrialsWriter(make_runtime_features.RuntimeFeatureWriter): + class_name = 'OriginTrials' def __init__(self, in_file_path): - super(ExperimentalFeatureWriter, self).__init__(in_file_path) + super(OriginTrialsWriter, self).__init__(in_file_path) self._outputs = { (self.class_name + '.cpp'): self.generate_implementation, (self.class_name + '.h'): self.generate_header, @@ -61,4 +61,4 @@ class ExperimentalFeatureWriter(make_runtime_features.RuntimeFeatureWriter): if __name__ == '__main__': - in_generator.Maker(ExperimentalFeatureWriter).main(sys.argv) + in_generator.Maker(OriginTrialsWriter).main(sys.argv) diff --git a/third_party/WebKit/Source/build/scripts/make_runtime_features.py b/third_party/WebKit/Source/build/scripts/make_runtime_features.py index c44550c..e98f558 100755 --- a/third_party/WebKit/Source/build/scripts/make_runtime_features.py +++ b/third_party/WebKit/Source/build/scripts/make_runtime_features.py @@ -43,7 +43,7 @@ class RuntimeFeatureWriter(in_generator.Writer): 'status': ['stable', 'experimental', 'test'], } defaults = { - 'api_name': None, + 'origin_trial_feature_name': None, 'condition': None, 'implied_by': [], 'depends_on': [], diff --git a/third_party/WebKit/Source/build/scripts/templates/ExperimentalFeatures.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/ExperimentalFeatures.cpp.tmpl deleted file mode 100644 index cd5c417..0000000 --- a/third_party/WebKit/Source/build/scripts/templates/ExperimentalFeatures.cpp.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -{% from 'macros.tmpl' import license %} -{{license()}} - -#include "core/experiments/ExperimentalFeatures.h" - -#include "core/experiments/Experiments.h" -#include "platform/RuntimeEnabledFeatures.h" - -namespace blink { -{% for feature in features %} -{% if feature.api_name %} - -// static -bool ExperimentalFeatures::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext, String& errorMessage) { - return {{feature.first_lowered_name}}EnabledImpl(executionContext, &errorMessage); -} - -// static -bool ExperimentalFeatures::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext) { - return {{feature.first_lowered_name}}EnabledImpl(executionContext, nullptr); -} -{% endif %} -{% endfor %} - -{% for feature in features %} -{% if feature.api_name %} - -// static -bool ExperimentalFeatures::{{feature.first_lowered_name}}EnabledImpl(ExecutionContext* executionContext, String* errorMessage) { - if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) - return true; - return Experiments::isApiEnabled(executionContext, "{{feature.api_name}}", errorMessage); -} -{% endif %} -{% endfor %} - -} // namespace blink diff --git a/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl new file mode 100644 index 0000000..37c26020 --- /dev/null +++ b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl @@ -0,0 +1,37 @@ +{% from 'macros.tmpl' import license %} +{{license()}} + +#include "core/origin_trials/OriginTrials.h" + +#include "core/origin_trials/OriginTrialContext.h" +#include "platform/RuntimeEnabledFeatures.h" + +namespace blink { +{% for feature in features %} +{% if feature.origin_trial_feature_name %} + +// static +bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext, String& errorMessage) { + return {{feature.first_lowered_name}}EnabledImpl(executionContext, &errorMessage); +} + +// static +bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext) { + return {{feature.first_lowered_name}}EnabledImpl(executionContext, nullptr); +} +{% endif %} +{% endfor %} + +{% for feature in features %} +{% if feature.origin_trial_feature_name %} + +// static +bool OriginTrials::{{feature.first_lowered_name}}EnabledImpl(ExecutionContext* executionContext, String* errorMessage) { + if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) + return true; + return OriginTrialContext::isFeatureEnabled(executionContext, "{{feature.origin_trial_feature_name}}", errorMessage); +} +{% endif %} +{% endfor %} + +} // namespace blink diff --git a/third_party/WebKit/Source/build/scripts/templates/ExperimentalFeatures.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.h.tmpl index c44d07b..f49790e 100644 --- a/third_party/WebKit/Source/build/scripts/templates/ExperimentalFeatures.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.h.tmpl @@ -1,8 +1,8 @@ {% from 'macros.tmpl' import license %} {{license()}} -#ifndef ExperimentalFeatures_h -#define ExperimentalFeatures_h +#ifndef OriginTrials_h +#define OriginTrials_h #include "core/CoreExport.h" #include "wtf/text/WTFString.h" @@ -14,20 +14,20 @@ class ExecutionContext; // A class that stores dynamic tests for experimental features which can be // enabled through the experimental framework via API keys. -class CORE_EXPORT ExperimentalFeatures { +class CORE_EXPORT OriginTrials { public: {% for feature in features %} - {% if feature.api_name %} + {% if feature.origin_trial_feature_name %} static bool {{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext, String& errorMessage); static bool {{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext); {% endif %} {% endfor %} private: - ExperimentalFeatures() { } + OriginTrials() { } {% for feature in features %} - {% if feature.api_name %} + {% if feature.origin_trial_feature_name %} static bool {{feature.first_lowered_name}}EnabledImpl(ExecutionContext* executionContext, String* errorMessage); {% endif %} {% endfor %} @@ -35,4 +35,4 @@ private: } // namespace blink -#endif // ExperimentalFeatures_h +#endif // OriginTrials_h diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index 5285031..b17343c 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn @@ -367,9 +367,9 @@ source_set("core_generated") { "$blink_core_output_dir/XLinkNames.cpp", "$blink_core_output_dir/XMLNSNames.cpp", "$blink_core_output_dir/XMLNames.cpp", - "$blink_core_output_dir/experiments/ExperimentalFeatures.cpp", - "$blink_core_output_dir/experiments/ExperimentalFeatures.h", "$blink_core_output_dir/fetch/FetchInitiatorTypeNames.cpp", + "$blink_core_output_dir/origin_trials/OriginTrials.cpp", + "$blink_core_output_dir/origin_trials/OriginTrials.h", # Generated from HTMLEntityNames.in "$blink_core_output_dir/HTMLEntityTable.cpp", @@ -578,7 +578,6 @@ group("make_core_generated") { ":make_core_generated_event_names", ":make_core_generated_event_target_names", ":make_core_generated_event_type_names", - ":make_core_generated_experimental_features", ":make_core_generated_fetch_initiator_type_names", ":make_core_generated_html_element_factory", ":make_core_generated_html_element_lookup_trie", @@ -591,6 +590,7 @@ group("make_core_generated") { ":make_core_generated_media_feature_names", ":make_core_generated_media_features", ":make_core_generated_media_type_names", + ":make_core_generated_origin_trials", ":make_core_generated_private_script", ":make_core_generated_private_script_for_testing", ":make_core_generated_style_builder", @@ -987,25 +987,25 @@ action("make_core_generated_html_element_lookup_trie") { deps = make_core_generated_deps } -# "ExperimentalFeatures" action in make_core_generated from GYP. -action("make_core_generated_experimental_features") { - script = "../build/scripts/make_experimental_features.py" +# "OriginTrials" action in make_core_generated from GYP. +action("make_core_generated_origin_trials") { + script = "../build/scripts/make_origin_trials.py" inputs = scripts_for_in_files + [ - "../build/scripts/make_experimental_features.py", + "../build/scripts/make_origin_trials.py", "../platform/RuntimeEnabledFeatures.in", - "../build/scripts/templates/ExperimentalFeatures.cpp.tmpl", - "../build/scripts/templates/ExperimentalFeatures.h.tmpl", + "../build/scripts/templates/OriginTrials.cpp.tmpl", + "../build/scripts/templates/OriginTrials.h.tmpl", ] outputs = [ - "$blink_core_output_dir/experiments/ExperimentalFeatures.cpp", - "$blink_core_output_dir/experiments/ExperimentalFeatures.h", + "$blink_core_output_dir/origin_trials/OriginTrials.cpp", + "$blink_core_output_dir/origin_trials/OriginTrials.h", ] args = [ rebase_path("../platform/RuntimeEnabledFeatures.in", root_build_dir), "--output_dir", - "$rel_blink_core_gen_dir/experiments", + "$rel_blink_core_gen_dir/origin_trials", ] } diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi index f6b8afa..04d5797 100644 --- a/third_party/WebKit/Source/core/core.gypi +++ b/third_party/WebKit/Source/core/core.gypi @@ -1531,8 +1531,6 @@ 'editing/spellcheck/SpellChecker.h', 'editing/spellcheck/TextCheckingHelper.cpp', 'editing/spellcheck/TextCheckingHelper.h', - 'experiments/Experiments.cpp', - 'experiments/Experiments.h', 'fetch/AccessControlStatus.h', 'fetch/CSSStyleSheetResource.cpp', 'fetch/CSSStyleSheetResource.h', @@ -1935,6 +1933,8 @@ 'loader/appcache/ApplicationCache.h', 'loader/appcache/ApplicationCacheHost.cpp', 'loader/appcache/ApplicationCacheHost.h', + 'origin_trials/OriginTrialContext.cpp', + 'origin_trials/OriginTrialContext.h', 'page/AutoscrollController.cpp', 'page/AutoscrollController.h', 'page/ChromeClient.cpp', @@ -3804,7 +3804,7 @@ 'testing/Internals.idl', ], 'webcore_testing_dependency_idl_files': [ - 'experiments/testing/InternalsFrobulate.idl', + 'origin_trials/testing/InternalsFrobulate.idl', 'testing/PartialPrivateScriptTest.idl', ], 'generated_webcore_testing_idl_files': [ @@ -3820,8 +3820,8 @@ 'webcore_testing_files': [ '<(blink_core_output_dir)/testing/InternalSettingsGenerated.cpp', '<(blink_core_output_dir)/testing/InternalSettingsGenerated.h', - 'experiments/testing/InternalsFrobulate.cpp', - 'experiments/testing/InternalsFrobulate.h', + 'origin_trials/testing/InternalsFrobulate.cpp', + 'origin_trials/testing/InternalsFrobulate.h', 'testing/CoreTestPrinters.cpp', 'testing/DictionaryTest.cpp', 'testing/DictionaryTest.h', @@ -3956,7 +3956,6 @@ 'editing/serializers/StyledMarkupSerializerTest.cpp', 'events/EventPathTest.cpp', 'events/PointerEventManagerTest.cpp', - 'experiments/ExperimentsTest.cpp', 'fetch/CachingCorrectnessTest.cpp', 'fetch/ClientHintsPreferencesTest.cpp', 'fetch/FetchUtilsTest.cpp', @@ -4031,6 +4030,7 @@ 'loader/LinkHeaderTest.cpp', 'loader/LinkLoaderTest.cpp', 'loader/MixedContentCheckerTest.cpp', + 'origin_trials/OriginTrialContextTest.cpp', 'page/ChromeClientTest.cpp', 'page/ContextMenuControllerTest.cpp', 'page/EventSourceTest.cpp', diff --git a/third_party/WebKit/Source/core/core_generated.gyp b/third_party/WebKit/Source/core/core_generated.gyp index 01712e3..bb6f4e2 100644 --- a/third_party/WebKit/Source/core/core_generated.gyp +++ b/third_party/WebKit/Source/core/core_generated.gyp @@ -731,24 +731,24 @@ ], }, { - 'action_name': 'ExperimentalFeatures', + 'action_name': 'OriginTrials', 'inputs': [ '<@(scripts_for_in_files)', - '../build/scripts/make_experimental_features.py', + '../build/scripts/make_origin_trials.py', '../platform/RuntimeEnabledFeatures.in', - '../build/scripts/templates/ExperimentalFeatures.cpp.tmpl', - '../build/scripts/templates/ExperimentalFeatures.h.tmpl', + '../build/scripts/templates/OriginTrials.cpp.tmpl', + '../build/scripts/templates/OriginTrials.h.tmpl', ], 'outputs': [ - '<(blink_core_output_dir)/experiments/ExperimentalFeatures.cpp', - '<(blink_core_output_dir)/experiments/ExperimentalFeatures.h', + '<(blink_core_output_dir)/origin_trials/OriginTrials.cpp', + '<(blink_core_output_dir)/origin_trials/OriginTrials.h', ], 'action': [ 'python', - '../build/scripts/make_experimental_features.py', + '../build/scripts/make_origin_trials.py', '../platform/RuntimeEnabledFeatures.in', '--output_dir', - '<(blink_core_output_dir)/experiments', + '<(blink_core_output_dir)/origin_trials', ], }, ], diff --git a/third_party/WebKit/Source/core/core_generated.gypi b/third_party/WebKit/Source/core/core_generated.gypi index a397855..190a07c 100644 --- a/third_party/WebKit/Source/core/core_generated.gypi +++ b/third_party/WebKit/Source/core/core_generated.gypi @@ -123,9 +123,9 @@ # Generated from make_css_property_metadata.py '<(blink_core_output_dir)/CSSPropertyMetadata.cpp', - # Generated from make_experimental_features.py - '<(blink_core_output_dir)/experiments/ExperimentalFeatures.cpp', - '<(blink_core_output_dir)/experiments/ExperimentalFeatures.h', + # Generated from make_origin_trials.py + '<(blink_core_output_dir)/origin_trials/OriginTrials.cpp', + '<(blink_core_output_dir)/origin_trials/OriginTrials.h', ], }, } diff --git a/third_party/WebKit/Source/core/experiments/Experiments.h b/third_party/WebKit/Source/core/experiments/Experiments.h deleted file mode 100644 index ac6d034..0000000 --- a/third_party/WebKit/Source/core/experiments/Experiments.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef Experiments_h -#define Experiments_h - -#include "core/CoreExport.h" -#include "core/dom/DOMException.h" -#include "core/dom/ExecutionContext.h" -#include "wtf/text/WTFString.h" - -namespace blink { - -class WebApiKeyValidator; - -// The Experimental Framework (EF) provides limited access to experimental APIs, -// on a per-origin basis. This class provides the implementation to check if -// the experimental API should be enabled for the current context. This class -// is not for direct use by API implementers. Instead, the ExperimentalFeatures -// generated class provides a static method for each API to check if it is -// enabled. Experimental APIs must be defined in RuntimeEnabledFeatures.in, -// which is used to generate ExperimentalFeatures.h/cpp. -// -// Experimental APIs are defined by string names, provided by the implementers. -// The EF code does not maintain an enum or constant list for experiment names. -// Instead, the EF validates the name provided by the API implementation against -// any provided API keys. -// -// This class is not intended to be instantiated. Any required state is kept -// with a WebApiKeyValidator object held in the Platform object. -// The static methods in this class may be called either from the main thread -// or from a worker thread. -// -// TODO(chasej): Link to documentation, or provide more detail on keys, .etc -class CORE_EXPORT Experiments { -public: - // Creates a NotSupportedError exception with a message explaining to - // external developers why the API is disabled and how to join API - // experiments. - static DOMException* createApiDisabledException(const String& apiName); - -private: - friend class ExperimentalFeatures; - friend class ExperimentsTest; - - Experiments(); - - // Returns true if the API should be considered enabled for the current - // execution context. This method usually makes use of the API key validator - // object in the platform, but this may be overridden if a custom validator - // is required (for testing, for instance). - static bool isApiEnabled(ExecutionContext*, const String& apiName, String* errorMessage, WebApiKeyValidator* = nullptr); -}; - -} // namespace blink - -#endif // Experiments_h diff --git a/third_party/WebKit/Source/core/experiments/Experiments.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp index b127d68..d7c39cc 100644 --- a/third_party/WebKit/Source/core/experiments/Experiments.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/experiments/Experiments.h" +#include "core/origin_trials/OriginTrialContext.h" #include "core/dom/ElementTraversal.h" #include "core/dom/ExceptionCode.h" @@ -11,39 +11,39 @@ #include "platform/RuntimeEnabledFeatures.h" #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/Platform.h" -#include "public/platform/WebApiKeyValidator.h" +#include "public/platform/WebTrialTokenValidator.h" namespace blink { namespace { -const char kExperimentsMetaName[] = "api-experiments"; +const char kTrialMetaTagName[] = "api-experiments"; String getCurrentOrigin(ExecutionContext* executionContext) { return executionContext->securityOrigin()->toString(); } -String getDisabledMessage(const String& apiName) +String getDisabledMessage(const String& featureName) { // TODO(chasej): Update message with URL to experiments site, when live - return "The '" + apiName + "' API is currently enabled in limited experiments. Please see [Chrome experiments website URL] for information on enabling this experiment on your site."; + return "The '" + featureName + "' feature is currently enabled in limited trials. Please see [Phosphor console URL] for information on enabling a trial for your site."; } -bool hasValidAPIKey(ExecutionContext* executionContext, const String& apiName, String* errorMessage, WebApiKeyValidator* validator) +bool hasValidToken(ExecutionContext* executionContext, const String& featureName, String* errorMessage, WebTrialTokenValidator* validator) { - bool foundAnyKey = false; + bool foundAnyToken = false; String origin = getCurrentOrigin(executionContext); - // When in a document, the API key is provided in a meta tag + // When in a document, the token is provided in a meta tag if (executionContext->isDocument()) { HTMLHeadElement* head = toDocument(executionContext)->head(); for (HTMLMetaElement* metaElement = head ? Traversal<HTMLMetaElement>::firstChild(*head) : 0; metaElement; metaElement = Traversal<HTMLMetaElement>::nextSibling(*metaElement)) { - if (equalIgnoringCase(metaElement->name(), kExperimentsMetaName)) { - foundAnyKey = true; - String keyString = metaElement->content(); + if (equalIgnoringCase(metaElement->name(), kTrialMetaTagName)) { + foundAnyToken = true; + String tokenString = metaElement->content(); // Check with the validator service to verify the signature. - if (validator->validateApiKey(keyString, origin, apiName)) { + if (validator->validateToken(tokenString, origin, featureName)) { return true; } } @@ -51,10 +51,10 @@ bool hasValidAPIKey(ExecutionContext* executionContext, const String& apiName, S } if (errorMessage) { - if (foundAnyKey) { - *errorMessage = "The provided key(s) are not valid for the '" + apiName + "' API."; + if (foundAnyToken) { + *errorMessage = "The provided token(s) are not valid for the '" + featureName + "' feature."; } else { - *errorMessage = getDisabledMessage(apiName); + *errorMessage = getDisabledMessage(featureName); } } return false; @@ -63,7 +63,7 @@ bool hasValidAPIKey(ExecutionContext* executionContext, const String& apiName, S } // namespace // static -bool Experiments::isApiEnabled(ExecutionContext* executionContext, const String& apiName, String* errorMessage, WebApiKeyValidator* validator) +bool OriginTrialContext::isFeatureEnabled(ExecutionContext* executionContext, const String& featureName, String* errorMessage, WebTrialTokenValidator* validator) { if (!RuntimeEnabledFeatures::experimentalFrameworkEnabled()) { if (errorMessage) { @@ -77,7 +77,7 @@ bool Experiments::isApiEnabled(ExecutionContext* executionContext, const String& return false; } - // Experiments are only enabled for secure origins + // Feature trials are only enabled for secure origins bool isSecure = errorMessage ? executionContext->isSecureContext(*errorMessage) : executionContext->isSecureContext(); @@ -86,7 +86,7 @@ bool Experiments::isApiEnabled(ExecutionContext* executionContext, const String& } if (!validator) { - validator = Platform::current()->apiKeyValidator(); + validator = Platform::current()->trialTokenValidator(); if (!validator) { if (errorMessage) { *errorMessage = "Experimental Framework is not enabled."; @@ -95,13 +95,7 @@ bool Experiments::isApiEnabled(ExecutionContext* executionContext, const String& } } - return hasValidAPIKey(executionContext, apiName, errorMessage, validator); -} - -// static -DOMException* Experiments::createApiDisabledException(const String& apiName) -{ - return DOMException::create(NotSupportedError, getDisabledMessage(apiName)); + return hasValidToken(executionContext, featureName, errorMessage, validator); } } // namespace blink diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h new file mode 100644 index 0000000..579307d --- /dev/null +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h @@ -0,0 +1,52 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef OriginTrialContext_h +#define OriginTrialContext_h + +#include "core/CoreExport.h" +#include "core/dom/DOMException.h" +#include "core/dom/ExecutionContext.h" +#include "wtf/text/WTFString.h" + +namespace blink { + +class WebTrialTokenValidator; + +// The Experimental Framework (EF) provides limited access to experimental +// features, on a per-origin basis (origin trials). This class provides the +// implementation to check if the experimental feature should be enabled for the +// current context. This class is not for direct use by feature implementers. +// Instead, the OriginTrials generated class provides a static method for each +// feature to check if it is enabled. Experimental features must be defined in +// RuntimeEnabledFeatures.in, which is used to generate OriginTrials.h/cpp. +// +// Experimental features are defined by string names, provided by the +// implementers. The EF code does not maintain an enum or constant list for +// feature names. Instead, the EF validates the name provided by the feature +// implementation against any provided tokens. +// +// This class is not intended to be instantiated. Any required state is kept +// with a WebApiKeyValidator object held in the Platform object. +// The static methods in this class may be called either from the main thread +// or from a worker thread. +// +// TODO(chasej): Link to documentation, or provide more detail on keys, .etc +class CORE_EXPORT OriginTrialContext { +private: + friend class OriginTrialContextTest; + friend class OriginTrials; + + OriginTrialContext(); + + // Returns true if the feature should be considered enabled for the current + // execution context. This method usually makes use of the token validator + // object in the platform, but this may be overridden if a custom validator + // is required (for testing, for instance). + static bool isFeatureEnabled(ExecutionContext*, const String& featureName, String* errorMessage, WebTrialTokenValidator* = nullptr); +}; + +} // namespace blink + +#endif // OriginTrialContext_h diff --git a/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp index aa90cf6..ef18615 100644 --- a/third_party/WebKit/Source/core/experiments/ExperimentsTest.cpp +++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContextTest.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/experiments/Experiments.h" +#include "core/origin_trials/OriginTrialContext.h" #include "core/HTMLNames.h" #include "core/dom/DOMException.h" @@ -14,31 +14,31 @@ #include "core/testing/DummyPageHolder.h" #include "platform/weborigin/KURL.h" #include "platform/weborigin/SecurityOrigin.h" -#include "public/platform/WebApiKeyValidator.h" +#include "public/platform/WebTrialTokenValidator.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { namespace { -const char kNonExistingAPIName[] = "This API does not exist"; -const char kFrobulateAPIName[] = "Frobulate"; +const char kNonExistingFeatureName[] = "This feature does not exist"; +const char kFrobulateFeatureName[] = "Frobulate"; const char kFrobulateEnabledOrigin[] = "https://www.example.com"; const char kFrobulateEnabledOriginUnsecure[] = "http://www.example.com"; -// API Key that will appear valid. -const char kGoodAPIKey[] = "AnySignatureWillDo|https://www.example.com|Frobulate|2000000000"; +// Trial token which will appear valid +const char kGoodToken[] = "AnySignatureWillDo|https://www.example.com|Frobulate|2000000000"; -class MockApiKeyValidator : public WebApiKeyValidator { +class MockTokenValidator : public WebTrialTokenValidator { public: - MockApiKeyValidator() + MockTokenValidator() : m_response(false) , m_callCount(0) { } - ~MockApiKeyValidator() override {} + ~MockTokenValidator() override {} - // blink::WebApiKeyValidator implementation - bool validateApiKey(const blink::WebString& apiKey, const blink::WebString& origin, const blink::WebString& apiName) override + // blink::WebTrialTokenValidator implementation + bool validateToken(const blink::WebString& token, const blink::WebString& origin, const blink::WebString& featureName) override { m_callCount++; return m_response; @@ -63,24 +63,24 @@ private: bool m_response; int m_callCount; - DISALLOW_COPY_AND_ASSIGN(MockApiKeyValidator); + DISALLOW_COPY_AND_ASSIGN(MockTokenValidator); }; } // namespace -class ExperimentsTest : public ::testing::Test { +class OriginTrialContextTest : public ::testing::Test { protected: - ExperimentsTest() + OriginTrialContextTest() : m_page(DummyPageHolder::create()) , m_frameworkWasEnabled(RuntimeEnabledFeatures::experimentalFrameworkEnabled()) - , m_apiKeyValidator(adoptPtr(new MockApiKeyValidator())) + , m_tokenValidator(adoptPtr(new MockTokenValidator())) { if (!RuntimeEnabledFeatures::experimentalFrameworkEnabled()) { RuntimeEnabledFeatures::setExperimentalFrameworkEnabled(true); } } - ~ExperimentsTest() + ~OriginTrialContextTest() { if (!m_frameworkWasEnabled) { RuntimeEnabledFeatures::setExperimentalFrameworkEnabled(false); @@ -102,7 +102,7 @@ protected: } ExecutionContext* executionContext() { return &(m_page->document()); } - MockApiKeyValidator* apiKeyValidator() { return m_apiKeyValidator.get(); } + MockTokenValidator* tokenValidator() { return m_tokenValidator.get(); } HTMLDocument& document() const { return *m_document; } void setPageOrigin(const String& origin) @@ -118,117 +118,109 @@ protected: document().view()->updateAllLifecyclePhases(); } - void addApiKey(const String& keyValue) + void addTrialToken(const String& token) { HTMLElement* head = document().head(); ASSERT_TRUE(head); RefPtrWillBeRawPtr<HTMLMetaElement> meta = HTMLMetaElement::create(document()); meta->setAttribute(HTMLNames::nameAttr, "api-experiments"); - AtomicString value(keyValue); + AtomicString value(token); meta->setAttribute(HTMLNames::contentAttr, value); head->appendChild(meta.release()); } - bool isApiEnabled(const String& origin, const String& apiName, const String& apiKeyValue, String* errorMessage) + bool isFeatureEnabled(const String& origin, const String& featureName, const String& token, String* errorMessage) { setPageOrigin(origin); - addApiKey(apiKeyValue); - return Experiments::isApiEnabled(executionContext(), apiName, errorMessage, apiKeyValidator()); + addTrialToken(token); + return OriginTrialContext::isFeatureEnabled(executionContext(), featureName, errorMessage, tokenValidator()); } - bool isApiEnabledWithoutErrorMessage(const String& origin, const String& apiName, const char* apiKeyValue) + bool isFeatureEnabledWithoutErrorMessage(const String& origin, const String& featureName, const char* token) { - return isApiEnabled(origin, apiName, apiKeyValue, nullptr); + return isFeatureEnabled(origin, featureName, token, nullptr); } private: OwnPtr<DummyPageHolder> m_page; RefPtrWillBePersistent<HTMLDocument> m_document; const bool m_frameworkWasEnabled; - OwnPtr<MockApiKeyValidator> m_apiKeyValidator; + OwnPtr<MockTokenValidator> m_tokenValidator; }; -TEST_F(ExperimentsTest, EnabledNonExistingAPI) +TEST_F(OriginTrialContextTest, EnabledNonExistingFeature) { String errorMessage; - bool isNonExistingApiEnabled = isApiEnabled(kFrobulateEnabledOrigin, - kNonExistingAPIName, - kGoodAPIKey, + bool isNonExistingFeatureEnabled = isFeatureEnabled(kFrobulateEnabledOrigin, + kNonExistingFeatureName, + kGoodToken, &errorMessage); - EXPECT_FALSE(isNonExistingApiEnabled); - EXPECT_EQ(("The provided key(s) are not valid for the 'This API does not exist' API."), errorMessage); + EXPECT_FALSE(isNonExistingFeatureEnabled); + EXPECT_EQ(("The provided token(s) are not valid for the 'This feature does not exist' feature."), errorMessage); } -TEST_F(ExperimentsTest, EnabledNonExistingAPIWithoutErrorMessage) +TEST_F(OriginTrialContextTest, EnabledNonExistingFeatureWithoutErrorMessage) { - bool isNonExistingApiEnabled = isApiEnabledWithoutErrorMessage( + bool isNonExistingFeatureEnabled = isFeatureEnabledWithoutErrorMessage( kFrobulateEnabledOrigin, - kNonExistingAPIName, - kGoodAPIKey); - EXPECT_FALSE(isNonExistingApiEnabled); + kNonExistingFeatureName, + kGoodToken); + EXPECT_FALSE(isNonExistingFeatureEnabled); } -// The API should be enabled if a valid key for the origin is provided -TEST_F(ExperimentsTest, EnabledSecureRegisteredOrigin) +// The feature should be enabled if a valid token for the origin is provided +TEST_F(OriginTrialContextTest, EnabledSecureRegisteredOrigin) { String errorMessage; - apiKeyValidator()->setResponse(true); - bool isOriginEnabled = isApiEnabled(kFrobulateEnabledOrigin, - kFrobulateAPIName, - kGoodAPIKey, + tokenValidator()->setResponse(true); + bool isOriginEnabled = isFeatureEnabled(kFrobulateEnabledOrigin, + kFrobulateFeatureName, + kGoodToken, &errorMessage); EXPECT_TRUE(isOriginEnabled); EXPECT_TRUE(errorMessage.isEmpty()) << "Message should be empty, was: " << errorMessage; - EXPECT_EQ(1, apiKeyValidator()->callCount()); + EXPECT_EQ(1, tokenValidator()->callCount()); } // ... but if the browser says it's invalid for any reason, that's enough to // reject. -TEST_F(ExperimentsTest, InvalidKeyResponseFromPlatform) +TEST_F(OriginTrialContextTest, InvalidTokenResponseFromPlatform) { String errorMessage; - apiKeyValidator()->setResponse(false); - bool isOriginEnabled = isApiEnabled(kFrobulateEnabledOrigin, - kFrobulateAPIName, - kGoodAPIKey, + tokenValidator()->setResponse(false); + bool isOriginEnabled = isFeatureEnabled(kFrobulateEnabledOrigin, + kFrobulateFeatureName, + kGoodToken, &errorMessage); EXPECT_FALSE(isOriginEnabled); - EXPECT_EQ(("The provided key(s) are not valid for the 'Frobulate' API."), errorMessage); - EXPECT_EQ(1, apiKeyValidator()->callCount()); + EXPECT_EQ(("The provided token(s) are not valid for the 'Frobulate' feature."), errorMessage); + EXPECT_EQ(1, tokenValidator()->callCount()); } -TEST_F(ExperimentsTest, EnabledSecureRegisteredOriginWithoutErrorMessage) +TEST_F(OriginTrialContextTest, EnabledSecureRegisteredOriginWithoutErrorMessage) { - apiKeyValidator()->setResponse(true); - bool isOriginEnabled = isApiEnabledWithoutErrorMessage( + tokenValidator()->setResponse(true); + bool isOriginEnabled = isFeatureEnabledWithoutErrorMessage( kFrobulateEnabledOrigin, - kFrobulateAPIName, - kGoodAPIKey); + kFrobulateFeatureName, + kGoodToken); EXPECT_TRUE(isOriginEnabled); - EXPECT_EQ(1, apiKeyValidator()->callCount()); + EXPECT_EQ(1, tokenValidator()->callCount()); } -// The API should not be enabled if the origin is unsecure, even if a valid -// key for the origin is provided -TEST_F(ExperimentsTest, EnabledNonSecureRegisteredOrigin) +// The feature should not be enabled if the origin is unsecure, even if a valid +// token for the origin is provided +TEST_F(OriginTrialContextTest, EnabledNonSecureRegisteredOrigin) { String errorMessage; - bool isOriginEnabled = isApiEnabled(kFrobulateEnabledOriginUnsecure, - kFrobulateAPIName, - kGoodAPIKey, + bool isOriginEnabled = isFeatureEnabled(kFrobulateEnabledOriginUnsecure, + kFrobulateFeatureName, + kGoodToken, &errorMessage); EXPECT_FALSE(isOriginEnabled); EXPECT_TRUE(errorMessage.contains("secure origin")) << "Message should indicate only secure origins are allowed, was: " << errorMessage; - EXPECT_EQ(0, apiKeyValidator()->callCount()); -} - -TEST_F(ExperimentsTest, DisabledException) -{ - DOMException* disabledException = Experiments::createApiDisabledException(kNonExistingAPIName); - ASSERT_TRUE(disabledException) << "An exception should have been created"; - EXPECT_EQ(DOMException::getErrorName(NotSupportedError), disabledException->name()); - EXPECT_TRUE(disabledException->message().contains(kNonExistingAPIName)) << "Message should contain the API name, was: " << disabledException->message(); + EXPECT_EQ(0, tokenValidator()->callCount()); } } // namespace blink diff --git a/third_party/WebKit/Source/core/experiments/testing/InternalsFrobulate.cpp b/third_party/WebKit/Source/core/origin_trials/testing/InternalsFrobulate.cpp index 5d1ea1e..f2b361f 100644 --- a/third_party/WebKit/Source/core/experiments/testing/InternalsFrobulate.cpp +++ b/third_party/WebKit/Source/core/origin_trials/testing/InternalsFrobulate.cpp @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/experiments/testing/InternalsFrobulate.h" +#include "core/origin_trials/testing/InternalsFrobulate.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" -#include "core/experiments/ExperimentalFeatures.h" +#include "core/origin_trials/OriginTrials.h" namespace blink { @@ -14,7 +14,7 @@ namespace blink { bool InternalsFrobulate::frobulate(ScriptState* scriptState, Internals& internals, ExceptionState& exceptionState) { String errorMessage; - if (!ExperimentalFeatures::experimentalFrameworkSampleAPIEnabled(scriptState->executionContext(), errorMessage)) { + if (!OriginTrials::experimentalFrameworkSampleAPIEnabled(scriptState->executionContext(), errorMessage)) { exceptionState.throwDOMException(NotSupportedError, errorMessage); return false; } diff --git a/third_party/WebKit/Source/core/experiments/testing/InternalsFrobulate.h b/third_party/WebKit/Source/core/origin_trials/testing/InternalsFrobulate.h index a4f7aa0..a4f7aa0 100644 --- a/third_party/WebKit/Source/core/experiments/testing/InternalsFrobulate.h +++ b/third_party/WebKit/Source/core/origin_trials/testing/InternalsFrobulate.h diff --git a/third_party/WebKit/Source/core/experiments/testing/InternalsFrobulate.idl b/third_party/WebKit/Source/core/origin_trials/testing/InternalsFrobulate.idl index 7c8c5cb..7c8c5cb 100644 --- a/third_party/WebKit/Source/core/experiments/testing/InternalsFrobulate.idl +++ b/third_party/WebKit/Source/core/origin_trials/testing/InternalsFrobulate.idl diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in index ba7bb89..71e22d5 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in @@ -20,11 +20,10 @@ // condition=ENABLE_NAME is used for wrapping features in compile-time // #if ENABLE(FEATURE) guards. These are deprecated and should all be removed. // -// api_name=API_NAME is used to integrate the feature with the experimental framework, so that the feature can be -// enabled at runtime on a per-page basis through a signed API key for the corresponding API name. -// Declaring the api_name will cause a static method to be generated in -// ExperimentalFeatures.h/cpp. This static method allows the feature -// implementation to check if it is enabled for the current context. +// origin_trial_feature_name=FEATURE_NAME is used to integrate the feature with the experimental framework, so that the +// feature can be enabled at runtime on a per-page basis through a signed token for the corresponding feature name. +// Declaring the origin_trial_feature_name will cause a static method to be generated in OriginTrials.h/cpp. This static +// method allows the feature implementation to check if it is enabled for the current context. AppBanner status=stable AlwaysUseComplexText status=stable @@ -82,7 +81,7 @@ ExperimentalFramework status=test // The sample API is used in both unit and layout tests for the Experimental // Framework. Do not change this flag to stable, as it exists solely to generate // code used by the sample API implementation. -ExperimentalFrameworkSampleAPI api_name=Frobulate +ExperimentalFrameworkSampleAPI origin_trial_feature_name=Frobulate ExperimentalV8Extras status=experimental FastMobileScrolling FileAPIBlobClose status=experimental diff --git a/third_party/WebKit/public/platform/Platform.h b/third_party/WebKit/public/platform/Platform.h index fe97b1d..784aa7e 100644 --- a/third_party/WebKit/public/platform/Platform.h +++ b/third_party/WebKit/public/platform/Platform.h @@ -59,7 +59,6 @@ class GrContext; namespace blink { -class WebApiKeyValidator; class WebAudioBus; class WebBlobRegistry; class WebCanvasCaptureHandler; @@ -114,6 +113,7 @@ class WebSyncProvider; struct WebFloatPoint; class WebThemeEngine; class WebThread; +class WebTrialTokenValidator; class WebURL; class WebURLLoader; class WebUnitTestSupport; @@ -635,7 +635,7 @@ public: // Experimental Framework ---------------------------------------------- - virtual WebApiKeyValidator* apiKeyValidator() { return nullptr; } + virtual WebTrialTokenValidator* trialTokenValidator() { return nullptr; } protected: BLINK_PLATFORM_EXPORT Platform(); diff --git a/third_party/WebKit/public/platform/WebApiKeyValidator.h b/third_party/WebKit/public/platform/WebApiKeyValidator.h deleted file mode 100644 index c283b70..0000000 --- a/third_party/WebKit/public/platform/WebApiKeyValidator.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WebApiKeyValidator_h -#define WebApiKeyValidator_h - -#include "public/platform/WebCallbacks.h" -#include "public/platform/WebString.h" - -namespace blink { - -// This interface abstracts the task of validating a key for an experimental -// API. Experimental APIs can be turned on and off at runtime for a specific -// renderer, depending on the presence of a valid key in the document's head. -// The details of determining whether a key is valid for a particular API is -// left up to the embedder. An implementation can effectively disable all API -// experiments by simply returning false in all cases. -// -// More documentation on the design of the experimental framework is at -// https://docs.google.com/document/d/1qVP2CK1lbfmtIJRIm6nwuEFFhGhYbtThLQPo3CSTtmg - -class WebApiKeyValidator { -public: - virtual ~WebApiKeyValidator() {} - - // Returns true if the given API key is valid for the specified origin and - // API name. - virtual bool validateApiKey(const WebString& apiKey, const WebString& origin, const WebString& apiName) = 0; -}; - -} // namespace blink - -#endif // WebApiKeyValidator_h diff --git a/third_party/WebKit/public/platform/WebTrialTokenValidator.h b/third_party/WebKit/public/platform/WebTrialTokenValidator.h new file mode 100644 index 0000000..c6108b7 --- /dev/null +++ b/third_party/WebKit/public/platform/WebTrialTokenValidator.h @@ -0,0 +1,32 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WebTrialTokenValidator_h +#define WebTrialTokenValidator_h + +#include "public/platform/WebCallbacks.h" +#include "public/platform/WebString.h" + +namespace blink { + +// This interface abstracts the task of validating a token for an experimental +// feature. Experimental features can be turned on and off at runtime for a +// specific renderer, depending on the presence of a valid token provided by +// the origin. +// +// More documentation on the design of the experimental framework is at +// https://docs.google.com/document/d/1qVP2CK1lbfmtIJRIm6nwuEFFhGhYbtThLQPo3CSTtmg + +class WebTrialTokenValidator { +public: + virtual ~WebTrialTokenValidator() {} + + // Returns true if the given token is valid for the specified origin and + // feature name. + virtual bool validateToken(const WebString& token, const WebString& origin, const WebString& featureName) = 0; +}; + +} // namespace blink + +#endif // WebTrialTokenValidator_h |