Closed Bug 1238883 Opened 8 years ago Closed 8 years ago

[TV Browser] It shows "The page cannot be displayed" when user browse some webpages

Categories

(Firefox OS Graveyard :: Gaia::TV::Browser, defect, P3)

ARM
Gonk (Firefox OS)
defect

Tracking

(blocking-b2g:2.5+, b2g-v2.5 verified, b2g-master verified)

VERIFIED FIXED
blocking-b2g 2.5+
Tracking Status
b2g-v2.5 --- verified
b2g-master --- verified

People

(Reporter: cynthiatang, Assigned: JamesCheng)

References

Details

(Whiteboard: [ft:conndevices])

Attachments

(2 files, 1 obsolete file)

Attached image Screen Shot
STR:
 1. Launch Browser on real TV
 2. Open the webpage https://goo.gl/NUVhzb


Actual Result:
 - Strange window popped up. Please see the attachment.

Expected Result:
 - No strange window
This issue can be reproduced in Mulet.

Branch Master
Commit 8ceec0a370c015f1981ef02969adf8a4d87b0b9e
Merge: 0e47b10 59ac882
Author: Julien Wajsberg <felash@gmail.com>
Date:   Mon Jan 11 23:21:59 2016 +0100

    Merge pull request #33207 from julienw/1222344-force-reflow
    
    Bug 1222344 - Force a reflow in the test after setting up the CSS r=a…
Flags: needinfo?(yliao)
Summary: [TV Browser] → [TV Browser] It shows "The page cannot be displayed" when user browse some webpages
QA Whiteboard: [COM=TV Browser]
Flags: needinfo?(yliao)
Hi Kershaw, after discuss with SC, we will need your help on this issue.

The browser app will get a mozbrowsererror event with type:'other' while the video is playing correctly. Could you please help to identify the reason why this error is fired? Thanks!
Flags: needinfo?(kechang)
The error is coming from this line [1]. I think we need someone who is familiar with media to take a look.

[1] https://dxr.mozilla.org/mozilla-central/source/dom/media/MediaResource.cpp#683
Flags: needinfo?(kechang)
@kershaw: can you provide the full call stack? We can ask media team to help on this bug.
Here are some call stacks:
1. The call stack that passes NS_ERROR_PARSED_DATA_CACHED to BrowserElementChildPreload.js
XUL`nsDocLoader::DoFireOnStateChange(this=0x0000000121126000, aProgress=0x0000000121126000, aRequest=0x000000011ff56800, aStateFlags=0x00007fff5fbfd054, aStatus=2153578529) + 332 at nsDocLoader.cpp:1249, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x0000000103086cac XUL`nsDocLoader::DoFireOnStateChange(this=0x0000000121126000, aProgress=0x0000000121126000, aRequest=0x000000011ff56800, aStateFlags=0x00007fff5fbfd054, aStatus=2153578529) + 332 at nsDocLoader.cpp:1249
    frame #1: 0x000000010308623b XUL`nsDocLoader::FireOnStateChange(this=<unavailable>, aProgress=0x0000000121126000, aRequest=0x000000011ff56800, aStateFlags=65552, aStatus=2153578529) + 251 at nsDocLoader.cpp:1210
    frame #2: 0x0000000103086427 XUL`nsDocLoader::doStopURLLoad(this=0x0000000121126000, request=0x000000011ff56800, aStatus=2153578529) + 199 at nsDocLoader.cpp:788
    frame #3: 0x0000000103085fe7 XUL`nsDocLoader::OnStopRequest(this=0x0000000121126000, aRequest=0x000000011ff56800, aCtxt=<unavailable>, aStatus=2153578529) + 887 at nsDocLoader.cpp:594
    frame #4: 0x000000010308650d XUL`non-virtual thunk to nsDocLoader::OnStopRequest(this=<unavailable>, aRequest=<unavailable>, aCtxt=<unavailable>, aStatus=<unavailable>) + 13 at nsDocLoader.cpp:468
    frame #5: 0x0000000102659361 XUL`nsLoadGroup::RemoveRequest(this=0x000000011cd30100, request=0x000000011ff56800, ctxt=0x0000000000000000, aStatus=2153578529) + 1313 at nsLoadGroup.cpp:634
    frame #6: 0x0000000102869a22 XUL`mozilla::net::nsHttpChannel::OnStopRequest(this=0x000000011ff56800, request=<unavailable>, ctxt=<unavailable>, status=<unavailable>) + 1890 at nsHttpChannel.cpp:5945
    frame #7: 0x0000000102656663 XUL`nsInputStreamPump::OnStateStop(this=0x0000000128b1eec0) + 323 at nsInputStreamPump.cpp:715
    frame #8: 0x0000000102655aff XUL`nsInputStreamPump::OnInputStreamReady(this=0x0000000128b1eec0, stream=<unavailable>) + 367 at nsInputStreamPump.cpp:434
    frame #9: 0x00000001025648a9 XUL`nsInputStreamReadyEvent::Run(this=<unavailable>) + 41 at nsStreamUtils.cpp:94

2. Call stack before ChannelMediaResource::CloseChannel
frame #0: 0x000000010481d88e XUL`mozilla::ChannelMediaResource::CloseChannel(this=<unavailable>) + 286 at MediaResource.cpp:684
    frame #1: 0x000000010481e0c5 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=16809984, aResume=false) + 117 at MediaResource.cpp:932
    frame #2: 0x000000010478009c XUL`mozilla::MediaCache::Update(this=0x000000011f781110) + 4172 at MediaCache.cpp:1341
    frame #3: 0x00000001047cc5e5 XUL`mozilla::UpdateEvent::Run(this=<unavailable>) + 21 at MediaCache.cpp:1384
    frame #4: 0x00000001025822b7 XUL`nsThread::ProcessNextEvent(this=0x000000010061e600, aMayWait=<unavailable>, aResult=0x00007fff5fbfd627) + 1495 at nsThread.cpp:989

3. Things happened after ChannelMediaResource::CloseChannel
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481d899 XUL`mozilla::ChannelMediaResource::CloseChannel(this=<unavailable>) + 297 at MediaResource.cpp:685, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481d899 XUL`mozilla::ChannelMediaResource::CloseChannel(this=<unavailable>) + 297 at MediaResource.cpp:685
   682         // at the moment.
   683         printf_stderr("@@@@@@ NS_ERROR_PARSED_DATA_CACHED in CloseChannel\n");
   684         mChannel->Cancel(NS_ERROR_PARSED_DATA_CACHED);
-> 685         mChannel = nullptr;
   686       }
   687     }
   688
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481d8c9 XUL`mozilla::ChannelMediaResource::CloseChannel() [inlined] nsCOMPtr<nsIChannel>::operator=(this=<unavailable>) + 48 at nsCOMPtr.h:579, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481d8c9 XUL`mozilla::ChannelMediaResource::CloseChannel() [inlined] nsCOMPtr<nsIChannel>::operator=(this=<unavailable>) + 48 at nsCOMPtr.h:579
   576       nsCOMPtr<T>& operator=(T* aRhs)
   577       {
   578         assign_with_AddRef(aRhs);
-> 579         NSCAP_ASSERT_NO_QUERY_NEEDED();
   580         return *this;
   581       }
   582
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001025a2160 XUL`nsCOMPtr<nsIChannel>::Assert_NoQueryNeeded(this=0x0000000120c6a320) at nsCOMPtr.h:412, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001025a2160 XUL`nsCOMPtr<nsIChannel>::Assert_NoQueryNeeded(this=0x0000000120c6a320) at nsCOMPtr.h:412
   409
   410     #ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES
   411       void Assert_NoQueryNeeded()
-> 412       {
   413         if (mRawPtr) {
   414           nsCOMPtr<T> query_result(do_QueryInterface(mRawPtr));
   415           NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001025a216c XUL`nsCOMPtr<nsIChannel>::Assert_NoQueryNeeded(this=0x0000000120c6a320) + 12 at nsCOMPtr.h:413, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001025a216c XUL`nsCOMPtr<nsIChannel>::Assert_NoQueryNeeded(this=0x0000000120c6a320) + 12 at nsCOMPtr.h:413
   410     #ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES
   411       void Assert_NoQueryNeeded()
   412       {
-> 413         if (mRawPtr) {
   414           nsCOMPtr<T> query_result(do_QueryInterface(mRawPtr));
   415           NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
   416         }
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001025a2201 XUL`nsCOMPtr<nsIChannel>::Assert_NoQueryNeeded(this=<unavailable>) + 161 at nsCOMPtr.h:417, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001025a2201 XUL`nsCOMPtr<nsIChannel>::Assert_NoQueryNeeded(this=<unavailable>) + 161 at nsCOMPtr.h:417
   414           nsCOMPtr<T> query_result(do_QueryInterface(mRawPtr));
   415           NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
   416         }
-> 417       }
   418
   419       #define NSCAP_ASSERT_NO_QUERY_NEEDED() Assert_NoQueryNeeded();
   420     #else
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e0c5 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=16809984, aResume=false) + 117 at MediaResource.cpp:934, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e0c5 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=16809984, aResume=false) + 117 at MediaResource.cpp:934
   931
   932       CloseChannel();
   933
-> 934       mOffset = aOffset;
   935
   936       // Don't report close of the channel because the channel is not closed for
   937       // download ended, but for internal changes in the read position.
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e0c9 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=16809984, aResume=false) + 121 at MediaResource.cpp:938, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e0c9 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=16809984, aResume=false) + 121 at MediaResource.cpp:938
   935
   936       // Don't report close of the channel because the channel is not closed for
   937       // download ended, but for internal changes in the read position.
-> 938       mIgnoreClose = true;
   939
   940       if (aResume) {
   941         mSuspendAgent.Resume();
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e0cd XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=16809984, aResume=false) + 125 at MediaResource.cpp:940, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e0cd XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=16809984, aResume=false) + 125 at MediaResource.cpp:940
   937       // download ended, but for internal changes in the read position.
   938       mIgnoreClose = true;
   939
-> 940       if (aResume) {
   941         mSuspendAgent.Resume();
   942       }
   943
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e0de XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 142 at MediaResource.cpp:946, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e0de XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 142 at MediaResource.cpp:946
   943
   944       // Don't create a new channel if we are still suspended. The channel will
   945       // be recreated when we are resumed.
-> 946       if (mSuspendAgent.IsSuspended()) {
   947         return NS_OK;
   948       }
   949
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e0f5 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 165 at MediaResource.cpp:950, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e0f5 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 165 at MediaResource.cpp:950
   947         return NS_OK;
   948       }
   949
-> 950       nsresult rv = RecreateChannel();
   951       NS_ENSURE_SUCCESS(rv, rv);
   952
   953       return OpenChannel(nullptr);
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e100 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 176 at MediaResource.cpp:951, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e100 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 176 at MediaResource.cpp:951
   948       }
   949
   950       nsresult rv = RecreateChannel();
-> 951       NS_ENSURE_SUCCESS(rv, rv);
   952
   953       return OpenChannel(nullptr);
   954     }
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e107 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 183 at MediaResource.cpp:953, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e107 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=0x0000000120c6a300, aOffset=<unavailable>, aResume=<unavailable>) + 183 at MediaResource.cpp:953
   950       nsresult rv = RecreateChannel();
   951       NS_ENSURE_SUCCESS(rv, rv);
   952
-> 953       return OpenChannel(nullptr);
   954     }
   955
   956     void
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e114 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=<unavailable>, aOffset=<unavailable>, aResume=<unavailable>) + 196 at MediaResource.cpp:953, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e114 XUL`mozilla::ChannelMediaResource::CacheClientSeek(this=<unavailable>, aOffset=<unavailable>, aResume=<unavailable>) + 196 at MediaResource.cpp:953
   950       nsresult rv = RecreateChannel();
   951       NS_ENSURE_SUCCESS(rv, rv);
   952
-> 953       return OpenChannel(nullptr);
   954     }
   955
   956     void
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e9e0 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) at MediaResource.cpp:528, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e9e0 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) at MediaResource.cpp:528
   525     }
   526
   527     nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
-> 528     {
   529       NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
   530       NS_ENSURE_TRUE(mChannel, NS_ERROR_NULL_POINTER);
   531       NS_ASSERTION(!mListener, "Listener should have been removed by now");
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481e9f3 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 19 at MediaResource.cpp:529, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481e9f3 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 19 at MediaResource.cpp:529
   526
   527     nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
   528     {
-> 529       NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
   530       NS_ENSURE_TRUE(mChannel, NS_ERROR_NULL_POINTER);
   531       NS_ASSERTION(!mListener, "Listener should have been removed by now");
   532
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ea21 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 65 at MediaResource.cpp:530, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ea21 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 65 at MediaResource.cpp:530
   527     nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
   528     {
   529       NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
-> 530       NS_ENSURE_TRUE(mChannel, NS_ERROR_NULL_POINTER);
   531       NS_ASSERTION(!mListener, "Listener should have been removed by now");
   532
   533       if (aStreamListener) {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ea2c XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 76 at MediaResource.cpp:531, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ea2c XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 76 at MediaResource.cpp:531
   528     {
   529       NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
   530       NS_ENSURE_TRUE(mChannel, NS_ERROR_NULL_POINTER);
-> 531       NS_ASSERTION(!mListener, "Listener should have been removed by now");
   532
   533       if (aStreamListener) {
   534         *aStreamListener = nullptr;
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ea58 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 120 at MediaResource.cpp:533, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ea58 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 120 at MediaResource.cpp:533
   530       NS_ENSURE_TRUE(mChannel, NS_ERROR_NULL_POINTER);
   531       NS_ASSERTION(!mListener, "Listener should have been removed by now");
   532
-> 533       if (aStreamListener) {
   534         *aStreamListener = nullptr;
   535       }
   536
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ea64 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 132 at MediaResource.cpp:537, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ea64 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 132 at MediaResource.cpp:537
   534         *aStreamListener = nullptr;
   535       }
   536
-> 537       if (mByteRange.IsEmpty()) {
   538         // We're not making a byte range request, so set the content length,
   539         // if it's available as an HTTP header. This ensures that MediaResource
   540         // wrapping objects for platform libraries that expect to know
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ea78 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 152 at MediaResource.cpp:542, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ea78 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 152 at MediaResource.cpp:542
   539         // if it's available as an HTTP header. This ensures that MediaResource
   540         // wrapping objects for platform libraries that expect to know
   541         // the length of a resource can get it before OnStartRequest() fires.
-> 542         nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
   543         if (hc) {
   544           int64_t cl = -1;
   545           if (NS_SUCCEEDED(hc->GetContentLength(&cl)) && cl != -1) {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ead8 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 248 at MediaResource.cpp:543, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ead8 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 248 at MediaResource.cpp:543
   540         // wrapping objects for platform libraries that expect to know
   541         // the length of a resource can get it before OnStartRequest() fires.
   542         nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
-> 543         if (hc) {
   544           int64_t cl = -1;
   545           if (NS_SUCCEEDED(hc->GetContentLength(&cl)) && cl != -1) {
   546             mCacheStream.NotifyDataLength(cl);
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481eae1 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 257 at MediaResource.cpp:544, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481eae1 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 257 at MediaResource.cpp:544
   541         // the length of a resource can get it before OnStartRequest() fires.
   542         nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
   543         if (hc) {
-> 544           int64_t cl = -1;
   545           if (NS_SUCCEEDED(hc->GetContentLength(&cl)) && cl != -1) {
   546             mCacheStream.NotifyDataLength(cl);
   547           }
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481eae9 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 265 at MediaResource.cpp:545, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481eae9 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 265 at MediaResource.cpp:545
   542         nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
   543         if (hc) {
   544           int64_t cl = -1;
-> 545           if (NS_SUCCEEDED(hc->GetContentLength(&cl)) && cl != -1) {
   546             mCacheStream.NotifyDataLength(cl);
   547           }
   548         }
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481eb0d XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 301 at MediaResource.cpp:549, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481eb0d XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 301 at MediaResource.cpp:549
   546             mCacheStream.NotifyDataLength(cl);
   547           }
   548         }
-> 549       }
   550
   551       mListener = new Listener(this);
   552       if (aStreamListener) {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481eb9d XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 445 at MediaResource.cpp:552, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481eb9d XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=0x0000000000000000) + 445 at MediaResource.cpp:552
   549       }
   550
   551       mListener = new Listener(this);
-> 552       if (aStreamListener) {
   553         *aStreamListener = mListener;
   554         NS_ADDREF(*aStreamListener);
   555       } else {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ebb4 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 468 at MediaResource.cpp:556, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ebb4 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 468 at MediaResource.cpp:556
   553         *aStreamListener = mListener;
   554         NS_ADDREF(*aStreamListener);
   555       } else {
-> 556         nsresult rv = mChannel->SetNotificationCallbacks(mListener.get());
   557         NS_ENSURE_SUCCESS(rv, rv);
   558
   559         rv = SetupChannelHeaders();
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ebdc XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 508 at MediaResource.cpp:557, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ebdc XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 508 at MediaResource.cpp:557
   554         NS_ADDREF(*aStreamListener);
   555       } else {
   556         nsresult rv = mChannel->SetNotificationCallbacks(mListener.get());
-> 557         NS_ENSURE_SUCCESS(rv, rv);
   558
   559         rv = SetupChannelHeaders();
   560         NS_ENSURE_SUCCESS(rv, rv);
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ebe5 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 517 at MediaResource.cpp:559, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ebe5 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 517 at MediaResource.cpp:559
   556         nsresult rv = mChannel->SetNotificationCallbacks(mListener.get());
   557         NS_ENSURE_SUCCESS(rv, rv);
   558
-> 559         rv = SetupChannelHeaders();
   560         NS_ENSURE_SUCCESS(rv, rv);
   561
   562         rv = mChannel->AsyncOpen2(mListener);
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ebf0 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 528 at MediaResource.cpp:560, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ebf0 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 528 at MediaResource.cpp:560
   557         NS_ENSURE_SUCCESS(rv, rv);
   558
   559         rv = SetupChannelHeaders();
-> 560         NS_ENSURE_SUCCESS(rv, rv);
   561
   562         rv = mChannel->AsyncOpen2(mListener);
   563         NS_ENSURE_SUCCESS(rv, rv);
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ebf9 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 537 at MediaResource.cpp:562, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ebf9 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 537 at MediaResource.cpp:562
   559         rv = SetupChannelHeaders();
   560         NS_ENSURE_SUCCESS(rv, rv);
   561
-> 562         rv = mChannel->AsyncOpen2(mListener);
   563         NS_ENSURE_SUCCESS(rv, rv);
   564
   565         // Tell the media element that we are fetching data from a channel.
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ec16 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 566 at MediaResource.cpp:563, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ec16 XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 566 at MediaResource.cpp:563
   560         NS_ENSURE_SUCCESS(rv, rv);
   561
   562         rv = mChannel->AsyncOpen2(mListener);
-> 563         NS_ENSURE_SUCCESS(rv, rv);
   564
   565         // Tell the media element that we are fetching data from a channel.
   566         MediaDecoderOwner* owner = mCallback->GetMediaOwner();
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ec1f XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 575 at MediaResource.cpp:566, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ec1f XUL`mozilla::ChannelMediaResource::OpenChannel(this=0x0000000120c6a300, aStreamListener=<unavailable>) + 575 at MediaResource.cpp:566
   563         NS_ENSURE_SUCCESS(rv, rv);
   564
   565         // Tell the media element that we are fetching data from a channel.
-> 566         MediaDecoderOwner* owner = mCallback->GetMediaOwner();
   567         NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
   568         dom::HTMLMediaElement* element = owner->GetMediaElement();
   569         element->DownloadResumed(true);
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ec31 XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 593 at MediaResource.cpp:567, queue = 'com.apple.main-thread', stop reason = step over
Return value: (mozilla::MediaDecoderOwner *) $5 = 0x000000011234a0a0

    frame #0: 0x000000010481ec31 XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 593 at MediaResource.cpp:567
   564
   565         // Tell the media element that we are fetching data from a channel.
   566         MediaDecoderOwner* owner = mCallback->GetMediaOwner();
-> 567         NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
   568         dom::HTMLMediaElement* element = owner->GetMediaElement();
   569         element->DownloadResumed(true);
   570       }
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ec3a XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 602 at MediaResource.cpp:568, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ec3a XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 602 at MediaResource.cpp:568
   565         // Tell the media element that we are fetching data from a channel.
   566         MediaDecoderOwner* owner = mCallback->GetMediaOwner();
   567         NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
-> 568         dom::HTMLMediaElement* element = owner->GetMediaElement();
   569         element->DownloadResumed(true);
   570       }
   571
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ec48 XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 616 at MediaResource.cpp:569, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ec48 XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 616 at MediaResource.cpp:569
   566         MediaDecoderOwner* owner = mCallback->GetMediaOwner();
   567         NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
   568         dom::HTMLMediaElement* element = owner->GetMediaElement();
-> 569         element->DownloadResumed(true);
   570       }
   571
   572       return NS_OK;
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010481ec53 XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 627 at MediaResource.cpp:573, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010481ec53 XUL`mozilla::ChannelMediaResource::OpenChannel(this=<unavailable>, aStreamListener=<unavailable>) + 627 at MediaResource.cpp:573
   570       }
   571
   572       return NS_OK;
-> 573     }
   574
   575     nsresult ChannelMediaResource::SetupChannelHeaders()
   576     {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010478009c XUL`mozilla::MediaCache::Update(this=0x000000011f781110) + 4172 at MediaCache.cpp:1341, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010478009c XUL`mozilla::MediaCache::Update(this=0x000000011f781110) + 4172 at MediaCache.cpp:1341
   1338        case SEEK_AND_RESUME:
   1339          CACHE_LOG(LogLevel::Debug, ("Stream %p CacheSeek to %lld (resume=%d)", stream,
   1340                    (long long)stream->mChannelOffset, actions[i] == SEEK_AND_RESUME));
-> 1341          rv = stream->mClient->CacheClientSeek(stream->mChannelOffset,
   1342                                                actions[i] == SEEK_AND_RESUME);
   1343          break;
   1344        case RESUME:
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x0000000104780220 XUL`mozilla::MediaCache::Update(this=0x000000011f781110) + 4560 at MediaCache.cpp:1359, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000104780220 XUL`mozilla::MediaCache::Update(this=0x000000011f781110) + 4560 at MediaCache.cpp:1359
   1356          break;
   1357        }
   1358
-> 1359        if (NS_FAILED(rv)) {
   1360          // Close the streams that failed due to error. This will cause all
   1361          // client Read and Seek operations on those streams to fail. Blocked
   1362          // Reads will also be woken up.
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010478022c XUL`mozilla::MediaCache::Update(this=0x000000011f781110) + 4572 at MediaCache.cpp:1333, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010478022c XUL`mozilla::MediaCache::Update(this=0x000000011f781110) + 4572 at MediaCache.cpp:1333
   1330        stream->mHasHadUpdate = true;
   1331      }
   1332
-> 1333      for (uint32_t i = 0; i < mStreams.Length(); ++i) {
   1334        MediaCacheStream* stream = mStreams[i];
   1335        nsresult rv;
   1336        switch (actions[i]) {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x0000000104780253 XUL`mozilla::MediaCache::Update() [inlined] nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyWithMemutils>::Length() const + 3 at nsTArray.h:367, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000104780253 XUL`mozilla::MediaCache::Update() [inlined] nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyWithMemutils>::Length() const + 3 at nsTArray.h:367
   364       typedef size_t index_type;
   365
   366       // @return The number of elements in the array.
-> 367       size_type Length() const { return mHdr->mLength; }
   368
   369       // @return True if the array is empty or false otherwise.
   370       bool IsEmpty() const { return Length() == 0; }
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x000000010478025a XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4618 at MediaCache.cpp:1369, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010478025a XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4618 at MediaCache.cpp:1369
   1366      }
   1367
   1368      // Notify streams about the suspended status changes.
-> 1369      for (uint32_t i = 0; i < mSuspendedStatusToNotify.Length(); ++i) {
   1370        MediaCache::ResourceStreamIterator iter(mSuspendedStatusToNotify[i]);
   1371        while (MediaCacheStream* stream = iter.Next()) {
   1372          stream->mClient->CacheClientNotifySuspendedStatusChanged();
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001047802c8 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4728 at MediaCache.cpp:1375, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001047802c8 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4728 at MediaCache.cpp:1375
   1372          stream->mClient->CacheClientNotifySuspendedStatusChanged();
   1373        }
   1374      }
-> 1375      mSuspendedStatusToNotify.Clear();
   1376    }
   1377
   1378    class UpdateEvent : public nsRunnable
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001047802d0 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4736 at MediaCache.cpp:1376, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001047802d0 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4736 at MediaCache.cpp:1376
   1373        }
   1374      }
   1375      mSuspendedStatusToNotify.Clear();
-> 1376    }
   1377
   1378    class UpdateEvent : public nsRunnable
   1379    {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001047802f4 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4772 at MediaCache.cpp:1043, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001047802f4 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4772 at MediaCache.cpp:1043
   1040      // decisions while holding the cache lock but implement those decisions
   1041      // without holding the cache lock, since we need to call out to
   1042      // stream, decoder and element code.
-> 1043      nsAutoTArray<StreamAction,10> actions;
   1044
   1045      {
   1046        ReentrantMonitorAutoEnter mon(mReentrantMonitor);
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001047802f8 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4776 at MediaCache.cpp:1376, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001047802f8 XUL`mozilla::MediaCache::Update(this=<unavailable>) + 4776 at MediaCache.cpp:1376
   1373        }
   1374      }
   1375      mSuspendedStatusToNotify.Clear();
-> 1376    }
   1377
   1378    class UpdateEvent : public nsRunnable
   1379    {
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001047cc5e5 XUL`mozilla::UpdateEvent::Run(this=0x0000000000000103) + 21 at MediaCache.cpp:1384, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001047cc5e5 XUL`mozilla::UpdateEvent::Run(this=0x0000000000000103) + 21 at MediaCache.cpp:1384
   1381      NS_IMETHOD Run()
   1382      {
   1383        if (gMediaCache) {
-> 1384          gMediaCache->Update();
   1385        }
   1386        return NS_OK;
   1387      }
(lldb) n
Process 33716 stopped
* thread #1: tid = 0x30e253, 0x00000001047cc5e7 XUL`mozilla::UpdateEvent::Run(this=0x0000000000000103) + 23 at MediaCache.cpp:1386, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x00000001047cc5e7 XUL`mozilla::UpdateEvent::Run(this=0x0000000000000103) + 23 at MediaCache.cpp:1386
   1383        if (gMediaCache) {
   1384          gMediaCache->Update();
   1385        }
-> 1386        return NS_OK;
   1387      }
   1388    };
   1389
@blake can you assign someone to take a look at this issue. It can also be reproduce on b2g desktop with TV Gaia.

The reproduce step is fairly simple: use TV browser app and open https://people.mozilla.org/~mfinkle/casting/Mobile-launch-greatday640.mp4.
Flags: needinfo?(bwu)
James, 
Can you help check this bug first?
Thanks! If you need any help, JW is the best guy you can consult with. :)
Flags: needinfo?(bwu) → needinfo?(jacheng)
Sorry for the late response,

Kershaw and me just saw some different call flow between normal case and abnormal dialog pop-up case
We list the key call flow as below,

(1) Abnormal case(the dialog pop-up as attachment shown)

The scenario will invoke
void ChannelMediaResource::CloseChannel()
and callback the
mChannel->Cancel(NS_ERROR_PARSED_DATA_CACHED); with error code.
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/dom/media/MediaResource.cpp#683


It will invoke
nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status)
and callback with status = 805d0021(NS_ERROR_PARSED_DATA_CACHED)
mLoadGroup->RemoveRequest(this, nullptr, status);
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/protocol/http/nsHttpChannel.cpp#5962


nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
                           nsresult aStatus)
nsLoadFlags flags;
rv = request->GetLoadFlags(&flags);

will get 0x20400040 without LOAD_BACKGROUND(0x1) contains...
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#621

thus, this statement will be true
if (!(flags & nsIRequest::LOAD_BACKGROUND)) {
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#624
and it will trigger the observer with error status(NS_ERROR_PARSED_DATA_CACHED)
rv = observer->OnStopRequest(request, ctxt, aStatus);
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#634

Eventually it will trigger
sendAsyncMsg('error', { type: 'other' }); in BrowserElementChildPreload.js
The dialog pops up...
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/dom/browser-element/BrowserElementChildPreload.js#1996

I found that this function
void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground)
will be invoked later with aLoadInBackground=true and the mChannel will be null.
if (!mChannel) {
    // No channel, resource is probably already loaded.
    return;
  }






(2) Normal case

