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

Issue 538323003: Have window.closed return true when frame is closed. (Closed)

Created:
6 years, 3 months ago by sof
Modified:
6 years, 3 months ago
CC:
abarth-chromium, blink-reviews, mkwst+moarreviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Have window.closed return true when frame is closed. This Window property currently returns true once the Frame it is attached to is destroyed, which exposes an object memory management detail that's hard to emulate with Oilpan. Switch instead to having "closed" return true once the frame is externally closed or the (i)frame is removed&detached. Adjust tests to check for this instead -- no indication that this slight adjustment in behavior will pose a compatibility problem. R=haraken,ager,mkwst,tkent BUG=414658 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182148

Patch Set 1 #

Total comments: 2

Patch Set 2 : Update m_hasBeenClosed comment #

Total comments: 2

Patch Set 3 : Un-inline and improve formatting of Frame::setHasBeenClosed() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -15 lines) Patch
M LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated.html View 1 chunk +2 lines, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed.html View 1 chunk +2 lines, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced.html View 1 chunk +2 lines, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated.html View 1 chunk +2 lines, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed.html View 1 chunk +2 lines, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced.html View 1 chunk +2 lines, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/fast/dom/Window/resources/window-property-collector.js View 3 chunks +8 lines, -5 lines 0 comments Download
M Source/core/frame/Frame.h View 1 2 2 chunks +11 lines, -0 lines 0 comments Download
M Source/core/frame/Frame.cpp View 1 2 2 chunks +7 lines, -0 lines 0 comments Download
M Source/core/frame/LocalDOMWindow.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/web/WebLocalFrameImpl.cpp View 1 chunk +3 lines, -0 lines 0 comments Download
M Source/web/WebRemoteFrameImpl.cpp View 2 chunks +3 lines, -1 line 0 comments Download

Messages

Total messages: 25 (4 generated)
sof
Please take a look.
6 years, 3 months ago (2014-09-16 16:42:29 UTC) #2
haraken
How do other browsers behave?
6 years, 3 months ago (2014-09-17 00:02:19 UTC) #3
sof
On 2014/09/17 00:02:19, haraken(OOO til Sep 21) wrote: > How do other browsers behave? Sorry, ...
6 years, 3 months ago (2014-09-17 07:36:16 UTC) #4
haraken
On 2014/09/17 07:36:16, sof wrote: > On 2014/09/17 00:02:19, haraken(OOO til Sep 21) wrote: > ...
6 years, 3 months ago (2014-09-17 07:40:00 UTC) #5
Mads Ager (chromium)
LGTM I think the behavior change is a good thing here. No reason to tie ...
6 years, 3 months ago (2014-09-17 07:47:39 UTC) #6
Mike West
LGTM2, for what it's worth.
6 years, 3 months ago (2014-09-17 07:49:39 UTC) #8
sof
Cc +abarth: fyi Thanks for the reviews. ager wrote: > I think the behavior change ...
6 years, 3 months ago (2014-09-17 08:08:28 UTC) #9
sof
tkent, jochen: when you next have some "platform owner" cycles available, could you take a ...
6 years, 3 months ago (2014-09-17 08:10:37 UTC) #11
tkent
The behavior change sounds reasonable. lgtm. https://codereview.chromium.org/538323003/diff/20001/Source/core/frame/Frame.h File Source/core/frame/Frame.h (right): https://codereview.chromium.org/538323003/diff/20001/Source/core/frame/Frame.h#newcode102 Source/core/frame/Frame.h:102: void setHasBeenClosed() { ...
6 years, 3 months ago (2014-09-17 08:28:46 UTC) #12
sof
https://codereview.chromium.org/538323003/diff/20001/Source/core/frame/Frame.h File Source/core/frame/Frame.h (right): https://codereview.chromium.org/538323003/diff/20001/Source/core/frame/Frame.h#newcode102 Source/core/frame/Frame.h:102: void setHasBeenClosed() { ASSERT(!m_hasBeenClosed); m_hasBeenClosed = true; } On ...
6 years, 3 months ago (2014-09-17 09:55:05 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/538323003/40001
6 years, 3 months ago (2014-09-17 09:56:26 UTC) #15
dcheng
Why do we need a new boolean for this? How come we can't do something ...
6 years, 3 months ago (2014-09-17 10:56:23 UTC) #16
dcheng
not lgtm, since I don't think we should be adding another bit of parallel state.
6 years, 3 months ago (2014-09-17 10:58:45 UTC) #17
commit-bot: I haz the power
Committed patchset #3 (id:40001) as 182148
6 years, 3 months ago (2014-09-17 11:02:50 UTC) #18
sof
On 2014/09/17 10:56:23, dcheng (OOO) wrote: > Why do we need a new boolean for ...
6 years, 3 months ago (2014-09-17 11:06:58 UTC) #19
dcheng
On 2014/09/17 at 11:06:58, sigbjornf wrote: > On 2014/09/17 10:56:23, dcheng (OOO) wrote: > > ...
6 years, 3 months ago (2014-09-17 11:09:56 UTC) #20
sof
On 2014/09/17 11:09:56, dcheng (OOO) wrote: > On 2014/09/17 at 11:06:58, sigbjornf wrote: > > ...
6 years, 3 months ago (2014-09-17 11:12:24 UTC) #21
dcheng
On 2014/09/17 at 11:12:24, sigbjornf wrote: > On 2014/09/17 11:09:56, dcheng (OOO) wrote: > > ...
6 years, 3 months ago (2014-09-17 11:20:35 UTC) #22
sof
On 2014/09/17 11:20:35, dcheng (OOO) wrote: > On 2014/09/17 at 11:12:24, sigbjornf wrote: > > ...
6 years, 3 months ago (2014-09-17 11:24:30 UTC) #23
sof
On 2014/09/17 11:24:30, sof wrote: > On 2014/09/17 11:20:35, dcheng (OOO) wrote: > > On ...
6 years, 3 months ago (2014-09-17 11:42:04 UTC) #24
sof
6 years, 3 months ago (2014-09-17 13:47:58 UTC) #25
Message was sent while issue was closed.
On 2014/09/17 11:42:04, sof wrote:
> On 2014/09/17 11:24:30, sof wrote:
> > On 2014/09/17 11:20:35, dcheng (OOO) wrote:
> > > On 2014/09/17 at 11:12:24, sigbjornf wrote:
> > > > On 2014/09/17 11:09:56, dcheng (OOO) wrote:
> > > > > On 2014/09/17 at 11:06:58, sigbjornf wrote:
> > > > > > On 2014/09/17 10:56:23, dcheng (OOO) wrote:
> > > > > > > Why do we need a new boolean for this? How come we can't do
> something
> > > like
> > > > > check
> > > > > > > that Frame::host() is not null?
> > > > > > 
> > > > > > m_host wouldn't be set to null upon calling close(), or would it?
> > > > > 
> > > > > close() is called by the embedder as one of the final steps of frame
> > detach.
> > > > > m_host is nulled out as part of frame detach.
> > > > 
> > > > So window.closed should become true upon detaching instead?
> > > 
> > > That's essentially what this patch is--I just don't think we actually need
> the
> > > bool. WebFrame::close() is somewhat of a misleading name in this context.
> When
> > > we refactored WebFrame, we didn't want to expose the refcounted nature to
> the
> > > embedder. So instead, the embedder pairs the concepts create() and
> close()--if
> > > it creates()s a WebFrame or WebView, it must close() it or else it will
> leak.
> > > 
> > > When a frame is being detached for any reason (window.close(), iframe
> > detached,
> > > webview closed), it goes through Frame::detach(). Blink finishes all its
> > cleanup
> > > (which includes setting Frame::m_host to null) before signaling to the
> > embedder
> > > that the frame is detached via WebFrameClient::frameDetached(). The
embedder
> > > then performs its cleanup, and the as the final step, calls
> WebFrame::close()
> > to
> > > match the original call to WebFrame::create().
> > 
> > We can certainly try to simplify it along those lines; it would be for the
> > better if it works out.
> 
> Looks encouraging, preparing a follow up CL. Good stuff, thanks for pointing
> this out.

For cross-reference, https://codereview.chromium.org/544013005/

Powered by Google App Engine
This is Rietveld 408576698