Closed Bug 1755581 Opened 3 years ago Closed 3 years ago

Fenix parent process unexpectedly loads scripts intended for the child process

Categories

(GeckoView :: General, defect, P1)

Unspecified
All
defect

Tracking

(firefox99 fixed)

RESOLVED FIXED
99 Branch
Tracking Status
firefox99 --- fixed

People

(Reporter: mcomella, Assigned: agi)

Details

(Whiteboard: [geckoview:m99])

Attachments

(1 file)

As part of my investigation for bug 1755533, I took a profile of COLD VIEW start up in fenix and noticed that many *Child.jsm scripts are loaded: https://share.firefox.dev/3JyVG4P I confirmed it occurs even with the profiler disabled by enabling the JSComponentLoader logs.

:agi investigated and discovered they are triggered web extensions being loaded in the parent process, specifically by the background extension page:

102-15 13:33:14.041 22292 22326 D GeckoViewAutoFill[C]: sferrog: pageshow moz-extension://f0a6b378-6d97-4d4c-9a65-10e763cbdeae/_generated_background_page.html

I noticed the import of SelectionActionDelegateChild.jsm is triggered by Document::OnPageHide:

mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) [dom/events/EventDispatcher.cpp]
EventDispatcher::Dispatch []
EventDispatcher::Dispatch pagehide []
mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) [dom/events/EventDispatcher.cpp]
mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) [dom/events/EventDispatcher.cpp]
mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) [dom/events/EventDispatcher.cpp]
mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) [dom/events/EventDispatcher.cpp]
mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) [dom/events/EventListenerManager.cpp]
mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) [dom/events/EventListenerManager.cpp]
mozilla::dom::JSWindowActorProtocol::HandleEvent(mozilla::dom::Event*) [dom/ipc/jsactor/JSWindowActorProtocol.cpp]
mozilla::dom::JSActorManager::GetActor(JSContext*, nsTSubstring<char> const&, mozilla::ErrorResult&) [dom/ipc/jsactor/JSActorManager.cpp]
mozJSComponentLoader::Import(JSContext*, nsTSubstring<char> const&, JS::MutableHandle<JSObject*>, JS::MutableHandle<JSObject*>, bool) [js/xpconnect/loader/mozJSComponentLoader.cpp

Note: I don't see the same behavior in geckoview_example: https://share.firefox.dev/3Jt1L2S

If you spend some time reducing the number of JSMs we load on startup, you might want to add a test like browser/base/content/test/performance/browser_startup.js for Android. That's a test Florian worked on to ensure that we don't start accidentally load extra JSMs, taking advantage of some special logging facilities of the JSM module loader.

Assignee: nobody → agi
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P1
Whiteboard: [geckoview:m99]
Pushed by asferro@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/acb70cedf519 Run GeckoView actors only on browsers messageManagerGroup. r=calu
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: