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

Unified Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 1308723003: DOMWindow::navigator should return navigator w/o frame when detached. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
« no previous file with comments | « LayoutTests/http/tests/serviceworker/chromium/frame-removed.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalDOMWindow.cpp
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index 0ffefbc9f3026c909f369bca438422e598acdad5..1516155ddf3c510143f5f748e86286725ba773ef 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -661,8 +661,17 @@ ApplicationCache* LocalDOMWindow::applicationCache() const
Navigator* LocalDOMWindow::navigator() const
{
+ if (!isCurrentlyDisplayedInFrame() && (!m_navigator || m_navigator->frame())) {
+ // We return a navigator with null frame instead of returning null
+ // pointer as other functions do, in order to allow users to access
+ // functions such as navigator.product.
+ m_navigator = Navigator::create(nullptr);
+ }
if (!m_navigator)
m_navigator = Navigator::create(frame());
+ // As described above, when not dispayed in the frame, the returning
+ // navigator should not be associated with the frame.
+ ASSERT(isCurrentlyDisplayedInFrame() || !m_navigator->frame());
return m_navigator.get();
}
« no previous file with comments | « LayoutTests/http/tests/serviceworker/chromium/frame-removed.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698