mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 09:07:30 +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) {
|
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::media) {
|
||||||
UpdateMediaList(aValue);
|
UpdateMediaList(aValue);
|
||||||
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src) {
|
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src) {
|
||||||
|
mSrcTriggeringPrincipal = nsContentUtils::GetAttrTriggeringPrincipal(
|
||||||
|
this, aValue ? aValue->GetStringValue() : EmptyString(),
|
||||||
|
aMaybeScriptedPrincipal);
|
||||||
mSrcMediaSource = nullptr;
|
mSrcMediaSource = nullptr;
|
||||||
if (aValue) {
|
if (aValue) {
|
||||||
nsString srcStr = aValue->GetStringValue();
|
nsString srcStr = aValue->GetStringValue();
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,17 @@ public:
|
||||||
MediaSource* GetSrcMediaSource() { return mSrcMediaSource; };
|
MediaSource* GetSrcMediaSource() { return mSrcMediaSource; };
|
||||||
|
|
||||||
// WebIDL
|
// WebIDL
|
||||||
void GetSrc(nsString& aSrc)
|
void GetSrc(nsString& aSrc, nsIPrincipal&)
|
||||||
{
|
{
|
||||||
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
|
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)
|
void GetType(DOMString& aType)
|
||||||
|
|
@ -117,6 +121,9 @@ private:
|
||||||
RefPtr<nsMediaList> mMediaList;
|
RefPtr<nsMediaList> mMediaList;
|
||||||
RefPtr<MediaSource> mSrcMediaSource;
|
RefPtr<MediaSource> mSrcMediaSource;
|
||||||
|
|
||||||
|
// The triggering principal for the src attribute.
|
||||||
|
nsCOMPtr<nsIPrincipal> mSrcTriggeringPrincipal;
|
||||||
|
|
||||||
// Generates a new nsMediaList using the given input
|
// Generates a new nsMediaList using the given input
|
||||||
void UpdateMediaList(const nsAttrValue* aValue);
|
void UpdateMediaList(const nsAttrValue* aValue);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
[HTMLConstructor]
|
[HTMLConstructor]
|
||||||
interface HTMLSourceElement : HTMLElement {
|
interface HTMLSourceElement : HTMLElement {
|
||||||
[CEReactions, SetterThrows]
|
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
|
||||||
attribute DOMString src;
|
attribute DOMString src;
|
||||||
[CEReactions, SetterThrows]
|
[CEReactions, SetterThrows]
|
||||||
attribute DOMString type;
|
attribute DOMString type;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue