Bug 1723723 - stop using getURLSpecFromFile from JS code to avoid mainthread IO, r=florian

Differential Revision: https://phabricator.services.mozilla.com/D121620
This commit is contained in:
Gijs Kruitbosch 2021-08-03 18:32:50 +00:00
parent d9a5f40263
commit 4fa576deda
5 changed files with 8 additions and 8 deletions

View File

@ -2808,7 +2808,7 @@ var gMainPane = {
var fph = Services.io
.getProtocolHandler("file")
.QueryInterface(Ci.nsIFileProtocolHandler);
var urlSpec = fph.getURLSpecFromFile(aFile);
var urlSpec = fph.getURLSpecFromActualFile(aFile);
return "moz-icon://" + urlSpec + "?size=16";
},
@ -3064,19 +3064,19 @@ var gMainPane = {
downloadFolder.value = currentDirPref.value
? `\u2066${currentDirPref.value.path}\u2069`
: "";
iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
iconUrlSpec = fph.getURLSpecFromDir(currentDirPref.value);
} else if (folderIndex == 1) {
// 'Downloads'
[downloadFolder.value] = await document.l10n.formatValues([
{ id: "downloads-folder-name" },
]);
iconUrlSpec = fph.getURLSpecFromFile(await this._indexToFolder(1));
iconUrlSpec = fph.getURLSpecFromDir(await this._indexToFolder(1));
} else {
// 'Desktop'
[downloadFolder.value] = await document.l10n.formatValues([
{ id: "desktop-folder-name" },
]);
iconUrlSpec = fph.getURLSpecFromFile(
iconUrlSpec = fph.getURLSpecFromDir(
await this._getDownloadsFolder("Desktop")
);
}

View File

@ -32,7 +32,7 @@ add_task(async function test() {
.getProtocolHandler("file")
.QueryInterface(Ci.nsIFileProtocolHandler);
let fileURL = fileHandler.getURLSpecFromFile(file);
let fileURL = fileHandler.getURLSpecFromActualFile(file);
info("Opening url: " + fileURL);
let tab = BrowserTestUtils.addTab(gBrowser, fileURL);

View File

@ -29,7 +29,7 @@ add_task(async function test() {
.getProtocolHandler("file")
.QueryInterface(Ci.nsIFileProtocolHandler);
let fileURL = fileHandler.getURLSpecFromFile(file);
let fileURL = fileHandler.getURLSpecFromActualFile(file);
info("Opening url: " + fileURL);
let tab = BrowserTestUtils.addTab(gBrowser, fileURL);

View File

@ -1032,7 +1032,7 @@ var TPS = {
testFile,
"testing/modules/ajv-4.1.1.js"
);
let ajvURL = fileProtocolHandler.getURLSpecFromFile(ajvFile);
let ajvURL = fileProtocolHandler.getURLSpecFromActualFile(ajvFile);
let ns = {};
ChromeUtils.import(ajvURL, ns);
let ajv = new ns.Ajv({ async: "co*" });

View File

@ -128,7 +128,7 @@ AppPicker.prototype = {
return "";
}
var urlSpec = fph.getURLSpecFromFile(file);
var urlSpec = fph.getURLSpecFromActualFile(file);
return "moz-icon://" + urlSpec + "?size=32";
},