Closed Bug 1651628 Opened 7 months ago Closed 7 months ago

ExtensionPermissions.jsm uses deprecated FileUtils.getDir (main thread I/O on startup)

Categories

(WebExtensions :: General, defect)

defect

Tracking

(firefox-esr68 unaffected, firefox-esr78 unaffected, firefox78 unaffected, firefox79 disabled, firefox80 fixed)

RESOLVED FIXED
mozilla80
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox78 --- unaffected
firefox79 --- disabled
firefox80 --- fixed

People

(Reporter: standard8, Assigned: agi)

References

(Blocks 2 open bugs, Regression)

Details

(Keywords: regression, Whiteboard: [fxperf:p2])

Attachments

(1 file)

This was introduced recently in bug . When running xpcshell-tests or starting up Firefox, I see:

11:00:30.678 DEPRECATION WARNING: Calling FileUtils.getDir(..., ..., true) causes main thread I/O and should be avoided especially during startup/shutdown
You may find more details about this deprecation at: https://bugzilla.mozilla.org/show_bug.cgi?id=921157
resource://gre/modules/FileUtils.jsm 81 FileUtils_getDir
resource://gre/modules/ExtensionPermissions.jsm 137 _init
resource://gre/modules/ExtensionPermissions.jsm 146 lazyInit
resource://gre/modules/ExtensionPermissions.jsm 218 get
resource://gre/modules/ExtensionPermissions.jsm 266 _get
resource://gre/modules/ExtensionPermissions.jsm 271 _getCached/<
resource://gre/modules/ExtensionParent.jsm 1829 get
resource://gre/modules/addons/XPIProvider.jsm 228 awaitPromise
resource://gre/modules/addons/XPIInstall.jsm 752 syncLoadManifest
resource://gre/modules/addons/XPIDatabase.jsm 2918 updateMetadata
resource://gre/modules/addons/XPIDatabase.jsm 3143 updateExistingAddon
resource://gre/modules/addons/XPIDatabase.jsm 3230 processFileChanges
resource://gre/modules/addons/XPIProvider.jsm 2997 checkForChanges
resource://gre/modules/addons/XPIProvider.jsm 2457 startup
resource://gre/modules/AddonManager.jsm 212 callProvider
resource://gre/modules/AddonManager.jsm 583 _startProvider
resource://gre/modules/AddonManager.jsm 807 startup
resource://gre/modules/AddonManager.jsm 3462 startup
resource://gre/modules/addonManager.js 87 observe
Deprecated.jsm:84
    warning resource://gre/modules/Deprecated.jsm:84
    FileUtils_getDir resource://gre/modules/FileUtils.jsm:81
    _init resource://gre/modules/ExtensionPermissions.jsm:137
    lazyInit resource://gre/modules/ExtensionPermissions.jsm:146
    get resource://gre/modules/ExtensionPermissions.jsm:218
    _get resource://gre/modules/ExtensionPermissions.jsm:266
    _getCached resource://gre/modules/ExtensionPermissions.jsm:271
    get resource://gre/modules/ExtensionParent.jsm:1829
    AsyncFunctionNext self-hosted:684
    awaitPromise resource://gre/modules/addons/XPIProvider.jsm:228
    syncLoadManifest resource://gre/modules/addons/XPIInstall.jsm:752
    updateMetadata resource://gre/modules/addons/XPIDatabase.jsm:2918
    updateExistingAddon resource://gre/modules/addons/XPIDatabase.jsm:3143
    processFileChanges resource://gre/modules/addons/XPIDatabase.jsm:3230
    checkForChanges resource://gre/modules/addons/XPIProvider.jsm:2997
    startup resource://gre/modules/addons/XPIProvider.jsm:2457
    callProvider resource://gre/modules/AddonManager.jsm:212
    _startProvider resource://gre/modules/AddonManager.jsm:583
    startup resource://gre/modules/AddonManager.jsm:807
    startup resource://gre/modules/AddonManager.jsm:3462
    observe resource://gre/modules/addonManager.js:87
Summary: ExtensionPermissions.jsm uses deprecated FileUtils.getDir → ExtensionPermissions.jsm uses deprecated FileUtils.getDir (main thread I/O on startup)
Severity: -- → N/A

Does rkv support autocreating the directory if it doesn't exist?

If so, then we can remove the true (=autocreate) parameter at:

https://searchfox.org/mozilla-central/rev/8d55e18875b89cdf2a22a7cba60dc40999c18356/toolkit/components/extensions/ExtensionPermissions.jsm#137

If not, is it possible to add support for auto-creating it?

Flags: needinfo?(vporof)
Keywords: regression
Regressed by: 1637680

IIRC, no, it will throw a StoreError::DirectoryDoesNotExistError.

Flags: needinfo?(vporof)

(In reply to Victor Porof [:vporof][:vp] from comment #2)

IIRC, no, it will throw a StoreError::DirectoryDoesNotExistError.

Are you willing to change the behavior, to allow non-existing directories to be created?
If concerned about creating unwanted directories, possibly by taking the path to the base directory / sub directories as separate parameters by KeyValueService.getOrCreate.

Flags: needinfo?(vporof)

PS. This feature is off by default except on Nightly - see bug 1646182.

Blocks: 1646182
Assignee: nobody → agi
Status: NEW → ASSIGNED
Whiteboard: [fxperf] → [fxperf:p2]
Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/29bfedcc02e7
Don't use deprecated FileUtils.getDir(,,true). r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
Duplicate of this bug: 1652127

(In reply to Rob Wu [:robwu] from comment #3)

(In reply to Victor Porof [:vporof][:vp] from comment #2)

IIRC, no, it will throw a StoreError::DirectoryDoesNotExistError.

Are you willing to change the behavior, to allow non-existing directories to be created?
If concerned about creating unwanted directories, possibly by taking the path to the base directory / sub directories as separate parameters by KeyValueService.getOrCreate.

Yes that seems reasonable!

What's the motivation behind such a change?

Flags: needinfo?(vporof)
See Also: → 1653555
You need to log in before you can comment on or make changes to this bug.