mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Issue #2736 - Part 9: Re-work <source> src attribute.
Use subject principal as triggering principal in <source> "src" attribute for <audio>/<video> elements.
This commit is contained in:
parent
b6bdce6f98
commit
b1b5062dc4
3 changed files with 14 additions and 4 deletions
|
|
@ -133,6 +133,9 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::media) {
|
||||
UpdateMediaList(aValue);
|
||||
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src) {
|
||||
mSrcTriggeringPrincipal = nsContentUtils::GetAttrTriggeringPrincipal(
|
||||
this, aValue ? aValue->GetStringValue() : EmptyString(),
|
||||
aMaybeScriptedPrincipal);
|
||||
mSrcMediaSource = nullptr;
|
||||
if (aValue) {
|
||||
nsString srcStr = aValue->GetStringValue();
|
||||
|
|
|
|||
|
|
@ -56,13 +56,17 @@ public:
|
|||
MediaSource* GetSrcMediaSource() { return mSrcMediaSource; };
|
||||
|
||||
// WebIDL
|
||||
void GetSrc(nsString& aSrc)
|
||||
void GetSrc(nsString& aSrc, nsIPrincipal&)
|
||||
{
|
||||
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
|
||||
}
|
||||
void SetSrc(const nsAString& aSrc, mozilla::ErrorResult& rv)
|
||||
void SetSrc(const nsAString& aSrc, nsIPrincipal& aTriggeringPrincipal, mozilla::ErrorResult& rv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::src, aSrc, rv);
|
||||
SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, rv);
|
||||
}
|
||||
nsIPrincipal* GetSrcTriggeringPrincipal() const
|
||||
{
|
||||
return mSrcTriggeringPrincipal;
|
||||
}
|
||||
|
||||
void GetType(DOMString& aType)
|
||||
|
|
@ -117,6 +121,9 @@ private:
|
|||
RefPtr<nsMediaList> mMediaList;
|
||||
RefPtr<MediaSource> mSrcMediaSource;
|
||||
|
||||
// The triggering principal for the src attribute.
|
||||
nsCOMPtr<nsIPrincipal> mSrcTriggeringPrincipal;
|
||||
|
||||
// Generates a new nsMediaList using the given input
|
||||
void UpdateMediaList(const nsAttrValue* aValue);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
[HTMLConstructor]
|
||||
interface HTMLSourceElement : HTMLElement {
|
||||
[CEReactions, SetterThrows]
|
||||
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
|
||||
attribute DOMString src;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute DOMString type;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue