Index: third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp |
diff --git a/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp b/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp |
index bbfbbe36f2c0692d0d8d03247198e7fff8e36e28..836dcfd8bda86ad36c83d15020d5476f952acc9d 100644 |
--- a/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp |
+++ b/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp |
@@ -327,6 +327,14 @@ bool AutoplayExperimentHelper::isEligible() const |
&& !client().isLegacyViewportType()) |
return false; |
+ // If we require same-origin, then check the origin. If we additionally |
+ // allow "or muted", then also allow autoplay in that case. |
+ if (enabled(IfSameOrigin) && client().frame() |
+ && client().frame()->isCrossOrigin()) { |
+ if (!enabled(OrMuted) || !client().muted()) |
+ return false; |
+ } |
+ |
// If we require muted media and this is muted, then it is eligible. |
if (enabled(IfMuted)) |
return client().muted(); |
@@ -394,6 +402,10 @@ AutoplayExperimentHelper::Mode AutoplayExperimentHelper::fromString(const String |
value |= IfMuted; |
if (mode.contains("-ifmobile")) |
value |= IfMobile; |
+ if (mode.contains("-ifsameorigin")) |
+ value |= IfSameOrigin; |
+ if (mode.contains("-ormuted")) |
+ value |= OrMuted; |
if (mode.contains("-playmuted")) |
value |= PlayMuted; |