Bug 1526542 follow-up: Address froydnj's review comment by adding the length of aGrantedOrigin to the capacity consideration of aPermissionKey as well
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 12 Feb 2019 10:02:38 -0500
changeset 458705 cbbdfdbbe0ab
parent 458702 609114233603
child 458706 d09e3e887cdf
push id35546
push userrmaries@mozilla.com
push dateWed, 13 Feb 2019 04:27:59 +0000
treeherdermozilla-central@636d2c00234d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1526542
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 1526542 follow-up: Address froydnj's review comment by adding the length of aGrantedOrigin to the capacity consideration of aPermissionKey as well
toolkit/components/antitracking/AntiTrackingCommon.cpp
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -141,17 +141,18 @@ void CreatePermissionKey(const nsCString
   if (aTrackingOrigin == aGrantedOrigin) {
     CreatePermissionKey(aTrackingOrigin, aPermissionKey);
     return;
   }
 
   static const nsLiteralCString prefix =
       NS_LITERAL_CSTRING(ANTITRACKING_PERM_KEY "^");
 
-  aPermissionKey.SetCapacity(prefix.Length() + 1 + aTrackingOrigin.Length());
+  aPermissionKey.SetCapacity(prefix.Length() + 1 + aTrackingOrigin.Length() +
+                             aGrantedOrigin.Length());
   aPermissionKey.Append(prefix);
   aPermissionKey.Append(aTrackingOrigin);
   aPermissionKey.AppendLiteral("^");
   aPermissionKey.Append(aGrantedOrigin);
 }
 
 // This internal method returns ACCESS_DENY if the access is denied,
 // ACCESS_DEFAULT if unknown, some other access code if granted.