Bug 1673199 - Make MediaList objects return a style sheet parent so that we associate reflectors to the right global. r=smaug

Otherwise if devtools or other privileged JS access them then content
can choke.

Differential Revision: https://phabricator.services.mozilla.com/D95121
This commit is contained in:
Emilio Cobos Álvarez 2020-10-29 10:15:47 +00:00
parent cfaedde161
commit 73560dc1dd
2 changed files with 3 additions and 1 deletions

View File

@ -39,6 +39,8 @@ void MediaList::SetStyleSheet(StyleSheet* aSheet) {
mStyleSheet = aSheet;
}
nsISupports* MediaList::GetParentObject() const { return mStyleSheet; }
template <typename Func>
void MediaList::DoMediaChange(Func aCallback, ErrorResult& aRv) {
if (IsReadOnly()) {

View File

@ -40,7 +40,7 @@ class MediaList final : public nsISupports, public nsWrapperCache {
already_AddRefed<MediaList> Clone();
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
nsISupports* GetParentObject() const { return nullptr; }
nsISupports* GetParentObject() const;
void GetText(nsAString& aMediaText);
void SetText(const nsAString& aMediaText);