Commit bd25c169 authored by Bryan McQuade's avatar Bryan McQuade Committed by Commit Bot

Ensure runtime enabled features are enabled as part of activating navigation trials.

2 small fixes for OriginTrialContext:
* only exit early from InitializePendingFeatures if there are
  no enabled features, and no navigation features
* ensure OriginTrialContext::IsFeatureEnabled (which is invoked
  via RuntimeEnabledFeatures, for OT features) returns true if
  a feature was activated via navigation.

These were discovered while writing tests as part of
https://chromium-review.googlesource.com/c/chromium/src/+/1601980.


Change-Id: Ia8e711ab61dc4bf14a6e3c12a52faf5e1f096bec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1618175Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Commit-Queue: Bryan McQuade <bmcquade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662935}
parent 0de28c73
...@@ -240,7 +240,7 @@ void OriginTrialContext::ActivateNavigationFeaturesFromInitiator( ...@@ -240,7 +240,7 @@ void OriginTrialContext::ActivateNavigationFeaturesFromInitiator(
} }
void OriginTrialContext::InitializePendingFeatures() { void OriginTrialContext::InitializePendingFeatures() {
if (!enabled_features_.size()) if (!enabled_features_.size() && !navigation_activated_features_.size())
return; return;
auto* document = DynamicTo<Document>(GetSupplementable()); auto* document = DynamicTo<Document>(GetSupplementable());
if (!document) if (!document)
...@@ -279,8 +279,10 @@ bool OriginTrialContext::IsFeatureEnabled(OriginTrialFeature feature) const { ...@@ -279,8 +279,10 @@ bool OriginTrialContext::IsFeatureEnabled(OriginTrialFeature feature) const {
if (!RuntimeEnabledFeatures::OriginTrialsEnabled()) if (!RuntimeEnabledFeatures::OriginTrialsEnabled())
return false; return false;
if (enabled_features_.Contains(feature)) if (enabled_features_.Contains(feature) ||
navigation_activated_features_.Contains(feature)) {
return true; return true;
}
// HTML imports do not have a browsing context, see: // HTML imports do not have a browsing context, see:
// - Spec: https://w3c.github.io/webcomponents/spec/imports/#terminology // - Spec: https://w3c.github.io/webcomponents/spec/imports/#terminology
......
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