Bug 1340926 - Part 1: Make nsDocument::IsAboutPage usable in const function. r=Ehsan, a=gchang
authorXidorn Quan <me@upsuper.org>
Mon, 20 Feb 2017 12:35:15 +1100
changeset 359452 a5357f98767044783946a3719dd04fa20a3bd108
parent 359451 faa3b0ea01237c74a055568f3bd82b1b3f371cb4
child 359453 31e2622d8bf86da2206b9267fa385833afc1e46f
push id10805
push userryanvm@gmail.com
push dateFri, 24 Feb 2017 18:25:19 +0000
treeherdermozilla-aurora@329442feed24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, gchang
bugs1340926
milestone53.0a2
Bug 1340926 - Part 1: Make nsDocument::IsAboutPage usable in const function. r=Ehsan, a=gchang MozReview-Commit-ID: 6MYH6VAQ911
dom/base/nsDocument.cpp
dom/base/nsDocument.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1363,19 +1363,19 @@ nsIDocument::~nsIDocument()
   if (mDocGroup) {
     mDocGroup->RemoveDocument(this);
   }
 
   UnlinkOriginalDocumentIfStatic();
 }
 
 bool
-nsDocument::IsAboutPage()
-{
-  nsCOMPtr<nsIPrincipal> principal = GetPrincipal();
+nsDocument::IsAboutPage() const
+{
+  nsCOMPtr<nsIPrincipal> principal = NodePrincipal();
   nsCOMPtr<nsIURI> uri;
   principal->GetURI(getter_AddRefs(uri));
   bool isAboutScheme = true;
   if (uri) {
     uri->SchemeIs("about", &isAboutScheme);
   }
   return isAboutScheme;
 }
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -1534,17 +1534,17 @@ private:
   void RevokeAnimationFrameNotifications();
   // Reschedule any notifications we need to handle
   // requestAnimationFrame, if it's OK to do so.
   void MaybeRescheduleAnimationFrameNotifications();
 
   void ClearAllBoxObjects();
 
   // Returns true if the scheme for the url for this document is "about"
-  bool IsAboutPage();
+  bool IsAboutPage() const;
 
   // These are not implemented and not supported.
   nsDocument(const nsDocument& aOther);
   nsDocument& operator=(const nsDocument& aOther);
 
   // The layout history state that should be used by nodes in this
   // document.  We only actually store a pointer to it when:
   // 1)  We have no script global object.