Bug 1530685 - Part 1: Remove unused nsIJARURI::cloneWithJARFile() method; r=valentin
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 26 Feb 2019 15:28:18 +0000
changeset 519110 abfb5e0d627cd2b0d8d9e5f819689b514df6df00
parent 519109 0a003a54ff4554cb8b68f3f0d54a6bd3ef166c16
child 519111 b44a6076d5835f63480e2e65fa855865886fe633
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1530685
milestone67.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 1530685 - Part 1: Remove unused nsIJARURI::cloneWithJARFile() method; r=valentin Differential Revision: https://phabricator.services.mozilla.com/D21222
modules/libjar/nsIJARURI.idl
modules/libjar/nsJARURI.cpp
modules/libjar/nsJARURI.h
--- a/modules/libjar/nsIJARURI.idl
+++ b/modules/libjar/nsIJARURI.idl
@@ -24,22 +24,16 @@ interface nsIJARURI : nsIURL {
      */
     readonly attribute nsIURI JARFile;
 
     /**
      * Returns the entry specified for this JAR URI (e.g., "ocean.html").  This
      * value may contain %-escaped byte sequences.
      */
     readonly attribute AUTF8String JAREntry;
-
-    /**
-     * Create a clone of the JAR URI with a new root URI (the URI for the
-     * actual JAR file).
-     */
-    nsIJARURI cloneWithJARFile(in nsIURI jarFile);
 };
 
 [builtinclass, uuid(d66df117-eda7-4324-b4e4-1f670ff6718e)]
 interface nsIJARURIMutator : nsISupports
 {
     /**
      * Will initalize a URI using the passed spec, baseURI and charset.
      */
--- a/modules/libjar/nsJARURI.cpp
+++ b/modules/libjar/nsJARURI.cpp
@@ -479,23 +479,21 @@ nsJARURI::SchemeIs(const char *i_Scheme,
     return NS_OK;
   }
 
   *o_Equals = PL_strcasecmp("jar", i_Scheme) ? false : true;
   return NS_OK;
 }
 
 nsresult nsJARURI::Clone(nsIURI **result) {
-  nsresult rv;
+  RefPtr<nsJARURI> uri = new nsJARURI();
+  uri->mJARFile = mJARFile;
+  uri->mJAREntry = mJAREntry;
+  uri.forget(result);
 
-  nsCOMPtr<nsIJARURI> uri;
-  rv = CloneWithJARFileInternal(mJARFile, eHonorRef, getter_AddRefs(uri));
-  if (NS_FAILED(rv)) return rv;
-
-  uri.forget(result);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsJARURI::Resolve(const nsACString &relativePath, nsACString &result) {
   nsresult rv;
 
   nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
@@ -703,58 +701,16 @@ nsJARURI::GetJAREntry(nsACString &entryP
   return NS_OK;
 }
 
 nsresult nsJARURI::SetJAREntry(const nsACString &entryPath) {
   return CreateEntryURL(entryPath, mCharsetHint.get(),
                         getter_AddRefs(mJAREntry));
 }
 
-NS_IMETHODIMP
-nsJARURI::CloneWithJARFile(nsIURI *jarFile, nsIJARURI **result) {
-  return CloneWithJARFileInternal(jarFile, eHonorRef, result);
-}
-
-nsresult nsJARURI::CloneWithJARFileInternal(
-    nsIURI *jarFile, nsJARURI::RefHandlingEnum refHandlingMode,
-    nsIJARURI **result) {
-  return CloneWithJARFileInternal(jarFile, refHandlingMode, EmptyCString(),
-                                  result);
-}
-
-nsresult nsJARURI::CloneWithJARFileInternal(
-    nsIURI *jarFile, nsJARURI::RefHandlingEnum refHandlingMode,
-    const nsACString &newRef, nsIJARURI **result) {
-  if (!jarFile) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  nsresult rv = NS_OK;
-  nsCOMPtr<nsIURI> newJARFile = jarFile;
-  nsCOMPtr<nsIURI> newJAREntryURI;
-  if (refHandlingMode == eHonorRef) {
-    newJAREntryURI = mJAREntry;
-  } else if (refHandlingMode == eReplaceRef) {
-    rv = NS_GetURIWithNewRef(mJAREntry, newRef, getter_AddRefs(newJAREntryURI));
-  } else {
-    rv = NS_GetURIWithoutRef(mJAREntry, getter_AddRefs(newJAREntryURI));
-  }
-  if (NS_FAILED(rv)) return rv;
-
-  nsCOMPtr<nsIURL> newJAREntry(do_QueryInterface(newJAREntryURI));
-  NS_ASSERTION(newJAREntry, "This had better QI to nsIURL!");
-
-  RefPtr<nsJARURI> uri = new nsJARURI();
-  uri->mJARFile = newJARFile;
-  uri->mJAREntry = newJAREntry;
-  uri.forget(result);
-
-  return NS_OK;
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsJARURI::GetInnerURI(nsIURI **aURI) {
   nsCOMPtr<nsIURI> uri = mJARFile;
   uri.forget(aURI);
   return NS_OK;
 }
--- a/modules/libjar/nsJARURI.h
+++ b/modules/libjar/nsJARURI.h
@@ -67,24 +67,16 @@ class nsJARURI final : public nsIJARURI,
   // enum used in a few places to specify how .ref attribute should be handled
   enum RefHandlingEnum { eIgnoreRef, eHonorRef, eReplaceRef };
 
   // Helper to share code between Equals methods.
   virtual nsresult EqualsInternal(nsIURI *other,
                                   RefHandlingEnum refHandlingMode,
                                   bool *result);
 
-  // Helpers to share code between Clone methods.
-  nsresult CloneWithJARFileInternal(nsIURI *jarFile,
-                                    RefHandlingEnum refHandlingMode,
-                                    nsIJARURI **result);
-  nsresult CloneWithJARFileInternal(nsIURI *jarFile,
-                                    RefHandlingEnum refHandlingMode,
-                                    const nsACString &newRef,
-                                    nsIJARURI **result);
   nsCOMPtr<nsIURI> mJARFile;
   // mJarEntry stored as a URL so that we can easily access things
   // like extensions, refs, etc.
   nsCOMPtr<nsIURL> mJAREntry;
   nsCString mCharsetHint;
 
  private:
   nsresult Clone(nsIURI **aURI);