Bug 1340926 part 1 - Make nsDocument::IsAboutPage usable in const function. r?ehsan draft
authorXidorn Quan <me@upsuper.org>
Mon, 20 Feb 2017 12:35:15 +1100
changeset 486805 1356f8cc0b941fd08b8080c7fa45f1e2ecc59339
parent 486506 9e3fe0cfbc3f04a9b163697690d4eb68350d9482
child 486806 bd6ed7ba822f1e74a1119bd84a0e20abbffa7e2c
push id46065
push userxquan@mozilla.com
push dateMon, 20 Feb 2017 01:46:13 +0000
reviewersehsan
bugs1340926
milestone54.0a1
Bug 1340926 part 1 - Make nsDocument::IsAboutPage usable in const function. r?ehsan MozReview-Commit-ID: 6MYH6VAQ911
dom/base/nsDocument.cpp
dom/base/nsDocument.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1469,19 +1469,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
@@ -1530,17 +1530,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.