Add Gecko:Ready event notification to pageloader.js

RESOLVED WONTFIX

Status

defect
RESOLVED WONTFIX
7 years ago
5 months ago

People

(Reporter: jwir3, Unassigned)

Tracking

(Depends on 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [talos_wishlist])

Reporter

Description

7 years ago
(From bug 716575, comment 46):

> Scott and I ran some experiments on Try, and discovered that the Talos crashes
> are caused because screen->GetRect is returning a 0-size rect (which ultimately 
> causes a divide-by-zero in GetViewportInfo).

> I believe this happens because the Android Java code does not send the screen 
> size to Gecko until it receives a Gecko:Ready message.  This message is usually 
> sent when browser.xul loads, but the Talos pageloader extension replaces 
> browser.xul with its own pageloader.xul.

> The crash can be avoided by adding a zero check before dividing by aDisplayWidth 
> or aDisplayHeight.  The lack of screen information in Talos might be fixed just 
> by sending a Gecko:Ready message from pageloader.js when running in native 
> Android Fennec.

We should add the capability for pageloader.js to send a Gecko:Ready event, so we don't run into the problem of screen->GetRect() being 0 in the future.
Reporter

Comment 1

7 years ago
Joel:

To fix this, would it make sense to add the line:
>      sendAsyncMessage('Gecko:Ready', {});
after window.resizeTo(10,10) in pageloader.js? 

(I'm not 100% sure I understand how events are passed between the browser in pageloader). Alternatively, I could put the code from browser.js that gets the android bridge and sends a message that way, but it would require that we check to make sure it's on mobile.
(In reply to Scott Johnson (:jwir3) from comment #1)
> To fix this, would it make sense to add the line:
> >      sendAsyncMessage('Gecko:Ready', {});
> after window.resizeTo(10,10) in pageloader.js? 
> 
> (I'm not 100% sure I understand how events are passed between the browser in
> pageloader). Alternatively, I could put the code from browser.js that gets
> the android bridge and sends a message that way, but it would require that
> we check to make sure it's on mobile.

You'll need to use the Android bridge method to send a message from Gecko to the Android/Java code.  (sendAsyncMessage will only send messages between e10s content and chrome processes.)
Reporter

Comment 3

7 years ago
(In reply to Matt Brubeck (:mbrubeck) from comment #2)
> You'll need to use the Android bridge method to send a message from Gecko to
> the Android/Java code.  (sendAsyncMessage will only send messages between
> e10s content and chrome processes.)

Thanks for the heads-up. It's possible that this is why this wasn't working. (jmaher tried what I suggested this morning).
I don't have my build available anymore for this.  Can you link me to a build that can reproduce this problem?
Reporter

Comment 5

7 years ago
(In reply to Joel Maher (:jmaher) from comment #4)
> I don't have my build available anymore for this.  Can you link me to a
> build that can reproduce this problem?

I'm not sure how to link to an actual build, but here's a try revision that was exhibiting the problem:
https://hg.mozilla.org/try/rev/b3c5811f5463
Reporter

Comment 6

7 years ago
Matt:

jmaher added this code to pageloader.js, but it seems that it didn't fix the crash:

http://pastebin.mozilla.org/1842427
> dumpLine(bridge.handleGeckoMessage(JSON.stringify({'Gecko:Ready': {}})));

This should be:

> dumpLine(bridge.handleGeckoMessage(JSON.stringify({gecko: {type: 'Gecko:Ready'}})));
thanks for clarifying that.  I did this and had no luck, same old crash.
Blocks: 792212
Depends on: 1231626
Blocks: 1088251
Whiteboard: [talos_wishlist]

Updated

5 months ago
Status: NEW → RESOLVED
Last Resolved: 5 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.