Closed Bug 825435 Opened 7 years ago Closed 6 years ago

bad interaction between window.alert() and postResult() for inline activity

Categories

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

x86
macOS
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: djf, Unassigned)

References

Details

While working on the video app's view activity handler, I ended up handling an error case with code like this:

  alert(error_message);
  activity.postResult({});

When I did this, the alert would appear over the activity, the user would dismiss the alert dialog and the activity would end, but then the alert would still be visible over top of the calling app, and the user would have to dismiss it again.

I'm guessing that there is some strange interaction in the system app between dismissing an alert and dismissing an inline activity that causes the alert to be confused.

The workaround I found was this:

  alert(error_msg);
  setTimeout(function() { activity.postResult({}); }, 50);

With that code, the user only had to dismiss the alert once.

I'm going to cc Vivien and Tim on this because I think they may be familiar with the appropriate parts of the system app. Do either of you think that this should be a blocker?
I don't see this:) Could you provide your local branch? I used the wallpaper's postResult to test but it worked fine.
Component: Gaia::System → Gaia::System::Window Mgmt
We are having alert(modal dialog) for each app window now, so close this bug.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Hey Alive, we have the same "double alert" behavior for SMS app now: we show alert in the SMS app while it's run as inline 'share' activity. User has to dismiss it twice: once inside SMS app and once inside main app (Gallery in our case). For SMS app alert displays just message that we've asked for, for the main app it looks like "sms.gaiamobile.com:8080 says: {our message}".

As this bug is closed could you please clarify how to overcome this behavior?

Thanks!
Flags: needinfo?(alive)
Hi there, I don't see window.alert call in gallery app, could you show me the code?
Flags: needinfo?(alive)
(In reply to Alive Kuo [:alive][NEEDINFO!][God bless Taiwan.] from comment #4)
> Hi there, I don't see window.alert call in gallery app, could you show me
> the code?

Hi, window.alert call is planned to be in SMS app once patch for bug 936729 is landed, but you can reproduce it locally right away very easily:

1. Add "alert('Hello');" to the 'new' activity for SMS app [1];
2. Call SMS app as inline activity from Contacts app (SMS icon right after phone number in contact details);
3. You'll see first alert, once you dismiss it and close activity (cross icon in the top left), you'll see second alert in the Contacts app.

Please let me know if you're able to repro this. Thanks!

[1] https://github.com/mozilla-b2g/gaia/blob/master/apps/sms/js/activity_handler.js#L50
Flags: needinfo?(alive)
Hmm...this sounds a problem after we embed inline activity frame in appWindow.
Let's file another bug to fix it. Thanks for reporting!
Flags: needinfo?(alive)
You need to log in before you can comment on or make changes to this bug.