Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Backed out 3 changesets (bug 1514474, bug 1514296) for mochitest fail…
Browse files Browse the repository at this point in the history
…ures on test_featureList.html. CLOSED TREE

Backed out changeset 52ae606e4cfa (bug 1514296)
Backed out changeset e74168e44dd7 (bug 1514474)
Backed out changeset a43f3aa0ea77 (bug 1514296)
  • Loading branch information
CosminSabou committed Jul 3, 2019
1 parent 222e3af commit 5f69292
Show file tree
Hide file tree
Showing 31 changed files with 1,332 additions and 184 deletions.
10 changes: 5 additions & 5 deletions dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ nsresult Document::Init() {

// we need to create a policy here so getting the policy within
// ::Policy() can *always* return a non null policy
mFeaturePolicy = new mozilla::dom::FeaturePolicy(this);
mFeaturePolicy = new FeaturePolicy(this);
mFeaturePolicy->SetDefaultOrigin(NodePrincipal());

mStyleSet = MakeUnique<ServoStyleSet>(*this);
Expand Down Expand Up @@ -3275,14 +3275,14 @@ nsresult Document::InitFeaturePolicy(nsIChannel* aChannel) {

mFeaturePolicy->SetDefaultOrigin(NodePrincipal());

RefPtr<mozilla::dom::FeaturePolicy> parentPolicy = nullptr;
RefPtr<FeaturePolicy> parentPolicy = nullptr;
if (mDocumentContainer) {
nsPIDOMWindowOuter* containerWindow = mDocumentContainer->GetWindow();
if (containerWindow) {
nsCOMPtr<nsINode> node = containerWindow->GetFrameElementInternal();
HTMLIFrameElement* iframe = HTMLIFrameElement::FromNodeOrNull(node);
if (iframe) {
parentPolicy = iframe->FeaturePolicy();
parentPolicy = iframe->Policy();
}
}
}
Expand Down Expand Up @@ -12573,10 +12573,10 @@ void Document::MaybeResolveReadyForIdle() {
}
}

mozilla::dom::FeaturePolicy* Document::FeaturePolicy() const {
FeaturePolicy* Document::Policy() const {
// The policy is created when the document is initialized. We _must_ have a
// policy here even if the featurePolicy pref is off. If this assertion fails,
// it means that ::FeaturePolicy() is called before ::StartDocumentLoad().
// it means that ::Policy() is called before ::StartDocumentLoad().
MOZ_ASSERT(mFeaturePolicy);
return mFeaturePolicy;
}
Expand Down
4 changes: 2 additions & 2 deletions dom/base/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -4052,7 +4052,7 @@ class Document : public nsINode,
mAllowPaymentRequest = aAllowPaymentRequest;
}

mozilla::dom::FeaturePolicy* FeaturePolicy() const;
FeaturePolicy* Policy() const;

bool ModuleScriptsEnabled();

Expand Down Expand Up @@ -4474,7 +4474,7 @@ class Document : public nsINode,

RefPtr<Promise> mReadyForIdle;

RefPtr<mozilla::dom::FeaturePolicy> mFeaturePolicy;
RefPtr<FeaturePolicy> mFeaturePolicy;

UniquePtr<ResizeObserverController> mResizeObserverController;

Expand Down
8 changes: 3 additions & 5 deletions dom/html/HTMLIFrameElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ HTMLIFrameElement::HTMLIFrameElement(
FromParser aFromParser)
: nsGenericHTMLFrameElement(std::move(aNodeInfo), aFromParser) {
// We always need a featurePolicy, even if not exposed.
mFeaturePolicy = new mozilla::dom::FeaturePolicy(this);
mFeaturePolicy = new FeaturePolicy(this);

nsCOMPtr<nsIPrincipal> origin = GetFeaturePolicyDefaultOrigin();
MOZ_ASSERT(origin);
Expand Down Expand Up @@ -224,9 +224,7 @@ JSObject* HTMLIFrameElement::WrapNode(JSContext* aCx,
return HTMLIFrameElement_Binding::Wrap(aCx, this, aGivenProto);
}

mozilla::dom::FeaturePolicy* HTMLIFrameElement::FeaturePolicy() const {
return mFeaturePolicy;
}
FeaturePolicy* HTMLIFrameElement::Policy() const { return mFeaturePolicy; }

already_AddRefed<nsIPrincipal>
HTMLIFrameElement::GetFeaturePolicyDefaultOrigin() const {
Expand Down Expand Up @@ -270,7 +268,7 @@ void HTMLIFrameElement::RefreshFeaturePolicy(bool aParseAllowAttribute) {
origin);
}

mFeaturePolicy->InheritPolicy(OwnerDoc()->FeaturePolicy());
mFeaturePolicy->InheritPolicy(OwnerDoc()->Policy());
}

if (AllowPaymentRequest()) {
Expand Down
2 changes: 1 addition & 1 deletion dom/html/HTMLIFrameElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class HTMLIFrameElement final : public nsGenericHTMLFrameElement {
bool FullscreenFlag() const { return mFullscreenFlag; }
void SetFullscreenFlag(bool aValue) { mFullscreenFlag = aValue; }

mozilla::dom::FeaturePolicy* FeaturePolicy() const;
FeaturePolicy* Policy() const;

protected:
virtual ~HTMLIFrameElement();
Expand Down
12 changes: 1 addition & 11 deletions dom/security/featurepolicy/FeaturePolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void FeaturePolicy::ResetDeclaredPolicy() { mFeatures.Clear(); }

JSObject* FeaturePolicy::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return FeaturePolicy_Binding::Wrap(aCx, this, aGivenProto);
return Policy_Binding::Wrap(aCx, this, aGivenProto);
}

bool FeaturePolicy::AllowsFeature(const nsAString& aFeatureName,
Expand Down Expand Up @@ -148,16 +148,6 @@ bool FeaturePolicy::AllowsFeatureInternal(const nsAString& aFeatureName,
return false;
}

void FeaturePolicy::Features(nsTArray<nsString>& aFeatures) {
RefPtr<FeaturePolicy> self = this;
FeaturePolicyUtils::ForEachFeature(
[self, &aFeatures](const char* aFeatureName) {
nsString featureName;
featureName.AppendASCII(aFeatureName);
aFeatures.AppendElement(featureName);
});
}

void FeaturePolicy::AllowedFeatures(nsTArray<nsString>& aAllowedFeatures) {
RefPtr<FeaturePolicy> self = this;
FeaturePolicyUtils::ForEachFeature(
Expand Down
2 changes: 0 additions & 2 deletions dom/security/featurepolicy/FeaturePolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ class FeaturePolicy final : public nsISupports, public nsWrapperCache {
bool AllowsFeature(const nsAString& aFeatureName,
const Optional<nsAString>& aOrigin) const;

void Features(nsTArray<nsString>& aFeatures);

void AllowedFeatures(nsTArray<nsString>& aAllowedFeatures);

void GetAllowlistForFeature(const nsAString& aFeatureName,
Expand Down
2 changes: 1 addition & 1 deletion dom/security/featurepolicy/FeaturePolicyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ bool FeaturePolicyUtils::IsFeatureAllowed(Document* aDocument,
return true;
}

FeaturePolicy* policy = aDocument->FeaturePolicy();
FeaturePolicy* policy = aDocument->Policy();
MOZ_ASSERT(policy);

if (policy->AllowsFeatureInternal(aFeatureName, policy->DefaultOrigin())) {
Expand Down
1 change: 0 additions & 1 deletion dom/security/featurepolicy/test/mochitest/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ support-files =
test_parser.html^headers^

[test_parser.html]
[test_featureList.html]
41 changes: 0 additions & 41 deletions dom/security/featurepolicy/test/mochitest/test_featureList.html

This file was deleted.

Loading

0 comments on commit 5f69292

Please sign in to comment.