Open Bug 1492772 Opened 6 years ago Updated 2 years ago

Content scripts are not restored properly after the browser is closed or the browser crashes.

Categories

(Web Compatibility :: Interventions, defect, P3)

Tracking

(Not tracked)

People

(Reporter: obotisan, Unassigned)

Details

Attachments

(3 files)

[Affected versions]:
- Firefox 62.0
- Firefox 63.0b7
- Nightly 64.0a1

[Affected platforms]:
- Windows 10 x64 
- Ubuntu 16.04 x64
- macOS 10.13

[Steps to reproduce]:
1. Go to about:preferences#general and check the box for "Restore previous session".
2. In a new tab navigate to http://webcompat-addon-testcases.schub.io/.
3. Quit Firefox (right-click on Firefox form taskbar and then click on Close window/Quit)
4. Restart the browser with the same profile.

[Expected result]:
- The web page is properly displayed, containing four green boxes.

[Actual result]:
- the web page is properly displayed, containing two green boxes and two red boxes.

[Regression range]:
- I don't think this is a regression. I can reproduce on an older version of Nightly (2018-04-28).

[Additional notes]:
- The issue disappears if the page is refreshed.
- This issue reproduces even after the browser is crashed. 
- Please look at the attached gifs to see the issue reproducing.
Component: General → Go Faster
Summary: WebCompat is not restored properly after the browser is closed or the browser crashes. → Content scripts are not restored properly after the browser is closed or the browser crashes.
Perhaps we could also initialize when the session-restored (or whatever it's called) observer notification is delivered here:

https://searchfox.org/mozilla-central/rev/881a3c5664ede5e08ee986d76433bc5c4b5680e6/browser/extensions/webcompat/bootstrap.js#64

Florian, does that sound about right?
Flags: needinfo?(florian)
If this doesn't work during session restore but works when you reload the page, this likely means you have something initialized too late during startup.

browser/extensions/webcompat/bootstrap.js seems to have some initialization done off the useragentoverrides-initialized notification (I think this is when the first http request is started), and some done off the browser-delayed-startup-finished notification (this is right after the first browser window appears on screen).

Both of these notifications seem early enough, but there's some async init code starting with webExtension.startup().then, so maybe that's where you have a problem?

I'm not familiar with the exact code you are trying to initialize, so I'm not sure what's not ready yet when you need it.

(In reply to Panos Astithas (he/him) [:past] (please ni?) from comment #2)
> Perhaps we could also initialize when the session-restored (or whatever it's
> called) observer notification is delivered

This notification is sent much later, when startup is completely done, so I don't think this would help here.


Looking for the various things you care about in a (preferably slow) startup profile may help to figure out in which order things happen exactly.
Flags: needinfo?(florian)
Converting to a webextension in bug 1451484 instead of a bootstrapped extension is likely to change things related to the startup order.
I tested this on Windows 10 with FF Nightly 64.0a1(2018-09-28) and I found something intresting, I downloaded a fresh copy of Nightly on the computer and I was propted to install and add-on "ace script" I did that and with this add-on the issue is not reproducible, only the restart scenario is fixed by this add-on. Please see the screen recording for a for a better understanding: https://streamable.com/0fi8n
(In reply to Florian Quèze [:florian] from comment #4)
> Converting to a webextension in bug 1451484 instead of a bootstrapped
> extension is likely to change things related to the startup order.

An update here: we're going to try to fix 1451484 first before circling back to this.

Oana, we've since moved away from bootstrap addon to web extension -- could you test if this is still a valid bug? Thanks.

Flags: needinfo?(oana.botisan)
Priority: -- → P3
Attached image Untitled.png

I can't reproduce the same issue, but it does reproduce in another matter. Please look at the attached image.
I tested using Windows 10 x64 on both latest Nightly 68.0a1 and beta 67.0b18.

Flags: needinfo?(oana.botisan)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: