Page MenuHomePhabricator

Resource loader executes modules in non-global context
Closed, DeclinedPublic

Description

All gadgets loaded by ResourceLoader are executed in a non-global context, causing all variables and functions declared with "var foo" or "function foo" to be local, and unusable outside that specific module.


Version: unspecified
Severity: normal

Details

Reference
bz29703

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:28 PM
bzimport set Reference to bz29703.

This is a deliberate change to isolate the already-polluted global scope. If you need a specific variable to be truly global, instead of foo = 'bar' use window.foo = 'bar'.

If your gadget's JS is not ResourceLoader-compliant, don't mark it with [ResourceLoader].

See: