Skip to content

Commit edb8ba3

Browse files
committed
Backed out 2 changesets (bug 1424474) for mochitest failures on test_bug494328.html r=backout on a CLOSED TREE
Backed out changeset 39d5991f02ba (bug 1424474) Backed out changeset da3dec2fce06 (bug 1424474)
1 parent a7f32d5 commit edb8ba3

36 files changed

+59
-111
lines changed

dom/base/Element.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3955,7 +3955,7 @@ Element::GetInnerHTML(nsAString& aInnerHTML)
39553955
}
39563956

39573957
void
3958-
Element::SetInnerHTML(const nsAString& aInnerHTML, nsIPrincipal* aSubjectPrincipal, ErrorResult& aError)
3958+
Element::SetInnerHTML(const nsAString& aInnerHTML, nsIPrincipal& aSubjectPrincipal, ErrorResult& aError)
39593959
{
39603960
SetInnerHTMLInternal(aInnerHTML, aError);
39613961
}

dom/base/Element.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ class Element : public FragmentOrElement
13411341
nsTArray<RefPtr<Animation>>& aAnimations);
13421342

13431343
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
1344-
virtual void SetInnerHTML(const nsAString& aInnerHTML, nsIPrincipal* aSubjectPrincipal, ErrorResult& aError);
1344+
virtual void SetInnerHTML(const nsAString& aInnerHTML, nsIPrincipal& aSubjectPrincipal, ErrorResult& aError);
13451345
void GetOuterHTML(nsAString& aOuterHTML);
13461346
void SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError);
13471347
void InsertAdjacentHTML(const nsAString& aPosition, const nsAString& aText,
@@ -1568,9 +1568,9 @@ class Element : public FragmentOrElement
15681568
aError = SetAttr(kNameSpaceID_None, aAttr, aValue, true);
15691569
}
15701570

1571-
void SetAttr(nsAtom* aAttr, const nsAString& aValue, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aError)
1571+
void SetAttr(nsAtom* aAttr, const nsAString& aValue, nsIPrincipal& aTriggeringPrincipal, ErrorResult& aError)
15721572
{
1573-
aError = SetAttr(kNameSpaceID_None, aAttr, aValue, aTriggeringPrincipal, true);
1573+
aError = SetAttr(kNameSpaceID_None, aAttr, aValue, &aTriggeringPrincipal, true);
15741574
}
15751575

