Closed
Bug 1172928
Opened 10 years ago
Closed 10 years ago
Window.close() does not close the tab
Categories
(Firefox for iOS :: General, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
fxios | + | --- |
People
(Reporter: st3fan, Assigned: st3fan)
References
Details
(Whiteboard: ios9, needs-cleanup)
Attachments
(1 file, 1 obsolete file)
This is a followup bug for 1124942, which has not landed yet.
STR:
* Go to https://mozillians.org
* Login with persona
* The Persona login screen should appear in a new tab
* Finish the login
Expected:
The persona login tab closes and you go back to the tab you came from.
Actual:
Persona just sits there. But if you manually close the tab and you go back to the mozillians.org tab, you are actually correctly logged in.
Not sure what piece we miss to support window.close(), may be some WKWebView delegate that we need to implement?
Updated•10 years ago
|
Assignee: nobody → jhugman
Updated•10 years ago
|
Status: NEW → ASSIGNED
Comment 1•10 years ago
|
||
It looks like that there is no public API for detecting window.close events in WKWebview frameworks.
There is some code in Webkit https://bugs.webkit.org/show_bug.cgi?id=137008 demonstrating a private API, but this doesn't seem to be working for us in Swift. Plus: private APIs.
Comment 2•10 years ago
|
||
Flags: needinfo?(sarentz)
Assignee | ||
Comment 3•10 years ago
|
||
Flags: needinfo?(sarentz)
Assignee | ||
Comment 4•10 years ago
|
||
The bug that I filed yesterday was closed as a dupe of https://bugs.webkit.org/show_bug.cgi?id=145957 which adds a webViewDidClose: delegate method to the WKUIDelegate. So that will allow us to do this without any JavaScript hacks.
What I would like to suggest is that we do a simple solution now, like patching window.close(), which will probably catch 75% of the use-cases. And then replace that JavaScript solution with the new WKUIDelegate when we are ready for iOS9 later this year.
Flags: needinfo?(jhugman)
Assignee | ||
Updated•10 years ago
|
Summary: Persona login (popup) window does not close after logging in → Window.close() does not close the tab
Assignee | ||
Comment 6•10 years ago
|
||
Work in progress but please take a look anyway. This may catch most cases. Except persona as noted below.
This patches window.close to send us a callback so that the native code can close the tab. This work for the general case. It does not work for Persona because Persona is insanely complicated and they probably do something special.
Assignee: jhugman → sarentz
Attachment #8629164 -
Attachment is obsolete: true
Attachment #8634771 -
Flags: review?(bnicholson)
Updated•10 years ago
|
Flags: needinfo?(jhugman)
Comment 7•10 years ago
|
||
Comment on attachment 8634771 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/758
LGTM with a few comments.
Attachment #8634771 -
Flags: review?(bnicholson) → review+
Assignee | ||
Comment 8•10 years ago
|
||
Couple of notes:
This works correctly on for example http://www.permadi.com/tutorial/facebook-js-oauth-popup-centered/ which opens a new tab with a Facebook login. After logging in the tab closes correctly and you are back at the original tab and logged in.
On Persona this fails, but now I think this may not be an error in this code but an issue with Persona. I see a message about origin login.persona.org not matching login.mozilla.org. (This appears in the console for login.persona.org - dont forget to attach the debugger to the right tab)
Updated•10 years ago
|
Assignee: sarentz → jhugman
Comment 9•10 years ago
|
||
Assuming we want to land this since it handles some cases on iOS 8. Filed bug 1186030 for iOS 9 specifically.
Updated•10 years ago
|
Assignee: jhugman → nobody
Status: ASSIGNED → NEW
Whiteboard: ios9 → ios9, needs-cleanup
Updated•10 years ago
|
Assignee: nobody → bmunar
Updated•10 years ago
|
Assignee: bmunar → administration
Updated•10 years ago
|
Assignee: administration → nobody
Updated•10 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 11•10 years ago
|
||
I'll deal with the review comments on tuesday and land it then.
Is there someone on the (old) Persona team who we can loop in to see if we can find out why this patch does not work for the Persona popup? Persona does crazy things, but I don't know enough about JS to understand what specifically.
Flags: needinfo?(rnewman)
Assignee | ||
Comment 12•10 years ago
|
||
I have addressed the review comments and landed this. Couple of notes:
* There is a test page at http://people.mozilla.org/~sarentz/t/wo.html that shows this fix in action.
* For testing it is important to know that WebKit only lets you window.close() webviews that have a parent/child relationship. You can't just window.close() any window.
* This does not work with Persona yet because I assume Persona does some more complicated things. I have reached out to people to get that fixed too, which can be done as a followup bug.
https://github.com/mozilla/firefox-ios/commit/43e50b6c697196c260a0fd1472da3210b98592b2
Flags: needinfo?(rnewman)
Assignee | ||
Updated•10 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Comment 13•10 years ago
|
||
Shane Tomlinson would be your best bet from the legacy Persona team. You might want to approach Ryan Kelly or Chris Karlof about getting some of Shane's time to look into this.
Comment 14•8 years ago
|
||
Look like this issue is produce again in latest build.
(BUG RISES)
Please have a look into this issue for more detail.
https://github.com/mozilla-mobile/firefox-ios/issues/2481
I also did pull request for solution
https://github.com/mozilla-mobile/firefox-ios/pull/2484
Here is a test url i created to test.
https://bhavnapanchal.github.io/firefoxpopuptest.github.io/
Flags: needinfo?(sarentz)
You need to log in
before you can comment on or make changes to this bug.
Description
•