Closed Bug 1649601 Opened 4 years ago Closed 4 years ago

SearchService.jsm imports OS.File during startup

Categories

(Toolkit Graveyard :: OS.File, task)

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1671274

People

(Reporter: barret, Unassigned, Mentored)

References

Details

(Whiteboard: [lang=js])

According to this startup profile, SearchService.jsm runs during startup and imports osfile.jsm. We should migrate this to the new IOUtils replacement for osfile.jsm when possible.

Stack:

XREMain::XRE_main []
XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) [libxul.so]
XREMain::XRE_mainRun() [libxul.so]
nsAppStartup::Run() [libxul.so]
nsBaseAppShell::Run() [libxul.so]
MessageLoop::Run() [libxul.so]
mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) [libxul.so]
nsThread::ProcessNextEvent(bool, bool*) [libxul.so]
mozilla::ipc::MessageChannel::MessageTask::Run() [libxul.so]
mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) [libxul.so]
mozilla::layers::PCompositorManagerChild::OnMessageReceived(IPC::Message const&) [libxul.so]
PCompositorBridge::Msg_DidComposite []
mozilla::layers::PCompositorBridgeChild::OnMessageReceived(IPC::Message const&) [libxul.so]
mozilla::layers::CompositorBridgeChild::RecvDidComposite(mozilla::layers::LayersId const&, mozilla::layers::BaseTransactionId<mozilla::layers::TransactionIdType> const&, mozilla::TimeStamp const&, mozilla::TimeStamp const&) [libxul.so]
mozilla::layers::ClientLayerManager::DidComposite(mozilla::layers::BaseTransactionId<mozilla::layers::TransactionIdType>, mozilla::TimeStamp const&, mozilla::TimeStamp const&) [libxul.so]
nsView::DidCompositeWindow(mozilla::layers::BaseTransactionId<mozilla::layers::TransactionIdType>, mozilla::TimeStamp const&, mozilla::TimeStamp const&) [libxul.so]
nsContentUtils::RemoveScriptBlocker() [libxul.so]
DelayedFireDOMPaintEvent::Run() [libxul.so]
nsPresContext::FireDOMPaintEvent(nsTArray<nsRect>*, mozilla::layers::BaseTransactionId<mozilla::layers::TransactionIdType>, mozilla::TimeStamp) [libxul.so]
mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) [libxul.so]
EventDispatcher::Dispatch []
EventDispatcher::Dispatch MozAfterPaint []
mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) [libxul.so]
mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) [libxul.so]
EventListener.handleEvent []
mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) [libxul.so]
mozilla::dom::EventListener::HandleEvent(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) [libxul.so]
JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) [libxul.so]
js::RunScript []
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
bound [self-hosted:839:25]
0xff4eaa5dbc7 []
js::jit::DoCallFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICCall_Fallback*, unsigned int, JS::Value*, JS::MutableHandle<JS::Value>) [libxul.so]
js::RunScript []
_delayedStartup [chrome://browser/content/browser.js:1923:17]
delayedStartupInit [chrome://browser/content/browser.js:3918:20]
_updateURLBarPlaceholderFromDefaultEngine [chrome://browser/content/browser.js:4049:49]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
Interpret(JSContext*, js::RunState&) [libxul.so]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) [libxul.so]
XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) [libxul.so]
NS_InvokeByIndex [libxul.so]
SharedStub [libxul.so]
PrepareAndDispatch [libxul.so]
XPCWrappedJS method call []
nsXPCWrappedJS::CallMethod(unsigned short, nsXPTMethodInfo const*, nsXPTCMiniVariant*) [libxul.so]
JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) [libxul.so]
js::RunScript []
getDefault [resource://gre/modules/SearchService.jsm:3103:18]
init [resource://gre/modules/SearchService.jsm:2271:12]
_init [resource://gre/modules/SearchService.jsm:536:13]
> _readCacheFile [resource://gre/modules/SearchService.jsm:1557:22]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
Interpret(JSContext*, js::RunState&) [libxul.so]
js::NativeGetExistingProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<js::NativeObject*>, JS::Handle<js::Shape*>, JS::MutableHandle<JS::Value>) [libxul.so]
js::CallGetter(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::MutableHandle<JS::Value>) [libxul.so]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
mozilla::dom::module_getter::ModuleGetter(JSContext*, unsigned int, JS::Value*) [libxul.so]
mozJSComponentLoader::Import(JSContext*, nsTSubstring<char> const&, JS::MutableHandle<JSObject*>, JS::MutableHandle<JSObject*>, bool) [libxul.so]
profiler_get_backtrace() [libxul.so]
Registers::SyncPopulate() [libxul.so]

We need to remove the OS.File import in SearchService.jsm: https://searchfox.org/mozilla-central/rev/9c72508fcf2bba709a5b5b9eae9da35e0c707baa/toolkit/components/search/SearchService.jsm#19

We also need to update the usage of OS.File here: https://searchfox.org/mozilla-central/rev/9c72508fcf2bba709a5b5b9eae9da35e0c707baa/toolkit/components/search/SearchService.jsm#2610

This can be updated to instead use AsyncShutdown.profileBeforeChange.addBlocker instead, and we will need to import that module.

Mentor: emalysz
Keywords: good-first-bug
Whiteboard: [lang=js]
Blocks: 1671274
No longer blocks: 1671274

(In reply to Emma Malysz from comment #1)

[snip]
This can be updated to instead use AsyncShutdown.profileBeforeChange.addBlocker instead, and we will need to import that module.

The shutdown blocking code also needs to be updated to allow IO to run during this phase (currently blocking bug 1649595 from landing).

Keywords: good-first-bug

Ah, got it. I thought that had been covered by Bug 1659838. I can follow a file up bug

Blocks: 1671274
Depends on: 1649595
Depends on: 1672431
No longer depends on: 1649595

After speaking with :masterwayz, we are going to handle both of these removals in Bug 1671274 because they rely on each other

No longer blocks: 1671274
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Blocks: 1671274
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.