Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1270)

Unified Diff: Source/modules/screen_orientation/ScreenOrientation.cpp

Issue 131113003: Fix DOMWindow::isCurrentlyDisplayedInFrame to return false when detached (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix ScreenOrientation + test window.open. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/screen_orientation/ScreenOrientation.cpp
diff --git a/Source/modules/screen_orientation/ScreenOrientation.cpp b/Source/modules/screen_orientation/ScreenOrientation.cpp
index 0b150371089a322439e2c030ef1ccb73fda0080b..f84beab60a689323b09338d5c1e0f64e4937cd5d 100644
--- a/Source/modules/screen_orientation/ScreenOrientation.cpp
+++ b/Source/modules/screen_orientation/ScreenOrientation.cpp
@@ -99,11 +99,12 @@ const char* ScreenOrientation::supplementName()
return "ScreenOrientation";
}
-Document& ScreenOrientation::document() const
+Document* ScreenOrientation::document() const
{
- ASSERT(m_associatedDOMWindow);
+ if (!m_associatedDOMWindow || !m_associatedDOMWindow->isCurrentlyDisplayedInFrame())
+ return 0;
ASSERT(m_associatedDOMWindow->document());
- return *m_associatedDOMWindow->document();
+ return m_associatedDOMWindow->document();
}
ScreenOrientation& ScreenOrientation::from(Screen& screen)
@@ -123,7 +124,9 @@ ScreenOrientation::~ScreenOrientation()
const AtomicString& ScreenOrientation::orientation(Screen& screen)
{
ScreenOrientation& screenOrientation = ScreenOrientation::from(screen);
- ScreenOrientationController& controller = ScreenOrientationController::from(screenOrientation.document());
+ if (!screenOrientation.document())
+ return emptyAtom;
+ ScreenOrientationController& controller = ScreenOrientationController::from(*screenOrientation.document());
return orientationToString(controller.orientation());
}
« Source/core/frame/DOMWindow.cpp ('K') | « Source/modules/screen_orientation/ScreenOrientation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698