Closed Bug 488523 Opened 12 years ago Closed 12 years ago
Current Principal() broken if video is done loading
Paul and I were looking into why m-c was only working on http://people.mozilla.com/~prouget/demos/DynamicContentInjection.test/play.xhtml for about a second, and we discovered that after that a drawImage call on a canvas throws a security exception. The reason that happens is that a <video> is passed to drawImage and GetCurrentPrincipal() returns null. And the reason _that_ happens is that the video is done loading. In this case, the video's mDecoder is an nsOggDecoder and its mReader is an nsChannelReader. That has an nsMediaChannelStream as mStream. The GetCurrentPrincipal() call propagates all the way down to nsMediaChannelStream::GetCurrentPrincipal (though there is the confusion of the nsChannelReader::GetCurrentPrincipal being declared but not called or implemented), and returns null because mChannel is null. Which is presumably because the video is fully loaded. We should probably be saving the principal of the channel up front whenever we get OnStartRequest and not trying to get it from the channel every time. Alternately, we should cache the principal before dropping the mChannel ref at load completion. Requesting blocking, since this makes it timing-dependent whether a video can be drawn into a canvas... that's not good for the web at all.
dup of 486646?
Basically, except nulling out mChannel is not the problem; not saving the principal is.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 486646
You need to log in before you can comment on or make changes to this bug.