Hi guys,
I'm the author of ActiveInbox for Gmail, and a report that has
appeared sporadically amongst users in the last few weeks has now
started to happen a lot, including to my own Gmail accounts.
Summary:
ActiveInbox watches the load of every iframe in Gmail to find the
unrestricted document of #canvas_frame, and then loads fully into
that. As of 12.0.725.0, seemingly when Gmail has been cached,
#canvas_frame never fires a load event that injects the content-script
(but it's sibling iframes do).
This means ActiveInbox cannot load.
Loading:
I believe the manifest.json to be correct for what I'm trying to do
(it has worked for a year or more unchanged):
"content_scripts": [{
"matches": [
"
http://mail.google.com/mail/*",
"
https://mail.google.com/mail/*",
"
http://mail.google.com/a/*",
"
https://mail.google.com/a/*"
],
"js":[...],
"all_frames": true
It tests each iframe document load, checks if it is #canvas_frame, and
if so, proceeds.
And why not just fish
document.getElementById("canvas_frame").contentDocument from the main
document? Because that reference has sandbox restrictions. It has to
detect the true #canvas_frame document to get all permissions.
The Problem:
As of today, it seems that it simply never detects the load of the
#canvas_frame document. The content script just never fires (other
iframes do - e.g. sound_frame - as does the main document).
Upon further investigation, it seems related to caching. If I clear
the Chrome cache and refresh Gmail, it fires the load event on
#canvas_frame. But, if I then refresh Gmail again (at which point it
is cached), #canvas_frame stops firing.
One last minor observation: this has happened before, but never to
more than one or two users. This is the first time it's happened to a
bunch of us, including me.
Solutions?
1) Appeal to Chrome devs to understand why the content_script doesn't
fire on (presumably) cached iframes?
2) Try to use document.getElementById("canvas_frame").contentDocument
by avoiding the sandbox restrictions (like
document.getElementById("canvas_frame").contentDocument.defaultView
being null, for instance).
3) ??? Ideas very welcome!