flypig.co.uk

List items

Items from the current list are shown below.

Gecko

15 Oct 2023 : Day 60 #
Yesterday I put you through backtrace after backtrace, in the hope of in the hope of understanding why the mIsActive flag was being unset. This flag is critical in the render pipeline because when it's unset, simply put, all of the rendering will be skipped.

We didn't get to the bottom of it yesterday so I'm continuing today. I have to warn you in advance that there will be a lot more backtraces today. I mean a lot. This may be one to skip.

We want to know why the value is being set to false. This will most likely be happening as a result of a call to PresShell::SetIsActive() with the parameter set to false. There are four calls to this method when rendering a simple page with ESR 78. In all cases the aIsActive parameter is passed in as true.

Here are all for of the ESR 78 calls to PresShell::SetIsActive() identified by the debugger break points. Two of them have problematic backtraces, but are still valid hits. You can also see from these that the aIsActive input parameter is set to true for all of these calls.
Thread 10 "GeckoWorkerThre" hit Breakpoint 2, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7fb87b2b90, aIsActive=true)
    at layout/base/PresShell.cpp:10724
10724   nsresult PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7fb87b2b90, aIsActive=true)
    at layout/base/PresShell.cpp:10724
#1  0x0000007ff4223770 in mozilla::PresShell::QueryIsActive
    (this=this@entry=0x7fb87b2b90)
    at layout/base/PresShell.cpp:10709
#2  0x0000007ff424065c in mozilla::PresShell::Init (
dwarf2read.c:10473: internal-error: process_die_scope::process_die_scope
    (die_info*, dwarf2_cu*): Assertion `!m_die->in_process' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

Thread 10 "GeckoWorkerThre" hit Breakpoint 2, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7fb87b2b90, aIsActive=aIsActive@entry=true)
    at layout/base/PresShell.cpp:10724
10724   nsresult PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7fb87b2b90,
    aIsActive=aIsActive@entry=true)
    at layout/base/PresShell.cpp:10724
#1  0x0000007ff4acae90 in nsDocShell::SetIsActive (this=0x7fb90793d0, aIsActive=true)
    at docshell/base/nsDocShell.cpp:4607
#2  0x0000007ff4d9291c in mozilla::embedlite::EmbedLiteViewChild::RecvSetIsActive
    (this=0x7fb9070f10, aIsActive=@0x7fde8d68f0: true)
    at mobile/sailfishos/embedshared/EmbedLiteViewChild.cpp:623
#3  0x0000007ff23d3a00 in mozilla::embedlite::PEmbedLiteViewChild::
    OnMessageReceived (this=0x7fb9070f10, msg__=...) at PEmbedLiteViewChild.cpp:1158
[...]
#26 0x0000007fef65b89c in ?? () from /lib64/libc.so.6
(gdb) 

Thread 10 "GeckoWorkerThre" hit Breakpoint 2, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7fb93ef050, aIsActive=true)
    at layout/base/PresShell.cpp:10724
10724   nsresult PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7fb93ef050, aIsActive=true)
    at layout/base/PresShell.cpp:10724
#1  0x0000007ff4223770 in mozilla::PresShell::QueryIsActive
    (this=this@entry=0x7fb93ef050)
    at layout/base/PresShell.cpp:10709
#2  0x0000007ff424065c in mozilla::PresShell::Init (
dwarf2read.c:10473: internal-error: process_die_scope::process_die_scope
    (die_info*, dwarf2_cu*): Assertion `!m_die->in_process' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

Thread 10 "GeckoWorkerThre" hit Breakpoint 2, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7fb93ef050, aIsActive=aIsActive@entry=true)
    at layout/base/PresShell.cpp:10724
10724   nsresult PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7fb93ef050,
    aIsActive=aIsActive@entry=true)
    at layout/base/PresShell.cpp:10724
#1  0x0000007ff4ac3fa4 in nsDocShell::SetupNewViewer (this=this@entry=0x7fb90793d0, aNewViewer=aNewViewer@entry=0x7fb93cc1d0, 
    aWindowActor=aWindowActor@entry=0x0) at docshell/base/nsDocShell.cpp:7879
#2  0x0000007ff4acd75c in nsDocShell::Embed (this=this@entry=0x7fb90793d0,
    aContentViewer=0x7fb93cc1d0, aWindowActor=aWindowActor@entry=0x0)
    at docshell/base/nsDocShell.cpp:5441
#3  0x0000007ff4add358 in nsDocShell::CreateContentViewer (this=0x7fb90793d0,
    aContentType=..., aRequest=0x7fb926aa60, aContentHandler=<optimized out>)
    at docshell/base/nsDocShell.cpp:7662
#4  0x0000007ff4adde80 in nsDSURIContentListener::DoContent
    (this=this@entry=0x5555deec70, aContentType=..., 
    aIsContentPreferred=aIsContentPreferred@entry=false,
    aRequest=aRequest@entry=0x7fb926aa60, aContentHandler=0x7fb92b8ef0, 
    aAbortProcess=aAbortProcess@entry=0x7fde8d68a0)
    at docshell/base/nsDSURIContentListener.cpp:178
#5  0x0000007ff27af350 in nsDocumentOpenInfo::TryContentListener
    (this=0x7fb92b8ed0, aListener=0x5555deec70, aChannel=0x7fb926aa60)
    at obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:1351
[...]
#31 0x0000007fef65b89c in ?? () from /lib64/libc.so.6
(gdb) 
Now let's compare those to the equivalent calls to PresShell::SetIsActive() in ESR 91. There are five of these with backtraces that are very different to those for ESR 78. In all but one case the aIsActive input parameter is set to false.
Thread 8 "GeckoWorkerThre" hit Breakpoint 1, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7f889b5330, aIsActive=false)
    at layout/base/PresShell.cpp:10865
10865	void PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7f889b5330, aIsActive=false)
    at layout/base/PresShell.cpp:10865
#1  0x0000007fbc2236d0 in mozilla::PresShell::ActivenessMaybeChanged
    (this=this@entry=0x7f889b5330)
    at layout/base/PresShell.cpp:10794
#2  0x0000007fbc247da4 in mozilla::PresShell::Init (this=this@entry=0x7f889b5330, aPresContext=aPresContext@entry=0x7f885e1760, 
    aViewManager=aViewManager@entry=0x7f885e22f0) at layout/base/PresShell.cpp:1035
#3  0x0000007fbab910ac in mozilla::dom::Document::CreatePresShell
    (this=0x7f885dbc50, aContext=0x7f885e1760, aViewManager=0x7f885e22f0)
    at dom/base/Document.cpp:6637
#4  0x0000007fbc27b7bc in nsDocumentViewer::InitPresentationStuff
    (this=this@entry=0x7f885dd490, aDoInitialReflow=aDoInitialReflow@entry=false)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/RefPtr.h:289
#5  0x0000007fbc27d4c0 in nsDocumentViewer::InitInternal (this=0x7f885dd490,
    aParentWidget=<optimized out>, aState=aState@entry=0x0, aActor=0x0, 
    aBounds=..., aDoCreation=aDoCreation@entry=true, aNeedMakeCX=aNeedMakeCX@entry=true, aForceSetNewDocument=aForceSetNewDocument@entry=true)
    at layout/base/nsDocumentViewer.cpp:913
#6  0x0000007fbc27d68c in nsDocumentViewer::Init (this=<optimized out>,
    aParentWidget=<optimized out>, aBounds=..., aActor=<optimized out>)
    at layout/base/nsDocumentViewer.cpp:682
#7  0x0000007fbc969a04 in nsDocShell::SetupNewViewer (this=this@entry=0x7f885da880, aNewViewer=aNewViewer@entry=0x7f885dd490, 
    aWindowActor=aWindowActor@entry=0x0)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:859
#8  0x0000007fbc96e728 in nsDocShell::Embed (this=this@entry=0x7f885da880,
    aContentViewer=0x7f885dd490, aWindowActor=aWindowActor@entry=0x0, 
    aIsTransientAboutBlank=aIsTransientAboutBlank@entry=true,
    aPersist=aPersist@entry=false)
    at docshell/base/nsDocShell.cpp:5552
