Bug 1312954 - Part 10: Add an assertion to make sure every code path of gecko uses speculativeConnect2 correctly. r?ckerschb draft
authorTim Huang <tihuang@mozilla.com>
Thu, 19 Jan 2017 16:29:53 +0800
changeset 466004 56dffc33d182c507e989dad9398ae813d4153e2e
parent 466003 f1229abab447d11347b99f5ace8deca66eb6ebf1
child 466005 7253d331cfd56af9597e165aed0c83e3eb9f9b8a
push id42767
push userbmo:tihuang@mozilla.com
push dateWed, 25 Jan 2017 04:18:41 +0000
reviewersckerschb
bugs1312954
milestone54.0a1
Bug 1312954 - Part 10: Add an assertion to make sure every code path of gecko uses speculativeConnect2 correctly. r?ckerschb
netwerk/base/nsIOService.cpp
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -1796,16 +1796,18 @@ nsIOService::SpeculativeConnectInternal(
     // reward is slim with tcp peers closely located to the browser.
     nsresult rv;
     nsCOMPtr<nsIProtocolProxyService> pps =
             do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIPrincipal> loadingPrincipal = aPrincipal;
 
+    NS_ASSERTION(aPrincipal, "We expect passing a principal here.");
+
     // If the principal is given, we use this prinicpal directly. Otherwise,
     // we fallback to use the system principal.
     if (!aPrincipal) {
         nsCOMPtr<nsIScriptSecurityManager> secMan(
             do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv));
         NS_ENSURE_SUCCESS(rv, rv);
         rv = secMan->GetSystemPrincipal(getter_AddRefs(loadingPrincipal));
         NS_ENSURE_SUCCESS(rv, rv);