Same-origin policy prevents the contents script from recursing into the iframe contents.
The 'all_frames' manifest key allows the contents script to run inside the iframe, in a separate context. However, when run this way, the iframe does not know the state of the parent window, and has no way of knowing the color state of the background.
This could be fixed by forcing a specific style on iframe elements themselves in the parent window to ensure a consistent state for the script that runs for the iframe contents. This may not play well with sites that rely on specific iframe styling like transparency.
Iframes are very broken:
This could be fixed by forcing a specific style on iframe elements themselves in the parent window to ensure a consistent state for the script that runs for the iframe contents. This may not play well with sites that rely on specific iframe styling like transparency.