#9  0x0000007fbc96eb9c in nsDocShell::CreateAboutBlankContentViewer
    (this=this@entry=0x7f885da880, aPrincipal=aPrincipal@entry=0x0, 
    aPartitionedPrincipal=aPartitionedPrincipal@entry=0x0, aCSP=<optimized out>,
    aBaseURI=0x0, aCOEP=..., aTryToSaveOldPresentation=<optimized out>, 
    aTryToSaveOldPresentation@entry=true,
    aCheckPermitUnload=aCheckPermitUnload@entry=true, aActor=<optimized out>,
    aActor@entry=0x0)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:859
#10 0x0000007fbc96f008 in nsDocShell::EnsureContentViewer
    (this=this@entry=0x7f885da880)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/MaybeStorageBase.h:79
#11 0x0000007fbc96f9d8 in nsDocShell::GetDocument (this=0x7f885da880) at
    docshell/base/nsDocShell.cpp:3053
#12 0x0000007fbaad8780 in nsPIDOMWindowOuter::MaybeCreateDoc (this=<optimized out>)
    at dom/base/nsGlobalWindowOuter.cpp:7678
#13 0x0000007fbaad8aa4 in non-virtual thunk to nsGlobalWindowOuter::
    WrapObject(JSContext*, JS::Handle<JSObject*>) ()
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/js/HeapAPI.h:727
[...]
#47 0x0000007fb79cf89c in ?? () from /lib64/libc.so.6
(gdb) 

Thread 8 "GeckoWorkerThre" hit Breakpoint 1, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7f889b5330, aIsActive=false)
    at layout/base/PresShell.cpp:10865
10865	void PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7f889b5330, aIsActive=false)
    at layout/base/PresShell.cpp:10865
#1  0x0000007fbc2236d0 in mozilla::PresShell::ActivenessMaybeChanged
    (this=this@entry=0x7f889b5330)
    at layout/base/PresShell.cpp:10794
#2  0x0000007fbc969a54 in nsDocShell::SetupNewViewer (this=this@entry=0x7f885da880, aNewViewer=aNewViewer@entry=0x7f885dd490, 
    aWindowActor=aWindowActor@entry=0x0) at docshell/base/nsDocShell.cpp:8058
#3  0x0000007fbc96e728 in nsDocShell::Embed (this=this@entry=0x7f885da880,
    aContentViewer=0x7f885dd490, aWindowActor=aWindowActor@entry=0x0, 
    aIsTransientAboutBlank=aIsTransientAboutBlank@entry=true, aPersist=aPersist@entry=false)
    at docshell/base/nsDocShell.cpp:5552
#4  0x0000007fbc96eb9c in nsDocShell::CreateAboutBlankContentViewer
    (this=this@entry=0x7f885da880, aPrincipal=aPrincipal@entry=0x0, 
    aPartitionedPrincipal=aPartitionedPrincipal@entry=0x0, aCSP=<optimized out>,
    aBaseURI=0x0, aCOEP=..., aTryToSaveOldPresentation=<optimized out>, 
    aTryToSaveOldPresentation@entry=true,
    aCheckPermitUnload=aCheckPermitUnload@entry=true, aActor=<optimized out>,
    aActor@entry=0x0)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:859
#5  0x0000007fbc96f008 in nsDocShell::EnsureContentViewer
    (this=this@entry=0x7f885da880)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/MaybeStorageBase.h:79
#6  0x0000007fbc96f9d8 in nsDocShell::GetDocument (this=0x7f885da880) at
    docshell/base/nsDocShell.cpp:3053
#7  0x0000007fbaad8780 in nsPIDOMWindowOuter::MaybeCreateDoc (this=<optimized out>)
    at dom/base/nsGlobalWindowOuter.cpp:7678
