Bug 1207506 - Replace all uses of Services.io in path.js with URL;r=janx
authorEddy Bruel <ejpbruel@mozilla.com>
Fri, 04 Mar 2016 13:06:48 +0100
changeset 323235 d53f6871ec137d77e57f53fe8cf90da8afe0e671
parent 323234 c3a501635246e9e7408d3f00e2c778dedaf8e22b
child 323236 365dff9e6e1fdc49c111765fbfc6518dfc4c55ea
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanx
bugs1207506
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1207506 - Replace all uses of Services.io in path.js with URL;r=janx
devtools/shared/path.js
--- a/devtools/shared/path.js
+++ b/devtools/shared/path.js
@@ -1,38 +1,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "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;
 }
 
 /*
  * Join all the arguments together and normalize the resulting URI.
  * 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;
   }
 
   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;
 }