Content scripts share a global namespace, so that document_start
scripts can define a global variable that document_end scripts can
access.

Except at http://wonderwall.msn.com (with Chrome Beta 4.0.249.64) when
all_frames=true for both content scripts, this doesn't work.  The
document_end script doesn't see the variable defined at
document_start.

Which behavior is the bug?

Here's my manifest:

{
  "name": "AdBlock",
  "version": "1.2.74",
  "permissions": [
    "http://*/*";, "https://*/*";
  ],
  "content_scripts": [
    {
      "matches": ["http://*/*";, "https://*/*";],
      "js": [
        "one.js"
      ],
      "run_at": "document_start",
      "all_frames": true
    },
    {
      "matches": ["http://*/*";, "https://*/*";],
      "js": [
        "two.js"
      ],
      "run_at": "document_end",
      "all_frames": true
    }
  ]
}


one.js contains "var x = 4;" and two.js contains "console.log(x)".
It's not a race condition -- even if two.js waits 5 seconds before
logging, this error still shows up:

Uncaught ReferenceError: x is not defined

I'd like to know which way to go here, because I can use the global
namespace to my advantage -- unless it's a hole that's about to be
patched!

Thanks!
Michael
-- 
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to