Closed Bug 1399372 Opened 6 years ago Closed 6 years ago

ChannelMediaResource::OnDataAvailable() should update the principal only once


(Core :: Audio/Video: Playback, enhancement, P3)




Tracking Status
firefox57 --- fixed


(Reporter: jwwang, Assigned: jwwang)




(1 file)

One ChannelMediaResource::OnDataAvailable() call might result in multiple calls into MediaCacheStream::NotifyDataReceived() which will update the principal of the stream.

We should just update the principal only once per OnDataAvailable() call.
Assignee: nobody → jwwang
Blocks: 1382978
Priority: -- → P3
Attachment #8907903 - Flags: review?(cpearce)
Comment on attachment 8907903 [details]
Bug 1399372 - update the principal only once per OnDataAvailable() call.

::: dom/media/MediaCache.h:265
(Diff revision 1)
>    // Notifies the cache that data has been received. The stream already
>    // knows the offset because data is received in sequence and
>    // the starting offset is known via NotifyDataStarted or because
>    // the cache requested the offset in
>    // ChannelMediaResource::CacheClientSeek, or because it defaulted to 0.
>    // We pass in the principal that was used to load this data.

The comment here still mentions the principal.

::: dom/media/MediaResource.cpp:469
(Diff revision 1)
>    // This might happen off the main thread.
>    NS_ASSERTION(mChannel.get() == aRequest, "Wrong channel!");
> +  // Update principals before putting the data in the cache. This is important,
> +  // we want to make sure all principals are updated before any consumer.
> +  // TODO: Handle the case where OnDataAvailable() runs off the main thread.

You clipped off "// can see the new data." from the end of this comment when you moved it. Please can you add it back, as I want to be sure we leave the warning here as we don't want our developers accidentally adding privacy leaks to the code.
Attachment #8907903 - Flags: review?(cpearce) → review+
Pushed by
update the principal only once per OnDataAvailable() call. r=cpearce
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Blocks: 1428688
No longer blocks: 1428688
You need to log in before you can comment on or make changes to this bug.