CVE-2024-23271
Overview
Background
- Permissions/Feature Policy
- A mechanism that gates powerful features (camera, microphone, fullscreen, geolocation, payment) per embedding context, controlled by the embedder’s allow attribute or default rules.
- Embedding elements
- iframe, embed, object and frame can all host nested browsing contexts; policy must apply to all of them, not just iframe.
- defaultPolicy
- The feature policy applied when no allow attribute is present; the fix uses it for non-iframe owners.
Root Cause Analysis
This fixes a Permissions/Feature Policy enforcement gap: policy was applied only to iframe owners, not to other embedding elements. isFeaturePolicyAllowedByDocumentAndAllOwners walks from a document up to the top document and, for each ancestor, consults the owner element’s feature policy. Pre-patch it only handled the case where the owner was an HTMLIFrameElement: it did dynamicDowncast<HTMLIFrameElement>(ownerElement) and, only if that succeeded, checked iframe->featurePolicy().allows(type, origin); for any other embedding element (for example embed, object, or frame) the owner branch was skipped, so the powerful-feature gate (camera, microphone, fullscreen, geolocation, payment, etc.) was simply not enforced for documents embedded that way. A page could therefore host cross-origin content in a non-iframe embedder and use gated capabilities that Permissions Policy should deny — unexpected cross-origin behavior.
The fix computes isAllowedByFeaturePolicy for BOTH cases: iframe owners use iframe->featurePolicy().allows(…), and any other owner element falls back to FeaturePolicy::defaultPolicy(ownerElement->document()).allows(…), i.e. the default (no allow attribute) rules are applied to embed/frame owners; if neither allows it, the check fails. FeaturePolicy::parse is also changed to take the iframe by pointer (nullable) so it can be called for non-iframe owners, and the failure log message changes from ‘for iframe’ to ‘for element’.
The restored invariant is that feature/permissions policy is enforced for every embedding element, not just iframes.
The added test exercises getUserMedia inside an embed element.
Attack Path
- Embed cross-origin content without an iframe Host cross-origin content via a non-iframe embedder (embed/object/frame) rather than an iframe.
- Skip the policy gate isFeaturePolicyAllowedByDocumentAndAllOwners only checked iframe owners, so the embedded document’s ancestor check is bypassed.
- Use a gated feature Invoke a permissions-policy-gated capability (camera, microphone, fullscreen, geolocation, payment) that should be denied cross-origin.
- Obtain cross-origin access The feature is granted despite policy, yielding unexpected cross-origin behavior / access to powerful features.
Impact Assessment
Changed Functions
| Function | Change | Notes |
|---|---|---|
whileSource/WebCore/html/FeaturePolicy.cpp |
modified | |
ifSource/WebCore/html/FeaturePolicy.cpp |
modified | |
FeaturePolicySource/WebCore/html/FeaturePolicy.h |
modified |
Files Changed
LayoutTests/fullscreen/full-screen-enabled-expected.txtLayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txtLayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txtLayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txtLayoutTests/fullscreen/full-screen-restrictions-expected.txtLayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txtLayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txtLayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txtLayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element-expected.txtLayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element.htmlLayoutTests/http/tests/media/media-stream/resources/get-user-media-embed.htmlLayoutTests/http/tests/paymentrequest/payment-allow-attribute.https-expected.txtLayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txtLayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txtLayoutTests/http/tests/ssl/media-stream/get-user-media-different-host-expected.txtLayoutTests/http/tests/ssl/media-stream/get-user-media-nested-expected.txtLayoutTests/http/tests/webrtc/enumerateDevicesInFrames-expected.txtLayoutTests/http/tests/webshare/webshare-allow-attribute-canShare.https-expected.txtLayoutTests/http/tests/webshare/webshare-allow-attribute-share.https-expected.txtLayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allow-expected.txtLayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen-expected.txtLayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-feature-policy-none.https-expected.txtLayoutTests/imported/w3c/web-platform-tests/permissions-policy/payment-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub-expected.txtLayoutTests/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-enabled-by-feature-policy-attribute-redirect-on-load.https.sub-expected.txtLayoutTests/imported/w3c/web-platform-tests/web-share/disabled-by-permissions-policy-cross-origin.https.sub-expected.txtLayoutTests/platform/glib/imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-feature-policy-none.https-expected.txtLayoutTests/platform/glib/imported/w3c/web-platform-tests/screen-wake-lock/wakelock-enabled-by-feature-policy-attribute-redirect-on-load.https.sub-expected.txtSource/WebCore/html/FeaturePolicy.cppSource/WebCore/html/FeaturePolicy.h
Audit Directions
- Same function: owner-type handlingAudit isFeaturePolicyAllowedByDocumentAndAllOwners and related ownerElement checks for other dynamicDowncast<HTMLIFrameElement> gates that ignore embed/object/frame owners.
- Policy checks keyed on iframeGrep WebCore for featurePolicy()/allow-attribute logic that assumes an HTMLIFrameElement owner and misses other embedding elements.
Patch
diff --git a/Source/WebCore/html/FeaturePolicy.cpp b/Source/WebCore/html/FeaturePolicy.cpp
index b778bb1ca2dd..b4a985d7ec3c 100644
--- a/Source/WebCore/html/FeaturePolicy.cpp
+++ b/Source/WebCore/html/FeaturePolicy.cpp
@@ -89,25 +89,32 @@ static const char* policyTypeName(FeaturePolicy::Type type)
bool isFeaturePolicyAllowedByDocumentAndAllOwners(FeaturePolicy::Type type, const Document& document, LogFeaturePolicyFailure logFailure)
{
- auto& topDocument = document.topDocument();
- auto* ancestorDocument = &document;
- while (ancestorDocument != &topDocument) {
+ Ref topDocument = document.topDocument();
+ RefPtr ancestorDocument = &document;
+ while (ancestorDocument.get() != topDocument.ptr()) {
if (!ancestorDocument) {
if (logFailure == LogFeaturePolicyFailure::Yes && document.domWindow())
document.domWindow()->printErrorMessage(makeString("Feature policy '", policyTypeName(type), "' check failed."));
return false;
}
- auto* ownerElement = ancestorDocument->ownerElement();
- if (auto* iframe = dynamicDowncast<HTMLIFrameElement>(ownerElement)) {
- const auto& featurePolicy = iframe->featurePolicy();
- if (!featurePolicy.allows(type, ancestorDocument->securityOrigin().data())) {
- if (logFailure == LogFeaturePolicyFailure::Yes && document.domWindow()) {
- auto& allowValue = iframe->attributeWithoutSynchronization(HTMLNames::allowAttr);
- document.domWindow()->printErrorMessage(makeString("Feature policy '", policyTypeName(type), "' check failed for iframe with origin '", document.securityOrigin().toString(), "' and allow attribute '", allowValue, "'."));
- }
- return false;
+ RefPtr ownerElement = ancestorDocument->ownerElement();
+ RefPtr iframe = dynamicDowncast<HTMLIFrameElement>(ownerElement.get());
+
+ bool isAllowedByFeaturePolicy = false;
+ if (iframe)
+ isAllowedByFeaturePolicy = iframe->featurePolicy().allows(type, ancestorDocument->securityOrigin().data());
+ else if (ownerElement)
+ isAllowedByFeaturePolicy = FeaturePolicy::defaultPolicy(ownerElement->document()).allows(type, ancestorDocument->securityOrigin().data());
+
+ if (!isAllowedByFeaturePolicy) {
+ if (logFailure == LogFeaturePolicyFailure::Yes && document.domWindow()) {
+ String allowValue;
+ if (iframe)
+ allowValue = iframe->attributeWithoutSynchronization(HTMLNames::allowAttr);
+ document.domWindow()->printErrorMessage(makeString("Feature policy '", policyTypeName(type), "' check failed for element with origin '", document.securityOrigin().toString(), "' and allow attribute '", allowValue, "'."));
}
+ return false;
}
ancestorDocument = ancestorDocument->parentDocument();
@@ -196,7 +203,7 @@ static inline void updateList(Document& document, const HTMLIFrameElement& ifram
}
}
-FeaturePolicy FeaturePolicy::parse(Document& document, const HTMLIFrameElement& iframe, StringView allowAttributeValue)
+FeaturePolicy FeaturePolicy::parse(Document& document, const HTMLIFrameElement* iframe, StringView allowAttributeValue)
{
FeaturePolicy policy;
bool isCameraInitialized = false;
@@ -222,99 +229,101 @@ FeaturePolicy FeaturePolicy::parse(Document& document, const HTMLIFrameElement&
bool isXRSpatialTrackingInitialized = false;
#endif
bool isPrivateTokenInitialized = false;
- for (auto allowItem : allowAttributeValue.split(';')) {
- auto item = allowItem.trim(isASCIIWhitespace<UChar>);
- if (item.startsWith("camera"_s)) {
- isCameraInitialized = true;
- updateList(document, iframe, policy.m_cameraRule, item.substring(7));
- continue;
- }
- if (item.startsWith("microphone"_s)) {
- isMicrophoneInitialized = true;
- updateList(document, iframe, policy.m_microphoneRule, item.substring(11));
- continue;
- }
- if (item.startsWith("speaker-selection"_s)) {
- isSpeakerSelectionInitialized = true;
- updateList(document, iframe, policy.m_speakerSelectionRule, item.substring(18));
- continue;
- }
- if (item.startsWith("display-capture"_s)) {
- isDisplayCaptureInitialized = true;
- updateList(document, iframe, policy.m_displayCaptureRule, item.substring(16));
- continue;
- }
- if (item.startsWith("gamepad"_s)) {
- isGamepadInitialized = true;
- updateList(document, iframe, policy.m_gamepadRule, item.substring(8));
- continue;
- }
- if (item.startsWith("geolocation"_s)) {
- isGeolocationInitialized = true;
- updateList(document, iframe, policy.m_geolocationRule, item.substring(12));
- continue;
- }
- if (item.startsWith("payment"_s)) {
- isPaymentInitialized = true;
- updateList(document, iframe, policy.m_paymentRule, item.substring(8));
- continue;
- }
- if (item.startsWith("screen-wake-lock"_s)) {
- isScreenWakeLockInitialized = true;
- updateList(document, iframe, policy.m_screenWakeLockRule, item.substring(17));
- continue;
- }
- if (item.startsWith("sync-xhr"_s)) {
- isSyncXHRInitialized = true;
- updateList(document, iframe, policy.m_syncXHRRule, item.substring(9));
- continue;
- }
- if (item.startsWith("fullscreen"_s)) {
- isFullscreenInitialized = true;
- updateList(document, iframe, policy.m_fullscreenRule, item.substring(11));
- continue;
- }
- if (item.startsWith("web-share"_s)) {
- isWebShareInitialized = true;
- updateList(document, iframe, policy.m_webShareRule, item.substring(10));
- continue;
- }
+ if (iframe) {
+ for (auto allowItem : allowAttributeValue.split(';')) {
+ auto item = allowItem.trim(isASCIIWhitespace<UChar>);
+ if (item.startsWith("camera"_s)) {
+ isCameraInitialized = true;
+ updateList(document, *iframe, policy.m_cameraRule, item.substring(7));
+ continue;
+ }
+ if (item.startsWith("microphone"_s)) {
+ isMicrophoneInitialized = true;
+ updateList(document, *iframe, policy.m_microphoneRule, item.substring(11));
+ continue;
+ }
+ if (item.startsWith("speaker-selection"_s)) {
+ isSpeakerSelectionInitialized = true;
+ updateList(document, *iframe, policy.m_speakerSelectionRule, item.substring(18));
+ continue;
+ }
+ if (item.startsWith("display-capture"_s)) {
+ isDisplayCaptureInitialized = true;
+ updateList(document, *iframe, policy.m_displayCaptureRule, item.substring(16));
+ continue;
+ }
+ if (item.startsWith("gamepad"_s)) {
+ isGamepadInitialized = true;
+ updateList(document, *iframe, policy.m_gamepadRule, item.substring(8));
+ continue;
+ }
+ if (item.startsWith("geolocation"_s)) {
+ isGeolocationInitialized = true;
+ updateList(document, *iframe, policy.m_geolocationRule, item.substring(12));
+ continue;
+ }
+ if (item.startsWith("payment"_s)) {
+ isPaymentInitialized = true;
+ updateList(document, *iframe, policy.m_paymentRule, item.substring(8));
+ continue;
+ }
+ if (item.startsWith("screen-wake-lock"_s)) {
+ isScreenWakeLockInitialized = true;
+ updateList(document, *iframe, policy.m_screenWakeLockRule, item.substring(17));
+ continue;
+ }
+ if (item.startsWith("sync-xhr"_s)) {
+ isSyncXHRInitialized = true;
+ updateList(document, *iframe, policy.m_syncXHRRule, item.substring(9));
+ continue;
+ }
+ if (item.startsWith("fullscreen"_s)) {
+ isFullscreenInitialized = true;
+ updateList(document, *iframe, policy.m_fullscreenRule, item.substring(11));
+ continue;
+ }
+ if (item.startsWith("web-share"_s)) {
+ isWebShareInitialized = true;
+ updateList(document, *iframe, policy.m_webShareRule, item.substring(10));
+ continue;
+ }
#if ENABLE(DEVICE_ORIENTATION)
- if (item.startsWith("gyroscope"_s)) {
- isGyroscopeInitialized = true;
- updateList(document, iframe, policy.m_gyroscopeRule, item.substring(10));
- continue;
- }
- if (item.startsWith("accelerometer"_s)) {
- isAccelerometerInitialized = true;
- updateList(document, iframe, policy.m_accelerometerRule, item.substring(14));
- continue;
- }
- if (item.startsWith("magnetometer"_s)) {
- isMagnetometerInitialized = true;
- updateList(document, iframe, policy.m_magnetometerRule, item.substring(13));
- continue;
- }
+ if (item.startsWith("gyroscope"_s)) {
+ isGyroscopeInitialized = true;
+ updateList(document, *iframe, policy.m_gyroscopeRule, item.substring(10));
+ continue;
+ }
+ if (item.startsWith("accelerometer"_s)) {
+ isAccelerometerInitialized = true;
+ updateList(document, *iframe, policy.m_accelerometerRule, item.substring(14));
+ continue;
+ }
+ if (item.startsWith("magnetometer"_s)) {
+ isMagnetometerInitialized = true;
+ updateList(document, *iframe, policy.m_magnetometerRule, item.substring(13));
+ continue;
+ }
#endif
#if ENABLE(WEB_AUTHN)
- if (item.startsWith("publickey-credentials-get"_s)) {
- isPublickeyCredentialsGetInitialized = true;
- updateList(document, iframe, policy.m_publickeyCredentialsGetRule, item.substring(26));
- continue;
- }
+ if (item.startsWith("publickey-credentials-get"_s)) {
+ isPublickeyCredentialsGetInitialized = true;
+ updateList(document, *iframe, policy.m_publickeyCredentialsGetRule, item.substring(26));
+ continue;
+ }
#endif
#if ENABLE(WEBXR)
- if (item.startsWith("xr-spatial-tracking"_s)) {
- isXRSpatialTrackingInitialized = true;
- updateList(document, iframe, policy.m_xrSpatialTrackingRule, item.substring(19));
- continue;
- }
+ if (item.startsWith("xr-spatial-tracking"_s)) {
+ isXRSpatialTrackingInitialized = true;
+ updateList(document, *iframe, policy.m_xrSpatialTrackingRule, item.substring(19));
+ continue;
+ }
#endif
- constexpr auto privateTokenToken { "private-token"_s };
- if (item.startsWith(privateTokenToken)) {
- isPrivateTokenInitialized = true;
- updateList(document, iframe, policy.m_privateTokenRule, item.substring(privateTokenToken.length()));
- continue;
+ constexpr auto privateTokenToken { "private-token"_s };
+ if (item.startsWith(privateTokenToken)) {
+ isPrivateTokenInitialized = true;
+ updateList(document, *iframe, policy.m_privateTokenRule, item.substring(privateTokenToken.length()));
+ continue;
+ }
}
}
@@ -361,7 +370,7 @@ FeaturePolicy FeaturePolicy::parse(Document& document, const HTMLIFrameElement&
// 3.1 If element’s allowfullscreen attribute is specified, and container policy does
// not contain an allowlist for fullscreen,
if (!isFullscreenInitialized) {
- if (iframe.hasAttribute(allowfullscreenAttr) || iframe.hasAttribute(webkitallowfullscreenAttr)) {
+ if (iframe && (iframe->hasAttribute(allowfullscreenAttr) || iframe->hasAttribute(webkitallowfullscreenAttr))) {
// 3.1.1 Construct a new declaration for fullscreen, whose allowlist is the special value *.
policy.m_fullscreenRule.type = FeaturePolicy::AllowRule::Type::All;
} else {
diff --git a/Source/WebCore/html/FeaturePolicy.h b/Source/WebCore/html/FeaturePolicy.h
index 81c04b997069..e0cd08d29578 100644
--- a/Source/WebCore/html/FeaturePolicy.h
+++ b/Source/WebCore/html/FeaturePolicy.h
@@ -36,7 +36,8 @@ class HTMLIFrameElement;
class FeaturePolicy {
public:
- static FeaturePolicy parse(Document&, const HTMLIFrameElement&, StringView);
+ static FeaturePolicy defaultPolicy(Document& document) { return parse(document, nullptr, { }); }
+ static FeaturePolicy parse(Document& document, const HTMLIFrameElement& frame, StringView allow) { return parse(document, &frame, allow); }
enum class Type {
Camera,
@@ -72,6 +73,8 @@ public:
};
private:
+ static FeaturePolicy parse(Document&, const HTMLIFrameElement*, StringView);
+
AllowRule m_cameraRule;
AllowRule m_microphoneRule;
AllowRule m_speakerSelectionRule;
diff --git a/LayoutTests/fullscreen/full-screen-enabled-expected.txt b/LayoutTests/fullscreen/full-screen-enabled-expected.txt
index f5c5c513be41..d11846de8955 100644
--- a/LayoutTests/fullscreen/full-screen-enabled-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-enabled-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
This tests the fullscreenEnabled property laid out in section 4 of the W3C Full Screen API
EXPECTED (iframe.contentDocument.webkitFullscreenEnabled == 'true') OK
EXPECTED (iframe2.contentDocument.webkitFullscreenEnabled == 'false') OK
diff --git a/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt b/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt
index f5c5c513be41..d11846de8955 100644
--- a/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
This tests the fullscreenEnabled property laid out in section 4 of the W3C Full Screen API
EXPECTED (iframe.contentDocument.webkitFullscreenEnabled == 'true') OK
EXPECTED (iframe2.contentDocument.webkitFullscreenEnabled == 'false') OK
diff --git a/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt b/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt
index c7137c15184c..f56670d5caf5 100644
--- a/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
Test for bug 56264: Handle entering full screen security restrictions
To test manually, click the "Go full screen" button - the page should not enter full screen mode.
diff --git a/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt b/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt
index 9e2a4371735f..8f9baf48350d 100644
--- a/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'null' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'null' and allow attribute ''.
Test entering full screen security restrictions. An iframe without an allow attribute is still permitted to fullscreen if the request comes from the containing document.
To test manually, press any key - the page should enter full screen mode.
diff --git a/LayoutTests/fullscreen/full-screen-restrictions-expected.txt b/LayoutTests/fullscreen/full-screen-restrictions-expected.txt
index ef97931fc518..a60bd8a7536e 100644
--- a/LayoutTests/fullscreen/full-screen-restrictions-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-restrictions-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
This tests the restrictions to entering full screen mode laid out in section 4.1 of the W3C Full Screen API
"The context object is not in a document."
EVENT(webkitfullscreenerror)
diff --git a/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt b/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt
index a051075c8158..b0625abd2f2d 100644
--- a/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt
+++ b/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt
@@ -1,14 +1,14 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen http://localhost:8000'.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen http://localhost:8000'.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
PASS iframe with src="http://loc..." should have document.webkitFullscreenEnabled === false.
PASS iframe with src="../resourc..." should have document.webkitFullscreenEnabled === true.
PASS iframe with allow="fullscreen", src="http://loc..." should have document.webkitFullscreenEnabled === true.
diff --git a/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt b/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt
index 0a0f351b44f7..77d21402b2fc 100644
--- a/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt
+++ b/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt
@@ -1,7 +1,7 @@
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'gamepad 'none''.
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad 'none''.
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'gamepad 'self''.
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad https://localhost:8443'.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://localhost:8443' and allow attribute 'gamepad 'none''.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad 'none''.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://localhost:8443' and allow attribute 'gamepad 'self''.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad https://localhost:8443'.
PASS iframe src: "https://localhost:8443/gamepad/resources/gamepad-postmessage.html" with allow="" is allowed to call getGamepads().
PASS iframe src: "https://127.0.0.1:8443/gamepad/resources/gamepad-postmessage.html" with allow="" is allowed to call getGamepads().
PASS iframe src: "https://localhost:8443/gamepad/resources/gamepad-postmessage.html" with allow="gamepad" is allowed to call getGamepads().
diff --git a/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt b/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt
index 959cafcc3c82..c7705e321bbb 100644
--- a/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt
+++ b/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt
@@ -1,21 +1,21 @@
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call enumerateDevices.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call enumerateDevices.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
... (file diff truncated)
Regression Test / PoC
diff --git a/LayoutTests/fullscreen/full-screen-enabled-expected.txt b/LayoutTests/fullscreen/full-screen-enabled-expected.txt
index f5c5c513be41..d11846de8955 100644
--- a/LayoutTests/fullscreen/full-screen-enabled-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-enabled-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
This tests the fullscreenEnabled property laid out in section 4 of the W3C Full Screen API
EXPECTED (iframe.contentDocument.webkitFullscreenEnabled == 'true') OK
EXPECTED (iframe2.contentDocument.webkitFullscreenEnabled == 'false') OK
diff --git a/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt b/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt
index f5c5c513be41..d11846de8955 100644
--- a/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-enabled-prefixed-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
This tests the fullscreenEnabled property laid out in section 4 of the W3C Full Screen API
EXPECTED (iframe.contentDocument.webkitFullscreenEnabled == 'true') OK
EXPECTED (iframe2.contentDocument.webkitFullscreenEnabled == 'false') OK
diff --git a/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt b/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt
index c7137c15184c..f56670d5caf5 100644
--- a/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-iframe-not-allowed-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
Test for bug 56264: Handle entering full screen security restrictions
To test manually, click the "Go full screen" button - the page should not enter full screen mode.
diff --git a/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt b/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt
index 9e2a4371735f..8f9baf48350d 100644
--- a/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-iframe-without-allow-attribute-allowed-from-parent-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'null' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'null' and allow attribute ''.
Test entering full screen security restrictions. An iframe without an allow attribute is still permitted to fullscreen if the request comes from the containing document.
To test manually, press any key - the page should enter full screen mode.
diff --git a/LayoutTests/fullscreen/full-screen-restrictions-expected.txt b/LayoutTests/fullscreen/full-screen-restrictions-expected.txt
index ef97931fc518..a60bd8a7536e 100644
--- a/LayoutTests/fullscreen/full-screen-restrictions-expected.txt
+++ b/LayoutTests/fullscreen/full-screen-restrictions-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin '' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin '' and allow attribute 'fullscreen 'none''.
This tests the restrictions to entering full screen mode laid out in section 4.1 of the W3C Full Screen API
"The context object is not in a document."
EVENT(webkitfullscreenerror)
diff --git a/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt b/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt
index a051075c8158..b0625abd2f2d 100644
--- a/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt
+++ b/LayoutTests/http/tests/fullscreen/fullscreen-feature-policy-expected.txt
@@ -1,14 +1,14 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen http://localhost:8000'.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen http://localhost:8000'.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'fullscreen 'none''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'http://localhost:8000' and allow attribute 'fullscreen 'self''.
PASS iframe with src="http://loc..." should have document.webkitFullscreenEnabled === false.
PASS iframe with src="../resourc..." should have document.webkitFullscreenEnabled === true.
PASS iframe with allow="fullscreen", src="http://loc..." should have document.webkitFullscreenEnabled === true.
diff --git a/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt b/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt
index 0a0f351b44f7..77d21402b2fc 100644
--- a/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt
+++ b/LayoutTests/http/tests/gamepad/gamepad-allow-attribute.https-expected.txt
@@ -1,7 +1,7 @@
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'gamepad 'none''.
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad 'none''.
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'gamepad 'self''.
-CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad https://localhost:8443'.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://localhost:8443' and allow attribute 'gamepad 'none''.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad 'none''.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://localhost:8443' and allow attribute 'gamepad 'self''.
+CONSOLE MESSAGE: Feature policy 'Gamepad' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'gamepad https://localhost:8443'.
PASS iframe src: "https://localhost:8443/gamepad/resources/gamepad-postmessage.html" with allow="" is allowed to call getGamepads().
PASS iframe src: "https://127.0.0.1:8443/gamepad/resources/gamepad-postmessage.html" with allow="" is allowed to call getGamepads().
PASS iframe src: "https://localhost:8443/gamepad/resources/gamepad-postmessage.html" with allow="gamepad" is allowed to call getGamepads().
diff --git a/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt b/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt
index 959cafcc3c82..c7705e321bbb 100644
--- a/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt
+++ b/LayoutTests/http/tests/media/media-stream/enumerate-devices-iframe-allow-attribute-expected.txt
@@ -1,21 +1,21 @@
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call enumerateDevices.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call enumerateDevices.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call enumerateDevices.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'microphone'.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute 'microphone'.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'camera'.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://localhost:8000' and allow attribute 'camera'.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://localhost:8000' and allow attribute 'microphone;speaker-selection'.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute 'microphone;speaker-selection'.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
diff --git a/LayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element-expected.txt b/LayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element-expected.txt
new file mode 100644
index 000000000000..2cfc4821ab98
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element-expected.txt
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://localhost:8000' and allow attribute ''.
+CONSOLE MESSAGE: Not allowed to call getUserMedia.
+
+
+PASS Same origin embed should get access to camera
+PASS Cross origin embed should not get access to camera
+
diff --git a/LayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element.html b/LayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element.html
new file mode 100644
index 000000000000..82212184f76e
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-stream/get-user-media-in-embed-element.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+ <div id="testDiv"></div>
+
+ <script>
+promise_test(async t => {
+ testDiv.innerHTML = '<embed id="embedElement" src="resources/get-user-media-embed.html"></embed>';
+ const result = await new Promise(resolve => window.onmessage = e => resolve(e.data));
+ assert_equals(result, "OK");
+}, "Same origin embed should get access to camera");
+
+promise_test(async t => {
+ testDiv.innerHTML = '<embed id="embedElement" src="http://localhost:8000/media/media-stream/resources/get-user-media-embed.html"></embed>';
+ const result = await new Promise(resolve => window.onmessage = e => resolve(e.data));
+ assert_equals(result, "KO");
+}, "Cross origin embed should not get access to camera");
+ </script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/media/media-stream/resources/get-user-media-embed.html b/LayoutTests/http/tests/media/media-stream/resources/get-user-media-embed.html
new file mode 100644
index 000000000000..343fea34fe46
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-stream/resources/get-user-media-embed.html
@@ -0,0 +1,9 @@
+<script>
+onload = () => {
+ navigator.mediaDevices.getUserMedia({ video: true }).then(() => {
+ parent.postMessage("OK", "*");
+ }, () => {
+ parent.postMessage("KO", "*");
+ });
+}
+</script>
diff --git a/LayoutTests/http/tests/paymentrequest/payment-allow-attribute.https-expected.txt b/LayoutTests/http/tests/paymentrequest/payment-allow-attribute.https-expected.txt
index 6e201738d888..e0969831057a 100644
--- a/LayoutTests/http/tests/paymentrequest/payment-allow-attribute.https-expected.txt
+++ b/LayoutTests/http/tests/paymentrequest/payment-allow-attribute.https-expected.txt
@@ -1,8 +1,8 @@
-CONSOLE MESSAGE: Feature policy 'Payment' check failed for iframe with origin 'https://localhost:8443' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'Payment' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'payment 'none''.
-CONSOLE MESSAGE: Feature policy 'Payment' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'payment 'none''.
-CONSOLE MESSAGE: Feature policy 'Payment' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'payment 'self''.
-CONSOLE MESSAGE: Feature policy 'Payment' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'payment https://localhost:8443'.
+CONSOLE MESSAGE: Feature policy 'Payment' check failed for element with origin 'https://localhost:8443' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Payment' check failed for element with origin 'https://localhost:8443' and allow attribute 'payment 'none''.
+CONSOLE MESSAGE: Feature policy 'Payment' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'payment 'none''.
+CONSOLE MESSAGE: Feature policy 'Payment' check failed for element with origin 'https://localhost:8443' and allow attribute 'payment 'self''.
+CONSOLE MESSAGE: Feature policy 'Payment' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'payment https://localhost:8443'.
PASS iframe src: "https://localhost:8443/paymentrequest/resources/payment-postmessage.html" with allow="" MUST NOT create a PaymentRequest. SecurityError Third-party iframes are not allowed to request payments unless explicitly allowed via Feature-Policy (payment)
PASS iframe src: "https://127.0.0.1:8443/paymentrequest/resources/payment-postmessage.html" with allow="" is allowed to create a PaymentRequest.
PASS iframe src: "https://localhost:8443/paymentrequest/resources/payment-postmessage.html" with allow="payment" is allowed to create a PaymentRequest.
diff --git a/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt b/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt
index c44e098b6e38..8e287455f4e5 100644
--- a/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt
+++ b/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Geolocation' check failed for iframe with origin 'null' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Geolocation' check failed for element with origin 'null' and allow attribute ''.
Tests that navigator.geolocation.getCurrentPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.
diff --git a/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt b/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt
index 5983d6d5e82d..6681fe160293 100644
--- a/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt
+++ b/LayoutTests/http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Geolocation' check failed for iframe with origin 'null' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Geolocation' check failed for element with origin 'null' and allow attribute ''.
Tests that navigator.geolocation.watchPosition() returns error PERMISSION_DENIED when called from a document in a sandboxed iframe.
diff --git a/LayoutTests/http/tests/ssl/media-stream/get-user-media-different-host-expected.txt b/LayoutTests/http/tests/ssl/media-stream/get-user-media-different-host-expected.txt
index 68917f7a0334..a734a5524fc7 100644
--- a/LayoutTests/http/tests/ssl/media-stream/get-user-media-different-host-expected.txt
+++ b/LayoutTests/http/tests/ssl/media-stream/get-user-media-different-host-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'https://localhost:8443' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'https://localhost:8443' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
Tests that getUserMedia fails when the top level document and iframe do not have the same domain.
diff --git a/LayoutTests/http/tests/ssl/media-stream/get-user-media-nested-expected.txt b/LayoutTests/http/tests/ssl/media-stream/get-user-media-nested-expected.txt
index 9682a789de5a..49fe9e80d423 100644
--- a/LayoutTests/http/tests/ssl/media-stream/get-user-media-nested-expected.txt
+++ b/LayoutTests/http/tests/ssl/media-stream/get-user-media-nested-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'https://localhost:8443' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'https://localhost:8443' and allow attribute ''.
CONSOLE MESSAGE: Not allowed to call getUserMedia.
Tests that getUserMedia fails when the top level document and iframe do not have the same domain.
diff --git a/LayoutTests/http/tests/webrtc/enumerateDevicesInFrames-expected.txt b/LayoutTests/http/tests/webrtc/enumerateDevicesInFrames-expected.txt
index 7960fd0fd199..00a93737e2fb 100644
--- a/LayoutTests/http/tests/webrtc/enumerateDevicesInFrames-expected.txt
+++ b/LayoutTests/http/tests/webrtc/enumerateDevicesInFrames-expected.txt
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: Feature policy 'Camera' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'microphone:'none'; camera:'none''.
-CONSOLE MESSAGE: Feature policy 'Microphone' check failed for iframe with origin 'http://127.0.0.1:8000' and allow attribute 'microphone:'none'; camera:'none''.
+CONSOLE MESSAGE: Feature policy 'Camera' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'microphone:'none'; camera:'none''.
+CONSOLE MESSAGE: Feature policy 'Microphone' check failed for element with origin 'http://127.0.0.1:8000' and allow attribute 'microphone:'none'; camera:'none''.
CONSOLE MESSAGE: Not allowed to call enumerateDevices.
diff --git a/LayoutTests/http/tests/webshare/webshare-allow-attribute-canShare.https-expected.txt b/LayoutTests/http/tests/webshare/webshare-allow-attribute-canShare.https-expected.txt
index 41df73a40b69..f2abeedf18f0 100644
--- a/LayoutTests/http/tests/webshare/webshare-allow-attribute-canShare.https-expected.txt
+++ b/LayoutTests/http/tests/webshare/webshare-allow-attribute-canShare.https-expected.txt
@@ -1,8 +1,8 @@
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://localhost:8443' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'web-share 'none''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'web-share 'none''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'web-share 'self''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'web-share https://localhost:8443'.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://localhost:8443' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://localhost:8443' and allow attribute 'web-share 'none''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'web-share 'none''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://localhost:8443' and allow attribute 'web-share 'self''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'web-share https://localhost:8443'.
PASS iframe src: "https://localhost:8443/webshare/resources/webshare-postmessage.html" with allow="" MUST NOT be allowed to call canShare().
PASS iframe src: "https://127.0.0.1:8443/webshare/resources/webshare-postmessage.html" with allow="" is allowed to call canShare().
PASS iframe src: "https://localhost:8443/webshare/resources/webshare-postmessage.html" with allow="web-share" is allowed to call canShare().
diff --git a/LayoutTests/http/tests/webshare/webshare-allow-attribute-share.https-expected.txt b/LayoutTests/http/tests/webshare/webshare-allow-attribute-share.https-expected.txt
index 00015ad00f5d..fe81a588319e 100644
--- a/LayoutTests/http/tests/webshare/webshare-allow-attribute-share.https-expected.txt
+++ b/LayoutTests/http/tests/webshare/webshare-allow-attribute-share.https-expected.txt
@@ -1,8 +1,8 @@
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://localhost:8443' and allow attribute ''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'web-share 'none''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'web-share 'none''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://localhost:8443' and allow attribute 'web-share 'self''.
-CONSOLE MESSAGE: Feature policy 'WebShare' check failed for iframe with origin 'https://127.0.0.1:8443' and allow attribute 'web-share https://localhost:8443'.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://localhost:8443' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://localhost:8443' and allow attribute 'web-share 'none''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'web-share 'none''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://localhost:8443' and allow attribute 'web-share 'self''.
+CONSOLE MESSAGE: Feature policy 'WebShare' check failed for element with origin 'https://127.0.0.1:8443' and allow attribute 'web-share https://localhost:8443'.
PASS iframe src: "https://localhost:8443/webshare/resources/webshare-postmessage.html" with allow="" MUST NOT be allowed to call share(). NotAllowedError Third-party iframes are not allowed to call share() unless explicitly allowed via Feature-Policy (web-share)
PASS iframe src: "https://127.0.0.1:8443/webshare/resources/webshare-postmessage.html" with allow="" is allowed to call share().
PASS iframe src: "https://localhost:8443/webshare/resources/webshare-postmessage.html" with allow="web-share" is allowed to call share().
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allow-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allow-expected.txt
index e94a846045d4..9a47362595cf 100644
--- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allow-expected.txt
+++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allow-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'null' and allow attribute ''.
+CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for element with origin 'null' and allow attribute ''.
FAIL iframe-cross-origin-allow assert_false: Feature should be denied when correct allow attribute is added, before reload expected false got true
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen-expected.txt
index 212875694128..007acd787520 100644
--- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen-expected.txt
+++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-allowfullscreen-expected.txt
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'null' and allow attribute ''.
... (truncated)