Closed Bug 1399372 Opened 7 years ago Closed 7 years ago

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

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

Details

Attachments

(1 file)

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

http://searchfox.org/mozilla-central/rev/e76c0fee79a34a3612740b33508276f4b37c3ee8/dom/media/MediaCache.cpp#1891

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.

https://reviewboard.mozilla.org/r/179582/#review184798

::: 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+
Thanks!
Pushed by jwwang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9b145214faae
update the principal only once per OnDataAvailable() call. r=cpearce
https://hg.mozilla.org/mozilla-central/rev/9b145214faae
Status: NEW → RESOLVED
Closed: 7 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.