Open Bug 1375875 Opened 7 years ago Updated 2 years ago

Presence of an Webextension makes the head element missing on (iframe) load

Categories

(WebExtensions :: General, defect, P3)

55 Branch
defect

Tracking

(Not tracked)

People

(Reporter: jan, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce:

Use FF 55.0b3 (64-bit) or a recent Nightly.

Go to

http://try.jquery.com/levels/3/sections/12 

and see the site being looking like this:

https://user-images.githubusercontent.com/11567756/27332039-c8fced66-55f2-11e7-935e-4a72529f81e6.png

Then install a WebExtension (either Tampermonkey[1] or Bitwarden [2]) and reload the page and see that it looks like this:

https://user-images.githubusercontent.com/11567756/27332001-a702eb84-55f2-11e7-9c2d-a7d8e6bb21e0.png

I've debugged the problem and it looks like the head element is missing when jQuery(iframe).on('load') fires.
You can double-check this by adding a conditional breakpoint 

console.log('after', head);

at line 31710 of the script 

http://d3n3e0roqdrhcc.cloudfront.net/assets/application-a7fd1434c73111597f2819a38ca73acf.js

The issue can be fixed by either adding this conditional breakpoint:

console.log('before', $(iframeDoc).find('head')); for (var i=0;i<1000000;ii+) {};

one line above (31709) or disabling the WebExtension.

[1]https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/
[2]https://addons.mozilla.org/en-US/firefox/addon/bitwarden-password-manager/

References:
https://forum.tampermonkey.net/viewtopic.php?f=17&t=2199
https://github.com/bitwarden/browser/issues/180
Summary: Presence of an Webextensions make the head element missing on (iframe) load → Presence of an Webextension makes the head element missing on (iframe) load
> The issue can be fixed by either adding this conditional breakpoint:
...or simply a unconditional breakpoint
If this is a web extension specific problem + iframe, maybe it has something to do with content scripts with all_frames = true?
Status: UNCONFIRMED → NEW
Component: Untriaged → WebExtensions: Untriaged
Ever confirmed: true
Product: Firefox → Toolkit
Priority: -- → P3
I've been able to reproduce this on Nightly using a content script which has both "all_frames": true and "run_at": "document_start". 

I've the feeling that it could be related to (or even a duplicate of) Bug 1379148, because that website provides an embedded livepreview feature, and so it is very likely that this website is trying to change the content of an iframe while the iframe document loading has been paused by the content script which needs to run at document_start, but I didn't need to set "match_about_blank" to true to be able to reproduce this issue).

The issue can be reproduced even with an empty content script (which is also an additional clue that this issue impacts on websites that is changing the content of one of its iframe while the document has been paused because of a document_start content_script)
See Also: → 1379148
Product: Toolkit → WebExtensions
Hmm, I didn't knowingly make that change of status, I had a problem with the browser when attempting to submit a comment (and found the change of status after submission failed). 

Is this reproducible with Firefox ESR 60.1 or Firefox 61?
Bulk move of bugs per https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
Component: Untriaged → General
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.