Backed out changeset 56336c4873fe (bug 1434766) for build bustages on a CLOSED TREE
authorarthur.iakab <aiakab@mozilla.com>
Tue, 27 Feb 2018 17:14:15 +0200
changeset 405587 d1c333aa68c58ace016ed5d6271519e4c66245fe
parent 405586 7e9df457d4b783ae1e479c3e9e0795e3af382fda
child 405588 f5a63c04d6723cc757f7ca06eeef3aaeee217bfa
push id33525
push usernerli@mozilla.com
push dateWed, 28 Feb 2018 10:11:03 +0000
treeherdermozilla-central@9b1228043619 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1434766
milestone60.0a1
backs out56336c4873fea04e899159bbb3a97e07087af169
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 56336c4873fe (bug 1434766) for build bustages on a CLOSED TREE
netwerk/base/nsIFileURL.idl
netwerk/base/nsStandardURL.cpp
netwerk/base/nsStandardURL.h
netwerk/protocol/file/nsFileProtocolHandler.cpp
--- a/netwerk/base/nsIFileURL.idl
+++ b/netwerk/base/nsIFileURL.idl
@@ -12,23 +12,23 @@ interface nsIURIMutator;
  * nsIFileURL provides access to the underlying nsIFile object corresponding to
  * an URL.  The URL scheme need not be file:, since other local protocols may
  * map URLs to files (e.g., resource:).
  */
 [scriptable, builtinclass, uuid(e91ac988-27c2-448b-b1a1-3822e1ef1987)]
 interface nsIFileURL : nsIURL
 {
     /**
-     * Get the nsIFile corresponding to this URL.
+     * Get/Set nsIFile corresponding to this URL.
      *
-     *  - Returns a reference to an immutable object.  Callers must clone
+     *  - Getter returns a reference to an immutable object.  Callers must clone
      *    before attempting to modify the returned nsIFile object.  NOTE: this
      *    constraint might not be enforced at runtime, so beware!!
      */
-    readonly attribute nsIFile file;
+    attribute nsIFile file;
 };
 
 [scriptable, builtinclass, uuid(a588b6f2-d2b9-4024-84c7-be3368546b57)]
 interface nsIFileURLMutator : nsISupports
 {
     /*
      *  - Setter clones the nsIFile object (allowing the caller to safely modify
      *    the nsIFile object after setting it on this interface).
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -3251,17 +3251,17 @@ nsStandardURL::GetFile(nsIFile **result)
     // XXX nsIFileURL.idl specifies that the consumer must _not_ modify the
     // nsIFile returned from this method; but it seems that some folks do
     // (see bug 161921). until we can be sure that all the consumers are
     // behaving themselves, we'll stay on the safe side and clone the file.
     // see bug 212724 about fixing the consumers.
     return mFile->Clone(result);
 }
 
-nsresult
+NS_IMETHODIMP
 nsStandardURL::SetFile(nsIFile *file)
 {
     ENSURE_MUTABLE();
 
     NS_ENSURE_ARG_POINTER(file);
 
     nsresult rv;
     nsAutoCString url;
--- a/netwerk/base/nsStandardURL.h
+++ b/netwerk/base/nsStandardURL.h
@@ -179,17 +179,16 @@ protected:
     // ensure that our mFile is initialized, if it's possible.
     // returns NS_ERROR_NO_INTERFACE if the url does not map to a file
     virtual nsresult EnsureFile();
 
 private:
     nsresult Init(uint32_t urlType, int32_t defaultPort, const nsACString &spec,
                   const char *charset, nsIURI *baseURI);
     nsresult SetDefaultPort(int32_t aNewDefaultPort);
-    nsresult SetFile(nsIFile *file);
 
     nsresult SetFileNameInternal(const nsACString &input);
     nsresult SetFileBaseNameInternal(const nsACString &input);
     nsresult SetFileExtensionInternal(const nsACString &input);
 
     int32_t  Port() { return mPort == -1 ? mDefaultPort : mPort; }
 
     void     ReplacePortInSpec(int32_t aNewPort);
--- a/netwerk/protocol/file/nsFileProtocolHandler.cpp
+++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp
@@ -237,22 +237,28 @@ nsFileProtocolHandler::AllowPort(int32_t
 
 //-----------------------------------------------------------------------------
 // nsIFileProtocolHandler methods:
 
 NS_IMETHODIMP
 nsFileProtocolHandler::NewFileURI(nsIFile *file, nsIURI **result)
 {
     NS_ENSURE_ARG_POINTER(file);
+    nsresult rv;
+
+    nsCOMPtr<nsIFileURL> url = new nsStandardURL(true);
+    if (!url)
+        return NS_ERROR_OUT_OF_MEMORY;
 
     // NOTE: the origin charset is assigned the value of the platform
     // charset by the SetFile method.
-    return NS_MutateURI(new nsStandardURL::Mutator())
-             .Apply(NS_MutatorMethod(&nsIFileURLMutator::SetFile, file))
-             .Finalize(result);
+    rv = url->SetFile(file);
+    if (NS_FAILED(rv)) return rv;
+
+    return CallQueryInterface(url, result);
 }
 
 NS_IMETHODIMP
 nsFileProtocolHandler::NewFileURIMutator(nsIFile *aFile, nsIURIMutator **aResult)
 {
     NS_ENSURE_ARG_POINTER(aFile);
     nsresult rv;