Note that there are some explanatory texts on larger screens.

plurals
  1. POwhat's the javascript function scope in firefox components?
    primarykey
    data
    text
    <p>I am making a firefox component using javascript.<br> But i am always confused about what is the global scope of the current javascript function, which results in the following questions?</p> <ol> <li><p>I understand some basic concept about global scope of js function in normal case, but i want to know, when is the global scope of a function determined? The time when function is created(defined), or the time when the function is called?</p></li> <li><p>Is there a way to show(print some information) the current global scope of a javascript function?</p> <p><code>following question is firefox component specific</code> </p></li> <li><p>For firefox component, does each component have a global scope itself? (which means each function of the component will be run in itself global scope ), or every components have the same global scope?<br> If same, what's that?</p></li> <li><p>For example, in such case<br> <code>sorry for this boring example, i just make it as clear as possible.</code><br> I make a sandbox via <code>Components.utils.Sandbox(&lt;scope1&gt;)</code>. I define some function in a ff component( i called <code>&lt;scope2&gt;</code> ) ,and inject a variable in to sandbox by : <code>sandbox.external = this;</code> ( "this" is just a component itself, which in a scope2 )<br> After these step, i run some code in sandbox by <code>Components.utils.evalInSandbox( &lt;code&gt; , sandbox);</code> , and <code>&lt;code&gt;</code> contains a <code>function sandboxFoo()</code> that call <code>external.foo()</code></p> <p>1). what's the global scope of <code>sandboxFoo</code> when it is running? I think it should be </p> <p>2). what's the global scope of <code>external.foo</code> when it is called by <code>sandboxFoo</code>? Is it the <code>&lt;scope1&gt;</code> or <code>&lt;scope2&gt;</code>? Any documentation? </p></li> </ol>
    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.
 

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