mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 921157 - Deprecate FileUtils.getDir(..., ..., true) during startup/shutdown
Because passing true to the 3rd parameter (shouldCreate) causes main thread I/O and should be avoided especially during startup/shutdown Differential Revision: https://phabricator.services.mozilla.com/D78912
This commit is contained in:
parent
6c48a4ff36
commit
687756c037
@ -9,6 +9,18 @@ const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"Services",
|
||||
"resource://gre/modules/Services.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"Deprecated",
|
||||
"resource://gre/modules/Deprecated.jsm"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"gDirService",
|
||||
@ -65,6 +77,13 @@ var FileUtils = {
|
||||
}
|
||||
|
||||
if (shouldCreate) {
|
||||
if (Services.startup.startingUp || Services.startup.shuttingDown) {
|
||||
Deprecated.warning(
|
||||
"Calling FileUtils.getDir(..., ..., true) causes main thread I/O and should be avoided especially during startup/shutdown",
|
||||
"https://bugzilla.mozilla.org/show_bug.cgi?id=921157"
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
dir.create(Ci.nsIFile.DIRECTORY_TYPE, this.PERMS_DIRECTORY);
|
||||
} catch (ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user