Closed Bug 488523 Opened 16 years ago Closed 16 years ago

GetCurrentPrincipal() broken if video is done loading

Categories

(Core :: Audio/Video, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 486646

People

(Reporter: bzbarsky, Unassigned)

Details

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.
Flags: blocking1.9.1?
dup of 486646?
Basically, except nulling out mChannel is not the problem; not saving the principal is.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Flags: blocking1.9.1?
You need to log in before you can comment on or make changes to this bug.