Bug 1340926 part 1 - Make nsDocument::IsAboutPage usable in const function. r=ehsan
MozReview-Commit-ID: 6MYH6VAQ911
--- 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.