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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 2085983002: binding: Window-returning attributes return null if a Window is detached. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ToV8.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/DOMWindow.h" 5 #include "core/frame/DOMWindow.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/dom/SecurityContext.h" 10 #include "core/dom/SecurityContext.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // FIXME: Use FrameTree to get opener as well, to simplify logic here. 96 // FIXME: Use FrameTree to get opener as well, to simplify logic here.
97 if (!frame() || !frame()->client()) 97 if (!frame() || !frame()->client())
98 return nullptr; 98 return nullptr;
99 99
100 Frame* opener = frame()->client()->opener(); 100 Frame* opener = frame()->client()->opener();
101 return opener ? opener->domWindow() : nullptr; 101 return opener ? opener->domWindow() : nullptr;
102 } 102 }
103 103
104 DOMWindow* DOMWindow::parent() const 104 DOMWindow* DOMWindow::parent() const
105 { 105 {
106 if (!frame()) 106 // TODO(yukishiino): The 'parent' attribute must return |this|
107 // (the WindowProxy object of the browsing context itself) when it's
108 // top-level or detached.
109 if (!isCurrentlyDisplayedInFrame())
107 return nullptr; 110 return nullptr;
108 111
109 Frame* parent = frame()->tree().parent(); 112 Frame* parent = frame()->tree().parent();
110 return parent ? parent->domWindow() : frame()->domWindow(); 113 return parent ? parent->domWindow() : frame()->domWindow();
111 } 114 }
112 115
113 DOMWindow* DOMWindow::top() const 116 DOMWindow* DOMWindow::top() const
114 { 117 {
115 if (!frame()) 118 // TODO(yukishiino): The 'top' attribute must return |this|
119 // (the WindowProxy object of the browsing context itself) when it's
120 // top-level or detached.
121 if (!isCurrentlyDisplayedInFrame())
116 return nullptr; 122 return nullptr;
117 123
118 return frame()->tree().top()->domWindow(); 124 return frame()->tree().top()->domWindow();
119 } 125 }
120 126
121 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const 127 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const
122 { 128 {
123 if (!frame()) 129 if (!frame())
124 return nullptr; 130 return nullptr;
125 131
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */ ); 374 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */ );
369 } 375 }
370 376
371 DEFINE_TRACE(DOMWindow) 377 DEFINE_TRACE(DOMWindow)
372 { 378 {
373 visitor->trace(m_location); 379 visitor->trace(m_location);
374 EventTargetWithInlineData::trace(visitor); 380 EventTargetWithInlineData::trace(visitor);
375 } 381 }
376 382
377 } // namespace blink 383 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ToV8.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698