#8  0x0000007fbaad8aa4 in non-virtual thunk to nsGlobalWindowOuter::
    WrapObject(JSContext*, JS::Handle<JSObject*>) ()
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/js/HeapAPI.h:727
[...]
#42 0x0000007fb79cf89c in ?? () from /lib64/libc.so.6
(gdb) 

Thread 8 "GeckoWorkerThre" hit Breakpoint 1, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7f88c0a200, aIsActive=false)
    at layout/base/PresShell.cpp:10865
10865	void PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7f88c0a200, aIsActive=false)
    at layout/base/PresShell.cpp:10865
#1  0x0000007fbc2236d0 in mozilla::PresShell::ActivenessMaybeChanged
    (this=this@entry=0x7f88c0a200)
    at layout/base/PresShell.cpp:10794
#2  0x0000007fbc247da4 in mozilla::PresShell::Init
    (this=this@entry=0x7f88c0a200, aPresContext=aPresContext@entry=0x7f88bdfe80, 
    aViewManager=aViewManager@entry=0x7f88b80b60) at
    layout/base/PresShell.cpp:1035
#3  0x0000007fbab910ac in mozilla::dom::Document::CreatePresShell
    (this=0x7f88ab64e0, aContext=0x7f88bdfe80, aViewManager=0x7f88b80b60)
    at dom/base/Document.cpp:6637
#4  0x0000007fbc27b7bc in nsDocumentViewer::InitPresentationStuff
    (this=this@entry=0x7f88b16b60, aDoInitialReflow=aDoInitialReflow@entry=false)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/RefPtr.h:289
#5  0x0000007fbc27d4c0 in nsDocumentViewer::InitInternal (this=0x7f88b16b60,
    aParentWidget=<optimized out>, aState=aState@entry=0x0, aActor=0x0, 
    aBounds=..., aDoCreation=aDoCreation@entry=true,
    aNeedMakeCX=aNeedMakeCX@entry=true,
    aForceSetNewDocument=aForceSetNewDocument@entry=true)
    at layout/base/nsDocumentViewer.cpp:913
#6  0x0000007fbc27d68c in nsDocumentViewer::Init (this=<optimized out>,
    aParentWidget=<optimized out>, aBounds=..., aActor=<optimized out>)
    at layout/base/nsDocumentViewer.cpp:682
#7  0x0000007fbc969a04 in nsDocShell::SetupNewViewer (this=this@entry=0x7f885da880, aNewViewer=aNewViewer@entry=0x7f88b16b60, 
    aWindowActor=aWindowActor@entry=0x0)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:859
#8  0x0000007fbc96e728 in nsDocShell::Embed (this=this@entry=0x7f885da880, aContentViewer=aContentViewer@entry=0x7f88b16b60, 
    aWindowActor=aWindowActor@entry=0x0,
    aIsTransientAboutBlank=aIsTransientAboutBlank@entry=false, aPersist=true)
    at docshell/base/nsDocShell.cpp:5552
#9  0x0000007fbc97cf8c in nsDocShell::CreateContentViewer
    (this=this@entry=0x7f885da880, aContentType=...,
    aRequest=aRequest@entry=0x7f88b075e0, 
    aContentHandler=aContentHandler@entry=0x7f88ac5130)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:859
#10 0x0000007fbc97d6a8 in nsDSURIContentListener::DoContent (this=0x55559666c0,
    aContentType=..., aIsContentPreferred=<optimized out>, 
    aRequest=0x7f88b075e0, aContentHandler=0x7f88ac5130, aAbortProcess=0x7f9f4f35c0)
    at docshell/base/nsDSURIContentListener.cpp:179
[...]
#51 0x0000007fb79cf89c in ?? () from /lib64/libc.so.6
(gdb) 

Thread 8 "GeckoWorkerThre" hit Breakpoint 1, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7f88c0a200, aIsActive=false)
    at layout/base/PresShell.cpp:10865
10865	void PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7f88c0a200, aIsActive=false)
    at layout/base/PresShell.cpp:10865
#1  0x0000007fbc2236d0 in mozilla::PresShell::ActivenessMaybeChanged
    (this=this@entry=0x7f88c0a200)
    at layout/base/PresShell.cpp:10794
#2  0x0000007fbc969a54 in nsDocShell::SetupNewViewer (this=this@entry=0x7f885da880, aNewViewer=aNewViewer@entry=0x7f88b16b60, 
    aWindowActor=aWindowActor@entry=0x0) at docshell/base/nsDocShell.cpp:8058
#3  0x0000007fbc96e728 in nsDocShell::Embed (this=this@entry=0x7f885da880, aContentViewer=aContentViewer@entry=0x7f88b16b60, 
    aWindowActor=aWindowActor@entry=0x0,
    aIsTransientAboutBlank=aIsTransientAboutBlank@entry=false, aPersist=true)
    at docshell/base/nsDocShell.cpp:5552
#4  0x0000007fbc97cf8c in nsDocShell::CreateContentViewer
    (this=this@entry=0x7f885da880, aContentType=...,
    aRequest=aRequest@entry=0x7f88b075e0, 
    aContentHandler=aContentHandler@entry=0x7f88ac5130)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:859
#5  0x0000007fbc97d6a8 in nsDSURIContentListener::DoContent (this=0x55559666c0,
    aContentType=..., aIsContentPreferred=<optimized out>, 
    aRequest=0x7f88b075e0, aContentHandler=0x7f88ac5130, aAbortProcess=0x7f9f4f35c0)
    at docshell/base/nsDSURIContentListener.cpp:179
#6  0x0000007fba5dc5c8 in nsDocumentOpenInfo::TryContentListener
    (this=0x7f88ac5110, aListener=0x55559666c0, aChannel=0x7f88b075e0)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:359
#7  0x0000007fba5dc91c in nsDocumentOpenInfo::TryDefaultContentListener
    (this=<optimized out>, aChannel=<optimized out>)
    at uriloader/base/nsURILoader.cpp:626
[...]
#46 0x0000007fb79cf89c in ?? () from /lib64/libc.so.6
(gdb) 

Thread 8 "GeckoWorkerThre" hit Breakpoint 1, mozilla::PresShell::SetIsActive
    (this=this@entry=0x7f8868ab50, aIsActive=true)
    at layout/base/PresShell.cpp:10865
10865	void PresShell::SetIsActive(bool aIsActive) {
(gdb) bt
#0  mozilla::PresShell::SetIsActive (this=this@entry=0x7f8868ab50, aIsActive=true)
    at layout/base/PresShell.cpp:10865
#1  0x0000007fbc2236d0 in mozilla::PresShell::ActivenessMaybeChanged
    (this=this@entry=0x7f8868ab50)
    at layout/base/PresShell.cpp:10794
#2  0x0000007fbc247da4 in mozilla::PresShell::Init (this=this@entry=0x7f8868ab50, aPresContext=aPresContext@entry=0x7f88b50b10, 
    aViewManager=aViewManager@entry=0x7f88590220) at
    layout/base/PresShell.cpp:1035
#3  0x0000007fbab910ac in mozilla::dom::Document::CreatePresShell
    (this=0x7f88680b10, aContext=0x7f88b50b10, aViewManager=0x7f88590220)
    at dom/base/Document.cpp:6637
#4  0x0000007fbc27b7bc in nsDocumentViewer::InitPresentationStuff
    (this=this@entry=0x7f8886baf0, aDoInitialReflow=aDoInitialReflow@entry=false)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/RefPtr.h:289
#5  0x0000007fbc27d4c0 in nsDocumentViewer::InitInternal (this=0x7f8886baf0,
    aParentWidget=<optimized out>, aState=aState@entry=0x0, aActor=0x0, 
    aBounds=..., aDoCreation=aDoCreation@entry=true, aNeedMakeCX=aNeedMakeCX@entry=true, aForceSetNewDocument=aForceSetNewDocument@entry=true)
    at layout/base/nsDocumentViewer.cpp:913
