mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 996685 - Report an error in the console when a cross-origin media element is used with a Media(ElementAudio|Stream)SourceNode. r=pehrsons
MozReview-Commit-ID: 8VP7Sv8unUq
This commit is contained in:
parent
ee334b0f81
commit
0d3dbc04dc
@ -93,6 +93,10 @@ MediaDecodeAudioDataUnknownError=An unknown error occured while processing decod
|
||||
MediaDecodeAudioDataInvalidContent=The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully.
|
||||
# LOCALIZATION NOTE: Do not translate decodeAudioData.
|
||||
MediaDecodeAudioDataNoAudio=The buffer passed to decodeAudioData does not contain any audio.
|
||||
# LOCALIZATION NOTE: Do not translate HTMLMediaElement and createMediaElementSource.
|
||||
MediaElementAudioSourceNodeCrossOrigin=The HTMLMediaElement passed to createMediaElementSource has a cross-origin resource, the node will output silence.
|
||||
# LOCALIZATION NOTE: Do not translate MediaStream and createMediaStreamSource.
|
||||
MediaStreamAudioSourceNodeCrossOrigin=The MediaStream passed to createMediaStreamSource has a cross-origin resource, the node it will output silence.
|
||||
MediaLoadExhaustedCandidates=All candidate resources failed to load. Media load paused.
|
||||
MediaLoadSourceMissingSrc=<source> element has no "src" attribute. Media resource load failed.
|
||||
# LOCALIZATION NOTE: %1$S is the Http error code the server returned (e.g. 404, 500, etc), %2$S is the URL of the media resource which failed to load.
|
||||
|
@ -25,6 +25,11 @@ public:
|
||||
return "MediaElementAudioSourceNode";
|
||||
}
|
||||
|
||||
const char* CrossOriginErrorString() const override
|
||||
{
|
||||
return "MediaElementAudioSourceNodeCrossOrigin";
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
{
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
@ -165,8 +165,9 @@ MediaStreamAudioSourceNode::PrincipalChanged(MediaStreamTrack* aMediaStreamTrack
|
||||
MOZ_ASSERT(aMediaStreamTrack == mInputTrack);
|
||||
|
||||
bool subsumes = false;
|
||||
nsIDocument* doc = nullptr;
|
||||
if (nsPIDOMWindowInner* parent = Context()->GetParentObject()) {
|
||||
nsIDocument* doc = parent->GetExtantDoc();
|
||||
doc = parent->GetExtantDoc();
|
||||
if (doc) {
|
||||
nsIPrincipal* docPrincipal = doc->NodePrincipal();
|
||||
nsIPrincipal* trackPrincipal = aMediaStreamTrack->GetPrincipal();
|
||||
@ -176,8 +177,16 @@ MediaStreamAudioSourceNode::PrincipalChanged(MediaStreamTrack* aMediaStreamTrack
|
||||
}
|
||||
}
|
||||
auto stream = static_cast<AudioNodeExternalInputStream*>(mStream.get());
|
||||
stream->SetInt32Parameter(MediaStreamAudioSourceNodeEngine::ENABLE,
|
||||
subsumes || aMediaStreamTrack->GetCORSMode() != CORS_NONE);
|
||||
bool enabled = subsumes || aMediaStreamTrack->GetCORSMode() != CORS_NONE;
|
||||
stream->SetInt32Parameter(MediaStreamAudioSourceNodeEngine::ENABLE, enabled);
|
||||
|
||||
if (!enabled && doc) {
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("Web Audio"),
|
||||
doc,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
CrossOriginErrorString());
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -62,6 +62,11 @@ public:
|
||||
return "MediaStreamAudioSourceNode";
|
||||
}
|
||||
|
||||
virtual const char* CrossOriginErrorString() const
|
||||
{
|
||||
return "MediaStreamAudioSourceNodeCrossOrigin";
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user