mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1207506 - Replace all uses of Services.io in path.js with URL;r=janx
This commit is contained in:
parent
6613c02e64
commit
1bbc0e2817
@ -4,14 +4,13 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
const URL = require("URL");
|
||||
|
||||
/*
|
||||
* Returns the directory name of the path
|
||||
*/
|
||||
exports.dirname = path => {
|
||||
return Services.io.newURI(
|
||||
".", null, Services.io.newURI(path, null, null)).spec;
|
||||
return new URL(".", new URL(path)).href;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -19,10 +18,10 @@ exports.dirname = path => {
|
||||
* The initial path must be an full URI with a protocol (i.e. http://).
|
||||
*/
|
||||
exports.joinURI = (initialPath, ...paths) => {
|
||||
let uri;
|
||||
let url;
|
||||
|
||||
try {
|
||||
uri = Services.io.newURI(initialPath, null, null);
|
||||
url = new URL(initialPath);
|
||||
}
|
||||
catch(e) {
|
||||
return;
|
||||
@ -30,9 +29,9 @@ exports.joinURI = (initialPath, ...paths) => {
|
||||
|
||||
for(let path of paths) {
|
||||
if (path) {
|
||||
uri = Services.io.newURI(path, null, uri);
|
||||
url = new URL(path, url);
|
||||
}
|
||||
}
|
||||
|
||||
return uri.spec;
|
||||
return url.href;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user