Bug 1419270 part 2. Use getter or setter specific NeedsSubjectPrincipal annotations more. r=qdot

MozReview-Commit-ID: KBwjFh3TMUg
This commit is contained in:
Boris Zbarsky 2017-12-05 16:03:18 -05:00
parent a61f696c24
commit 887ce3941a
29 changed files with 26 additions and 58 deletions

View File

@ -87,10 +87,7 @@ public:
// XPCOM GetName() is OK
void GetValue(nsString& val, nsIPrincipal&)
{
GetValue(val);
}
// XPCOM GetValue() is OK
void SetValue(const nsAString& aValue, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aRv);

View File

@ -1220,10 +1220,6 @@ public:
nsTArray<RefPtr<Animation>>& aAnimations);
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
void GetInnerHTML(nsAString& aInnerHTML, nsIPrincipal& aSubjectPrincipal)
{
GetInnerHTML(aInnerHTML);
}
virtual void SetInnerHTML(const nsAString& aInnerHTML, nsIPrincipal& aSubjectPrincipal, ErrorResult& aError);
void GetOuterHTML(nsAString& aOuterHTML);
void SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError);

View File

@ -440,7 +440,6 @@ Location::GetHref(nsAString& aHref)
void
Location::SetHref(const nsAString& aHref,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)
{
JSContext *cx = nsContentUtils::GetCurrentJSContext();

View File

@ -69,7 +69,6 @@ public:
}
void SetHref(const nsAString& aHref,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError);
void GetOrigin(nsAString& aOrigin,

View File

@ -1340,12 +1340,6 @@ public:
// way to ask an element whether it's an HTMLContentElement.
virtual bool IsHTMLContentElement() const { return false; }
void GetTextContent(nsAString& aTextContent,
nsIPrincipal& aSubjectPrincipal,
mozilla::OOMReporter& aError)
{
GetTextContentInternal(aTextContent, aError);
}
void GetTextContent(nsAString& aTextContent,
mozilla::OOMReporter& aError)
{

View File

@ -29,7 +29,7 @@ def generate(output, idlFilename, preprocessorHeader):
# Unfortunately, even some of the getters here are fallible
# (e.g. on nsComputedDOMStyle).
extendedAttrs = ["Throws", "TreatNullAs=EmptyString",
"NeedsSubjectPrincipal"]
"SetterNeedsSubjectPrincipal"]
if pref is not "":
extendedAttrs.append('Pref="%s"' % pref)

View File

@ -100,7 +100,7 @@ public:
SetHTMLAttr(nsGkAtoms::scrolling, aScrolling, aError);
}
void GetSrc(nsString& aSrc, nsIPrincipal&)
void GetSrc(nsString& aSrc)
{
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
}

View File

@ -46,7 +46,7 @@ public:
uint32_t GetSandboxFlags();
// Web IDL binding methods
void GetSrc(nsString& aSrc, nsIPrincipal&) const
void GetSrc(nsString& aSrc) const
{
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
}

View File

@ -142,10 +142,6 @@ public:
{
SetHTMLAttr(nsGkAtoms::alt, aAlt, aError);
}
void GetSrc(nsAString& aSrc, nsIPrincipal&)
{
GetSrc(aSrc);
}
void GetSrc(nsAString& aSrc)
{
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
@ -158,7 +154,7 @@ public:
{
SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, aError);
}
void GetSrcset(nsAString& aSrcset, nsIPrincipal&)
void GetSrcset(nsAString& aSrcset)
{
GetHTMLAttr(nsGkAtoms::srcset, aSrcset);
}

View File

@ -714,7 +714,7 @@ public:
SetUnsignedIntAttr(nsGkAtoms::size, aValue, DEFAULT_COLS, aRv);
}
void GetSrc(nsAString& aValue, nsIPrincipal&)
void GetSrc(nsAString& aValue)
{
GetURIAttr(nsGkAtoms::src, nullptr, aValue);
}

View File

@ -88,10 +88,6 @@ public:
{
GetURIAttr(nsGkAtoms::href, nullptr, aValue);
}
void GetHref(nsString& aValue, nsIPrincipal&)
{
GetHref(aValue);
}
void SetHref(const nsAString& aHref, nsIPrincipal& aTriggeringPrincipal, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::href, aHref, aTriggeringPrincipal, aRv);

View File

@ -442,10 +442,6 @@ public:
MediaError* GetError() const;
void GetSrc(nsString& aSrc, nsIPrincipal&)
{
GetSrc(aSrc);
}
void SetSrc(const nsAString& aSrc, nsIPrincipal& aTriggeringPrincipal, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, aRv);

View File

@ -54,7 +54,7 @@ public:
MediaSource* GetSrcMediaSource() { return mSrcMediaSource; };
// WebIDL
void GetSrc(nsString& aSrc, nsIPrincipal&)
void GetSrc(nsString& aSrc)
{
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
}
@ -82,7 +82,7 @@ public:
SetHTMLAttr(nsGkAtoms::type, aType, rv);
}
void GetSrcset(DOMString& aSrcset, nsIPrincipal&)
void GetSrcset(DOMString& aSrcset)
{
GetHTMLAttr(nsGkAtoms::srcset, aSrcset);
}

View File

@ -209,11 +209,7 @@ public:
mozilla::ErrorResult& rv);
void Writeln(JSContext* cx, const mozilla::dom::Sequence<nsString>& aText,
mozilla::ErrorResult& rv);
void GetDesignMode(nsAString& aDesignMode,
nsIPrincipal& aSubjectPrincipal)
{
GetDesignMode(aDesignMode);
}
// XPCOM GetDesignMode is fine.
void SetDesignMode(const nsAString& aDesignMode,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& rv);

View File

@ -12,7 +12,7 @@
interface Attr : Node {
readonly attribute DOMString localName;
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString value;
[Constant]

View File

@ -8,7 +8,7 @@
*/
interface CSSStyleDeclaration {
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString cssText;
readonly attribute unsigned long length;

View File

@ -221,7 +221,7 @@ partial interface Element {
// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
partial interface Element {
[CEReactions, NeedsSubjectPrincipal, Pure,SetterThrows,TreatNullAs=EmptyString]
[CEReactions, SetterNeedsSubjectPrincipal, Pure, SetterThrows, TreatNullAs=EmptyString]
attribute DOMString innerHTML;
[CEReactions, Pure,SetterThrows,TreatNullAs=EmptyString]
attribute DOMString outerHTML;

View File

@ -42,7 +42,7 @@ interface HTMLDocument : Document {
[CEReactions, Throws]
void writeln(DOMString... text);
[CEReactions, SetterThrows, NeedsSubjectPrincipal]
[CEReactions, SetterThrows, SetterNeedsSubjectPrincipal]
attribute DOMString designMode;
[CEReactions, Throws, NeedsSubjectPrincipal]
boolean execCommand(DOMString commandId, optional boolean showUI = false,

View File

@ -17,7 +17,7 @@ interface HTMLFrameElement : HTMLElement {
attribute DOMString name;
[CEReactions, SetterThrows]
attribute DOMString scrolling;
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString src;
[CEReactions, SetterThrows]
attribute DOMString frameBorder;

View File

@ -13,7 +13,7 @@
[HTMLConstructor]
interface HTMLIFrameElement : HTMLElement {
[CEReactions, NeedsSubjectPrincipal, SetterThrows, Pure]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows, Pure]
attribute DOMString src;
[CEReactions, SetterThrows, Pure]
attribute DOMString srcdoc;

View File

@ -21,9 +21,9 @@ interface nsIStreamListener;
interface HTMLImageElement : HTMLElement {
[CEReactions, SetterThrows]
attribute DOMString alt;
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString src;
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString srcset;
[CEReactions, SetterThrows]
attribute DOMString? crossOrigin;

View File

@ -81,7 +81,7 @@ interface HTMLInputElement : HTMLElement {
attribute boolean required;
[CEReactions, Pure, SetterThrows]
attribute unsigned long size;
[CEReactions, Pure, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, Pure, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString src;
[CEReactions, Pure, SetterThrows]
attribute DOMString step;

View File

@ -16,7 +16,7 @@
interface HTMLLinkElement : HTMLElement {
[Pure]
attribute boolean disabled;
[CEReactions, NeedsSubjectPrincipal, SetterThrows, Pure]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows, Pure]
attribute DOMString href;
[CEReactions, SetterThrows, Pure]
attribute DOMString? crossOrigin;

View File

@ -17,7 +17,7 @@ interface HTMLMediaElement : HTMLElement {
readonly attribute MediaError? error;
// network state
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString src;
readonly attribute DOMString currentSrc;

View File

@ -13,14 +13,14 @@
[HTMLConstructor]
interface HTMLSourceElement : HTMLElement {
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString src;
[CEReactions, SetterThrows]
attribute DOMString type;
};
partial interface HTMLSourceElement {
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
[CEReactions, SetterNeedsSubjectPrincipal, SetterThrows]
attribute DOMString srcset;
[CEReactions, SetterThrows]
attribute DOMString sizes;

View File

@ -20,7 +20,7 @@ interface Location {
[Throws, NeedsSubjectPrincipal]
stringifier;
[Throws, CrossOriginWritable, NeedsSubjectPrincipal]
[Throws, CrossOriginWritable, GetterNeedsSubjectPrincipal]
attribute USVString href;
[Throws, NeedsSubjectPrincipal]
readonly attribute USVString origin;

View File

@ -59,7 +59,7 @@ interface Node : EventTarget {
[CEReactions, SetterThrows, Pure]
attribute DOMString? nodeValue;
[CEReactions, SetterThrows, GetterCanOOM, NeedsSubjectPrincipal, Pure]
[CEReactions, SetterThrows, GetterCanOOM, SetterNeedsSubjectPrincipal, Pure]
attribute DOMString? textContent;
[CEReactions, Throws]
Node insertBefore(Node node, Node? child);

View File

@ -73,8 +73,7 @@ public:
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
void \
Get##method_(nsAString& aValue, nsIPrincipal& aSubjectPrincipal, \
mozilla::ErrorResult& rv) \
Get##method_(nsAString& aValue, mozilla::ErrorResult& rv) \
{ \
rv = GetPropertyValue(eCSSProperty_##id_, aValue); \
} \

View File

@ -110,7 +110,7 @@ public:
mozilla::ErrorResult& rv) {
rv = SetCssText(aString, &aSubjectPrincipal);
}
void GetCssText(nsString& aString, nsIPrincipal& aSubjectPrincipal) {
void GetCssText(nsString& aString) {
// Cast to nsAString& so we end up calling our virtual
// |GetCssText(nsAString& aCssText)| overload, which does the real work.
GetCssText(static_cast<nsAString&>(aString));