Closed Bug 978610 Opened 10 years ago Closed 10 years ago

[e10s] Make window.close() work

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: billm, Assigned: billm)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file, 5 obsolete files)

Attached patch window-close (obsolete) — Splinter Review
I mostly just copies what we do in non-e10s code. See the DOMWindowClose event.
Attachment #8384313 - Flags: review?(bugs)
How does b2g deal with this stuff?
Comment on attachment 8384313 [details] [diff] [review]
window-close

We need to coordinate this kind of changes with b2g. And have some tests.
Attachment #8384313 - Flags: review?(bugs) → review-
Comment on attachment 8384313 [details] [diff] [review]
window-close

And DOMTabClose is, well, tab specific. We will use remote stuff for other
remote browsers too.
So perhaps DOMRemoteBrowserClose.

Also, isn't that this.tabs.length thing doing the wrong thing here.
It prevent us to close the last tab/window.

DOMWindowClose doesn't call event.preventDefault which means nsGlobalWindow
doesn't try to close itself.

I think it would be better to mimic the non-OOP behavior.
TabChild could catch DOMWindowClose and forward it synchronously to
parent and parent then deals it the same way as it does local
DOMWindowClose.
Attached patch window-close v2 (obsolete) — Splinter Review
Does this look right?
Attachment #8384313 - Attachment is obsolete: true
Attachment #8385604 - Flags: review?(bugs)
Comment on attachment 8385604 [details] [diff] [review]
window-close v2

>+TabParent::RecvCloseWindow()
>+{
>+  nsContentUtils::DispatchTrustedEvent(mFrameElement->OwnerDoc(), mFrameElement,
>+                                       NS_LITERAL_STRING("DOMRemoteWindowClose"),
>+                                       true, true);
Null check mFrameElement.

But this needs a toolkit/ review, since I'm not sure whether calling window.close() is the right thing.
I believe BrowserTryToCloseWindow() or closeWindow(some params) should be used.

Also, I don't know how b2g app closing works.
Attachment #8385604 - Flags: review?(bugs) → review+
Comment on attachment 8385604 [details] [diff] [review]
window-close v2

> But this needs a toolkit/ review, since I'm not sure whether calling
> window.close() is the right thing.
> I believe BrowserTryToCloseWindow() or closeWindow(some params) should be used.

I don't see where non-e10s code would call those functions, so I don't think we should call them in e10s either. When there's only one tab, the non-e10s code just seems to handle everything in nsGlobalWindow, which I think is what window.close() does.
Attachment #8385604 - Flags: review+ → review?(felipc)
Attached patch window-close v3 (obsolete) — Splinter Review
It turns out this patch does break b2g, so I added a branch to avoid that.
Attachment #8385604 - Attachment is obsolete: true
Attachment #8385604 - Flags: review?(felipc)
Attachment #8388978 - Flags: review?(felipc)
Attachment #8388978 - Flags: review?(bugs)
Attached patch window-close v4 (obsolete) — Splinter Review
Oops, wrong patch.
Attachment #8388978 - Attachment is obsolete: true
Attachment #8388978 - Flags: review?(felipc)
Attachment #8388978 - Flags: review?(bugs)
Attachment #8389001 - Flags: review?(felipc)
Attachment #8389001 - Flags: review?(bugs)
Attachment #8389001 - Flags: review?(felipc) → review+
Attached patch window-close v5 (obsolete) — Splinter Review
Getting this patch to work on b2g has really been painful. The IsBrowserOrApp checks didn't work and I don't know why. Anyway, this patch does everything in frontend code. Sorry for the churn, Felipe.
Attachment #8389001 - Attachment is obsolete: true
Attachment #8389001 - Flags: review?(bugs)
Attachment #8391381 - Flags: review?(felipc)
Comment on attachment 8391381 [details] [diff] [review]
window-close v5

Never mind. This one doesn't work either.
Attachment #8391381 - Flags: review?(felipc)
Attached patch window-close v6Splinter Review
This one is really conservative. I don't think there's any way it should affect b2g.
Attachment #8391381 - Attachment is obsolete: true
Attachment #8391466 - Flags: review?(felipc)
Blocks: 924260
Comment on attachment 8391466 [details] [diff] [review]
window-close v6

Review of attachment 8391466 [details] [diff] [review]:
-----------------------------------------------------------------

do you think bug 924260 needs to be addressed together?
Attachment #8391466 - Flags: review?(felipc) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/18e9c7c020bd

You mean fixing the assertion mentioned in bug 924260? That seems separate I think.
(In reply to Bill McCloskey (:billm) from comment #13)
> https://hg.mozilla.org/integration/mozilla-inbound/rev/18e9c7c020bd
> 
> You mean fixing the assertion mentioned in bug 924260? That seems separate I
> think.

Yeah, I'm just starting to look at sandboxing / e10s stuff, so I'm happy to pick up bug 924260 as a separate piece.
https://hg.mozilla.org/mozilla-central/rev/18e9c7c020bd
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
billm, can you describe how QA can test and verify this fix? Thanks!
Flags: needinfo?(wmccloskey)
We have tests to check this and they're running on tinderbox now, so there's no need to verify.
Flags: needinfo?(wmccloskey)
Thanks Bill!
Keywords: verifyme
Whiteboard: [qa-]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: