author | Christoph Kerschbaumer <mozilla@christophkerschbaumer.com> |
Sun, 11 Jan 2015 20:26:40 -0800 | |
changeset 223192 | 643589c3ef94ab60157309c3be7f1441c32503c2 |
parent 223191 | 922d760d0dcf2d5418f85ccbab105c4fa5929643 |
child 223215 | a41cce2dd4081306e06bb93b9c80bb125c9d1265 |
child 223314 | b61e84480e2e7e475a4d730a7d1a1128707043ad |
push id | 28082 |
push user | cbook@mozilla.com |
push date | Mon, 12 Jan 2015 10:44:52 +0000 |
treeherder | mozilla-central@643589c3ef94 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sworkman |
bugs | 1110469 |
milestone | 37.0a1 |
first release with | nightly linux32
643589c3ef94
/
37.0a1
/
20150112030201
/
files
nightly linux64
643589c3ef94
/
37.0a1
/
20150112030201
/
files
nightly mac
643589c3ef94
/
37.0a1
/
20150112030201
/
files
nightly win32
643589c3ef94
/
37.0a1
/
20150112030201
/
files
nightly win64
643589c3ef94
/
37.0a1
/
20150112030201
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
37.0a1
/
20150112030201
/
pushlog to previous
nightly linux64
37.0a1
/
20150112030201
/
pushlog to previous
nightly mac
37.0a1
/
20150112030201
/
pushlog to previous
nightly win32
37.0a1
/
20150112030201
/
pushlog to previous
nightly win64
37.0a1
/
20150112030201
/
pushlog to previous
|
--- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -575,18 +575,17 @@ nsresult nsPluginHost::PostURL(nsISuppor } else if (0 == PL_strcmp(target, "_current")) { target = "_self"; } rv = owner->GetURL(url, target, postStream, (void*)postHeaders, postHeadersLength); } } - // if we don't have a target, just create a stream. This does - // NS_OpenURI()! + // if we don't have a target, just create a stream. if (streamListener) rv = NewPluginURLStream(NS_ConvertUTF8toUTF16(url), instance, streamListener, postStream, postHeaders, postHeadersLength); return rv; }
--- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -2706,29 +2706,27 @@ XULDocument::LoadOverlayInternal(nsIURI* if (NS_FAILED(rv)) { // Abandon this prototype mCurrentPrototype = nullptr; // The parser won't get an OnStartRequest and // OnStopRequest, so it needs a Terminate. parser->Terminate(); - // Just move on to the next overlay. NS_OpenURI could fail - // just because a channel could not be opened, which can happen - // if a file or chrome package does not exist. + // Just move on to the next overlay. ReportMissingOverlay(aURI); - + // XXX the error could indicate an internal error as well... *aFailureFromContent = true; return rv; } // If it's a 'chrome:' prototype document, then put it into // the prototype cache; other XUL documents will be reloaded - // each time. We must do this after NS_OpenURI and AsyncOpen, + // each time. We must do this after AsyncOpen, // or chrome code will wrongly create a cached chrome channel // instead of a real one. Prototypes are only cached when the // document to be overlayed is chrome to avoid caching overlay // scripts with incorrect principals, see bug 565610. if (useXULCache && overlayIsChrome && documentIsChrome) { nsXULPrototypeCache::GetInstance()->PutPrototype(mCurrentPrototype); }
--- a/editor/libeditor/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/nsHTMLDataTransfer.cpp @@ -1078,22 +1078,25 @@ nsresult nsHTMLEditor::InsertObject(cons 0 == nsCRT::strcmp(type, kJPGImageMime) || 0 == nsCRT::strcmp(type, kPNGImageMime) || 0 == nsCRT::strcmp(type, kGIFImageMime) || insertAsImage) { nsCOMPtr<nsIInputStream> imageStream; if (insertAsImage) { NS_ASSERTION(fileURI, "The file URI should be retrieved earlier"); - rv = NS_OpenURI(getter_AddRefs(imageStream), - fileURI, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER); + nsCOMPtr<nsIChannel> channel; + rv = NS_NewChannel(getter_AddRefs(channel), + fileURI, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER); + NS_ENSURE_SUCCESS(rv, rv); + rv = channel->Open(getter_AddRefs(imageStream)); NS_ENSURE_SUCCESS(rv, rv); } else { imageStream = do_QueryInterface(aObject); NS_ENSURE_TRUE(imageStream, NS_ERROR_FAILURE); } nsCString imageData; rv = NS_ConsumeStream(imageStream, UINT32_MAX, imageData);
--- a/intl/hyphenation/hnjstdio.cpp +++ b/intl/hyphenation/hnjstdio.cpp @@ -31,23 +31,28 @@ hnjFopen(const char* aURISpec, const cha NS_ASSERTION(!strcmp(aMode, "r"), "unsupported fopen() mode in hnjFopen"); nsCOMPtr<nsIURI> uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), aURISpec); if (NS_FAILED(rv)) { return nullptr; } + nsCOMPtr<nsIChannel> channel; + rv = NS_NewChannel(getter_AddRefs(channel), + uri, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER); + if (NS_FAILED(rv)) { + return nullptr; + } + nsCOMPtr<nsIInputStream> instream; - rv = NS_OpenURI(getter_AddRefs(instream), - uri, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER); - + rv = channel->Open(getter_AddRefs(instream)); if (NS_FAILED(rv)) { return nullptr; } hnjFile *f = new hnjFile; f->mStream = instream; f->mCurPos = 0; f->mLimit = 0;
--- a/intl/strres/nsStringBundle.cpp +++ b/intl/strres/nsStringBundle.cpp @@ -64,17 +64,16 @@ nsStringBundle::LoadProperties() nsresult rv; // do it synchronously nsCOMPtr<nsIURI> uri; rv = NS_NewURI(getter_AddRefs(uri), mPropertiesURL); if (NS_FAILED(rv)) return rv; - // We don't use NS_OpenURI because we want to tweak the channel nsCOMPtr<nsIChannel> channel; rv = NS_NewChannel(getter_AddRefs(channel), uri, nsContentUtils::GetSystemPrincipal(), nsILoadInfo::SEC_NORMAL, nsIContentPolicy::TYPE_OTHER); if (NS_FAILED(rv)) return rv;
--- a/intl/strres/nsStringBundleTextOverride.cpp +++ b/intl/strres/nsStringBundleTextOverride.cpp @@ -141,26 +141,29 @@ nsStringBundleTextOverride::Init() // chrome://package/locale/foo.properties:keyname nsAutoCString customStringsURLSpec; rv = NS_GetURLSpecFromFile(customStringsFile, customStringsURLSpec); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsIURI> uri; rv = NS_NewURI(getter_AddRefs(uri), customStringsURLSpec); - if (NS_FAILED(rv)) return rv; + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr<nsIChannel> channel; + rv = NS_NewChannel(getter_AddRefs(channel), + uri, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER); + + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIInputStream> in; - rv = NS_OpenURI(getter_AddRefs(in), - uri, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER); - - if (NS_FAILED(rv)) return rv; + rv = channel->Open(getter_AddRefs(in)); + NS_ENSURE_SUCCESS(rv, rv); static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID); mValues = do_CreateInstance(kPersistentPropertiesCID, &rv); if (NS_FAILED(rv)) return rv; rv = mValues->Load(in); // turn this on to see the contents of custom-strings.txt
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -131,18 +131,18 @@ mozJSSubScriptLoader::ReadScript(nsIURI bool reuseGlobal, JS::MutableHandleScript script, JS::MutableHandleFunction function) { RootedObject target_obj(cx, targetObjArg); script.set(nullptr); function.set(nullptr); - // Instead of calling NS_OpenURI, we create the channel ourselves and call - // SetContentType, to avoid expensive MIME type lookups (bug 632490). + // We create a channel and call SetContentType, to avoid expensive MIME type + // lookups (bug 632490). nsCOMPtr<nsIChannel> chan; nsCOMPtr<nsIInputStream> instream; nsresult rv; rv = NS_NewChannel(getter_AddRefs(chan), uri, nsContentUtils::GetSystemPrincipal(), nsILoadInfo::SEC_NORMAL, nsIContentPolicy::TYPE_OTHER,
--- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -1459,68 +1459,60 @@ Loader::LoadSheet(SheetLoadData* aLoadDa if (mDocument) { mozilla::net::PredictorLearn(aLoadData->mURI, mDocument->GetDocumentURI(), nsINetworkPredictor::LEARN_LOAD_SUBRESOURCE, mDocument); } // Just load it - nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIChannel> channel; - // Note that we are calling NS_OpenURIInternal() with both a node and a - // principal. This is because of a case where the node is the document - // being styled and the principal is the stylesheet (perhaps from a - // different origin) that is applying the styles. + // Note that we are calling NS_NewChannelWithTriggeringPrincipal() with both + // a node and a principal. + // This is because of a case where the node is the document being styled and + // the principal is the stylesheet (perhaps from a different origin) that is + // applying the styles. if (aLoadData->mRequestingNode) { - rv = NS_OpenURIWithTriggeringPrincipal(getter_AddRefs(stream), - aLoadData->mURI, - aLoadData->mRequestingNode, - triggeringPrincipal, - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER, - nullptr, // aLoadGroup - nullptr, // aCallbacks - nsIRequest::LOAD_NORMAL, - nullptr, // aIoService - getter_AddRefs(channel)); + rv = NS_NewChannelWithTriggeringPrincipal(getter_AddRefs(channel), + aLoadData->mURI, + aLoadData->mRequestingNode, + triggeringPrincipal, + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER); } else { // either we are loading something inside a document, in which case // we should always have a requestingNode, or we are loading something // outside a document, in which case the triggeringPrincipal // should always be the systemPrincipal. MOZ_ASSERT(nsContentUtils::IsSystemPrincipal(triggeringPrincipal)); - rv = NS_OpenURI(getter_AddRefs(stream), - aLoadData->mURI, - triggeringPrincipal, - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER, - nullptr, // aLoadGroup - nullptr, // aCallbacks - nsIRequest::LOAD_NORMAL, - nullptr, // aIoService - getter_AddRefs(channel)); + rv = NS_NewChannel(getter_AddRefs(channel), + aLoadData->mURI, + triggeringPrincipal, + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER); } + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr<nsIInputStream> stream; + rv = channel->Open(getter_AddRefs(stream)); if (NS_FAILED(rv)) { LOG_ERROR((" Failed to open URI synchronously")); SheetComplete(aLoadData, rv); return rv; } - NS_ASSERTION(channel, "NS_OpenURI lied?"); - // Force UA sheets to be UTF-8. // XXX this is only necessary because the default in // SheetLoadData::OnDetermineCharset is wrong (bug 521039). channel->SetContentCharset(NS_LITERAL_CSTRING("UTF-8")); - // Manually feed the streamloader the contents of the stream we - // got from NS_OpenURI. This will call back into OnStreamComplete + // Manually feed the streamloader the contents of the stream. + // This will call back into OnStreamComplete // and thence to ParseSheet. Regardless of whether this fails, // SheetComplete has been called. return nsSyncLoadService::PushSyncStreamToListener(stream, streamLoader, channel); } SheetLoadData* existingData = nullptr;
--- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -857,43 +857,51 @@ nsJARChannel::AsyncOpen(nsIStreamListene // These variables must only be set if we're going to trigger an // OnStartRequest, either from AsyncRead or OnDownloadComplete. // // That means: Do not add early return statements beyond this point! mListener = listener; mListenerContext = ctx; mIsPending = true; + nsCOMPtr<nsIChannel> channel; + if (!mJarFile) { // Not a local file... // kick off an async download of the base URI... rv = NS_NewDownloader(getter_AddRefs(mDownloader), this); if (NS_SUCCEEDED(rv)) { // Since we might not have a loadinfo on all channels yet // we have to provide default arguments in case mLoadInfo is null; + uint32_t loadFlags = + mLoadFlags & ~(LOAD_DOCUMENT_URI | LOAD_CALL_CONTENT_SNIFFERS); if (mLoadInfo) { - rv = NS_OpenURIInternal(mDownloader, - nullptr, // aContext - mJarBaseURI, - mLoadInfo, - mLoadGroup, - mCallbacks, - mLoadFlags & ~(LOAD_DOCUMENT_URI | LOAD_CALL_CONTENT_SNIFFERS)); + rv = NS_NewChannelInternal(getter_AddRefs(channel), + mJarBaseURI, + mLoadInfo, + mLoadGroup, + mCallbacks, + loadFlags); + } else { + rv = NS_NewChannel(getter_AddRefs(channel), + mJarBaseURI, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER, + mLoadGroup, + mCallbacks, + loadFlags); } - else { - rv = NS_OpenURI(mDownloader, - nullptr, // aContext - mJarBaseURI, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER, - mLoadGroup, - mCallbacks, - mLoadFlags & ~(LOAD_DOCUMENT_URI | LOAD_CALL_CONTENT_SNIFFERS)); + if (NS_FAILED(rv)) { + mIsPending = false; + mListenerContext = nullptr; + mListener = nullptr; + return rv; } + channel->AsyncOpen(mDownloader, nullptr); } } else if (mOpeningRemote) { // nothing to do: already asked parent to open file. } else { rv = OpenLocalFile(); } if (NS_FAILED(rv)) {
--- a/netwerk/base/public/nsNetUtil.h +++ b/netwerk/base/public/nsNetUtil.h @@ -184,17 +184,17 @@ NS_NewFileURI(nsIURI* *result, rv = net_EnsureIOService(&ioService, grip); if (ioService) rv = ioService->NewFileURI(spec, result); return rv; } /* * How to create a new Channel, using NS_NewChannel, -* NS_NewChannelWithTriggeringPrincipal, NS_OpenURI, +* NS_NewChannelWithTriggeringPrincipal, * NS_NewInputStreamChannel, NS_NewChannelInternal * and it's variations: * * What specific API function to use: * * The NS_NewChannelInternal functions should almost never be directly * called outside of necko code. * * If possible, use NS_NewChannel() providing a loading *nsINode* * * If no loading *nsINode* is avaialable, call NS_NewChannel() providing @@ -444,199 +444,16 @@ NS_NewChannel(nsIChannel** out aSecurityFlags, aContentPolicyType, aLoadGroup, aCallbacks, aLoadFlags, aIoService); } -// Use this function with CAUTION. It creates a stream that blocks when you -// Read() from it and blocking the UI thread is a bad idea. If you don't want -// to implement a full blown asynchronous consumer (via nsIStreamListener) look -// at nsIStreamLoader instead. -inline nsresult -NS_OpenURIInternal(nsIInputStream** outStream, - nsIURI* aUri, - nsINode* aLoadingNode, - nsIPrincipal* aLoadingPrincipal, - nsIPrincipal* aTriggeringPrincipal, - nsSecurityFlags aSecurityFlags, - nsContentPolicyType aContentPolicyType, - nsILoadGroup* aLoadGroup = nullptr, - nsIInterfaceRequestor* aCallbacks = nullptr, - nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, - nsIIOService* aIoService = nullptr, // pass in nsIIOService to optimize callers - nsIChannel** outChannel = nullptr) -{ - NS_ASSERTION(aLoadingPrincipal, "Can not create channel without a loading Principal!"); - - nsCOMPtr<nsIChannel> channel; - nsresult rv = NS_NewChannelInternal(getter_AddRefs(channel), - aUri, - aLoadingNode, - aLoadingPrincipal, - aTriggeringPrincipal, - aSecurityFlags, - aContentPolicyType, - aLoadGroup, - aCallbacks, - aLoadFlags, - aIoService); - - NS_ENSURE_SUCCESS(rv, rv); - nsIInputStream *stream; - rv = channel->Open(&stream); - NS_ENSURE_SUCCESS(rv, rv); - *outStream = stream; - if (outChannel) { - *outChannel = nullptr; - channel.swap(*outChannel); - } - return NS_OK; -} - -inline nsresult /* NS_OpenURIprincipal */ -NS_OpenURI(nsIInputStream** outStream, - nsIURI* aUri, - nsIPrincipal* aLoadingPrincipal, - nsSecurityFlags aSecurityFlags, - nsContentPolicyType aContentPolicyType, - nsILoadGroup* aLoadGroup = nullptr, - nsIInterfaceRequestor* aCallbacks = nullptr, - nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, - nsIIOService* aIoService = nullptr, - nsIChannel** outChannel = nullptr) -{ - return NS_OpenURIInternal(outStream, - aUri, - nullptr, // aLoadingNode - aLoadingPrincipal, - nullptr, // aTriggeringPrincipal - aSecurityFlags, - aContentPolicyType, - aLoadGroup, - aCallbacks, - aLoadFlags, - aIoService, - outChannel); -} - -inline nsresult /* NS_OpenURIWithTriggeringPrincipalAndNode */ -NS_OpenURIWithTriggeringPrincipal(nsIInputStream** outStream, - nsIURI* aUri, - nsINode* aLoadingNode, - nsIPrincipal* aTriggeringPrincipal, - nsSecurityFlags aSecurityFlags, - nsContentPolicyType aContentPolicyType, - nsILoadGroup* aLoadGroup = nullptr, - nsIInterfaceRequestor* aCallbacks = nullptr, - nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, - nsIIOService* aIoService = nullptr, - nsIChannel** outChannel = nullptr) -{ - MOZ_ASSERT(aLoadingNode); - NS_ASSERTION(aTriggeringPrincipal, "Can not open uri without a triggering Principal!"); - return NS_OpenURIInternal(outStream, - aUri, - aLoadingNode, - aLoadingNode->NodePrincipal(), - aTriggeringPrincipal, - aSecurityFlags, - aContentPolicyType, - aLoadGroup, - aCallbacks, - aLoadFlags, - aIoService, - outChannel); -} - -inline nsresult -NS_OpenURIInternal(nsIStreamListener* aListener, - nsISupports* aContext, - nsIURI* aUri, - nsILoadInfo* aLoadInfo, - nsILoadGroup* aLoadGroup = nullptr, - nsIInterfaceRequestor* aCallbacks = nullptr, - nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, - nsIIOService* aIoService = nullptr) -{ - nsCOMPtr<nsIChannel> channel; - nsresult rv = NS_NewChannelInternal(getter_AddRefs(channel), - aUri, - aLoadInfo, - aLoadGroup, - aCallbacks, - aLoadFlags, - aIoService); - NS_ENSURE_SUCCESS(rv, rv); - return channel->AsyncOpen(aListener, aContext); -} - -inline nsresult -NS_OpenURIInternal(nsIStreamListener* aListener, - nsISupports* aContext, - nsIURI* aUri, - nsINode* aLoadingNode, - nsIPrincipal* aLoadingPrincipal, - nsIPrincipal* aTriggeringPrincipal, - nsSecurityFlags aSecurityFlags, - nsContentPolicyType aContentPolicyType, - nsILoadGroup* aLoadGroup = nullptr, - nsIInterfaceRequestor* aCallbacks = nullptr, - nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, - nsIIOService* aIoService = nullptr) -{ - NS_ASSERTION(aLoadingPrincipal, "Can not create channel without a loading Principal!"); - - nsCOMPtr<nsILoadInfo> loadInfo = - new mozilla::LoadInfo(aLoadingPrincipal, - aTriggeringPrincipal, - aLoadingNode, - aSecurityFlags, - aContentPolicyType); - if (!loadInfo) { - return NS_ERROR_UNEXPECTED; - } - return NS_OpenURIInternal(aListener, - aContext, - aUri, - loadInfo, - aLoadGroup, - aCallbacks, - aLoadFlags, - aIoService); -} - -inline nsresult -NS_OpenURI(nsIStreamListener* aListener, - nsISupports* aContext, - nsIURI* aUri, - nsIPrincipal* aLoadingPrincipal, - nsSecurityFlags aSecurityFlags, - nsContentPolicyType aContentPolicyType, - nsILoadGroup* aLoadGroup = nullptr, - nsIInterfaceRequestor* aCallbacks = nullptr, - nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, - nsIIOService* aIoService = nullptr) -{ - return NS_OpenURIInternal(aListener, - aContext, - aUri, - nullptr, // aLoadingNode - aLoadingPrincipal, - nullptr, // aTriggeringPrincipal - aSecurityFlags, - aContentPolicyType, - aLoadGroup, - aCallbacks, - aLoadFlags, - aIoService); -} - inline nsresult NS_MakeAbsoluteURI(nsACString &result, const nsACString &spec, nsIURI *baseURI) { nsresult rv; if (!baseURI) { NS_WARNING("It doesn't make sense to not supply a base URI"); @@ -1739,37 +1556,39 @@ NS_ReadInputStreamToString(nsIInputStrea inline nsresult NS_LoadPersistentPropertiesFromURI(nsIPersistentProperties** outResult, nsIURI* aUri, nsIPrincipal* aLoadingPrincipal, nsContentPolicyType aContentPolicyType, nsIIOService* aIoService = nullptr) { + nsCOMPtr<nsIChannel> channel; + nsresult rv = NS_NewChannel(getter_AddRefs(channel), + aUri, + aLoadingPrincipal, + nsILoadInfo::SEC_NORMAL, + aContentPolicyType, + nullptr, // aLoadGroup + nullptr, // aCallbacks + nsIRequest::LOAD_NORMAL, + aIoService); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIInputStream> in; - nsresult rv = NS_OpenURI(getter_AddRefs(in), - aUri, - aLoadingPrincipal, - nsILoadInfo::SEC_NORMAL, - aContentPolicyType, - nullptr, // aLoadGroup - nullptr, // aCallbacks - nsIRequest::LOAD_NORMAL, //aLoadFlags - aIoService); + rv = channel->Open(getter_AddRefs(in)); + NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIPersistentProperties> properties = do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); rv = properties->Load(in); - if (NS_SUCCEEDED(rv)) { - *outResult = nullptr; - properties.swap(*outResult); - } - return rv; + NS_ENSURE_SUCCESS(rv, rv); + + properties.swap(*outResult); + return NS_OK; } inline nsresult NS_LoadPersistentPropertiesFromURISpec(nsIPersistentProperties** outResult, const nsACString& aSpec, nsIPrincipal* aLoadingPrincipal, nsContentPolicyType aContentPolicyType, const char* aCharset = nullptr,
--- a/netwerk/test/TestOpen.cpp +++ b/netwerk/test/TestOpen.cpp @@ -54,23 +54,26 @@ main(int argc, char **argv) nsCOMPtr<nsIScriptSecurityManager> secman = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); RETURN_IF_FAILED(rv, "Couldn't get script security manager!"); nsCOMPtr<nsIPrincipal> systemPrincipal; rv = secman->GetSystemPrincipal(getter_AddRefs(systemPrincipal)); RETURN_IF_FAILED(rv, "Couldn't get system principal!"); - rv = NS_OpenURI(getter_AddRefs(stream), - uri, - systemPrincipal, - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER); + nsCOMPtr<nsIChannel> channel; + rv = NS_NewChannel(getter_AddRefs(channel), + uri, + systemPrincipal, + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER); + RETURN_IF_FAILED(rv, "NS_NewChannel"); - RETURN_IF_FAILED(rv, "NS_OpenURI"); + rv = channel->Open(getter_AddRefs(stream)); + RETURN_IF_FAILED(rv, "channel->Open()"); FILE* outfile = fopen(argv[2], "wb"); if (!outfile) { printf("error opening %s\n", argv[2]); return 1; } uint32_t read;
--- a/rdf/base/nsRDFXMLDataSource.cpp +++ b/rdf/base/nsRDFXMLDataSource.cpp @@ -950,26 +950,27 @@ RDFXMLDataSourceImpl::Refresh(bool aBloc rv = BlockingParse(mURL, this); mListener = nullptr; // release the parser if (NS_FAILED(rv)) return rv; } else { // Null LoadGroup ? - rv = NS_OpenURI(this, - nullptr, // aContext - mURL, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER, - nullptr, // aLoadGroup - this); // aCallbacks - - if (NS_FAILED(rv)) return rv; + nsCOMPtr<nsIChannel> channel; + rv = NS_NewChannel(getter_AddRefs(channel), + mURL, + nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_NORMAL, + nsIContentPolicy::TYPE_OTHER, + nullptr, // aLoadGroup + this); // aCallbacks + NS_ENSURE_SUCCESS(rv, rv); + rv = channel->AsyncOpen(this, nullptr); + NS_ENSURE_SUCCESS(rv, rv); // So we don't try to issue two asynchronous loads at once. mLoadState = eLoadState_Pending; } return NS_OK; }