Bug 1340710 - Part 9: Speed up the OriginAttributes comparison in BasePrincipal::Subsumes(); r=bholley
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 24 Feb 2017 20:27:06 -0500
changeset 396767 8cd9e592cc85ff5f48d65160bf64e7dfc9c8c844
parent 396766 c9bf97b0dd70b4559367fa91fc4dcdabd8c3660b
child 396768 5dd02b882459fe98a58cde580a215793def4880e
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1340710
milestone54.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 1340710 - Part 9: Speed up the OriginAttributes comparison in BasePrincipal::Subsumes(); r=bholley
caps/BasePrincipal.cpp
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -316,23 +316,24 @@ BasePrincipal::GetOriginNoSuffix(nsACStr
   }
   return GetOriginInternal(aOrigin);
 }
 
 bool
 BasePrincipal::Subsumes(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration)
 {
   MOZ_ASSERT(aOther);
+  MOZ_ASSERT_IF(Kind() == eCodebasePrincipal, mOriginSuffix);
 
   // Expanded principals handle origin attributes for each of their
   // sub-principals individually, null principals do only simple checks for
   // pointer equality, and system principals are immune to origin attributes
   // checks, so only do this check for codebase principals.
   if (Kind() == eCodebasePrincipal &&
-      OriginAttributesRef() != Cast(aOther)->OriginAttributesRef()) {
+      mOriginSuffix != Cast(aOther)->mOriginSuffix) {
     return false;
   }
 
   return SubsumesInternal(aOther, aConsideration);
 }
 
 bool
 BasePrincipal::FastEquals(nsIPrincipal* aOther)