Open
Bug 1486036
Opened 6 years ago
Updated 1 month ago
content scripts/css not injected in about:blank frames
Categories
(WebExtensions :: General, defect, P3)
WebExtensions
General
Tracking
(Not tracked)
NEW
People
(Reporter: robwu, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
1.42 KB,
application/zip
|
Details |
STR.
1. Load attached extension.
2. Visit example.com.
3. Open devtools, and run the following snippet in the console:
document.body.innerHTML = '<iframe>';
Expected:
After step 2: The page starts with "Injected static script at document_start" / "document_end"
After step 3: The added frame should contain: "Injected static script at document_start" / "document_end"
Actual:
After step 2: As expected.
After step 3: The frame is blank.
More info:
- The scripts are executed as expected when an extension starts up, or when tabs.executeScript is used.
- The issue is caused by the early return at: https://searchfox.org/mozilla-central/rev/c45b9755593ce6cc91f558b21e544f5165752de7/toolkit/components/extensions/ExtensionPolicyService.cpp#343-348
(the document's readyState is READYSTATE_UNINITIALIZED).
Comment 1•6 years ago
|
||
(In reply to Rob Wu [:robwu] from comment #0)
> - The issue is caused by the early return at:
> https://searchfox.org/mozilla-central/rev/
> c45b9755593ce6cc91f558b21e544f5165752de7/toolkit/components/extensions/
> ExtensionPolicyService.cpp#343-348
> (the document's readyState is READYSTATE_UNINITIALIZED).
No it isn't. The uninitialized about:blank document is eventually replaced by another document. Injecting anything into an uninitialized document is by definition the wrong behavior.
Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Kris Maglione [:kmag] from comment #1)
> (In reply to Rob Wu [:robwu] from comment #0)
> > - The issue is caused by the early return at:
> > https://searchfox.org/mozilla-central/rev/c45b9755593ce6cc91f558b21e544f5165752de7/toolkit/components/extensions/ExtensionPolicyService.cpp#343-348
> > (the document's readyState is READYSTATE_UNINITIALIZED).
>
> No it isn't. The uninitialized about:blank document is eventually replaced
> by another document. Injecting anything into an uninitialized document is by
> definition the wrong behavior.
Does this document replacement even happen if the document is touched by a script?
The bug does not occur when I replace step 2-3 by opening an ordinary HTML page containing only <iframe></iframe> (this suggests that devtools is triggering a condition for this bug).
But when I use the following page (still without DevTools), then the test fails (as reported):
<iframe></iframe>
<script>frames[0]</script>
Reporter | ||
Comment 3•6 years ago
|
||
The test also fails for the following cases:
Step 3: Run any of the following snippets, close the devtools and click in the page:
onclick = () => { window.open("about:blank"); }
onclick = () => { document.body.append(document.createElement("iframe")); };
Reporter | ||
Comment 4•6 years ago
|
||
Bug 1415539 also reports that content scripts don't load, but under different circumstances (frame is inserted after some delay).
They could be duplicates, but I can't really tell.
See Also: → 1415539
Updated•6 years ago
|
Priority: -- → P3
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•