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 487671 7ed49c06d62e1003ad33ef67aa1cda74c4740473
parent 487670 fa50f42a55d70138154deec3b4b6da84398e04b8
child 487672 f895006f49ee2e0a810c53073f85470e007214ee
push id46289
push userxquan@mozilla.com
push dateTue, 21 Feb 2017 23:05:51 +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.