#6  0x0000007fbc27d68c in nsDocumentViewer::Init (this=<optimized out>,
    aParentWidget=<optimized out>, aBounds=..., aActor=<optimized out>)
    at layout/base/nsDocumentViewer.cpp:682
#7  0x0000007fba96f1b4 in gfxSVGGlyphsDocument::SetupPresentation
    (this=this@entry=0x7f8867a940)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/gfx/BaseRect.h:53
#8  0x0000007fba96f3c8 in gfxSVGGlyphsDocument::gfxSVGGlyphsDocument
    (this=0x7f8867a940, 
    aBuffer=0x7ea8f3c42d "<svg xmlns=\"http://www.w3.org/2000/svg\"
    id=\"glyph690\"><g transform=\"translate(0 -6.75) translate(0,-1638.4)
    scale(56.", '8' <repeats 14 times>, "6)\"><path fill=\"#C1694F\" d=\"M32
    34a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 "..., aBufLen=<optimized out>,
    aSVGGlyphs=<optimized out>)
    at gfx/thebes/gfxSVGGlyphs.cpp:311
[...]
#120 0x0000007fb79cf89c in ?? () from /lib64/libc.so.6
(gdb) 
That's quite a difference. The backtraces are so different that it's hard to effectively compare the two sets with one another. I also notice that although these last five backtraces for ESR 91 look quite similar, they're actually all quite difference. We can see that just from the lengths of the backtraces themselves: 47, 42, 51, 46, 120. These all represent a very deep level of nesting. I believe this is to do with the way the page is laid out.

Also worth noting is that the glyph that we can see being rendered as an SVG image right at the end of the final backtrace is a glyph that does appear in the page being rendered.

In the case of ESR 91 the value passed in is coming from the PresShell::ShouldBeActive() method, so the obvious question is why this isn't returning true in the majority of the cases.

So I've put a breakpoint on PresShell::ShouldBeActive() to find out. Here's what stepping through the method gives us. Note that when we reach the IsActive() call we step inside (rather than stepping over it) to find out what's happening inside.
Thread 8 "GeckoWorkerThre" hit Breakpoint 1, mozilla::PresShell::ShouldBeActive
    at layout/base/PresShell.cpp:10797
10797	bool PresShell::ShouldBeActive() const {
(gdb) n
[LWP 32361 exited]
10798	  MOZ_LOG(gLog, LogLevel::Debug,
(gdb) n
10805	  Document* doc = mDocument;
(gdb) n
10807	  if (doc->IsBeingUsedAsImage()) {
(gdb) n
10814	  if (Document* displayDoc = doc->GetDisplayDocument()) {
(gdb) n
10823	  Document* root = nsContentUtils::GetInProcessSubtreeRootDocument(doc);
(gdb) n
10824	  if (auto* browserChild = BrowserChild::GetFrom(root->GetDocShell())) {
(gdb) n
10859	  BrowsingContext* bc = doc->GetBrowsingContext();
(gdb) n
10860	  MOZ_LOG(gLog, LogLevel::Debug,
(gdb) n
10862	  return bc && bc->IsActive();
(gdb) p bc
$1 = (mozilla::dom::BrowsingContext *) 0x7f885e1ff0
(gdb) s
mozilla::dom::BrowsingContext::IsActive (this=this@entry=0x7f885e1ff0)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/dom/
    BrowsingContext.h:227
227	${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/dom/BrowsingContext.h:
    No such file or directory.
(gdb) n
611	    if (explicit_ != ExplicitActiveStatus::None) {
(gdb) n
612	      return explicit_ == ExplicitActiveStatus::Active;
(gdb) p explicit_
$2 = mozilla::dom::ExplicitActiveStatus::Inactive
(gdb) n
From this we can see that the explicit_ variable, which is used to determine the return result, is set to ExplicitActiveStatus::Inactive, which is why the function is returning false.

We're a bit further along. Now it's clear that BrowsingContext::GetExplicitActive() is returning ExplicitActiveStatus::Inactive when we want it to return ExplicitActiveStatus::Active.

This value gets set through calls to the BrowsingContext::SetExplicitActive() method, so we should try to determine where that gets called.

But putting a breakpoint on it doesn't result in any hits. So it seems it's not getting called anywhere. Hmmm; that's unexpected. That must be because the value being set in BrowsingContext::CreateDetached() is still being used. There it's set to a lambda function that looks like this:
  fields.mExplicitActive = [&] {
    if (parentBC) {
      // Non-root browsing-contexts inherit their status from its parent.
      return ExplicitActiveStatus::None;
    }
    if (aType == Type::Content) {
      // Content gets managed by the chrome front-end / embedder element and
      // starts as inactive.
      return ExplicitActiveStatus::Inactive;
    }
    // Chrome starts as active.
    return ExplicitActiveStatus::Active;
  }();
What does this function do? It first checks whether parentBC is null. Then it checks whether aType is set to Type::Content. If either of these things hold it will return a value that will result in the status being set as inactive. If none of these conditions hold then we reach the end of the lambda function and a value is returned that say the current state is active.

I want to see whether this is where our rendering is getting blocked. So I've changed the second of the three return statements so it now looks like this:
      return ExplicitActiveStatus::Active;
In other words, the lambda will now result in an active statement when it would have been inactive before. I'm hoping this will force the elements to always be active. I've done a partial build to test this and scp-d the resulting libxul.so file over to my phone. On executing it, the paint function is now being called:
Thread 8 "GeckoWorkerThre" hit Breakpoint 1, nsLayoutUtils::PaintFrame
    (aRenderingContext=aRenderingContext@entry=0x0,
    aFrame=aFrame@entry=0x7f88bea280, 
    aDirtyRegion=..., aBackstop=aBackstop@entry=4294967295, 
    aBuilderMode=aBuilderMode@entry=nsDisplayListBuilderMode::Painting, 
    aFlags=aFlags@entry=(nsLayoutUtils::PaintFrameFlags::WidgetLayers |
    nsLayoutUtils::PaintFrameFlags::ExistingTransaction |
    nsLayoutUtils::PaintFrameFlags::NoComposite)) at
    ${PROJECT}/gecko-dev/layout/base/nsLayoutUtils.cpp:3144
3144	${PROJECT}/gecko-dev/layout/base/nsLayoutUtils.cpp: No such file or directory.
(gdb) bt
#0  nsLayoutUtils::PaintFrame (aRenderingContext=aRenderingContext@entry=0x0,
    aFrame=aFrame@entry=0x7f88bea280, aDirtyRegion=..., 
    aBackstop=aBackstop@entry=4294967295,
    aBuilderMode=aBuilderMode@entry=nsDisplayListBuilderMode::Painting, 
    aFlags=aFlags@entry=(nsLayoutUtils::PaintFrameFlags::WidgetLayers |
    nsLayoutUtils::PaintFrameFlags::ExistingTransaction |
    nsLayoutUtils::PaintFrameFlags::NoComposite)) at
    ${PROJECT}/gecko-dev/layout/base/nsLayoutUtils.cpp:3144
#1  0x0000007fbc230c24 in mozilla::PresShell::Paint (this=this@entry=0x7f88ba9150, aViewToPaint=aViewToPaint@entry=0x7f880dfe90, aDirtyRegion=..., 
    aFlags=aFlags@entry=mozilla::PaintFlags::PaintLayers)
    at ${PROJECT}/gecko-dev/layout/base/PresShell.cpp:6400
#2  0x0000007fbc068ae4 in nsViewManager::ProcessPendingUpdatesPaint
    (this=this@entry=0x7f88b81020, aWidget=aWidget@entry=0x7f88a229f0)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/gfx/RectAbsolute.h:43
#3  0x0000007fbc068e98 in nsViewManager::ProcessPendingUpdatesForView
    (this=this@entry=0x7f88b81020, aView=<optimized out>, 
    aFlushDirtyRegion=aFlushDirtyRegion@entry=true)
    at ${PROJECT}/gecko-dev/view/nsViewManager.cpp:394
#4  0x0000007fbc069488 in nsViewManager::ProcessPendingUpdates
    (this=this@entry=0x7f88b81020)
    at ${PROJECT}/gecko-dev/view/nsViewManager.cpp:972
#5  0x0000007fbc069548 in nsViewManager::WillPaintWindow
    (this=this@entry=0x7f88b81020, aWidget=0x7f88a229f0)
    at ${PROJECT}/gecko-dev/view/nsViewManager.cpp:625
#6  0x0000007fbc069594 in nsView::WillPaintWindow (this=<optimized out>,
    aWidget=<optimized out>)
    at ${PROJECT}/gecko-dev/view/nsView.cpp:1051
#7  0x0000007fbcc95974 in mozilla::embedlite::PuppetWidgetBase::Invalidate
    (this=0x7f88a229f0, aRect=...)
    at ${PROJECT}/gecko-dev/mobile/sailfishos/embedshared/PuppetWidgetBase.cpp:268
#8  0x0000007fbcc9a558 in mozilla::embedlite::PuppetWidgetBase::Show
    (this=this@entry=0x7f88a229f0, aState=aState@entry=true)
    at ${PROJECT}/gecko-dev/mobile/sailfishos/embedshared/PuppetWidgetBase.cpp:129
#9  0x0000007fbcc90a58 in mozilla::embedlite::EmbedLitePuppetWidget::Show
    (this=0x7f88a229f0, aState=<optimized out>)
    at ${PROJECT}/gecko-dev/mobile/sailfishos/embedshared/
    EmbedLitePuppetWidget.cpp:97
#10 0x0000007fbc27e11c in nsDocumentViewer::Show (this=0x7f88ac6100)
    at ${PROJECT}/gecko-dev/layout/base/nsDocumentViewer.cpp:2082
#11 0x0000007fbc28c2f8 in nsPresContext::EnsureVisible (this=0x7f88a59d80)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/nsCOMPtr.h:869
#12 0x0000007fbc244ab4 in mozilla::PresShell::UnsuppressAndInvalidate
    (this=this@entry=0x7f88ba9150)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/RefPtr.h:313
#13 0x0000007fbc24b338 in mozilla::PresShell::ProcessReflowCommands
    (this=this@entry=0x7f88ba9150, aInterruptible=aInterruptible@entry=false)
    at ${PROJECT}/gecko-dev/layout/base/PresShell.cpp:9812
#14 0x0000007fbc24a024 in mozilla::PresShell::DoFlushPendingNotifications
    (this=this@entry=0x7f88ba9150, aFlush=..., aFlush@entry=...)
    at ${PROJECT}/gecko-dev/layout/base/PresShell.cpp:4233
#15 0x0000007fbab915d8 in mozilla::PresShell::FlushPendingNotifications
    (aType=..., this=0x7f88ba9150)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/PresShell.h:1413
#16 mozilla::dom::Document::FlushPendingNotifications (this=0x7f88b780f0, aFlush=...)
    at ${PROJECT}/gecko-dev/dom/base/Document.cpp:10613
#17 0x0000007fbab91754 in mozilla::dom::Document::FlushPendingNotifications
    (this=<optimized out>, aType=aType@entry=mozilla::FlushType::Layout)
    at ${PROJECT}/gecko-dev/dom/base/Document.cpp:10534
#18 0x0000007fbabec604 in mozilla::dom::Selection::ScrollIntoView
    (this=this@entry=0x7f88b59c70, aRegion=1, aVertical=..., aHorizontal=...,
    aFlags=10)
    at ${PROJECT}/obj-build-mer-qt-xr/dist/include/mozilla/RefPtr.h:289
[...]
#50 0x0000007fb79cf89c in ?? () from /lib64/libc.so.6
(gdb) 
Sadly there's still nothing appearing on the screen though.

Phew, that's a lot of debugging and investigation. And it's been quite exhausting. It sadly hasn't got us where we need to be yet, but it has been illuminating. I'll be persevering with this over the coming days.

As always, if you'd like to read more about all this gecko stuff, do take a look at my full Gecko Dev Diary.

Comments

Uncover Disqus comments