Commit 6de2afd7 authored by Ian Clelland's avatar Ian Clelland Committed by Commit Bot

Add ASSERT_ORIGIN_TRIAL.

This adds a compile-time assertion macro to test whether a given feature
is part of an origin trial, and uses it to assert that WebVR and WebXR
are under origin trial when constructing the feature policy default
feature list.

Change-Id: I71a24d73ef0837165aefcdc0a12ed6212cee5553
Reviewed-on: https://chromium-review.googlesource.com/c/1136989
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611452}
parent a94d04ab
......@@ -11,6 +11,11 @@
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#define ASSERT_ORIGIN_TRIAL(feature) \
static_assert(std::is_same<decltype(::blink::origin_trials::feature##Enabled(\
nullptr)), bool>(), \
#feature " must be part of an origin trial");
namespace blink {
class ExecutionContext;
......
......@@ -7,6 +7,7 @@
#include "base/metrics/histogram_macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trials.h"
#include "third_party/blink/renderer/platform/json/json_values.h"
#include "third_party/blink/renderer/platform/network/http_parsers.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
......@@ -272,6 +273,8 @@ const FeatureNameMap& GetDefaultFeatureNameMap() {
mojom::FeaturePolicyFeature::kSyncXHR);
// Under origin trial: Should be made conditional on WebVR and WebXR
// runtime flags once it is out of trial.
ASSERT_ORIGIN_TRIAL(WebVR);
ASSERT_ORIGIN_TRIAL(WebXR);
default_feature_name_map.Set("vr", mojom::FeaturePolicyFeature::kWebVr);
if (RuntimeEnabledFeatures::ExperimentalProductivityFeaturesEnabled()) {
default_feature_name_map.Set(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment