mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Backed out changeset 5bc25dc3e767 (bug 1772920) for causing geckoview failures
This commit is contained in:
parent
144b2ecb64
commit
3bfc64d7f6
@ -4,6 +4,7 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
|
||||
});
|
||||
@ -157,26 +158,21 @@ this.downloads = class extends ExtensionAPI {
|
||||
return Promise.reject({ message: "filename must not be empty" });
|
||||
}
|
||||
|
||||
if (PathUtils.isAbsolute(filename)) {
|
||||
const path = OS.Path.split(filename);
|
||||
if (path.absolute) {
|
||||
return Promise.reject({
|
||||
message: "filename must not be an absolute path",
|
||||
});
|
||||
}
|
||||
|
||||
const pathComponents = PathUtils.splitRelative(filename, {
|
||||
allowEmpty: true,
|
||||
allowCurrentDir: true,
|
||||
allowParentDir: true,
|
||||
});
|
||||
|
||||
if (pathComponents.some(component => component == "..")) {
|
||||
if (path.components.some(component => component == "..")) {
|
||||
return Promise.reject({
|
||||
message: "filename must not contain back-references (..)",
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
pathComponents.some(component => {
|
||||
path.components.some(component => {
|
||||
const sanitized = DownloadPaths.sanitize(component, {
|
||||
compressWhitespaces: false,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user