Bug 1200402 - Ignore desktop mode for about: pages. r=snorp,khuey

This commit is contained in:
Kartikaya Gupta 2015-09-01 14:04:58 -04:00
parent b0b4a86a25
commit 0c30a874d9
2 changed files with 19 additions and 11 deletions

View File

@ -1591,6 +1591,18 @@ nsIDocument::~nsIDocument()
UnlinkOriginalDocumentIfStatic();
}
bool
nsDocument::IsAboutPage()
{
nsCOMPtr<nsIPrincipal> principal = GetPrincipal();
nsCOMPtr<nsIURI> uri;
principal->GetURI(getter_AddRefs(uri));
bool isAboutScheme = true;
if (uri) {
uri->SchemeIs("about", &isAboutScheme);
}
return isAboutScheme;
}
nsDocument::~nsDocument()
{
@ -1608,15 +1620,7 @@ nsDocument::~nsDocument()
if (IsTopLevelContentDocument()) {
//don't report for about: pages
nsCOMPtr<nsIPrincipal> principal = GetPrincipal();
nsCOMPtr<nsIURI> uri;
principal->GetURI(getter_AddRefs(uri));
bool isAboutScheme = true;
if (uri) {
uri->SchemeIs("about", &isAboutScheme);
}
if (!isAboutScheme) {
if (!IsAboutPage()) {
// Record the page load
uint32_t pageLoaded = 1;
Accumulate(Telemetry::MIXED_CONTENT_UNBLOCK_COUNTER, pageLoaded);
@ -7900,9 +7904,10 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
CSSToScreenScale defaultScale = layoutDeviceScale
* LayoutDeviceToScreenScale(1.0);
// Get requested Desktopmode
// Special behaviour for desktop mode, provided we are not on an about: page
nsPIDOMWindow* win = GetWindow();
if (win && win->IsDesktopModeViewport())
if (win && win->IsDesktopModeViewport() && !IsAboutPage())
{
float viewportWidth = gfxPrefs::DesktopViewportWidth() / fullZoom;
float scaleToFit = aDisplaySize.width / viewportWidth;

View File

@ -1770,6 +1770,9 @@ private:
// requestAnimationFrame, if it's OK to do so.
void MaybeRescheduleAnimationFrameNotifications();
// Returns true if the scheme for the url for this document is "about"
bool IsAboutPage();
// These are not implemented and not supported.
nsDocument(const nsDocument& aOther);
nsDocument& operator=(const nsDocument& aOther);