Closed Bug 1649598 Opened 4 years ago Closed 3 years ago

ProfileAge.jsm imports OS.File during startup

Categories

(Toolkit Graveyard :: OS.File, task, P3)

Tracking

(firefox89 fixed)

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: barret, Assigned: barret)

References

Details

Attachments

(1 file, 2 obsolete files)

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

Stack:

(root) []
XREMain::XRE_main []
XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) [libxul.so]
XREMain::XRE_mainRun() [libxul.so]
nsXREDirProvider::DoStartup() [libxul.so]
Category observer notification - profile-after-change (TelemetryStartup) []
NS_CreateServicesFromCategory(char const*, nsISupports*, char const*, char16_t const*) [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 []
TelemetryStartup.prototype.observe [resource://gre/modules/TelemetryStartup.jsm:28:45]
annotateEnvironment [resource://gre/modules/TelemetryStartup.jsm:43:28]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
Interpret(JSContext*, js::RunState&) [libxul.so]
<name omitted> [libxul.so]
js::CallGetter(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::MutableHandle<JS::Value>) [libxul.so]
js::RunScript []
get currentEnvironment [resource://gre/modules/TelemetryEnvironment.jsm:105:24]
getGlobal [resource://gre/modules/TelemetryEnvironment.jsm:97:18]
EnvironmentCache [resource://gre/modules/TelemetryEnvironment.jsm:958:25]
_updateProfile [resource://gre/modules/TelemetryEnvironment.jsm:1656: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]
component loader load module []
mozJSComponentLoader::ObjectForLocation(ComponentLoaderInfo&, nsIFile*, JS::MutableHandle<JSObject*>, JS::MutableHandle<JSScript*>, char**, bool, JS::MutableHandle<JS::Value>) [libxul.so]
js::ExecuteInJSMEnvironment(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>) [libxul.so]
js::ExecuteInJSMEnvironment(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>, JS::Handle<JS::StackGCVector<JSObject*, js::TempAllocPolicy> >) [libxul.so]
ExecuteInExtensibleLexicalEnvironment(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>) [libxul.so]
js::RunScript []
> resource://gre/modules/ProfileAge.jsm []
js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>, JS::Handle<JS::Value>, js::AbstractFramePtr, JS::MutableHandle<JS::Value>) [libxul.so]
Interpret(JSContext*, js::RunState&) [libxul.so]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
ChromeUtils.import []
mozilla::dom::ChromeUtils_Binding::import(JSContext*, unsigned int, JS::Value*) [libxul.so]
> ChromeUtils::Import resource://gre/modules/osfile.jsm []
mozilla::dom::ChromeUtils::Import(mozilla::dom::GlobalObject const&, nsTSubstring<char16_t> const&, mozilla::dom::Optional<JS::Handle<JSObject*> > const&, JS::MutableHandle<JSObject*>, mozilla::ErrorResult&) [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]

One of the usages of OS.File here is for a directory iterator. Currently, IOUtils doesn't have an analogous interface for directory iteration.

Depends on: 1660328

Prior to this change, getOldestProfileTimestamp(profilePath, log) would
attempt to report the oldest timestamp by creation time on macOS and Windows,
falling back to last modified time. On Linux, where there is no concept of a
creation time, last modified time was always used.

As a consequence of migrating to IOUtils, we no longer have a way to obtain the
creation date of a file. Instead, we now always use the last modified time.

Depends on D87875

Assignee: nobody → krourke
Status: NEW → ASSIGNED

In order to migrate to IOUtils without any behavioural changes in ProfileAge.jsm, we will need a way to get the file creation time.

Depends on: 1660843
Attachment #9171721 - Attachment is obsolete: true
Depends on: 1671035
Depends on: 1674311
Assignee: mail → brennie
Severity: -- → S3
Priority: -- → P3
Depends on: 1676942
Attachment #9187461 - Attachment is obsolete: true
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c8797f2b2e98
Migrate ProfileAge.jsm to IOUtils and PathUtils r=emalysz
Depends on: 1672431
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d2e4b67c8570
Migrate ProfileAge.jsm to IOUtils and PathUtils r=emalysz
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: