Null principal subsumes assertion fires in media mochitests

RESOLVED FIXED in mozilla30

Status

()

Core
Audio/Video
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: cpearce, Assigned: cpearce)

Tracking

29 Branch
mozilla30
x86_64
Windows 8.1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
I see lots of these assertion failures when running content/media/test mochitests:

 7:21.89 [5004] WARNING: Need a principal to compare this to!: file c:\Users\cpearce\src\mozilla\purple\caps\src\nsPrincipal.cpp, line 239

Stack:

xul.dll!nsPrincipal::Equals(nsIPrincipal * aOther=0x00000000, bool * aResult=0x00e1e993) Line 240	C++
xul.dll!nsPrincipal::Subsumes(nsIPrincipal * aOther=0x00000000, bool * aResult=0x00e1e993) Line 292	C++
xul.dll!mozilla::dom::HTMLMediaElement::NotifyDecoderPrincipalChanged() Line 3362	C++
xul.dll!mozilla::dom::HTMLMediaElement::FinishDecoderSetup(mozilla::MediaDecoder * aDecoder=0x0766a9b8, mozilla::MediaResource * aStream=0x0a37e338, nsIStreamListener * * aListener=0x069aa11c, mozilla::MediaDecoder * aCloneDonor=0x00000000) Line 2613	C++
xul.dll!mozilla::dom::HTMLMediaElement::InitializeDecoderForChannel(nsIChannel * aChannel=0x1683dd6c, nsIStreamListener * * aListener=0x069aa11c) Line 2579	C++
xul.dll!mozilla::dom::HTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest * aRequest=0x1683dd6c, nsISupports * aContext=0x00000000) Line 347	C++
xul.dll!nsCORSListenerProxy::OnStartRequest(nsIRequest * aRequest=0x1683dd6c, nsISupports * aContext=0x00000000) Line 501	C++
xul.dll!mozilla::net::nsHttpChannel::CallOnStartRequest() Line 876	C++
xul.dll!mozilla::net::nsHttpChannel::ContinueProcessNormal(tag_nsresult rv=NS_OK) Line 1466	C++
xul.dll!mozilla::net::nsHttpChannel::ProcessNormal() Line 1402	C++
xul.dll!mozilla::net::nsHttpChannel::ProcessResponse() Line 1240	C++
xul.dll!mozilla::net::nsHttpChannel::OnStartRequest(nsIRequest * request=0x16fddaa8, nsISupports * ctxt=0x00000000) Line 4952	C++
xul.dll!nsInputStreamPump::OnStateStart() Line 517	C++
xul.dll!nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream * stream=0x167a4770) Line 431	C++
xul.dll!nsInputStreamReadyEvent::Run() Line 86	C++
xul.dll!nsThread::ProcessNextEvent(bool mayWait=false, bool * result=0x00e1f063) Line 646	C++
xul.dll!NS_ProcessNextEvent(nsIThread * thread=0x00f27970, bool mayWait=false) Line 263	C++
xul.dll!mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate * aDelegate=0x00f401e0) Line 95	C++
xul.dll!MessageLoop::RunInternal() Line 227	C++
xul.dll!MessageLoop::RunHandler() Line 220	C++
xul.dll!MessageLoop::Run() Line 194	C++
xul.dll!nsBaseAppShell::Run() Line 163	C++
xul.dll!nsAppShell::Run() Line 113	C++
xul.dll!nsAppStartup::Run() Line 276	C++
xul.dll!XREMain::XRE_mainRun() Line 4090	C++
xul.dll!XREMain::XRE_main(int argc=5, char * * argv=0x010628a8, const nsXREAppData * aAppData=0x00e1f614) Line 4158	C++
xul.dll!XRE_main(int argc=5, char * * argv=0x010628a8, const nsXREAppData * aAppData=0x00e1f614, unsigned int aFlags=0) Line 4368	C++

It seems we only set the principal by calling MediaCacheStream::UpdatePrincipal() once we receive data from the channel:

xul.dll!mozilla::MediaCacheStream::UpdatePrincipal(nsIPrincipal * aPrincipal=0x15b1d080) Line 1688	C++
xul.dll!mozilla::MediaCacheStream::NotifyDataReceived(__int64 aSize=28942, const char * aData=0x152f5f68, nsIPrincipal * aPrincipal=0x15b1d080) Line 1705	C++
xul.dll!mozilla::ChannelMediaResource::CopySegmentToCache(nsIInputStream * aInStream=0x167a4770, void * aClosure=0x00e1ecc0, const char * aFromSegment=0x152f5f68, unsigned int aToOffset=0, unsigned int aCount=28942, unsigned int * aWriteCount=0x00e1ec48) Line 486	C++
xul.dll!nsInputStreamTee::WriteSegmentFun(nsIInputStream * in=0x167a4770, void * closure=0x16cf5e08, const char * fromSegment=0x152f5f68, unsigned int offset=0, unsigned int count=28942, unsigned int * writeCount=0x00e1ec48) Line 200	C++
xul.dll!nsPipeInputStream::ReadSegments(tag_nsresult (nsIInputStream *, void *, const char *, unsigned int, unsigned int, unsigned int *) * writer=0x0fe91dfa, void * closure=0x16cf5e08, unsigned int count=28942, unsigned int * readCount=0x00e1ecb0) Line 780	C++
xul.dll!nsInputStreamTee::ReadSegments(tag_nsresult (nsIInputStream *, void *, const char *, unsigned int, unsigned int, unsigned int *) * writer=0x0ffd3c7c, void * closure=0x00e1ecc0, unsigned int count=28942, unsigned int * bytesRead=0x00e1ecb0) Line 258	C++
xul.dll!mozilla::ChannelMediaResource::OnDataAvailable(nsIRequest * aRequest=0x1683dd6c, nsIInputStream * aStream=0x16cf5e08, unsigned int aCount=28942) Line 513	C++
xul.dll!mozilla::ChannelMediaResource::Listener::OnDataAvailable(nsIRequest * aRequest=0x1683dd6c, nsISupports * aContext=0x00000000, nsIInputStream * aStream=0x16cf5e08, unsigned __int64 aOffset=0, unsigned int aCount=28942) Line 118	C++
xul.dll!mozilla::dom::HTMLMediaElement::MediaLoadListener::OnDataAvailable(nsIRequest * aRequest=0x1683dd6c, nsISupports * aContext=0x00000000, nsIInputStream * aStream=0x16cf5e08, unsigned __int64 aOffset=0, unsigned int aCount=28942) Line 387	C++
xul.dll!nsCORSListenerProxy::OnDataAvailable(nsIRequest * aRequest=0x1683dd6c, nsISupports * aContext=0x00000000, nsIInputStream * aInputStream=0x16cf5e08, unsigned __int64 aOffset=0, unsigned int aCount=28942) Line 676	C++
xul.dll!nsStreamListenerTee::OnDataAvailable(nsIRequest * request=0x1683dd6c, nsISupports * context=0x00000000, nsIInputStream * input=0x167a4770, unsigned __int64 offset=0, unsigned int count=28942) Line 93	C++
xul.dll!mozilla::net::nsHttpChannel::OnDataAvailable(nsIRequest * request=0x16fddaa8, nsISupports * ctxt=0x00000000, nsIInputStream * input=0x167a4770, unsigned __int64 offset=0, unsigned int count=28942) Line 5316	C++
xul.dll!nsInputStreamPump::OnStateTransfer() Line 593	C++
xul.dll!nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream * stream=0x167a4770) Line 434	C++
xul.dll!nsInputStreamReadyEvent::Run() Line 86	C++
xul.dll!nsThread::ProcessNextEvent(bool mayWait=false, bool * result=0x00e1f063) Line 646	C++
xul.dll!NS_ProcessNextEvent(nsIThread * thread=0x00f27970, bool mayWait=false) Line 263	C++
xul.dll!mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate * aDelegate=0x00f401e0) Line 95	C++
xul.dll!MessageLoop::RunInternal() Line 227	C++
xul.dll!MessageLoop::RunHandler() Line 220	C++
xul.dll!MessageLoop::Run() Line 194	C++
xul.dll!nsBaseAppShell::Run() Line 163	C++
xul.dll!nsAppShell::Run() Line 113	C++
xul.dll!nsAppStartup::Run() Line 276	C++
xul.dll!XREMain::XRE_mainRun() Line 4090	C++

Maybe we can set the principal earlier? Like in OnStartRequest?
(Assignee)

Comment 1

4 years ago
Created attachment 8369840 [details] [diff] [review]
Patch

Null check the principal to prevent us subsuming a nullptr principal before data has arrived and we've set the principal.
Assignee: nobody → cpearce
Status: NEW → ASSIGNED
Attachment #8369840 - Flags: review?(roc)
Comment on attachment 8369840 [details] [diff] [review]
Patch

Review of attachment 8369840 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/HTMLMediaElement.cpp
@@ +3362,1 @@
>      NS_SUCCEEDED(NodePrincipal()->Subsumes(principal, &subsumes)) && subsumes);

() around the && clause
Attachment #8369840 - Flags: review?(roc) → review+
https://hg.mozilla.org/mozilla-central/rev/a15aa9ce56e2
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.