Bug 1529869: Remove the 2 from speculate speculative(Anonymous)Connect2 within nsISpeculativeConnect.idl. r=valentin
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Sun, 24 Feb 2019 20:26:56 +0100
changeset 518764 d2599501754a6861e27dabc49f338467be7eca78
parent 518763 640e731ed52e5ea2428b329d7eb296b61163ee4b
child 518765 e9677c67b09409735efdc4a63da14c1753d61d13
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1529869
milestone67.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 1529869: Remove the 2 from speculate speculative(Anonymous)Connect2 within nsISpeculativeConnect.idl. r=valentin
browser/components/sessionstore/SessionStore.jsm
browser/components/urlbar/UrlbarUtils.jsm
dom/base/Document.cpp
dom/base/Element.cpp
mobile/android/chrome/content/browser.js
netwerk/base/Predictor.cpp
netwerk/base/nsIOService.cpp
netwerk/base/nsISpeculativeConnect.idl
netwerk/ipc/NeckoParent.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/test/unit/test_speculative_connect.js
toolkit/components/extensions/test/xpcshell/test_ext_proxy_speculative.js
toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm
toolkit/components/search/SearchService.jsm
widget/android/nsAppShell.cpp
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -3813,17 +3813,17 @@ var SessionStoreInternal = {
    */
   prepareConnectionToHost(tab, url) {
     if (!url.startsWith("about:")) {
       let principal = Services.scriptSecurityManager.createNullPrincipal({
         userContextId: tab.userContextId,
       });
       let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
       let uri = Services.io.newURI(url);
-      sc.speculativeConnect2(uri, principal, null);
+      sc.speculativeConnect(uri, principal, null);
       return true;
     }
     return false;
   },
 
   /**
    * Make a connection to a host when users hover mouse on a tab.
    * This will also set a flag in the tab to prevent us from speculatively
--- a/browser/components/urlbar/UrlbarUtils.jsm
+++ b/browser/components/urlbar/UrlbarUtils.jsm
@@ -315,17 +315,17 @@ var UrlbarUtils = {
 
     if (urlOrEngine instanceof URL) {
       urlOrEngine = urlOrEngine.href;
     }
 
     try {
       let uri = urlOrEngine instanceof Ci.nsIURI ? urlOrEngine
                                                   : Services.io.newURI(urlOrEngine);
-      Services.io.speculativeConnect2(uri, window.gBrowser.contentPrincipal, null);
+      Services.io.speculativeConnect(uri, window.gBrowser.contentPrincipal, null);
     } catch (ex) {
       // Can't setup speculative connection for this url, just ignore it.
     }
   },
 
   /**
    * Used to filter out the javascript protocol from URIs, since we don't
    * support LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL for those.
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -8407,19 +8407,19 @@ void Document::MaybePreconnect(nsIURI* a
 
   nsCOMPtr<nsISpeculativeConnect> speculator(
       do_QueryInterface(nsContentUtils::GetIOService()));
   if (!speculator) {
     return;
   }
 
   if (aCORSMode == CORS_ANONYMOUS) {
-    speculator->SpeculativeAnonymousConnect2(uri, NodePrincipal(), nullptr);
+    speculator->SpeculativeAnonymousConnect(uri, NodePrincipal(), nullptr);
   } else {
-    speculator->SpeculativeConnect2(uri, NodePrincipal(), nullptr);
+    speculator->SpeculativeConnect(uri, NodePrincipal(), nullptr);
   }
 }
 
 void Document::ForgetImagePreload(nsIURI* aURI) {
   // Checking count is faster than hashing the URI in the common
   // case of empty table.
   if (mPreloadingImages.Count() != 0) {
     nsCOMPtr<imgIRequest> req;
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3098,17 +3098,17 @@ nsresult Element::PostHandleEventForLink
           EventStateManager::SetActiveManager(
               aVisitor.mPresContext->EventStateManager(), this);
 
           // OK, we're pretty sure we're going to load, so warm up a speculative
           // connection to be sure we have one ready when we open the channel.
           nsCOMPtr<nsISpeculativeConnect> sc =
               do_QueryInterface(nsContentUtils::GetIOService());
           nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryInterface(handler);
-          sc->SpeculativeConnect2(absURI, NodePrincipal(), ir);
+          sc->SpeculativeConnect(absURI, NodePrincipal(), ir);
         }
       }
     } break;
 
     case eMouseClick: {
       WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
       if (mouseEvent->IsLeftClickEvent()) {
         if (mouseEvent->IsControl() || mouseEvent->IsMeta() ||
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4990,19 +4990,19 @@ var BrowserEventHandler = {
     this._inCluster = aEvent.hitCluster;
     if (this._inCluster) {
       return;  // No highlight for a cluster of links
     }
 
     let uri = this._getLinkURI(target);
     if (uri) {
       try {
-        Services.io.QueryInterface(Ci.nsISpeculativeConnect).speculativeConnect2(uri,
-                                                                                 target.ownerDocument.nodePrincipal,
-                                                                                 null);
+        Services.io.QueryInterface(Ci.nsISpeculativeConnect).speculativeConnect(uri,
+                                                                                target.ownerDocument.nodePrincipal,
+                                                                                null);
       } catch (e) {}
     }
     this._doTapHighlight(target);
   },
 
   _getLinkURI: function(aElement) {
     if (aElement.nodeType == aElement.ELEMENT_NODE &&
         ((ChromeUtils.getClassName(aElement) === "HTMLAnchorElement" && aElement.href) ||
@@ -6781,17 +6781,17 @@ var Tabs = {
     switch (event) {
       case "Session:Prefetch":
         if (!data.url) {
           break;
         }
         try {
           let uri = Services.io.newURI(data.url);
           if (uri && !this._domains.has(uri.host)) {
-            Services.io.QueryInterface(Ci.nsISpeculativeConnect).speculativeConnect2(
+            Services.io.QueryInterface(Ci.nsISpeculativeConnect).speculativeConnect(
                 uri, BrowserApp.selectedBrowser.contentDocument.nodePrincipal, null);
             this._domains.add(uri.host);
           }
         } catch (e) {}
         break;
     }
   },
 
--- a/netwerk/base/Predictor.cpp
+++ b/netwerk/base/Predictor.cpp
@@ -845,17 +845,17 @@ void Predictor::PredictForLink(nsIURI *t
       PREDICTOR_LOG(("    Not predicting for link hover - on an SSL page"));
       return;
     }
   }
 
   nsCOMPtr<nsIPrincipal> principal =
       BasePrincipal::CreateCodebasePrincipal(targetURI, originAttributes);
 
-  mSpeculativeService->SpeculativeConnect2(targetURI, principal, nullptr);
+  mSpeculativeService->SpeculativeConnect(targetURI, principal, nullptr);
   if (verifier) {
     PREDICTOR_LOG(("    sending verification"));
     verifier->OnPredictPreconnect(targetURI);
   }
 }
 
 // This is the driver for prediction based on a new pageload.
 static const uint8_t MAX_PAGELOAD_DEPTH = 10;
@@ -1329,17 +1329,17 @@ bool Predictor::RunPredictions(nsIURI *r
   len = preconnects.Length();
   for (i = 0; i < len; ++i) {
     PREDICTOR_LOG(("    doing preconnect"));
     nsCOMPtr<nsIURI> uri = preconnects[i];
     ++totalPredictions;
     ++totalPreconnects;
     nsCOMPtr<nsIPrincipal> principal =
         BasePrincipal::CreateCodebasePrincipal(uri, originAttributes);
-    mSpeculativeService->SpeculativeConnect2(uri, principal, this);
+    mSpeculativeService->SpeculativeConnect(uri, principal, this);
     predicted = true;
     if (verifier) {
       PREDICTOR_LOG(("    sending preconnect verification"));
       verifier->OnPredictPreconnect(uri);
     }
   }
 
   len = preresolves.Length();
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -1720,20 +1720,19 @@ IOServiceProxyCallback::OnProxyAvailable
   if (!speculativeHandler) return NS_OK;
 
   nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
   nsCOMPtr<nsIPrincipal> principal = loadInfo->LoadingPrincipal();
 
   nsLoadFlags loadFlags = 0;
   channel->GetLoadFlags(&loadFlags);
   if (loadFlags & nsIRequest::LOAD_ANONYMOUS) {
-    speculativeHandler->SpeculativeAnonymousConnect2(uri, principal,
-                                                     mCallbacks);
+    speculativeHandler->SpeculativeAnonymousConnect(uri, principal, mCallbacks);
   } else {
-    speculativeHandler->SpeculativeConnect2(uri, principal, mCallbacks);
+    speculativeHandler->SpeculativeConnect(uri, principal, mCallbacks);
   }
 
   return NS_OK;
 }
 
 nsresult nsIOService::SpeculativeConnectInternal(
     nsIURI *aURI, nsIPrincipal *aPrincipal, nsIInterfaceRequestor *aCallbacks,
     bool aAnonymous) {
@@ -1797,25 +1796,24 @@ nsresult nsIOService::SpeculativeConnect
     return pps2->AsyncResolve2(channel, 0, callback, nullptr,
                                getter_AddRefs(cancelable));
   }
   return pps->AsyncResolve(channel, 0, callback, nullptr,
                            getter_AddRefs(cancelable));
 }
 
 NS_IMETHODIMP
-nsIOService::SpeculativeConnect2(nsIURI *aURI, nsIPrincipal *aPrincipal,
-                                 nsIInterfaceRequestor *aCallbacks) {
+nsIOService::SpeculativeConnect(nsIURI *aURI, nsIPrincipal *aPrincipal,
+                                nsIInterfaceRequestor *aCallbacks) {
   return SpeculativeConnectInternal(aURI, aPrincipal, aCallbacks, false);
 }
 
 NS_IMETHODIMP
-nsIOService::SpeculativeAnonymousConnect2(nsIURI *aURI,
-                                          nsIPrincipal *aPrincipal,
-                                          nsIInterfaceRequestor *aCallbacks) {
+nsIOService::SpeculativeAnonymousConnect(nsIURI *aURI, nsIPrincipal *aPrincipal,
+                                         nsIInterfaceRequestor *aCallbacks) {
   return SpeculativeConnectInternal(aURI, aPrincipal, aCallbacks, true);
 }
 
 /*static*/ bool nsIOService::IsDataURIUniqueOpaqueOrigin() {
   return sIsDataURIUniqueOpaqueOrigin;
 }
 
 /*static*/ bool nsIOService::BlockToplevelDataUriNavigations() {
--- a/netwerk/base/nsISpeculativeConnect.idl
+++ b/netwerk/base/nsISpeculativeConnect.idl
@@ -23,23 +23,23 @@ interface nsISpeculativeConnect : nsISup
      *
      * @param aURI the URI of the hinted transaction
      * @param aPrincipal the principal that will be used for opening the
      *        channel of the hinted transaction.
      * @param aCallbacks any security callbacks for use with SSL for interfaces
      *        such as nsIBadCertListener. May be null.
      *
      */
-    void speculativeConnect2(in nsIURI aURI,
-                             in nsIPrincipal aPrincipal,
-                             in nsIInterfaceRequestor aCallbacks);
+    void speculativeConnect(in nsIURI aURI,
+                            in nsIPrincipal aPrincipal,
+                            in nsIInterfaceRequestor aCallbacks);
 
-    void speculativeAnonymousConnect2(in nsIURI aURI,
-                                      in nsIPrincipal aPrincipal,
-                                      in nsIInterfaceRequestor aCallbacks);
+    void speculativeAnonymousConnect(in nsIURI aURI,
+                                     in nsIPrincipal aPrincipal,
+                                     in nsIInterfaceRequestor aCallbacks);
 };
 
 /**
  * This is used to override the default values for various values (documented
  * inline) to determine whether or not to actually make a speculative
  * connection.
  */
 [builtinclass, uuid(1040ebe3-6ed1-45a6-8587-995e082518d7)]
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -627,19 +627,19 @@ bool NeckoParent::DeallocPDNSRequestPare
 mozilla::ipc::IPCResult NeckoParent::RecvSpeculativeConnect(
     const URIParams& aURI, const Principal& aPrincipal,
     const bool& aAnonymous) {
   nsCOMPtr<nsISpeculativeConnect> speculator(gIOService);
   nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
   nsCOMPtr<nsIPrincipal> principal(aPrincipal);
   if (uri && speculator) {
     if (aAnonymous) {
-      speculator->SpeculativeAnonymousConnect2(uri, principal, nullptr);
+      speculator->SpeculativeAnonymousConnect(uri, principal, nullptr);
     } else {
-      speculator->SpeculativeConnect2(uri, principal, nullptr);
+      speculator->SpeculativeConnect(uri, principal, nullptr);
     }
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult NeckoParent::RecvHTMLDNSPrefetch(
     const nsString& hostname, const bool& isHttps,
     const OriginAttributes& aOriginAttributes, const uint16_t& flags) {
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -2467,25 +2467,25 @@ nsresult nsHttpHandler::SpeculativeConne
   auto *ci = new nsHttpConnectionInfo(host, port, EmptyCString(), username,
                                       nullptr, originAttributes, usingSSL);
   ci->SetAnonymous(anonymous);
 
   return SpeculativeConnect(ci, aCallbacks);
 }
 
 NS_IMETHODIMP
-nsHttpHandler::SpeculativeConnect2(nsIURI *aURI, nsIPrincipal *aPrincipal,
-                                   nsIInterfaceRequestor *aCallbacks) {
+nsHttpHandler::SpeculativeConnect(nsIURI *aURI, nsIPrincipal *aPrincipal,
+                                  nsIInterfaceRequestor *aCallbacks) {
   return SpeculativeConnectInternal(aURI, aPrincipal, aCallbacks, false);
 }
 
 NS_IMETHODIMP
-nsHttpHandler::SpeculativeAnonymousConnect2(nsIURI *aURI,
-                                            nsIPrincipal *aPrincipal,
-                                            nsIInterfaceRequestor *aCallbacks) {
+nsHttpHandler::SpeculativeAnonymousConnect(nsIURI *aURI,
+                                           nsIPrincipal *aPrincipal,
+                                           nsIInterfaceRequestor *aCallbacks) {
   return SpeculativeConnectInternal(aURI, aPrincipal, aCallbacks, true);
 }
 
 void nsHttpHandler::TickleWifi(nsIInterfaceRequestor *cb) {
   if (!cb || !mWifiTickler) return;
 
   // If B2G requires a similar mechanism nsINetworkManager, currently only avail
   // on B2G, contains the necessary information on wifi and gateway
--- a/netwerk/test/unit/test_speculative_connect.js
+++ b/netwerk/test/unit/test_speculative_connect.js
@@ -144,17 +144,17 @@ TestFailedStreamCallback.prototype = {
 function test_speculative_connect() {
     serv = new TestServer();
     var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
                 .getService(Ci.nsIScriptSecurityManager);
     var URI = ios.newURI("http://localhost:" + serv.listener.port + "/just/a/test");
     var principal = ssm.createCodebasePrincipal(URI, {});
 
     ios.QueryInterface(Ci.nsISpeculativeConnect)
-       .speculativeConnect2(URI, principal, null);
+       .speculativeConnect(URI, principal, null);
 }
 
 /* Speculative connections should not be allowed for hosts with local IP
  * addresses (Bug 853423). That list includes:
  *  -- IPv4 RFC1918 and Link Local Addresses.
  *  -- IPv6 Unique and Link Local Addresses.
  *
  * Two tests are required:
--- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_speculative.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_speculative.js
@@ -26,13 +26,13 @@ add_task(async function test_speculative
 
   Services.prefs.setBoolPref("network.http.debug-observations", true);
 
   await handlingExt.startup();
 
   let notificationPromise = ExtensionUtils.promiseObserved("speculative-connect-request");
 
   let uri = Services.io.newURI(`http://${proxy.identity.primaryHost}:${proxy.identity.primaryPort}`);
-  Services.io.speculativeConnect2(uri, Services.scriptSecurityManager.getSystemPrincipal(), null);
+  Services.io.speculativeConnect(uri, Services.scriptSecurityManager.getSystemPrincipal(), null);
   await notificationPromise;
 
   await handlingExt.unload();
 });
--- a/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm
+++ b/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm
@@ -77,17 +77,17 @@ RemoteWebNavigation.prototype = {
         // inferred from the current context.
         if (!principal || principal.isSystemPrincipal) {
           let attrs = {
             userContextId: this._browser.getAttribute("usercontextid") || 0,
             privateBrowsingId: PrivateBrowsingUtils.isBrowserPrivate(this._browser) ? 1 : 0,
           };
           principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, attrs);
         }
-        Services.io.speculativeConnect2(uri, principal, null);
+        Services.io.speculativeConnect(uri, principal, null);
       } catch (ex) {
         // Can't setup speculative connection for this uri string for some
         // reason (such as failing to parse the URI), just ignore it.
       }
     }
 
     this._sendMessage("WebNavigation:LoadURI", {
       uri: aURI,
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -2499,22 +2499,22 @@ Engine.prototype = {
 
     if (!attrs) {
       attrs = options.window.docShell.getOriginAttributes();
     }
 
     let principal = Services.scriptSecurityManager
                             .createCodebasePrincipal(searchURI, attrs);
 
-    connector.speculativeConnect2(searchURI, principal, callbacks);
+    connector.speculativeConnect(searchURI, principal, callbacks);
 
     if (this.supportsResponseType(URLTYPE_SUGGEST_JSON)) {
       let suggestURI = this.getSubmission("dummy", URLTYPE_SUGGEST_JSON).uri;
       if (suggestURI.prePath != searchURI.prePath)
-        connector.speculativeConnect2(suggestURI, principal, callbacks);
+        connector.speculativeConnect(suggestURI, principal, callbacks);
     }
   },
 };
 
 // nsISearchSubmission
 function Submission(aURI, aPostData = null) {
   this._uri = aURI;
   this._postData = aPostData;
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -135,17 +135,17 @@ class GeckoThreadSupport final
     nsCOMPtr<nsIURI> uri = nsAppShell::ResolveURI(aUriStr->ToCString());
     if (!uri) {
       return;
     }
 
     OriginAttributes attrs;
     nsCOMPtr<nsIPrincipal> principal =
         BasePrincipal::CreateCodebasePrincipal(uri, attrs);
-    specConn->SpeculativeConnect2(uri, principal, nullptr);
+    specConn->SpeculativeConnect(uri, principal, nullptr);
   }
 
   static bool WaitOnGecko(int64_t timeoutMillis) {
     struct NoOpRunnable : Runnable {
       NoOpRunnable() : Runnable("NoOpRunnable") {}
       NS_IMETHOD Run() override { return NS_OK; }
     };