Skip to content

Commit

Permalink
Bug 1547057 - HTMLIFrameElement must always set the default origin fo…
Browse files Browse the repository at this point in the history
…r FeaturePolicy, r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D29002

--HG--
extra : moz-landing-system : lando
  • Loading branch information
bakulf committed Apr 29, 2019
1 parent 408ff64 commit 0e59341
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dom/html/HTMLIFrameElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ HTMLIFrameElement::HTMLIFrameElement(
: nsGenericHTMLFrameElement(std::move(aNodeInfo), aFromParser) {
// We always need a featurePolicy, even if not exposed.
mFeaturePolicy = new FeaturePolicy(this);

nsCOMPtr<nsIPrincipal> origin = GetFeaturePolicyDefaultOrigin();
MOZ_ASSERT(origin);
mFeaturePolicy->SetDefaultOrigin(origin);
}

HTMLIFrameElement::~HTMLIFrameElement() {}
Expand Down
11 changes: 11 additions & 0 deletions dom/html/crashtests/1547057.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<head>
<script>
function start() {
const iframe = document.createElement('iframe')
iframe.policy.allowedFeatures()
}
window.addEventListener('load', start)
</script>
</head>
</html>
1 change: 1 addition & 0 deletions dom/html/crashtests/crashtests.list
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ load 1386905.html
asserts(0-4) load 1401726.html
load 1412173.html
load 1440523.html
load 1547057.html

0 comments on commit 0e59341

Please sign in to comment.