Backed out changeset 9c05226e2248 (bug 1405174) for failing browser-chrome's toolkit/components/addoncompat/tests/browser/browser_addonShims.js and netwerk/test/browser/browser_child_resource.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 04 Oct 2017 01:19:30 +0200
changeset 384324 c7de45b3805a1a2b567509d65d2b8c9e3c21d750
parent 384323 4a34b7b784382767f3802728e7e878c08d531481
child 384325 e5658cad41901f889fba0645a279e87012256c1c
push id52588
push userarchaeopteryx@coole-files.de
push dateTue, 03 Oct 2017 23:19:48 +0000
treeherderautoland@c7de45b3805a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1405174
milestone58.0a1
backs out9c05226e2248004f91a7487016612d32b39184d7
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
Backed out changeset 9c05226e2248 (bug 1405174) for failing browser-chrome's toolkit/components/addoncompat/tests/browser/browser_addonShims.js and netwerk/test/browser/browser_child_resource.js. r=backout
netwerk/protocol/res/SubstitutingProtocolHandler.cpp
netwerk/test/unit/test_bug337744.js
--- a/netwerk/protocol/res/SubstitutingProtocolHandler.cpp
+++ b/netwerk/protocol/res/SubstitutingProtocolHandler.cpp
@@ -420,29 +420,17 @@ SubstitutingProtocolHandler::ResolveURI(
 
   // Some code relies on an empty path resolving to a file rather than a
   // directory.
   NS_ASSERTION(path.CharAt(0) == '/', "Path must begin with '/'");
   if (path.Length() == 1) {
     rv = baseURI->GetSpec(result);
   } else {
     // Make sure we always resolve the path as file-relative to our target URI.
-    // When the baseURI doesn't end with a /, a file-relative resolution is going
-    // to pick something in the parent directory, so we resolve using an absolute
-    // path derived from the full path of the baseURI in that case.
-    nsAutoCString basePath;
-    rv = baseURI->GetFilePath(basePath);
-    if (NS_SUCCEEDED(rv) && !StringEndsWith(basePath, NS_LITERAL_CSTRING("/"))) {
-      // Cf. the assertion above, path already starts with a /, so prefixing
-      // with a string that doesn't end with one will leave us wit the right
-      // amount of /.
-      path.Insert(basePath, 0);
-    } else {
-      path.Insert('.', 0);
-    }
+    path.Insert('.', 0);
     rv = baseURI->Resolve(path, result);
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (MOZ_LOG_TEST(gResLog, LogLevel::Debug)) {
--- a/netwerk/test/unit/test_bug337744.js
+++ b/netwerk/test/unit/test_bug337744.js
@@ -89,33 +89,26 @@ function run_test() {
   // resource:/// and resource://gre/ are resolved specially, so we need
   // to create a temporary resource package to test the standard logic
   // with.
 
   let resProto = Cc['@mozilla.org/network/protocol;1?name=resource'].getService(Ci.nsIResProtocolHandler);
   let rootFile = Services.dirsvc.get("GreD", Ci.nsIFile);
   let rootURI = Services.io.newFileURI(rootFile);
 
-  let inexistentFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
-  inexistentFile.initWithPath("/this/directory/does/not/exist");
-  let inexistentURI = Services.io.newFileURI(inexistentFile);
-
   resProto.setSubstitution("res-test", rootURI);
-  resProto.setSubstitution("res-inexistent", inexistentURI);
   do_register_cleanup(() => {
     resProto.setSubstitution("res-test", null);
-    resProto.setSubstitution("res-inexistent", null);
   });
 
   let baseRoot = resProto.resolveURI(Services.io.newURI("resource:///"));
   let greRoot = resProto.resolveURI(Services.io.newURI("resource://gre/"));
 
   for (var spec of specs) {
     check_safe_resolution(spec, rootURI.spec);
-    check_safe_resolution(spec.replace("res-test", "res-inexistent"), inexistentURI.spec);
     check_safe_resolution(spec.replace("res-test", ""), baseRoot);
     check_safe_resolution(spec.replace("res-test", "gre"), greRoot);
   }
 
   for (var spec of error_specs) {
     check_resolution_error(spec);
   }
 }