Backed out 2 changesets (bug 1554527, bug 1553867) as requested by Sylvestre for causing huge perf regressions. a=backout
authorCosmin Sabou <csabou@mozilla.com>
Wed, 29 May 2019 09:57:29 +0300
changeset 476012 3a79d3be67486be1d30bda47988cf8c76ee3a3ee
parent 475927 dbc8659c51ebde4c5916b3c169bd097fed33f1c9
child 476013 537b6d1915e8d78f1da3112f0579d6101b6abda8
push id113240
push usernerli@mozilla.com
push dateWed, 29 May 2019 09:56:33 +0000
treeherdermozilla-inbound@3c26311b3d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1554527, 1553867
milestone69.0a1
backs out1e85291f97ded57e21692f3a30c836716be0214a
daf113171d6342f925fb8265cdbee384c7f64dc3
first release with
nightly linux32
3a79d3be6748 / 69.0a1 / 20190529065901 / files
nightly linux64
3a79d3be6748 / 69.0a1 / 20190529065901 / files
nightly mac
3a79d3be6748 / 69.0a1 / 20190529065901 / files
nightly win32
3a79d3be6748 / 69.0a1 / 20190529065901 / files
nightly win64
3a79d3be6748 / 69.0a1 / 20190529065901 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1554527, bug 1553867) as requested by Sylvestre for causing huge perf regressions. a=backout Backed out changeset 1e85291f97de (bug 1554527) Backed out changeset daf113171d63 (bug 1553867)
extensions/permissions/nsPermission.cpp
netwerk/base/nsIPermission.idl
netwerk/cookie/CookieSettings.cpp
--- a/extensions/permissions/nsPermission.cpp
+++ b/extensions/permissions/nsPermission.cpp
@@ -106,50 +106,39 @@ nsPermission::Matches(nsIPrincipal* aPri
 
   nsCOMPtr<nsIPrincipal> principal =
       nsPermission::ClonePrincipalForPermission(aPrincipal);
   if (!principal) {
     *aMatches = false;
     return NS_OK;
   }
 
-  return MatchesPrincipalForPermission(principal, aExactHost, aMatches);
-}
-
-NS_IMETHODIMP
-nsPermission::MatchesPrincipalForPermission(nsIPrincipal* aPrincipal,
-                                            bool aExactHost, bool* aMatches) {
-  NS_ENSURE_ARG_POINTER(aPrincipal);
-  NS_ENSURE_ARG_POINTER(aMatches);
-
-  *aMatches = false;
-
   // If the principals are equal, then they match.
-  if (mPrincipal->Equals(aPrincipal)) {
+  if (mPrincipal->Equals(principal)) {
     *aMatches = true;
     return NS_OK;
   }
 
   // If we are matching with an exact host, we're done now - the permissions
   // don't match otherwise, we need to start comparing subdomains!
   if (aExactHost) {
     return NS_OK;
   }
 
   // Compare their OriginAttributes
   const mozilla::OriginAttributes& theirAttrs =
-      aPrincipal->OriginAttributesRef();
+      principal->OriginAttributesRef();
   const mozilla::OriginAttributes& ourAttrs = mPrincipal->OriginAttributesRef();
 
   if (theirAttrs != ourAttrs) {
     return NS_OK;
   }
 
   nsCOMPtr<nsIURI> theirURI;
-  nsresult rv = aPrincipal->GetURI(getter_AddRefs(theirURI));
+  nsresult rv = principal->GetURI(getter_AddRefs(theirURI));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIURI> ourURI;
   rv = mPrincipal->GetURI(getter_AddRefs(ourURI));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Compare schemes
   nsAutoCString theirScheme;
--- a/netwerk/base/nsIPermission.idl
+++ b/netwerk/base/nsIPermission.idl
@@ -63,23 +63,16 @@ interface nsIPermission : nsISupports
      *                   @see nsIPermissionManager::testExactPermission.
      *                   If false, subdomains will also be searched,
      *                   @see nsIPermissionManager::testPermission.
      */
     boolean matches(in nsIPrincipal principal,
                     in boolean exactHost);
 
     /**
-     * Similar to matches() but the principal's URI should be just an origin
-     * (no path, no queryString, etc).
-     */
-    [noscript] boolean matchesPrincipalForPermission(in nsIPrincipal principal,
-                                                     in boolean exactHost);
-
-    /**
      * Test whether a URI would be affected by this permission.
      * NOTE: This performs matches with default origin attribute values.
      *
      * @param uri        the uri to test
      * @param exactHost  If true, only the specific host will be matched,
      *                   @see nsIPermissionManager::testExactPermission.
      *                   If false, subdomains will also be searched,
      *                   @see nsIPermissionManager::testPermission.
--- a/netwerk/cookie/CookieSettings.cpp
+++ b/netwerk/cookie/CookieSettings.cpp
@@ -120,37 +120,29 @@ CookieSettings::CookiePermission(nsIPrin
   NS_ENSURE_ARG_POINTER(aPrincipal);
   NS_ENSURE_ARG_POINTER(aCookiePermission);
 
   *aCookiePermission = nsIPermissionManager::UNKNOWN_ACTION;
 
   nsresult rv;
 
   // Let's see if we know this permission.
-  if (!mCookiePermissions.IsEmpty()) {
-    nsCOMPtr<nsIPrincipal> principal =
-        nsPermission::ClonePrincipalForPermission(aPrincipal);
-    if (NS_WARN_IF(!principal)) {
-      return NS_ERROR_FAILURE;
+  for (const RefPtr<nsIPermission>& permission : mCookiePermissions) {
+    bool match = false;
+    rv = permission->Matches(aPrincipal, false, &match);
+    if (NS_WARN_IF(NS_FAILED(rv)) || !match) {
+      continue;
     }
 
-    for (const RefPtr<nsIPermission>& permission : mCookiePermissions) {
-      bool match = false;
-      rv = permission->MatchesPrincipalForPermission(aPrincipal, false, &match);
-      if (NS_WARN_IF(NS_FAILED(rv)) || !match) {
-        continue;
-      }
+    rv = permission->GetCapability(aCookiePermission);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
 
-      rv = permission->GetCapability(aCookiePermission);
-      if (NS_WARN_IF(NS_FAILED(rv))) {
-        return rv;
-      }
-
-      return NS_OK;
-    }
+    return NS_OK;
   }
 
   // Let's ask the permission manager.
   nsPermissionManager* pm = nsPermissionManager::GetInstance();
   if (NS_WARN_IF(!pm)) {
     return NS_ERROR_FAILURE;
   }