void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground) {
will be invoked first and

if (aLoadInBackground) {
      loadFlags |= nsIRequest::LOAD_BACKGROUND;
    }
will be set (loadFlags=0x20400041) with LOAD_BACKGROUND contains.
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/dom/media/MediaResource.cpp#1587


and the following calling sequence is the same as abnormal case from 
void ChannelMediaResource::CloseChannel().

But
if (!(flags & nsIRequest::LOAD_BACKGROUND)) {
will not enter(since above flag is set), so the error will stop to propagate.
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#624




It can be reproduced on Mulet[3], and the test samples are [1] [2]

[1] Normal case test mp4 sample.
http://goo.gl/BKea4w

[2] Abnormal case test mp4 sample
https://goo.gl/NUVhzb

[3] How to setup Mulet.
https://wiki.mozilla.org/Mulet
Flags: needinfo?(jacheng)
Hi JW,

I am not quiet understand the calling sequence between these two test samples. Why it will "always" cause the timing issue which means the |BaseMediaResource::SetLoadInBackground| comes "after" the error code propagation.

Once we can make BaseMediaResource::SetLoadInBackground comes first and set the flag(LOAD_BACKGROUND)

This issue might be fixed.

Do you have any idea or possible solution for this?

Thank you.
Flags: needinfo?(jwwang)
Assign to James first because he is investigating. Feel free to redirect to others if you've done your part. Thanks.
Assignee: nobody → jacheng
Not familiar with the netwerk stack. roc is the better person to answer this.

Hi roc,
Can you comment the findings in comment 8?
Flags: needinfo?(jwwang) → needinfo?(roc)
blocking-b2g: --- → 2.5+
Hi roc,

You mean that I can just return when bumped into this case |NS_ERROR_PARSED_DATA_CACHED| as this patch wrote?

Could you review this patch or please recommend someone who can review this modification in BrowserElementChildPreload.js?

Thank you very much.
Attachment #8714180 - Flags: feedback?(roc)
(In reply to James Cheng[:JamesCheng] from comment #8)
> Sorry for the late response,
> 
> Kershaw and me just saw some different call flow between normal case and
> abnormal dialog pop-up case
> We list the key call flow as below,
> 
> (1) Abnormal case(the dialog pop-up as attachment shown)
> 
> The scenario will invoke
> void ChannelMediaResource::CloseChannel()
> and callback the
> mChannel->Cancel(NS_ERROR_PARSED_DATA_CACHED); with error code.
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/dom/media/MediaResource.cpp#683
> 

May I know where |ChannelMediaResource::CloseChannel| is being called ?

|BaseMediaResource::SetLoadInBackground| is triggered from |HTMLMediaElement::ChangeDelayLoadStatus|, is there any chance that the scenario is caused due to different treatment in HTMLMediaElement.
I found that there is difference in response header between Normal case (with "Cache-Control") and Abnormal case (w/o "Cache-Control").  I'm not sure if it will impact or not.  Just my observation. 

> 
> It will invoke
> nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
> nsresult status)
> and callback with status = 805d0021(NS_ERROR_PARSED_DATA_CACHED)
> mLoadGroup->RemoveRequest(this, nullptr, status);
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/protocol/http/nsHttpChannel.
> cpp#5962
> 
> 
> nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt,
>                            nsresult aStatus)
> nsLoadFlags flags;
> rv = request->GetLoadFlags(&flags);
> 
> will get 0x20400040 without LOAD_BACKGROUND(0x1) contains...
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#621
> 
> thus, this statement will be true
> if (!(flags & nsIRequest::LOAD_BACKGROUND)) {
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#624
> and it will trigger the observer with error
> status(NS_ERROR_PARSED_DATA_CACHED)
> rv = observer->OnStopRequest(request, ctxt, aStatus);
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#634
> 
> Eventually it will trigger
> sendAsyncMsg('error', { type: 'other' }); in BrowserElementChildPreload.js
> The dialog pops up...
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/dom/browser-element/
> BrowserElementChildPreload.js#1996
> 
> I found that this function
> void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground)
> will be invoked later with aLoadInBackground=true and the mChannel will be
> null.
> if (!mChannel) {
>     // No channel, resource is probably already loaded.
>     return;
>   }
> 
> 
> 
> 
> 
> 
> (2) Normal case
> 
> void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground) {
> will be invoked first and
> 
> if (aLoadInBackground) {
>       loadFlags |= nsIRequest::LOAD_BACKGROUND;
>     }
> will be set (loadFlags=0x20400041) with LOAD_BACKGROUND contains.
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/dom/media/MediaResource.cpp#1587
> 
> 
> and the following calling sequence is the same as abnormal case from 
> void ChannelMediaResource::CloseChannel().
> 
> But
> if (!(flags & nsIRequest::LOAD_BACKGROUND)) {
> will not enter(since above flag is set), so the error will stop to propagate.
> https://dxr.mozilla.org/mozilla-central/rev/
> aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/netwerk/base/nsLoadGroup.cpp#624
> 
> 
> 
> 
> It can be reproduced on Mulet[3], and the test samples are [1] [2]
> 
> [1] Normal case test mp4 sample.
> http://goo.gl/BKea4w
> 
> [2] Abnormal case test mp4 sample
> https://goo.gl/NUVhzb
> 
> [3] How to setup Mulet.
> https://wiki.mozilla.org/Mulet
(In reply to Kilik Kuo [:kikuo][:kilikkuo] from comment #14)
> (In reply to James Cheng[:JamesCheng] from comment #8)
> > Sorry for the late response,
> > 
> > Kershaw and me just saw some different call flow between normal case and
> > abnormal dialog pop-up case
> > We list the key call flow as below,
> > 
> > (1) Abnormal case(the dialog pop-up as attachment shown)
> > 
> > The scenario will invoke
> > void ChannelMediaResource::CloseChannel()
> > and callback the
> > mChannel->Cancel(NS_ERROR_PARSED_DATA_CACHED); with error code.
> > https://dxr.mozilla.org/mozilla-central/rev/
> > aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/dom/media/MediaResource.cpp#683
> > 
> 
> May I know where |ChannelMediaResource::CloseChannel| is being called ?
> 
> |BaseMediaResource::SetLoadInBackground| is triggered from
> |HTMLMediaElement::ChangeDelayLoadStatus|, is there any chance that the
> scenario is caused due to different treatment in HTMLMediaElement.
> I found that there is difference in response header between Normal case
> (with "Cache-Control") and Abnormal case (w/o "Cache-Control").  I'm not
> sure if it will impact or not.  Just my observation. 
> 
Hi Kilik,

I put these two samples into Dropbox with the same condition and to see the |cache-control = max-age=0| in the response header.

This issue can also be reproduced.

Maybe |NS_ERROR_PARSED_DATA_CACHED| is not really an error but a status...
I am kinda curious why we don't treat NS_ERROR_PARSED_DATA_CACHED as an error when load is in the background?
Comment on attachment 8714180 [details] [diff] [review]
Bug-1238883-TV-Browser-It-shows-The-page-cannot-be-d.patch

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

I think this is right.
Attachment #8714180 - Flags: feedback?(roc) → feedback+
(In reply to JW Wang [:jwwang] from comment #16)
> I am kinda curious why we don't treat NS_ERROR_PARSED_DATA_CACHED as an
> error when load is in the background?

No errors are forwarded for background loads. I think the idea is that browsers should not show errors in background loads.
Thanks for the feedback.

Could you please review the patch?

Thank you~
Attachment #8714180 - Attachment is obsolete: true
Attachment #8714703 - Flags: review?(roc)
Keywords: checkin-needed
Comment on attachment 8714703 [details] [diff] [review]
Bug-1238883-TV-Browser-It-shows-The-page-cannot-be-d.patch

[Triage Comment]
Attachment #8714703 - Flags: approval-gaia-v2.5+ → approval‑mozilla‑b2g44+
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: