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

Unified Diff: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h

Issue 2640823004: Allow origin trials to be enabled by script (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
diff --git a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
index cef1f0b3820ccc8cf036a089df88222034e40122..5c4ed4c6735a709a267d88f03d113d896d663b93 100644
--- a/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
+++ b/third_party/WebKit/Source/core/origin_trials/OriginTrialContext.h
@@ -71,21 +71,25 @@ class CORE_EXPORT OriginTrialContext final
// controls) should be considered enabled for the current execution context.
bool isTrialEnabled(const String& trialName);
- // Installs JavaScript bindings on the Window object for any features which
+ // Installs JavaScript bindings on the relevant objects for any features which
// should be enabled by the current set of trial tokens. This method is called
- // every time a token is added to the document, so that global interfaces will
- // be properly visible, even if the V8 context is being reused (i.e., after
- // navigation). If the V8 context is not initialized, this method will return
- // without doing anything.
+ // every time a token is added to the document (including when tokens are
+ // added via script). JavaScript-exposed members will be properly visible,
+ // for existing objects in the V8 context, or even if the V8 context is being
+ // reused (i.e., after navigation). If the V8 context is not initialized, or
+ // there are no enabled trials, this method returns without doing anything.
iclelland 2017/01/26 20:14:12 Can this method be called safely multiple times, i
chasej 2017/01/27 17:22:36 Done.
void initializePendingFeatures();
DECLARE_VIRTUAL_TRACE();
private:
- void validateToken(const String& token);
+ // Validate the trial token, and return true if valid. If valid, the trial
+ // named in the token is also added to the list of enabled trials.
+ bool validateToken(const String& token);
iclelland 2017/01/26 20:14:12 Maybe we should rename this to reflect its very re
chasej 2017/01/27 17:22:36 Good idea! Done.
Vector<String> m_tokens;
HashSet<String> m_enabledTrials;
+ HashSet<String> m_installedTrials;
WebTrialTokenValidator* m_trialTokenValidator;
};

Powered by Google App Engine
This is Rietveld 408576698