Bug 984008, part 1 - Remove trailing whitespace from nsWebBrowserPersist. r=ehsan
authorAndrew McCreight <continuation@gmail.com>
Mon, 17 Mar 2014 10:21:26 -0700
changeset 173946 a1d7d5b1bd92fc61af45fdec648a29cd2bf9bc4b
parent 173945 ed7130b21a6804f00b8dc08ff5453f082ff6167c
child 173947 18944b83451149777abb22d9e103139edef81794
push id26438
push userphilringnalda@gmail.com
push dateTue, 18 Mar 2014 05:39:07 +0000
treeherdermozilla-central@89275f0ae29f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs984008
milestone30.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 984008, part 1 - Remove trailing whitespace from nsWebBrowserPersist. r=ehsan
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -65,17 +65,17 @@
 #include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIDOMHTMLAppletElement.h"
 #include "nsIDOMHTMLOptionElement.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLSourceElement.h"
 #include "nsIDOMHTMLMediaElement.h"
- 
+
 #include "nsIImageLoadingContent.h"
 
 #include "ftpCore.h"
 #include "nsITransport.h"
 #include "nsISocketTransport.h"
 #include "nsIStringBundle.h"
 #include "nsIProtocolHandler.h"
 
@@ -173,17 +173,17 @@ struct CleanupData
 
 // Maximum file length constant. The max file name length is
 // volume / server dependent but it is difficult to obtain
 // that information. Instead this constant is a reasonable value that
 // modern systems should able to cope with.
 const uint32_t kDefaultMaxFilenameLength = 64;
 
 // Default flags for persistence
-const uint32_t kDefaultPersistFlags = 
+const uint32_t kDefaultPersistFlags =
     nsIWebBrowserPersist::PERSIST_FLAGS_NO_CONVERSION |
     nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES;
 
 // String bundle where error messages come from
 const char *kWebBrowserPersistStringBundle =
     "chrome://global/locale/nsWebBrowserPersist.properties";
 
 nsWebBrowserPersist::nsWebBrowserPersist() :
@@ -239,18 +239,18 @@ NS_IMETHODIMP nsWebBrowserPersist::GetIn
 
     *aIFace = nullptr;
 
     nsresult rv = QueryInterface(aIID, aIFace);
     if (NS_SUCCEEDED(rv))
     {
         return rv;
     }
-    
-    if (mProgressListener && (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) 
+
+    if (mProgressListener && (aIID.Equals(NS_GET_IID(nsIAuthPrompt))
                              || aIID.Equals(NS_GET_IID(nsIPrompt))))
     {
         mProgressListener->QueryInterface(aIID, aIFace);
         if (*aIFace)
             return NS_OK;
     }
 
     nsCOMPtr<nsIInterfaceRequestor> req = do_QueryInterface(mProgressListener);
@@ -434,17 +434,17 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveD
     if (aEncodingFlags & ENCODE_FLAGS_CR_LINEBREAKS)
         mEncodingFlags |= nsIDocumentEncoder::OutputCRLineBreak;
     if (aEncodingFlags & ENCODE_FLAGS_LF_LINEBREAKS)
         mEncodingFlags |= nsIDocumentEncoder::OutputLFLineBreak;
     if (aEncodingFlags & ENCODE_FLAGS_NOSCRIPT_CONTENT)
         mEncodingFlags |= nsIDocumentEncoder::OutputNoScriptContent;
     if (aEncodingFlags & ENCODE_FLAGS_NOFRAMES_CONTENT)
         mEncodingFlags |= nsIDocumentEncoder::OutputNoFramesContent;
-    
+
     if (aOutputContentType)
     {
         mContentType.AssignASCII(aOutputContentType);
     }
 
     rv = SaveDocumentInternal(aDocument, fileAsURI, datapathAsURI);
 
     // Now save the URIs that have been gathered
@@ -481,17 +481,17 @@ NS_IMETHODIMP nsWebBrowserPersist::Cance
 /* void cancelSave(); */
 NS_IMETHODIMP nsWebBrowserPersist::CancelSave()
 {
     return Cancel(NS_BINDING_ABORTED);
 }
 
 
 nsresult
-nsWebBrowserPersist::StartUpload(nsIStorageStream *storStream, 
+nsWebBrowserPersist::StartUpload(nsIStorageStream *storStream,
     nsIURI *aDestinationURI, const nsACString &aContentType)
 {
      // setup the upload channel if the destination is not local
     nsCOMPtr<nsIInputStream> inputstream;
     nsresult rv = storStream->NewInputStream(0, getter_AddRefs(inputstream));
     NS_ENSURE_TRUE(inputstream, NS_ERROR_FAILURE);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
     return StartUpload(inputstream, aDestinationURI, aContentType);
@@ -591,17 +591,17 @@ nsWebBrowserPersist::SerializeNextFile()
     }
 
     nsresult rv = SaveGatheredURIs(nullptr);
     if (NS_FAILED(rv))
     {
         return false;
     }
 
-    return (mURIMap.Count() 
+    return (mURIMap.Count()
         || mUploadList.Count()
         || mDocList.Length()
         || mOutputMap.Count());
 }
 
 
 //*****************************************************************************
 // nsWebBrowserPersist::nsIRequestObserver
@@ -685,17 +685,17 @@ NS_IMETHODIMP nsWebBrowserPersist::OnSta
             // cancel; we don't need to know any more
             // stop request will get called
             request->Cancel(NS_BINDING_ABORTED);
         }
     }
 
     return NS_OK;
 }
- 
+
 NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(
     nsIRequest* request, nsISupports *ctxt, nsresult status)
 {
     nsCOMPtr<nsISupports> keyPtr = do_QueryInterface(request);
     nsISupportsKey key(keyPtr);
     OutputData *data = (OutputData *) mOutputMap.Get(&key);
     if (data)
     {
@@ -854,17 +854,17 @@ nsWebBrowserPersist::OnDataAvailable(
             }
         }
 
         int64_t channelContentLength = -1;
         if (!cancel &&
             NS_SUCCEEDED(channel->GetContentLength(&channelContentLength)))
         {
             // if we get -1 at this point, we didn't get content-length header
-            // assume that we got all of the data and push what we have; 
+            // assume that we got all of the data and push what we have;
             // that's the best we can do now
             if ((-1 == channelContentLength) ||
                 ((channelContentLength - (aOffset + aLength)) == 0))
             {
                 NS_WARN_IF_FALSE(channelContentLength != -1,
                     "nsWebBrowserPersist::OnDataAvailable() no content length "
                     "header, pushing what we have");
                 // we're done with this pass; see if we need to do upload
@@ -1007,17 +1007,17 @@ NS_IMETHODIMP nsWebBrowserPersist::OnSta
 
 
 //*****************************************************************************
 // nsWebBrowserPersist private methods
 //*****************************************************************************
 
 // Convert error info into proper message text and send OnStatusChange notification
 // to the web progress listener.
-nsresult nsWebBrowserPersist::SendErrorStatusChange( 
+nsresult nsWebBrowserPersist::SendErrorStatusChange(
     bool aIsReadError, nsresult aResult, nsIRequest *aRequest, nsIURI *aURI)
 {
     NS_ENSURE_ARG_POINTER(aURI);
 
     if (!mProgressListener)
     {
         // Do nothing
         return NS_OK;
@@ -1032,17 +1032,17 @@ nsresult nsWebBrowserPersist::SendErrorS
         file->GetPath(path);
     }
     else
     {
         nsAutoCString fileurl;
         aURI->GetSpec(fileurl);
         AppendUTF8toUTF16(fileurl, path);
     }
-    
+
     nsAutoString msgId;
     switch(aResult)
     {
     case NS_ERROR_FILE_NAME_TOO_LONG:
         // File name too long.
         msgId.AssignLiteral("fileNameTooLongError");
         break;
     case NS_ERROR_FILE_ALREADY_EXISTS:
@@ -1076,33 +1076,33 @@ nsresult nsWebBrowserPersist::SendErrorS
     // Get properties file bundle and extract status string.
     nsresult rv;
     nsCOMPtr<nsIStringBundleService> s = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
     NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && s, NS_ERROR_FAILURE);
 
     nsCOMPtr<nsIStringBundle> bundle;
     rv = s->CreateBundle(kWebBrowserPersistStringBundle, getter_AddRefs(bundle));
     NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && bundle, NS_ERROR_FAILURE);
-    
+
     nsXPIDLString msgText;
     const char16_t *strings[1];
     strings[0] = path.get();
     rv = bundle->FormatStringFromName(msgId.get(), strings, 1, getter_Copies(msgText));
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
     mProgressListener->OnStatusChange(nullptr, aRequest, aResult, msgText);
 
     return NS_OK;
 }
 
 nsresult nsWebBrowserPersist::GetValidURIFromObject(nsISupports *aObject, nsIURI **aURI) const
 {
     NS_ENSURE_ARG_POINTER(aObject);
     NS_ENSURE_ARG_POINTER(aURI);
-    
+
     nsCOMPtr<nsIFile> objAsFile = do_QueryInterface(aObject);
     if (objAsFile)
     {
         return NS_NewFileURI(aURI, objAsFile);
     }
     nsCOMPtr<nsIURI> objAsURI = do_QueryInterface(aObject);
     if (objAsURI)
     {
@@ -1156,17 +1156,17 @@ nsresult nsWebBrowserPersist::SaveURIInt
     nsIURI *aURI, nsISupports *aCacheKey, nsIURI *aReferrer,
     nsIInputStream *aPostData, const char *aExtraHeaders,
     nsIURI *aFile, bool aCalcFileExt, bool aIsPrivate)
 {
     NS_ENSURE_ARG_POINTER(aURI);
     NS_ENSURE_ARG_POINTER(aFile);
 
     nsresult rv = NS_OK;
-    
+
     mURI = aURI;
 
     nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL;
     if (mPersistFlags & PERSIST_FLAGS_BYPASS_CACHE)
     {
         loadFlags |= nsIRequest::LOAD_BYPASS_CACHE;
     }
     else if (mPersistFlags & PERSIST_FLAGS_FROM_CACHE)
@@ -1210,34 +1210,34 @@ nsresult nsWebBrowserPersist::SaveURIInt
             nullptr, nullptr, static_cast<nsIInterfaceRequestor *>(this),
             loadFlags);
 
     nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(inputChannel);
     if (pbChannel)
     {
         pbChannel->SetPrivate(aIsPrivate);
     }
-    
+
     if (NS_FAILED(rv) || inputChannel == nullptr)
     {
         EndDownload(NS_ERROR_FAILURE);
         return NS_ERROR_FAILURE;
     }
-    
+
     // Disable content conversion
     if (mPersistFlags & PERSIST_FLAGS_NO_CONVERSION)
     {
         nsCOMPtr<nsIEncodedChannel> encodedChannel(do_QueryInterface(inputChannel));
         if (encodedChannel)
         {
             encodedChannel->SetApplyConversion(false);
         }
     }
 
-    if (mPersistFlags & PERSIST_FLAGS_FORCE_ALLOW_COOKIES) 
+    if (mPersistFlags & PERSIST_FLAGS_FORCE_ALLOW_COOKIES)
     {
         nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal =
                 do_QueryInterface(inputChannel);
         if (httpChannelInternal)
             httpChannelInternal->SetForceAllowThirdPartyCookie(true);
     }
 
     // Set the referrer, post data and headers if any
@@ -1462,17 +1462,17 @@ nsWebBrowserPersist::GetDocEncoderConten
         }
     }
 
     // Use the default if no encoder exists for the desired one
     if (!*aRealContentType)
     {
         *aRealContentType = ToNewUnicode(defaultContentType);
     }
-    
+
     NS_ENSURE_TRUE(*aRealContentType, NS_ERROR_OUT_OF_MEMORY);
 
     return NS_OK;
 }
 
 nsresult nsWebBrowserPersist::SaveDocumentInternal(
     nsIDOMDocument *aDocument, nsIURI *aFile, nsIURI *aDataPath)
 {
@@ -1597,17 +1597,17 @@ nsresult nsWebBrowserPersist::SaveDocume
         docData->mFile = aFile;
         docData->mRelativePathToData = mCurrentRelativePathToData;
         docData->mDataPath = mCurrentDataPath;
         docData->mDataPathIsRelative = mCurrentDataPathIsRelative;
         mDocList.AppendElement(docData);
 
         // Walk the DOM gathering a list of externally referenced URIs in the uri map
         nsCOMPtr<nsIDOMTreeWalker> walker;
-        rv = aDocument->CreateTreeWalker(docAsNode, 
+        rv = aDocument->CreateTreeWalker(docAsNode,
             nsIDOMNodeFilter::SHOW_ELEMENT |
                 nsIDOMNodeFilter::SHOW_DOCUMENT |
                 nsIDOMNodeFilter::SHOW_PROCESSING_INSTRUCTION,
             nullptr, 1, getter_AddRefs(walker));
         NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
         nsCOMPtr<nsIDOMNode> currentNode;
         walker->GetCurrentNode(getter_AddRefs(currentNode));
@@ -1712,17 +1712,17 @@ nsresult nsWebBrowserPersist::SaveDocume
             rv = NS_ERROR_FAILURE;
             break;
         }
 
         mCurrentBaseURI = docData->mBaseURI;
         mCurrentCharset = docData->mCharset;
 
         // Save the document, fixing it up with the new URIs as we do
-        
+
         nsEncoderNodeFixup *nodeFixup;
         nodeFixup = new nsEncoderNodeFixup;
         if (nodeFixup)
             nodeFixup->mWebBrowserPersist = this;
 
         // Get the content type
         nsXPIDLString realContentType;
         GetDocEncoderContentType(docData->mDocument,
@@ -1847,17 +1847,17 @@ void nsWebBrowserPersist::CleanupLocalFi
                     dirStack.AppendObject(pos);
 
                 while (isEmptyDirectory && (stackSize = dirStack.Count()))
                 {
                     // Pop the last element
                     nsCOMPtr<nsISimpleEnumerator> curPos;
                     curPos = dirStack[stackSize-1];
                     dirStack.RemoveObjectAt(stackSize - 1);
-                    
+
                     // Test if the enumerator has any more files in it
                     bool hasMoreElements = false;
                     curPos->HasMoreElements(&hasMoreElements);
                     if (!hasMoreElements)
                     {
                         continue;
                     }
 
@@ -1869,17 +1869,17 @@ void nsWebBrowserPersist::CleanupLocalFi
                     if (!child)
                         continue;
                     nsCOMPtr<nsIFile> childAsFile = do_QueryInterface(child);
                     NS_ASSERTION(childAsFile, "This should be a file but isn't");
 
                     bool childIsSymlink = false;
                     childAsFile->IsSymlink(&childIsSymlink);
                     bool childIsDir = false;
-                    childAsFile->IsDirectory(&childIsDir);                           
+                    childAsFile->IsDirectory(&childIsDir);
                     if (!childIsDir || childIsSymlink)
                     {
                         // Some kind of file or symlink which means dir
                         // is not empty so just drop out.
                         isEmptyDirectory = false;
                         break;
                     }
                     // Push parent enumerator followed by child enumerator
@@ -1999,17 +1999,17 @@ nsWebBrowserPersist::CalculateUniqueFile
                 }
                 tmpBase.Append(tmp);
                 PR_smprintf_free(tmp);
             }
             else
             {
                 tmpBase = base;
             }
-        
+
             tmpPath.Assign(directory);
             tmpPath.Append(tmpBase);
             tmpPath.Append(ext);
 
             // Test if the name is a duplicate
             if (!mFilenameList.Contains(tmpPath))
             {
                 if (!base.Equals(tmpBase))
@@ -2107,25 +2107,25 @@ nsWebBrowserPersist::MakeFilenameFromURI
                         // the middle, inserting ellipsis and so on.
                         break;
                     }
                 }
             }
         }
     }
 
-    // Empty filenames can confuse the local file object later 
+    // Empty filenames can confuse the local file object later
     // when it attempts to set the leaf name in CalculateUniqueFilename
     // for duplicates and ends up replacing the parent dir. To avoid
     // the problem, all filenames are made at least one character long.
     if (fileName.IsEmpty())
     {
         fileName.Append(char16_t('a')); // 'a' is for arbitrary
     }
- 
+
 end:
     aFilename = fileName;
     return NS_OK;
 }
 
 
 nsresult
 nsWebBrowserPersist::CalculateAndAppendFileExt(nsIURI *aURI, nsIChannel *aChannel, nsIURI *aOriginalURIWithExtension)
@@ -2190,17 +2190,17 @@ nsWebBrowserPersist::CalculateAndAppendF
                 {
                     mimeInfo->ExtensionExists(fileExt, &useOldExt);
                 }
 
                 // can't use old extension so use primary extension
                 if (!useOldExt)
                 {
                     mimeInfo->GetPrimaryExtension(fileExt);
-                } 
+                }
 
                 if (!fileExt.IsEmpty())
                 {
                     uint32_t newLength = newFileName.Length() + fileExt.Length() + 1;
                     if (newLength > kDefaultMaxFilenameLength)
                     {
                         if (fileExt.Length() > kDefaultMaxFilenameLength/2)
                             fileExt.Truncate(kDefaultMaxFilenameLength/2);
@@ -2259,17 +2259,17 @@ nsWebBrowserPersist::MakeOutputStreamFro
 
     nsCOMPtr<nsIFileOutputStream> fileOutputStream =
         do_CreateInstance(NS_LOCALFILEOUTPUTSTREAM_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
     // XXX brade:  get the right flags here!
     int32_t ioFlags = -1;
     if (mPersistFlags & nsIWebBrowserPersist::PERSIST_FLAGS_APPEND_TO_FILE)
-      ioFlags = PR_APPEND | PR_CREATE_FILE | PR_WRONLY; 
+      ioFlags = PR_APPEND | PR_CREATE_FILE | PR_WRONLY;
     rv = fileOutputStream->Init(aFile, ioFlags, -1, 0);
     NS_ENSURE_SUCCESS(rv, rv);
 
     *aOutputStream = NS_BufferOutputStream(fileOutputStream,
                                            BUFFERED_OUTPUT_SIZE).take();
 
     if (mPersistFlags & PERSIST_FLAGS_CLEANUP_ON_FAILURE)
     {
@@ -2291,17 +2291,17 @@ nsresult
 nsWebBrowserPersist::MakeOutputStreamFromURI(
     nsIURI *aURI, nsIOutputStream  **aOutputStream)
 {
     uint32_t segsize = 8192;
     uint32_t maxsize = uint32_t(-1);
     nsCOMPtr<nsIStorageStream> storStream;
     nsresult rv = NS_NewStorageStream(segsize, maxsize, getter_AddRefs(storStream));
     NS_ENSURE_SUCCESS(rv, rv);
-    
+
     NS_ENSURE_SUCCESS(CallQueryInterface(storStream, aOutputStream), NS_ERROR_FAILURE);
     return NS_OK;
 }
 
 void
 nsWebBrowserPersist::EndDownload(nsresult aResult)
 {
     // Store the error code in the result if it is an error
@@ -2482,17 +2482,17 @@ nsWebBrowserPersist::EnumPersistURIs(nsH
         return true;
     }
 
     nsWebBrowserPersist *pthis = (nsWebBrowserPersist *) closure;
     nsresult rv;
 
     // Create a URI from the key
     nsCOMPtr<nsIURI> uri;
-    rv = NS_NewURI(getter_AddRefs(uri), 
+    rv = NS_NewURI(getter_AddRefs(uri),
                    nsDependentCString(((nsCStringKey *) aKey)->GetString(),
                                       ((nsCStringKey *) aKey)->GetStringLength()),
                    data->mCharset.get());
     NS_ENSURE_SUCCESS(rv, false);
 
     // Make a URI to save the data to
     nsCOMPtr<nsIURI> fileAsURI;
     rv = data->mDataPath->Clone(getter_AddRefs(fileAsURI));
@@ -2735,17 +2735,17 @@ nsresult nsWebBrowserPersist::OnWalkDOMN
     }
 
     nsCOMPtr<nsIDOMHTMLEmbedElement> nodeAsEmbed = do_QueryInterface(aNode);
     if (nodeAsEmbed)
     {
         StoreURIAttribute(aNode, "src");
         return NS_OK;
     }
-    
+
     nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNode);
     if (nodeAsObject)
     {
         StoreURIAttribute(aNode, "data");
         return NS_OK;
     }
 
     nsCOMPtr<nsIDOMHTMLAppletElement> nodeAsApplet = do_QueryInterface(aNode);
@@ -2771,17 +2771,17 @@ nsresult nsWebBrowserPersist::OnWalkDOMN
         // otherwise we assume the archive file(s) contains it (bug 430283).
         if (!archiveURIData)
             StoreURIAttribute(aNode, "code");
 
         // restore the base URI we really want to have
         mCurrentBaseURI = oldBase;
         return NS_OK;
     }
-    
+
     nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNode);
     if (nodeAsLink)
     {
         // Test if the link has a rel value indicating it to be a stylesheet
         nsAutoString linkRel;
         if (NS_SUCCEEDED(nodeAsLink->GetRel(linkRel)) && !linkRel.IsEmpty())
         {
             nsReadingIterator<char16_t> start;
@@ -3105,17 +3105,17 @@ nsWebBrowserPersist::CloneNodeWithFixedU
     {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "src");
         }
         return rv;
     }
-    
+
     nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNodeIn);
     if (nodeAsObject)
     {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             FixupNodeAttribute(*aNodeOut, "data");
         }
@@ -3149,17 +3149,17 @@ nsWebBrowserPersist::CloneNodeWithFixedU
               RemoveAttribute(NS_LITERAL_STRING("codebase"));
             FixupNodeAttribute(*aNodeOut, "code");
             FixupNodeAttribute(*aNodeOut, "archive");
             // restore the base URI we really want to have
             mCurrentBaseURI = oldBase;
         }
         return rv;
     }
-    
+
     nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNodeIn);
     if (nodeAsLink)
     {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             // First see if the link represents linked content
             rv = FixupNodeAttribute(*aNodeOut, "href");
@@ -3254,28 +3254,28 @@ nsWebBrowserPersist::CloneNodeWithFixedU
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
         {
             // Tell the document encoder to serialize the text child we create below
             *aSerializeCloneKids = true;
 
             nsAutoString valueStr;
             nodeAsTextArea->GetValue(valueStr);
-            
+
             (*aNodeOut)->SetTextContent(valueStr);
         }
         return rv;
     }
 
     nsCOMPtr<nsIDOMHTMLOptionElement> nodeAsOption = do_QueryInterface(aNodeIn);
     if (nodeAsOption)
     {
         rv = GetNodeToFixup(aNodeIn, aNodeOut);
         if (NS_SUCCEEDED(rv) && *aNodeOut)
-        {          
+        {
             nsCOMPtr<nsIDOMHTMLOptionElement> outElt = do_QueryInterface(*aNodeOut);
             bool selected;
             nodeAsOption->GetSelected(&selected);
             outElt->SetDefaultSelected(selected);
         }
         return rv;
     }
 
@@ -3371,17 +3371,17 @@ nsWebBrowserPersist::StoreURIAttributeNS
     return NS_OK;
 }
 
 nsresult
 nsWebBrowserPersist::FixupURI(nsAString &aURI)
 {
     // get the current location of the file (absolutized)
     nsCOMPtr<nsIURI> uri;
-    nsresult rv = NS_NewURI(getter_AddRefs(uri), aURI, 
+    nsresult rv = NS_NewURI(getter_AddRefs(uri), aURI,
                             mCurrentCharset.get(), mCurrentBaseURI);
     NS_ENSURE_SUCCESS(rv, rv);
     nsAutoCString spec;
     rv = uri->GetSpec(spec);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Search for the URI in the map and replace it with the local file
     nsCStringKey key(spec.get());
@@ -3392,39 +3392,39 @@ nsWebBrowserPersist::FixupURI(nsAString 
     URIData *data = (URIData *) mURIMap.Get(&key);
     if (!data->mNeedsFixup)
     {
         return NS_OK;
     }
     nsCOMPtr<nsIURI> fileAsURI;
     if (data->mFile)
     {
-        rv = data->mFile->Clone(getter_AddRefs(fileAsURI)); 
+        rv = data->mFile->Clone(getter_AddRefs(fileAsURI));
         NS_ENSURE_SUCCESS(rv, rv);
     }
     else
     {
         rv = data->mDataPath->Clone(getter_AddRefs(fileAsURI));
         NS_ENSURE_SUCCESS(rv, rv);
         rv = AppendPathToURI(fileAsURI, data->mFilename);
         NS_ENSURE_SUCCESS(rv, rv);
     }
     nsAutoString newValue;
 
     // remove username/password if present
     fileAsURI->SetUserPass(EmptyCString());
 
-    // reset node attribute 
+    // reset node attribute
     // Use relative or absolute links
     if (data->mDataPathIsRelative)
     {
         nsCOMPtr<nsIURL> url(do_QueryInterface(fileAsURI));
         if (!url)
           return NS_ERROR_FAILURE;
-          
+
         nsAutoCString filename;
         url->GetFileName(filename);
 
         nsAutoCString rawPathURL(data->mRelativePathToData);
         rawPathURL.Append(filename);
 
         nsAutoCString buf;
         AppendUTF8toUTF16(NS_EscapeURL(rawPathURL, esc_FilePath, buf),
@@ -3522,17 +3522,17 @@ nsWebBrowserPersist::FixupAnchor(nsIDOMN
             return NS_OK;
         }
 
         nsCOMPtr<nsIURI> relativeURI;
         relativeURI = (mPersistFlags & PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION)
                       ? mTargetBaseURI : mCurrentBaseURI;
         // Make a new URI to replace the current one
         nsCOMPtr<nsIURI> newURI;
-        rv = NS_NewURI(getter_AddRefs(newURI), oldCValue, 
+        rv = NS_NewURI(getter_AddRefs(newURI), oldCValue,
                        mCurrentCharset.get(), relativeURI);
         if (NS_SUCCEEDED(rv) && newURI)
         {
             newURI->SetUserPass(EmptyCString());
             nsAutoCString uriSpec;
             newURI->GetSpec(uriSpec);
             attr->SetValue(NS_ConvertUTF8toUTF16(uriSpec));
         }
@@ -3671,54 +3671,54 @@ nsWebBrowserPersist::CreateChannelFromUR
 
     rv = ioserv->NewChannelFromURI(aURI, aChannel);
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ENSURE_ARG_POINTER(*aChannel);
 
     rv = (*aChannel)->SetNotificationCallbacks(static_cast<nsIInterfaceRequestor *>(this));
     NS_ENSURE_SUCCESS(rv, rv);
     return NS_OK;
-} 
+}
 
 nsresult
 nsWebBrowserPersist::SaveDocumentWithFixup(
     nsIDOMDocument *aDocument, nsIDocumentEncoderNodeFixup *aNodeFixup,
     nsIURI *aFile, bool aReplaceExisting, const nsACString &aFormatType,
     const nsCString &aSaveCharset, uint32_t aFlags)
 {
     NS_ENSURE_ARG_POINTER(aFile);
-    
+
     nsresult  rv = NS_OK;
     nsCOMPtr<nsIFile> localFile;
     GetLocalFileFromURI(aFile, getter_AddRefs(localFile));
     if (localFile)
     {
         // if we're not replacing an existing file but the file
         // exists, something is wrong
         bool fileExists = false;
         rv = localFile->Exists(&fileExists);
         NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
         if (!aReplaceExisting && fileExists)
             return NS_ERROR_FAILURE;                // where are the file I/O errors?
     }
-    
+
     nsCOMPtr<nsIOutputStream> outputStream;
     rv = MakeOutputStream(aFile, getter_AddRefs(outputStream));
     if (NS_FAILED(rv))
     {
         SendErrorStatusChange(false, rv, nullptr, aFile);
         return NS_ERROR_FAILURE;
     }
     NS_ENSURE_TRUE(outputStream, NS_ERROR_FAILURE);
 
     // Get a document encoder instance
     nsAutoCString contractID(NS_DOC_ENCODER_CONTRACTID_BASE);
     contractID.Append(aFormatType);
-    
+
     nsCOMPtr<nsIDocumentEncoder> encoder = do_CreateInstance(contractID.get(), &rv);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
     NS_ConvertASCIItoUTF16 newContentType(aFormatType);
     rv = encoder->Init(aDocument, newContentType, aFlags);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
     mTargetBaseURI = aFile;
@@ -3737,17 +3737,17 @@ nsWebBrowserPersist::SaveDocumentWithFix
         charsetStr = doc->GetDocumentCharacterSet();
     }
 
     rv = encoder->SetCharset(charsetStr);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
     rv = encoder->EncodeToStream(outputStream);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
-    
+
     if (!localFile)
     {
         nsCOMPtr<nsIStorageStream> storStream(do_QueryInterface(outputStream));
         if (storStream)
         {
             outputStream->Close();
             rv = StartUpload(storStream, aFile, aFormatType);
             NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
@@ -3929,17 +3929,17 @@ nsWebBrowserPersist::SetDocumentBase(
     NS_NAMED_LITERAL_STRING(kXHTMLNS, "http://www.w3.org/1999/xhtml");
     NS_NAMED_LITERAL_STRING(kHead, "head");
 
     // Find the head element
     nsCOMPtr<nsIDOMElement> headElement;
     nsCOMPtr<nsIDOMNodeList> headList;
     if (xmlDoc)
     {
-        // First see if there is XHTML content that needs base 
+        // First see if there is XHTML content that needs base
         // tags.
         if (!NeedXHTMLBaseTag(aDocument))
             return NS_OK;
 
         aDocument->GetElementsByTagNameNS(
             kXHTMLNS,
             kHead, getter_AddRefs(headList));
     }
@@ -4104,17 +4104,17 @@ NS_INTERFACE_MAP_END
 NS_IMETHODIMP nsEncoderNodeFixup::FixupNode(
     nsIDOMNode *aNode, bool *aSerializeCloneKids, nsIDOMNode **aOutNode)
 {
     NS_ENSURE_ARG_POINTER(aNode);
     NS_ENSURE_ARG_POINTER(aOutNode);
     NS_ENSURE_TRUE(mWebBrowserPersist, NS_ERROR_FAILURE);
 
     *aOutNode = nullptr;
-    
+
     // Test whether we need to fixup the node
     uint16_t type = 0;
     aNode->GetNodeType(&type);
     if (type == nsIDOMNode::ELEMENT_NODE ||
         type == nsIDOMNode::PROCESSING_INSTRUCTION_NODE)
     {
         return mWebBrowserPersist->CloneNodeWithFixedUpAttributes(aNode, aSerializeCloneKids, aOutNode);
     }
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h
@@ -41,27 +41,27 @@ class nsWebBrowserPersist : public nsIIn
                             public nsIProgressEventSink,
                             public nsSupportsWeakReference
 {
     friend class nsEncoderNodeFixup;
 
 // Public members
 public:
     nsWebBrowserPersist();
-    
+
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINTERFACEREQUESTOR
     NS_DECL_NSICANCELABLE
     NS_DECL_NSIWEBBROWSERPERSIST
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
     NS_DECL_NSIPROGRESSEVENTSINK
 
 // Protected members
-protected:    
+protected:
     virtual ~nsWebBrowserPersist();
     nsresult CloneNodeWithFixedUpAttributes(
         nsIDOMNode *aNodeIn, bool *aSerializeCloneKids, nsIDOMNode **aNodeOut);
     nsresult SaveURIInternal(
         nsIURI *aURI, nsISupports *aCacheKey, nsIURI *aReferrer,
         nsIInputStream *aPostData, const char *aExtraHeaders, nsIURI *aFile,
         bool aCalcFileExt, bool aIsPrivate);
     nsresult SaveChannelInternal(
@@ -212,19 +212,19 @@ private:
     nsString                  mContentType;
 };
 
 // Helper class does node fixup during persistence
 class nsEncoderNodeFixup : public nsIDocumentEncoderNodeFixup
 {
 public:
     nsEncoderNodeFixup();
-    
+
     NS_DECL_ISUPPORTS
     NS_IMETHOD FixupNode(nsIDOMNode *aNode, bool *aSerializeCloneKids, nsIDOMNode **aOutNode);
-    
+
     nsWebBrowserPersist *mWebBrowserPersist;
 
-protected:    
+protected:
     virtual ~nsEncoderNodeFixup();
 };
 
 #endif