Closed Bug 1459298 Opened 6 years ago Closed 6 years ago

Stop spinning event loop when window closes

Categories

(GeckoView :: General, enhancement, P2)

All
Android
enhancement

Tracking

(firefox62 fixed)

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: jchen, Assigned: jchen)

References

Details

Attachments

(1 file)

There are a few places where we can spin the event loop for longer than the window lifetime. We should exit the loop if the window closes so the window can clean up sooner.
Comment on attachment 8973684 [details]
Bug 1459298 - Stop spinning event loop when window closes;

https://reviewboard.mozilla.org/r/242050/#review247900

::: mobile/android/modules/geckoview/GeckoViewUtils.jsm:307
(Diff revision 1)
> -          iter.getNext().QueryInterface(Ci.nsIDOMWindow));
> +      dispatcher = this.getDispatcherForWindow(win);
>        if (dispatcher) {
> -        return dispatcher;
> +        return [dispatcher, win];
>        }
>      }
> -    return null;
> +    return [null, null];

Is there an advantage of returning an array vs. object in this case?

::: mobile/android/modules/geckoview/LoadURIDelegate.jsm:20
(Diff revision 1)
>  var LoadURIDelegate = {
>    // Delegate URI loading to the app.
>    // Return whether the loading has been handled.
> -  load: function(aEventDispatcher, aUri, aWhere, aFlags, aTriggeringPrincipal) {
> +  load: function(aWindow, aEventDispatcher, aUri, aWhere, aFlags) {
> +    if (!aWindow) {
> +      return false;

This shouldn't happen, maybe throw?
Attachment #8973684 - Flags: review?(esawin) → review+
Comment on attachment 8973684 [details]
Bug 1459298 - Stop spinning event loop when window closes;

https://reviewboard.mozilla.org/r/242050/#review247900

> Is there an advantage of returning an array vs. object in this case?

I thought array was more convenient, but there's no real advantage afaik.

> This shouldn't happen, maybe throw?

I think it can (rarely) be null for frame scripts (i.e. `content` can be null in rare cases).
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bd8a65154726
Stop spinning event loop when window closes; r=esawin
https://hg.mozilla.org/mozilla-central/rev/bd8a65154726
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 62
Depends on: 1460601
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 62 → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: