Closed
Bug 1074501
Opened 12 years ago
Closed 12 years ago
Multiple frame-scripts not executing in same scope in FF33b when injected using browser.messageManager.loadFrameScript
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: dgdawg, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
Steps to reproduce:
Tried to inject multiple frame scripts in a <browser> from an extension.
Actual results:
The individual scripts are executed but are not in the same scope.
Expected results:
All the scripts injected at the same time on the same <browser> should be executed in the same scope.
This was working fine until FF 32.
Updated•12 years ago
|
Component: Untriaged → DOM
Product: Firefox → Core
Comment 1•12 years ago
|
||
Is this because of bug 673569 ?
It does seem to be related to bug 673569 . But I couldn't figure out a solution to my problem. Pls suggest if there is an alternative way (like a arg that I can pass to loadFrameScript so that all scripts load in the same scope)
Will try to see if setting the 3rd arg to loadFrameScript(aURL, aAllowDelayedLoad, aRunInGlobalScope); makes every script load in global scope.
The aRunInGlobalScope argument will make everything run in global scope. However, keep in mind that |this| will still refer to the single global object shared by all frame scripts. So rather than using aRunInGlobalScope, you can replace |x| with |this.x| for every variable x that needs to be shared between scripts. That way you won't accidentally get name collisions.
Verified both aRunInGlobalScope and using |this| to share variables between scripts works.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•