Bug 1464012 - part1 : directly check media element's crossorigin attribute. r=jya

As `GetCORSMode()` would only be valid after media element starts loading, so we would fail to get the CORS mode if media's preload is `none`.

Therefore, according to the spec [1], we should directly check parent media element's `crossorigin` attribute in order to decide the `corsAttributeState`.

[1] https://html.spec.whatwg.org/multipage/media.html#sourcing-out-of-band-text-tracks:attr-media-crossorigin

Differential Revision: https://phabricator.services.mozilla.com/D34755

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alastor Wu 2019-06-14 17:56:33 +00:00
Родитель b4311cbef0
Коммит 5b19389470
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -313,7 +313,10 @@ void HTMLTrackElement::LoadResource(RefPtr<WebVTTListener>&& aWebVTTListener) {
// be the state of the parent media element's crossorigin content attribute. // be the state of the parent media element's crossorigin content attribute.
// Otherwise, let CORS mode be No CORS." // Otherwise, let CORS mode be No CORS."
// //
CORSMode corsMode = mMediaParent ? mMediaParent->GetCORSMode() : CORS_NONE; CORSMode corsMode =
mMediaParent ? AttrValueToCORSMode(
mMediaParent->GetParsedAttr(nsGkAtoms::crossorigin))
: CORS_NONE;
// Determine the security flag based on corsMode. // Determine the security flag based on corsMode.
nsSecurityFlags secFlags; nsSecurityFlags secFlags;