Bug 1199491 - Use channel->ascynOpen2 in netwerk/base/nsURIChecker (r=sicking,jduell)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Fri, 11 Sep 2015 18:54:00 -0700
changeset 294698 13082cd9855755a47677a031502bba1f074fa2b5
parent 294697 274e1235193ebd16a8f82c035ccb038ad7ec6ea6
child 294699 25e572cce005e1f9d7a4805d6c398dea5b1ff797
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, jduell
bugs1199491
milestone43.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 1199491 - Use channel->ascynOpen2 in netwerk/base/nsURIChecker (r=sicking,jduell)
netwerk/base/nsURIChecker.cpp
--- a/netwerk/base/nsURIChecker.cpp
+++ b/netwerk/base/nsURIChecker.cpp
@@ -1,20 +1,20 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsURIChecker.h"
 #include "nsIAuthPrompt.h"
 #include "nsIHttpChannel.h"
+#include "nsContentUtils.h"
 #include "nsNetUtil.h"
 #include "nsString.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
-#include "nsNullPrincipal.h"
 
 //-----------------------------------------------------------------------------
 
 static bool
 ServerIsNES3x(nsIHttpChannel *httpChannel)
 {
     nsAutoCString server;
     httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Server"), server);
@@ -132,22 +132,20 @@ nsURIChecker::CheckStatus()
 //-----------------------------------------------------------------------------
 // nsIURIChecker methods:
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsURIChecker::Init(nsIURI *aURI)
 {
     nsresult rv;
-    nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
-    NS_ENSURE_TRUE(nullPrincipal, NS_ERROR_FAILURE);
     rv = NS_NewChannel(getter_AddRefs(mChannel),
                        aURI,
-                       nullPrincipal,
-                       nsILoadInfo::SEC_NORMAL,
+                       nsContentUtils::GetSystemPrincipal(),
+                       nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                        nsIContentPolicy::TYPE_OTHER);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (mAllowHead) {
         mAllowHead = false;
         // See if it's an http channel, which needs special treatment:
         nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
         if (httpChannel) {
@@ -175,19 +173,19 @@ NS_IMETHODIMP
 nsURIChecker::AsyncCheck(nsIRequestObserver *aObserver,
                          nsISupports *aObserverContext)
 {
     NS_ENSURE_TRUE(mChannel, NS_ERROR_NOT_INITIALIZED);
 
     // Hook us up to listen to redirects and the like (this creates a reference
     // cycle!)
     mChannel->SetNotificationCallbacks(this);
-    
+
     // and start the request:
-    nsresult rv = mChannel->AsyncOpen(this, nullptr);
+    nsresult rv = mChannel->AsyncOpen2(this);
     if (NS_FAILED(rv))
         mChannel = nullptr;
     else {
         // ok, wait for OnStartRequest to fire.
         mIsPending = true;
         mObserver = aObserver;
         mObserverContext = aObserverContext;
     }