15761576
/**

dom/base/nsINode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,10 +1353,10 @@ class nsINode : public mozilla::dom::EventTarget
13531353
GetTextContentInternal(aTextContent, aError);
13541354
}
13551355
void SetTextContent(const nsAString& aTextContent,
1356-
nsIPrincipal* aSubjectPrincipal,
1356+
nsIPrincipal& aSubjectPrincipal,
13571357
mozilla::ErrorResult& aError)
13581358
{
1359-
SetTextContentInternal(aTextContent, aSubjectPrincipal, aError);
1359+
SetTextContentInternal(aTextContent, &aSubjectPrincipal, aError);
13601360
}
13611361
void SetTextContent(const nsAString& aTextContent,
13621362
mozilla::ErrorResult& aError)

dom/bindings/Codegen.py

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7415,53 +7415,31 @@ def needsConst(a):
74157415
self.cgRoot.append(call)
74167416

74177417
if needsSubjectPrincipal:
7418-
needsNonSystemPrincipal = (
7419-
"needsNonSystemSubjectPrincipal" in extendedAttributes)
7420-
if needsNonSystemPrincipal:
7421-
checkPrincipal = dedent(
7422-
"""
7423-
if (nsContentUtils::IsSystemPrincipal(principal)) {
7424-
principal = nullptr;
7425-
}
7426-
""")
7427-
else:
7428-
checkPrincipal = ""
7429-
7430-
getPrincipal = fill(
7418+
getPrincipal = dedent(
74317419
"""
74327420
JSCompartment* compartment = js::GetContextCompartment(cx);
74337421
MOZ_ASSERT(compartment);
74347422
JSPrincipals* principals = JS_GetCompartmentPrincipals(compartment);
7435-
nsIPrincipal* principal = nsJSPrincipals::get(principals);
7436-
${checkPrincipal}
7437-
""",
7438-
checkPrincipal=checkPrincipal)
7423+
""")
74397424

74407425
if descriptor.interface.isExposedInAnyWorker():
74417426
self.cgRoot.prepend(CGGeneric(fill(
74427427
"""
74437428
Maybe<nsIPrincipal*> subjectPrincipal;
74447429
if (NS_IsMainThread()) {
74457430
$*{getPrincipal}
7446-
subjectPrincipal.emplace(principal);
7431+
subjectPrincipal.emplace(nsJSPrincipals::get(principals));
74477432
}
74487433
""",
74497434
getPrincipal=getPrincipal)))
74507435
else:
7451-
if needsNonSystemPrincipal:
7452-
principalType = "nsIPrincipal*";
7453-
else:
7454-
principalType = "NonNull<nsIPrincipal>"
7455-
74567436
self.cgRoot.prepend(CGGeneric(fill(
74577437
"""
7458-
${principalType} subjectPrincipal;
7459-
{
7460-
$*{getPrincipal}
7461-
subjectPrincipal = principal;
7462-
}
7438+
$*{getPrincipal}
7439+
// Initializing a nonnull is pretty darn annoying...
7440+
NonNull<nsIPrincipal> subjectPrincipal;
7441+
subjectPrincipal = static_cast<nsIPrincipal*>(nsJSPrincipals::get(principals));
74637442
""",
7464-
principalType=principalType,
74657443
getPrincipal=getPrincipal)))
74667444

74677445
if isFallible or canOOM:
@@ -14302,18 +14280,8 @@ def dictionaryHasChromeOnly(dictionary):
1430214280
dictionary = dictionary.parent
1430314281
return False
1430414282

14305-
def needsNonSystemPrincipal(member):
14306-
return (
14307-
member.getExtendedAttribute("NeedsSubjectPrincipal") == ["NonSystem"] or
14308-
member.getExtendedAttribute("SetterNeedsSubjectPrincipal") == ["NonSystem"] or
14309-
member.getExtendedAttribute("GetterNeedsSubjectPrincipal") == ["NonSystem"])
14310-
14311-
def descriptorNeedsNonSystemPrincipal(d):
14312-
return any(needsNonSystemPrincipal(m) for m in d.interface.members)
14313-
1431414283
bindingHeaders["nsContentUtils.h"] = (
1431514284
any(descriptorHasChromeOnly(d) for d in descriptors) or
14316-
any(descriptorNeedsNonSystemPrincipal(d) for d in descriptors) or
1431714285
any(dictionaryHasChromeOnly(d) for d in dictionaries))
1431814286
hasNonEmptyDictionaries = any(
1431914287
len(dict.members) > 0 for dict in dictionaries)
@@ -14732,8 +14700,6 @@ def getArgs(self, returnType, argList):
1473214700
# Cheat and assume self.descriptorProvider is a descriptor
1473314701
if self.descriptorProvider.interface.isExposedInAnyWorker():
1473414702
args.append(Argument("Maybe<nsIPrincipal*>", "aSubjectPrincipal"))
14735-
elif 'needsNonSystemSubjectPrincipal' in self.extendedAttrs:
14736-
args.append(Argument("nsIPrincipal*", "aPrincipal"))
1473714703
else:
1473814704
args.append(Argument("nsIPrincipal&", "aPrincipal"))
1473914705
# And the caller type, if desired.

dom/bindings/Configuration.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -614,16 +614,9 @@ def maybeAppendCanOOMToAttrs(attrs, canOOM):
614614
attrs.append("canOOM")
615615

616616
def maybeAppendNeedsSubjectPrincipalToAttrs(attrs, needsSubjectPrincipal):
617-
if (needsSubjectPrincipal is not None and
618-
needsSubjectPrincipal is not True and
619-
needsSubjectPrincipal != ["NonSystem"]):
620-
raise TypeError("Unknown value for 'NeedsSubjectPrincipal': %s" %
621-
needsSubjectPrincipal[0])
622-
617+
ensureValidNeedsSubjectPrincipalExtendedAttribute(needsSubjectPrincipal)
623618
if needsSubjectPrincipal is not None:
624619
attrs.append("needsSubjectPrincipal")
625-
if needsSubjectPrincipal == ["NonSystem"]:
626-
attrs.append("needsNonSystemSubjectPrincipal")
627620

628621
name = member.identifier.name
629622
throws = self.interface.isJSImplemented() or member.getExtendedAttribute("Throws")

dom/bindings/GenerateCSS2PropertiesWebIDL.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def generate(output, idlFilename, preprocessorHeader):
2929
# Unfortunately, even some of the getters here are fallible
3030
# (e.g. on nsComputedDOMStyle).
3131
extendedAttrs = ["Throws", "TreatNullAs=EmptyString",
32-
"SetterNeedsSubjectPrincipal=NonSystem"]
32+
"SetterNeedsSubjectPrincipal"]
3333
if pref is not "":
3434
extendedAttrs.append('Pref="%s"' % pref)
3535

dom/bindings/test/TestBindingHeader.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,9 +971,6 @@ class TestInterface : public nsISupports,
971971
void NeedsCallerTypeMethod(CallerType);
972972
bool NeedsCallerTypeAttr(CallerType);
973973
void SetNeedsCallerTypeAttr(bool, CallerType);
974-
void NeedsNonSystemSubjectPrincipalMethod(nsIPrincipal*);
975-
bool NeedsNonSystemSubjectPrincipalAttr(nsIPrincipal*);
976-
void SetNeedsNonSystemSubjectPrincipalAttr(bool, nsIPrincipal*);
977974
void CeReactionsMethod();
978975
void CeReactionsMethodOverload();
979976
void CeReactionsMethodOverload(const nsAString&);
@@ -1469,9 +1466,6 @@ class TestWorkerExposedInterface : public nsISupports,
14691466
void NeedsCallerTypeMethod(CallerType);
14701467
bool NeedsCallerTypeAttr(CallerType);
14711468
void SetNeedsCallerTypeAttr(bool, CallerType);
1472-
void NeedsNonSystemSubjectPrincipalMethod(Maybe<nsIPrincipal*>);
1473-
bool NeedsNonSystemSubjectPrincipalAttr(Maybe<nsIPrincipal*>);
1474-
void SetNeedsNonSystemSubjectPrincipalAttr(bool, Maybe<nsIPrincipal*>);
14751469
};
14761470

14771471
class TestHTMLConstructorInterface : public nsGenericHTMLElement

dom/bindings/test/TestCodeGen.webidl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,6 @@ interface TestInterface {
957957
[NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr;
958958
[NeedsCallerType] void needsCallerTypeMethod();
959959
[NeedsCallerType] attribute boolean needsCallerTypeAttr;
960-
[NeedsSubjectPrincipal=NonSystem] void needsNonSystemSubjectPrincipalMethod();
961-
[NeedsSubjectPrincipal=NonSystem] attribute boolean needsNonSystemSubjectPrincipalAttr;
962960
[CEReactions] void ceReactionsMethod();
963961
[CEReactions] void ceReactionsMethodOverload();
964962
[CEReactions] void ceReactionsMethodOverload(DOMString bar);
@@ -1305,8 +1303,6 @@ interface TestWorkerExposedInterface {
13051303
[NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr;
13061304
[NeedsCallerType] void needsCallerTypeMethod();
13071305
[NeedsCallerType] attribute boolean needsCallerTypeAttr;
1308-
[NeedsSubjectPrincipal=NonSystem] void needsNonSystemSubjectPrincipalMethod();
1309-
[NeedsSubjectPrincipal=NonSystem] attribute boolean needsNonSystemSubjectPrincipalAttr;
13101306
};
13111307

13121308
[HTMLConstructor]

dom/bindings/test/TestExampleGen.webidl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,6 @@ interface TestExampleInterface {
783783
[SetterCanOOM] attribute boolean canOOMSetterAttr;
784784
[NeedsSubjectPrincipal] void needsSubjectPrincipalMethod();
785785
[NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr;
786-
[NeedsSubjectPrincipal=NonSystem] void needsNonSystemSubjectPrincipalMethod();
787-
[NeedsSubjectPrincipal=NonSystem] attribute boolean needsNonSystemSubjectPrincipalAttr;
788786
[NeedsCallerType] void needsCallerTypeMethod();
789787
[NeedsCallerType] attribute boolean needsCallerTypeAttr;
790788
[CEReactions] void ceReactionsMethod();
@@ -835,6 +833,4 @@ interface TestExampleWorkerInterface {
835833
[NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr;
836834
[NeedsCallerType] void needsCallerTypeMethod();
837835
[NeedsCallerType] attribute boolean needsCallerTypeAttr;
838-
[NeedsSubjectPrincipal=NonSystem] void needsNonSystemSubjectPrincipalMethod();
839-
[NeedsSubjectPrincipal=NonSystem] attribute boolean needsNonSystemSubjectPrincipalAttr;
840836
};

dom/html/HTMLFrameElement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class HTMLFrameElement final : public nsGenericHTMLFrameElement
104104
{
105105
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
106106
}
107-
void SetSrc(const nsAString& aSrc, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aError)
107+
void SetSrc(const nsAString& aSrc, nsIPrincipal& aTriggeringPrincipal, ErrorResult& aError)
108108
{
109109
SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, aError);
110110
}

0 commit comments

Comments
 (0)