Closed Bug 1285185 Opened 8 years ago Closed 8 years ago

Content script all_frames option ignores programmatically added iframes

Categories

(WebExtensions :: Untriaged, defect)

49 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1272890

People

(Reporter: meven29, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0
Build ID: 20160604131506

Steps to reproduce:

I am using firefox developper edition 49a2 for my tests and load the extension through Temporary Load.
I have an extension that uses content_script with the all_frames set to true in manifest.json :

    "content_scripts": [{
        "matches": [
            "http://*/*",
            "https://*/*"
        ],
        "js": ["content_script.js"],
        "match_about_blank": true,
        "all_frames": true
    }],

I open a webpage that creates a cross-domain iframe using javascript without a src.

<script type="text/javascript">

			var iframe_elt = document.createElement("iframe");
			document.appendChild(iframe_elt);
</script>


Actual results:

The content script is not added to the iframe.


Expected results:

The content script is added to the iframe.

This is what happens in chrome.

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/content_scripts states that:
all_frames 	set to true: inject the scripts specified in js and css into all frames in the page.
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
Are you saying that scripts are not injected into the iframe before you load anything into them, or that they're not injected at all?
OS: Mac OS X → All
Hardware: x86_64 → All
I'm pretty sure this is a duplicate of bug 1272890. Feel free to reopen if you're seeing something different.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
I am saying the content script is not injected at all, it should be once the frame is being loaded.
My example was over-simplified.

Consider this one :

var iframe2 = document.createElement("iframe");
	iframe2.id="iframe2";
	document.body.appendChild(iframe2);

	var w = iframe2.contentWindow;

setTimeout(function(){
w.document.body.innerHTML = '<div style="height: 250px; width: 250px; background-color:orange">';
w.document.body.style.margin = "0px";
	}, 10);

The iframe has no src attribute (so this does not concern about:blanck), yet has some content.

I would except the content script to be added to the iframe as chrome does.
Resolution: DUPLICATE → INVALID
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
(In reply to meven from comment #3)
> The iframe has no src attribute (so this does not concern about:blanck), yet has some content.

`document.getElementById("iframe2").contentDocument.documentURI` is "about:blank", yes? I think Kris is right.
Yes, it's about:blank
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → DUPLICATE
I agree, my mistake it is a duplicate.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.