Bug 1426501 - Change C++ code to use NS_MutateURI when changing URI r=mayhemer

MozReview-Commit-ID: 4VzZlhWrtSJ
This commit is contained in:
Valentin Gosu
2018-01-08 15:20:35 +01:00
parent 1fa8b4ea1c
commit 88bf2bd0fd
8 changed files with 29 additions and 41 deletions

View File

@@ -136,6 +136,7 @@
#include "nsIUploadChannel.h"
#include "nsIURIFixup.h"
#include "nsIURILoader.h"
#include "nsIURIMutator.h"
#include "nsIURL.h"
#include "nsIViewSourceChannel.h"
#include "nsIWebBrowserChrome.h"
@@ -1041,13 +1042,11 @@ nsDocShell::LoadStream(nsIInputStream* aStream, nsIURI* aURI,
if (!uri) {
// HACK ALERT
nsresult rv = NS_OK;
uri = do_CreateInstance(NS_SIMPLEURI_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
return rv;
}
// Make sure that the URI spec "looks" like a protocol and path...
// For now, just use a bogus protocol called "internal"
rv = uri->SetSpec(NS_LITERAL_CSTRING("internal:load-stream"));
rv = NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID)
.SetSpec(NS_LITERAL_CSTRING("internal:load-stream"))
.Finalize(uri);
if (NS_FAILED(rv)) {
return rv;
}