Closed Bug 1027991 Opened 10 years ago Closed 10 years ago

[system] Can't create child windows via window.open anymore

Categories

(Firefox OS Graveyard :: Gaia::System::Window Mgmt, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(blocking-b2g:2.0+, b2g-v2.0 fixed, b2g-v2.1 fixed)

RESOLVED FIXED
2.0 S5 (4july)
blocking-b2g 2.0+
Tracking Status
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed

People

(Reporter: squib, Assigned: alive)

References

Details

(Keywords: regression, Whiteboard: interaction-design)

Attachments

(1 file)

To triagers: I've requested blocking-b2g:2.0 on this because it breaks creating new ringtones from the ringtone manager. See below if you're interested in the details.

Since bug 1021658 landed, we can't create child windows (in-app sheets) anymore. I was using this for the ringtones app as follows:

1) Open the ringtone manager as an inline activity from the settings app
2) Click "+" which opens a pick activity, launching the music app
3) Pick a song from the music app, which returns the result to the ringtone manager
4) Taking the result from the pick activity, use window.open to open share.html (which is also a part of the ringtones app) and send it the pick activity's data via postMessage once share.html has loaded.

Step (4) used to create a child window, but now it creates a popup window. This adds an extra title bar from the system app, which looks weird. I'm also seeing this error some of the time:

E/GeckoConsole( 7239): [JavaScript Error: "TypeError: popup is null" {file: "app://ringtones.gaiamobile.org/gaia_build_defer_manage.js" line: 89}]

That's referring to the second line of this code[1]:

      var popup = window.open('share.html');
      popup.addEventListener('load', function loaded() { // popup is null here
        popup.removeEventListener('load', loaded);
        popup.postMessage(result, window.location.origin);
      });

It's not immediately obvious to me why window.open sometimes returns null.

I looked at bug 1021658, which sounds pretty serious, so we probably can't just re-enabled in-app sheets entirely. Maybe we could specify an argument to window.open to open a child window, like how you can pass 'dialog' or 'attention' now?

[1] https://github.com/mozilla-b2g/gaia/blob/bcb2115984ffdabc873f392678723f151cd880fd/apps/ringtones/js/manage.js#L27
Flags: needinfo?(alive)
(In reply to Jim Porter (:squib) from comment #0)
> To triagers: I've requested blocking-b2g:2.0 on this because it breaks
> creating new ringtones from the ringtone manager. See below if you're
> interested in the details.
> 
> Since bug 1021658 landed, we can't create child windows (in-app sheets)
> anymore. I was using this for the ringtones app as follows:
> 
> 1) Open the ringtone manager as an inline activity from the settings app
> 2) Click "+" which opens a pick activity, launching the music app
> 3) Pick a song from the music app, which returns the result to the ringtone
> manager
> 4) Taking the result from the pick activity, use window.open to open
> share.html (which is also a part of the ringtones app) and send it the pick
> activity's data via postMessage once share.html has loaded.
> 
> Step (4) used to create a child window, but now it creates a popup window.
> This adds an extra title bar from the system app, which looks weird. I'm
> also seeing this error some of the time:
> 
> E/GeckoConsole( 7239): [JavaScript Error: "TypeError: popup is null" {file:
> "app://ringtones.gaiamobile.org/gaia_build_defer_manage.js" line: 89}]
> 
> That's referring to the second line of this code[1]:
> 
>       var popup = window.open('share.html');
>       popup.addEventListener('load', function loaded() { // popup is null
> here
>         popup.removeEventListener('load', loaded);
>         popup.postMessage(result, window.location.origin);
>       });
> 
> It's not immediately obvious to me why window.open sometimes returns null.
> 
> I looked at bug 1021658, which sounds pretty serious, so we probably can't
> just re-enabled in-app sheets entirely. Maybe we could specify an argument
> to window.open to open a child window, like how you can pass 'dialog' or
> 'attention' now?
> 
> [1]
> https://github.com/mozilla-b2g/gaia/blob/
> bcb2115984ffdabc873f392678723f151cd880fd/apps/ringtones/js/manage.js#L27

Is it okay to you if I make the X button work again? Do you really want a in-app sheet or you just want to open another page and don't care it's a popup or sheet?
Flags: needinfo?(alive)
Assignee: nobody → alive
For this case, I'd like a sheet if at all possible (otherwise, I'll have to implement this in a totally different way), since popups have a header/title-bar created by the system app. We need to have our own header so that it uses the right color theme (the system app gives us a light one and we want a dark one) and also because our header has two buttons: an X on the left and "Save" on the right. I don't think the system app can do that for us.

Thanks!
(In reply to Jim Porter (:squib) from comment #2)
> For this case, I'd like a sheet if at all possible (otherwise, I'll have to
> implement this in a totally different way), since popups have a
> header/title-bar created by the system app. We need to have our own header
> so that it uses the right color theme (the system app gives us a light one
> and we want a dark one) and also because our header has two buttons: an X on
> the left and "Save" on the right. I don't think the system app can do that
> for us.
> 
> Thanks!

OK I understand what's you need now, thanks for the detail.
I am wondering if we want to reopen inner sheet to current app in v2.0 because it's still buggy.

Etienne, what do you think?
Flags: needinfo?(etienne)
Keywords: regression
(In reply to Alive Kuo [:alive][NEEDINFO!][OOO from 6/23 until 6/30] from comment #3)
> (In reply to Jim Porter (:squib) from comment #2)
> > For this case, I'd like a sheet if at all possible (otherwise, I'll have to
> > implement this in a totally different way), since popups have a
> > header/title-bar created by the system app. We need to have our own header
> > so that it uses the right color theme (the system app gives us a light one
> > and we want a dark one) and also because our header has two buttons: an X on
> > the left and "Save" on the right. I don't think the system app can do that
> > for us.
> > 
> > Thanks!
> 
> OK I understand what's you need now, thanks for the detail.
> I am wondering if we want to reopen inner sheet to current app in v2.0
> because it's still buggy.
> 
> Etienne, what do you think?

It's fine as long as the app is showing a button that does window.close, and the ringtone app does that so it's fine for the ringtone apps.

Now, since we currently explicitly require the app to implement a close button, I think triggering inner sheets explicitly with a keyword makes more sense.
I know it's **** to have a virtually undocumented keyword like this but I don't think we have a better option.
Flags: needinfo?(etienne)
Whiteboard: interaction-design
blocking-b2g: 2.0? → 2.0+
Proposed fix: use mozhaidasheet as keyword
Attachment #8444143 - Flags: review?(etienne)
Attachment #8444143 - Flags: review?(etienne) → review+
https://github.com/mozilla-b2g/gaia/commit/45b6e78dffcfeb1c1213d32d24f3c61c84ca52d0
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: