Closed
Bug 1479059
Opened 7 years ago
Closed 7 years ago
run_at document_start doesn't work
Categories
(WebExtensions :: General, defect)
WebExtensions
General
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: kolan_n, Unassigned)
References
()
Details
Attachments
(1 file)
|
878.96 KB,
video/quicktime
|
Details |
document_start scripts don't run before page scripts
1 clone https://github.com/KOLANICH/run_at_document_start_doesnt_work.git
2 read the code
3 install the extension
4 open the page
5 see `broken`
Comment 1•7 years ago
|
||
For executeScript, "run_at" is the earliest point in the load cycle the script will run. The guarantees that it will run before page scripts only apply to statically registered content scripts.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Kris, it neither works for statically, nor for dynamically. See the code. The test checks both cases.
Comment 3•7 years ago
|
||
It very definitely does work for static content scripts
>It very definitely does work for static content scripts
For me it doesn't for most of time. Success is nondeterministic, there is a race. Latest devedition, Win 7, 32 bit.
Comment 5•7 years ago
|
||
This is probably worth looking into, then. We do have tests for this, though, and they pass consistently.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Comment 6•7 years ago
|
||
If these tests are passing, let's have QA do a pass with this extension to see if the failures are reproducible on known environments.
Flags: needinfo?(kraj)
Comment 7•7 years ago
|
||
Verified on Nightly (63.0a1) and FF (61.0.1) using Ubuntu and Windows 10 x64 bit.
The issue is reproducing most of the time, giving the "broken" result, however, in a very low percentage of the cases, test2 will be shown as OK.
Validated using the test addon along with the test html by using multiple refreshes, re-opening the window, new tab, etc.
Flags: needinfo?(kraj)
Comment 8•7 years ago
|
||
Comment 9•7 years ago
|
||
The test case is flawed. In manifest.json, you're using "contentScript.js",
but the file itself is called "content_script.js".
When I rename the file to match the name in manifest.json, the test passes in Firefox 61.0.1.
Moreover, for "test2" you are calling tabs.executeScript at the webNavigation.onCommitted event. There is no guarantee that this executeScript method executes before the document attempts to run its scripts.
If you can still manage to reproduce the problem, please mention the following:
- Firefox version and operating system
- Whether the issue also reproduces when you remove the "defer" attribute (and put the script right before </body>).
- Whether the issue happens only at the first page load after an extension is loaded, or whether it also happens when you reload the page.
Status: REOPENED → RESOLVED
Closed: 7 years ago → 7 years ago
Resolution: --- → INVALID
Comment 10•7 years ago
|
||
I followed suggestions from Rob and everything looks fine now.
Thank you.
| Reporter | ||
Comment 11•7 years ago
|
||
I apologize, this was realy my fault, I confirm that the test with statically injected script is really OK after the fix.
You need to log in
before you can comment on or make changes to this bug.
Description
•