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 346292 8cd9e592cc85ff5f48d65160bf64e7dfc9c8c844
parent 346291 c9bf97b0dd70b4559367fa91fc4dcdabd8c3660b
child 346293 5dd02b882459fe98a58cde580a215793def4880e
push id31460
push usercbook@mozilla.com
push dateTue, 07 Mar 2017 14:14:00 +0000
treeherdermozilla-central@47e5c929a487 [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)