-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency: match_about_blank #575
Comments
The bug/feature in Chrome that skips injection in anonymous P.S. Violentmonkey/Tampermonkey won't need this trick if all browsers fix their injection timing for content scripts at document_start in same-origin iframes and same-origin window.open documents, which is reported in https://crbug.com/40202434 for Chromium/Chrome, but applies to Firefox too, maybe other browsers as well. |
This can be bypassed, though. I've already got a way to bypass the
FWIW this bug also applies to Safari app extensions. |
In the case of Violentmonkey/Tampermonkey they remove the iframe immediately (synchronously), so the only way for other extensions to see it is to use the deprecated synchronous mutation events + chrome.dom.openOrClosedShadowRoot as the iframe is inside a closed shadow DOM. These events already generate warnings in Chrome and will be removed in v127, so there'll be no way for other extensions in this case, which is why it might make sense to think of a way to allow extensions to create a non-injectable anonymous iframe. P.S. Violentmonkey/Tampermonkey won't be affected by this PR, AFAICT, because they remove the iframe before injection occurs in the currently bugged browsers. |
We agreed in the meeting today that the newer |
According to MDN, only Chromium supports this key: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts |
@lapcat, I believe MDN is correct. The EDIT: That said, I agree that we should collect data on how each browser handles the src strings you've identified and try to align on our handling of them as much as reasonably possible. |
It should be noted, however, that,
Apparently Firefox doesn't handle In any case, I see that the meeting notes say, "Firefox will implement match_origin_as_fallback soon." That's great, as long as extensions can add both |
Adding follow-up label to check we are aligned with this change and if so track it on our side. |
FYI I recently posted more context about
Copy-pasting here for future reference:
|
In my testing, Chrome's |
I spoke to @rdcronin about this. We agree that we should not make further updates to We do want to be careful of the potential impact to userscript extensions, and if there is a risk of significant breakage that might be a reason not to immediately fix this. @tophf, to confirm, it sounds like you don't think Tampermonkey / Violentmonkey will be impacted? Are there any other extensions you are aware of that rely on the same behavior? |
Yes, I expect the browser won't inject content scripts into this iframe because it's already removed from DOM at document_start. In the future this iframe trick won't be necessary after https://crbug.com/40202434 is fixed. |
In the wild (world wide web), I'm encountering a number of different ways that websites specify an
iframe
element without a source URL. Typically there would be nosrc
attribute, orsrc="about:blank"
. However, some sites are usingsrc="about:srcdoc"
or evensrc="javascript:false"
. (See forbes.com for an example of the last.) According to a Stack Overflow post,There is a
manifest.json
keymatch_about_blank
, but web browsers are inconsistent in their handling of this key. Chrome loads the content script intoabout:blank
andabout:srcdoc
but notjavascript:false
, while Firefox loads the content script intoabout:blank
andjavascript:false
but notabout:srcdoc
. (Firefox inserts "Hmm. That address doesn’t look right." intoabout:srcdoc
frames and for some strange reason a literal "false" string intojavascript:false
frames.) Safari web extensions do not supportmatch_about_blank
, while macOS Safari app extensions behave like Chrome extensions. (I realize that Safari app extensions are not under the purview of this group.)Empty iframes are not simply inert. Web pages are adding and running
script
elements inside iframes, and some of those scripts even add elements to the main frame. Thus, it's important for extensions to also be able to inject their scripts into those iframes too.Below is an example to demonstrate.
manifest.json
:content.js
:index.html
:The text was updated successfully, but these errors were encountered: