Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Note: See Wladimir Palant's answer for a more general overview.</p> <p>In the case of my example, I was actually using the function correctly, with more-or-less reasonable expectations. The problem was caused by Firefox's XPCNativeWrapper functionality.</p> <p>I'm still struggling to understand the details, but in a nutshell, my <code>wnd</code> object was being wrapped in an XPCNativeWrapper, and <code>testfoo.js</code> was considered a "protected" script, which meant that I could not see any changes made to the object once control passed back from <code>testfoo.js</code>.</p> <p>The solution is to unwrap the object before (or after -- that works too) passing it to the subscript, as follows:</p> <pre><code>var wnd = XPCNativeWrapper.unwrap(doc.defaultView); </code></pre> <p>As soon as I did that, the variables/properties modified by <code>testfoo.js</code> became visible to the parent script.</p> <p>I do not yet understand the full infrastructure well enough to know whether this is "safe". After all, this is a security mechanism designed to protect my extension from malicious code on the browser page.</p> <p>I am also seeing some problems with passing objects into methods defined by the subscript (not shown in my example). For that, I will make a separate question.</p> <p>Long story short: Unwrapping is a (probably "the") solution for the immediate problem as posed in my question, but does not appear to be a complete solution to the difficulties I was having that engendered the question in the first place.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload