1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
<!-- Generated by javadoc (build 1.4.2_05) on Tue Nov 30 22:11:30 EST 2004 -->
10
<META NAME="keywords" CONTENT="org.mozilla.javascript.ContextFactory class">
12
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
14
<SCRIPT type="text/javascript">
15
function windowTitle()
17
parent.document.title="ContextFactory (Rhino)";
23
<BODY BGCOLOR="white" onload="windowTitle();">
26
<!-- ========= START OF TOP NAVBAR ======= -->
27
<A NAME="navbar_top"><!-- --></A>
28
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
29
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
31
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
32
<A NAME="navbar_top_firstrow"><!-- --></A>
33
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
34
<TR ALIGN="center" VALIGN="top">
35
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
36
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
37
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
38
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
39
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
40
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
41
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
45
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
51
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
52
<A HREF="../../../org/mozilla/javascript/ContextAction.html" title="interface in org.mozilla.javascript"><B>PREV CLASS</B></A>
53
<A HREF="../../../org/mozilla/javascript/ContextFactory.Listener.html" title="interface in org.mozilla.javascript"><B>NEXT CLASS</B></A></FONT></TD>
54
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
55
<A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>
56
<A HREF="ContextFactory.html" target="_top"><B>NO FRAMES</B></A>
57
<SCRIPT type="text/javascript">
60
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
65
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
71
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
72
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
73
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
74
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
77
<A NAME="skip-navbar_top"></A>
78
<!-- ========= END OF TOP NAVBAR ========= -->
81
<!-- ======== START OF CLASS DATA ======== -->
84
org.mozilla.javascript</FONT>
86
Class ContextFactory</H2>
89
<IMG SRC="../../../resources/inherit.gif" ALT="extended by"><B>org.mozilla.javascript.ContextFactory</B>
93
<DT>public class <B>ContextFactory</B><DT>extends java.lang.Object</DL>
96
Factory class that Rhino runtime use to create new <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A>
97
instances or to notify about Context execution.
99
When Rhino runtime needs to create new <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> instance during
100
execution of <A HREF="../../../org/mozilla/javascript/Context.html#enter()"><CODE>Context.enter()</CODE></A> or <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A>, it will call
101
<A HREF="../../../org/mozilla/javascript/ContextFactory.html#makeContext()"><CODE>makeContext()</CODE></A> of the current global ContextFactory.
102
See <A HREF="../../../org/mozilla/javascript/ContextFactory.html#getGlobal()"><CODE>getGlobal()</CODE></A> and <A HREF="../../../org/mozilla/javascript/ContextFactory.html#initGlobal(org.mozilla.javascript.ContextFactory)"><CODE>initGlobal(ContextFactory)</CODE></A>.
104
It is also possible to use explicit ContextFactory instances for Context
105
creation. This is useful to have a set of independent Rhino runtime
106
instances under single JVM. See <A HREF="../../../org/mozilla/javascript/ContextFactory.html#call(org.mozilla.javascript.ContextAction)"><CODE>call(ContextAction)</CODE></A>.
108
The following example demonstrates Context customization to terminate
109
scripts running more then 10 seconds and to provide better compatibility
110
with JavaScript code using MSIE-specific features.
112
import org.mozilla.javascript.*;
114
class MyFactory extends ContextFactory
117
// Custom <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> to store execution time.
118
private static class MyContext extends Context
124
// Initialize GlobalFactory with custom factory
125
ContextFactory.initGlobal(new MyFactory());
128
// Override <A HREF="../../../org/mozilla/javascript/ContextFactory.html#makeContext()"><CODE>makeContext()</CODE></A>
129
protected Context makeContext()
131
MyContext cx = new MyContext();
132
// Use pure interpreter mode to allow for
133
// <A HREF="../../../org/mozilla/javascript/ContextFactory.html#observeInstructionCount(org.mozilla.javascript.Context, int)"><CODE>observeInstructionCount(Context, int)</CODE></A> to work
134
cx.setOptimizationLevel(-1);
135
// Make Rhino runtime to call observeInstructionCount
136
// each 10000 bytecode instructions
137
cx.setInstructionObserverThreshold(10000);
141
// Override <A HREF="../../../org/mozilla/javascript/ContextFactory.html#hasFeature(org.mozilla.javascript.Context, int)"><CODE>hasFeature(Context, int)</CODE></A>
142
public boolean hasFeature(Context cx, int featureIndex)
144
// Turn on maximum compatibility with MSIE scripts
145
switch (featureIndex) {
146
case <A HREF="../../../org/mozilla/javascript/Context.html#FEATURE_NON_ECMA_GET_YEAR"><CODE>Context.FEATURE_NON_ECMA_GET_YEAR</CODE></A>:
149
case <A HREF="../../../org/mozilla/javascript/Context.html#FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME"><CODE>Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME</CODE></A>:
152
case <A HREF="../../../org/mozilla/javascript/Context.html#FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER"><CODE>Context.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER</CODE></A>:
155
case <A HREF="../../../org/mozilla/javascript/Context.html#FEATURE_PARENT_PROTO_PROPRTIES"><CODE>Context.FEATURE_PARENT_PROTO_PROPRTIES</CODE></A>:
158
return super.hasFeature(cx, featureIndex);
161
// Override <A HREF="../../../org/mozilla/javascript/ContextFactory.html#observeInstructionCount(org.mozilla.javascript.Context, int)"><CODE>observeInstructionCount(Context, int)</CODE></A>
162
protected void observeInstructionCount(Context cx, int instructionCount)
164
MyContext mcx = (MyContext)cx;
165
long currentTime = System.currentTimeMillis();
166
if (currentTime - mcx.startTime > 10*1000) {
167
// More then 10 seconds from Context creation time:
168
// it is time to stop the script.
169
// Throw Error instance to ensure that script will never
170
// get control back through catch or finally.
175
// Override <A HREF="../../../org/mozilla/javascript/ContextFactory.html#doTopCall(org.mozilla.javascript.Callable, org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[])"><CODE>doTopCall(Callable, Context, Scriptable scope, Scriptable thisObj, Object[] args)</CODE></A>
176
protected Object doTopCall(Callable callable,
177
Context cx, Scriptable scope,
178
Scriptable thisObj, Object[] args)
180
MyContext mcx = (MyContext)cx;
181
mcx.startTime = System.currentTimeMillis();
183
return super.doTopCall(callable, cx, scope, thisObj, args);
195
<!-- ======== NESTED CLASS SUMMARY ======== -->
197
<A NAME="nested_class_summary"><!-- --></A>
198
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
199
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
200
<TD COLSPAN=2><FONT SIZE="+2">
201
<B>Nested Class Summary</B></FONT></TD>
203
<TR BGCOLOR="white" CLASS="TableRowColor">
204
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
205
<CODE>static interface</CODE></FONT></TD>
206
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.Listener.html" title="interface in org.mozilla.javascript">ContextFactory.Listener</A></B></CODE>
209
Listener of <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> creation and release events.</TD>
213
<!-- =========== FIELD SUMMARY =========== -->
216
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
218
<A NAME="constructor_summary"><!-- --></A>
219
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
220
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
221
<TD COLSPAN=2><FONT SIZE="+2">
222
<B>Constructor Summary</B></FONT></TD>
224
<TR BGCOLOR="white" CLASS="TableRowColor">
225
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#ContextFactory()">ContextFactory</A></B>()</CODE>
228
</TD>
232
<!-- ========== METHOD SUMMARY =========== -->
234
<A NAME="method_summary"><!-- --></A>
235
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
236
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
237
<TD COLSPAN=2><FONT SIZE="+2">
238
<B>Method Summary</B></FONT></TD>
240
<TR BGCOLOR="white" CLASS="TableRowColor">
241
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
242
<CODE> void</CODE></FONT></TD>
243
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#addListener(org.mozilla.javascript.ContextFactory.Listener)">addListener</A></B>(<A HREF="../../../org/mozilla/javascript/ContextFactory.Listener.html" title="interface in org.mozilla.javascript">ContextFactory.Listener</A> listener)</CODE>
246
</TD>
248
<TR BGCOLOR="white" CLASS="TableRowColor">
249
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
250
<CODE> java.lang.Object</CODE></FONT></TD>
251
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#call(org.mozilla.javascript.ContextAction)">call</A></B>(<A HREF="../../../org/mozilla/javascript/ContextAction.html" title="interface in org.mozilla.javascript">ContextAction</A> action)</CODE>
254
Call <A HREF="../../../org/mozilla/javascript/ContextAction.html#run(org.mozilla.javascript.Context)"><CODE>ContextAction.run(Context cx)</CODE></A>
255
using the <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> instance associated with the current thread.</TD>
257
<TR BGCOLOR="white" CLASS="TableRowColor">
258
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
259
<CODE>protected void</CODE></FONT></TD>
260
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#checkNotSealed()">checkNotSealed</A></B>()</CODE>
263
</TD>
265
<TR BGCOLOR="white" CLASS="TableRowColor">
266
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
267
<CODE>protected <A HREF="../../../org/mozilla/javascript/GeneratedClassLoader.html" title="interface in org.mozilla.javascript">GeneratedClassLoader</A></CODE></FONT></TD>
268
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#createClassLoader(java.lang.ClassLoader)">createClassLoader</A></B>(java.lang.ClassLoader parent)</CODE>
271
Create class loader for generated classes.</TD>
273
<TR BGCOLOR="white" CLASS="TableRowColor">
274
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
275
<CODE>protected java.lang.Object</CODE></FONT></TD>
276
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#doTopCall(org.mozilla.javascript.Callable, org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[])">doTopCall</A></B>(<A HREF="../../../org/mozilla/javascript/Callable.html" title="interface in org.mozilla.javascript">Callable</A> callable,
277
<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx,
278
<A HREF="../../../org/mozilla/javascript/Scriptable.html" title="interface in org.mozilla.javascript">Scriptable</A> scope,
279
<A HREF="../../../org/mozilla/javascript/Scriptable.html" title="interface in org.mozilla.javascript">Scriptable</A> thisObj,
280
java.lang.Object[] args)</CODE>
283
Execute top call to script or function.</TD>
285
<TR BGCOLOR="white" CLASS="TableRowColor">
286
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
287
<CODE>static <A HREF="../../../org/mozilla/javascript/ContextFactory.html" title="class in org.mozilla.javascript">ContextFactory</A></CODE></FONT></TD>
288
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#getGlobal()">getGlobal</A></B>()</CODE>
291
Get global ContextFactory.</TD>
293
<TR BGCOLOR="white" CLASS="TableRowColor">
294
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
295
<CODE>static boolean</CODE></FONT></TD>
296
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#hasExplicitGlobal()">hasExplicitGlobal</A></B>()</CODE>
299
Check if global factory was set.</TD>
301
<TR BGCOLOR="white" CLASS="TableRowColor">
302
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
303
<CODE>protected boolean</CODE></FONT></TD>
304
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#hasFeature(org.mozilla.javascript.Context, int)">hasFeature</A></B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx,
305
int featureIndex)</CODE>
308
Implementation of <A HREF="../../../org/mozilla/javascript/Context.html#hasFeature(int)"><CODE>Context.hasFeature(int featureIndex)</CODE></A>.</TD>
310
<TR BGCOLOR="white" CLASS="TableRowColor">
311
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
312
<CODE>static void</CODE></FONT></TD>
313
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#initGlobal(org.mozilla.javascript.ContextFactory)">initGlobal</A></B>(<A HREF="../../../org/mozilla/javascript/ContextFactory.html" title="class in org.mozilla.javascript">ContextFactory</A> factory)</CODE>
316
Set global ContextFactory.</TD>
318
<TR BGCOLOR="white" CLASS="TableRowColor">
319
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
320
<CODE> boolean</CODE></FONT></TD>
321
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#isSealed()">isSealed</A></B>()</CODE>
324
Checks if this is a sealed ContextFactory.</TD>
326
<TR BGCOLOR="white" CLASS="TableRowColor">
327
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
328
<CODE>protected <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A></CODE></FONT></TD>
329
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#makeContext()">makeContext</A></B>()</CODE>
332
Create new <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> instance to be associated with the current
335
<TR BGCOLOR="white" CLASS="TableRowColor">
336
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
337
<CODE>protected void</CODE></FONT></TD>
338
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#observeInstructionCount(org.mozilla.javascript.Context, int)">observeInstructionCount</A></B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx,
339
int instructionCount)</CODE>
342
Implementation of
343
<A HREF="../../../org/mozilla/javascript/Context.html#observeInstructionCount(int)"><CODE>Context.observeInstructionCount(int instructionCount)</CODE></A>.</TD>
345
<TR BGCOLOR="white" CLASS="TableRowColor">
346
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
347
<CODE>protected void</CODE></FONT></TD>
348
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#onContextCreated(org.mozilla.javascript.Context)">onContextCreated</A></B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx)</CODE>
351
</TD>
353
<TR BGCOLOR="white" CLASS="TableRowColor">
354
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
355
<CODE>protected void</CODE></FONT></TD>
356
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#onContextReleased(org.mozilla.javascript.Context)">onContextReleased</A></B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx)</CODE>
359
</TD>
361
<TR BGCOLOR="white" CLASS="TableRowColor">
362
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
363
<CODE> void</CODE></FONT></TD>
364
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#removeListener(org.mozilla.javascript.ContextFactory.Listener)">removeListener</A></B>(<A HREF="../../../org/mozilla/javascript/ContextFactory.Listener.html" title="interface in org.mozilla.javascript">ContextFactory.Listener</A> listener)</CODE>
367
</TD>
369
<TR BGCOLOR="white" CLASS="TableRowColor">
370
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
371
<CODE> void</CODE></FONT></TD>
372
<TD><CODE><B><A HREF="../../../org/mozilla/javascript/ContextFactory.html#seal()">seal</A></B>()</CODE>
375
Seal this ContextFactory so any attempt to modify it like to add or
376
remove its listeners will throw an exception.</TD>
379
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
380
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
381
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
382
<TD><B>Methods inherited from class java.lang.Object</B></TD>
384
<TR BGCOLOR="white" CLASS="TableRowColor">
385
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
391
<!-- ============ FIELD DETAIL =========== -->
394
<!-- ========= CONSTRUCTOR DETAIL ======== -->
396
<A NAME="constructor_detail"><!-- --></A>
397
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
398
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
399
<TD COLSPAN=1><FONT SIZE="+2">
400
<B>Constructor Detail</B></FONT></TD>
404
<A NAME="ContextFactory()"><!-- --></A><H3>
407
public <B>ContextFactory</B>()</PRE>
411
<!-- ============ METHOD DETAIL ========== -->
413
<A NAME="method_detail"><!-- --></A>
414
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
415
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
416
<TD COLSPAN=1><FONT SIZE="+2">
417
<B>Method Detail</B></FONT></TD>
421
<A NAME="getGlobal()"><!-- --></A><H3>
424
public static <A HREF="../../../org/mozilla/javascript/ContextFactory.html" title="class in org.mozilla.javascript">ContextFactory</A> <B>getGlobal</B>()</PRE>
426
<DD>Get global ContextFactory.
429
<DT><B>See Also:</B><DD><A HREF="../../../org/mozilla/javascript/ContextFactory.html#hasExplicitGlobal()"><CODE>hasExplicitGlobal()</CODE></A>,
430
<A HREF="../../../org/mozilla/javascript/ContextFactory.html#initGlobal(org.mozilla.javascript.ContextFactory)"><CODE>initGlobal(ContextFactory)</CODE></A></DL>
435
<A NAME="hasExplicitGlobal()"><!-- --></A><H3>
436
hasExplicitGlobal</H3>
438
public static boolean <B>hasExplicitGlobal</B>()</PRE>
440
<DD>Check if global factory was set.
441
Return true to indicate that <A HREF="../../../org/mozilla/javascript/ContextFactory.html#initGlobal(org.mozilla.javascript.ContextFactory)"><CODE>initGlobal(ContextFactory)</CODE></A> was
442
already called and false to indicate that the global factory was not
446
<DT><B>See Also:</B><DD><A HREF="../../../org/mozilla/javascript/ContextFactory.html#getGlobal()"><CODE>getGlobal()</CODE></A>,
447
<A HREF="../../../org/mozilla/javascript/ContextFactory.html#initGlobal(org.mozilla.javascript.ContextFactory)"><CODE>initGlobal(ContextFactory)</CODE></A></DL>
452
<A NAME="initGlobal(org.mozilla.javascript.ContextFactory)"><!-- --></A><H3>
455
public static void <B>initGlobal</B>(<A HREF="../../../org/mozilla/javascript/ContextFactory.html" title="class in org.mozilla.javascript">ContextFactory</A> factory)</PRE>
457
<DD>Set global ContextFactory.
458
The method can only be called once.
461
<DT><B>See Also:</B><DD><A HREF="../../../org/mozilla/javascript/ContextFactory.html#getGlobal()"><CODE>getGlobal()</CODE></A>,
462
<A HREF="../../../org/mozilla/javascript/ContextFactory.html#hasExplicitGlobal()"><CODE>hasExplicitGlobal()</CODE></A></DL>
467
<A NAME="makeContext()"><!-- --></A><H3>
470
protected <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> <B>makeContext</B>()</PRE>
472
<DD>Create new <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> instance to be associated with the current
474
This is a callback method used by Rhino to create <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A>
475
instance when it is necessary to associate one with the current
476
execution thread. <tt>makeContext()</tt> is allowed to call
477
<A HREF="../../../org/mozilla/javascript/Context.html#seal(java.lang.Object)"><CODE>Context.seal(Object)</CODE></A> on the result to prevent
478
<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> changes by hostile scripts or applets.
486
<A NAME="hasFeature(org.mozilla.javascript.Context, int)"><!-- --></A><H3>
489
protected boolean <B>hasFeature</B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx,
490
int featureIndex)</PRE>
492
<DD>Implementation of <A HREF="../../../org/mozilla/javascript/Context.html#hasFeature(int)"><CODE>Context.hasFeature(int featureIndex)</CODE></A>.
493
This can be used to customize <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> without introducing
494
additional subclasses.
502
<A NAME="createClassLoader(java.lang.ClassLoader)"><!-- --></A><H3>
503
createClassLoader</H3>
505
protected <A HREF="../../../org/mozilla/javascript/GeneratedClassLoader.html" title="interface in org.mozilla.javascript">GeneratedClassLoader</A> <B>createClassLoader</B>(java.lang.ClassLoader parent)</PRE>
507
<DD>Create class loader for generated classes.
508
This method creates an instance of the default implementation
509
of <A HREF="../../../org/mozilla/javascript/GeneratedClassLoader.html" title="interface in org.mozilla.javascript"><CODE>GeneratedClassLoader</CODE></A>. Rhino uses this interface to load
510
generated JVM classes when no <A HREF="../../../org/mozilla/javascript/SecurityController.html" title="class in org.mozilla.javascript"><CODE>SecurityController</CODE></A>
512
Application can override the method to provide custom class loading.
520
<A NAME="doTopCall(org.mozilla.javascript.Callable, org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[])"><!-- --></A><H3>
523
protected java.lang.Object <B>doTopCall</B>(<A HREF="../../../org/mozilla/javascript/Callable.html" title="interface in org.mozilla.javascript">Callable</A> callable,
524
<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx,
525
<A HREF="../../../org/mozilla/javascript/Scriptable.html" title="interface in org.mozilla.javascript">Scriptable</A> scope,
526
<A HREF="../../../org/mozilla/javascript/Scriptable.html" title="interface in org.mozilla.javascript">Scriptable</A> thisObj,
527
java.lang.Object[] args)</PRE>
529
<DD>Execute top call to script or function.
530
When the runtime is about to execute a script or function that will
531
create the first stack frame with scriptable code, it calls this method
532
to perform the real call. In this way execution of any script
533
happens inside this function.
541
<A NAME="observeInstructionCount(org.mozilla.javascript.Context, int)"><!-- --></A><H3>
542
observeInstructionCount</H3>
544
protected void <B>observeInstructionCount</B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx,
545
int instructionCount)</PRE>
547
<DD>Implementation of
548
<A HREF="../../../org/mozilla/javascript/Context.html#observeInstructionCount(int)"><CODE>Context.observeInstructionCount(int instructionCount)</CODE></A>.
549
This can be used to customize <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> without introducing
550
additional subclasses.
558
<A NAME="onContextCreated(org.mozilla.javascript.Context)"><!-- --></A><H3>
559
onContextCreated</H3>
561
protected void <B>onContextCreated</B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx)</PRE>
569
<A NAME="onContextReleased(org.mozilla.javascript.Context)"><!-- --></A><H3>
570
onContextReleased</H3>
572
protected void <B>onContextReleased</B>(<A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript">Context</A> cx)</PRE>
580
<A NAME="addListener(org.mozilla.javascript.ContextFactory.Listener)"><!-- --></A><H3>
583
public final void <B>addListener</B>(<A HREF="../../../org/mozilla/javascript/ContextFactory.Listener.html" title="interface in org.mozilla.javascript">ContextFactory.Listener</A> listener)</PRE>
591
<A NAME="removeListener(org.mozilla.javascript.ContextFactory.Listener)"><!-- --></A><H3>
594
public final void <B>removeListener</B>(<A HREF="../../../org/mozilla/javascript/ContextFactory.Listener.html" title="interface in org.mozilla.javascript">ContextFactory.Listener</A> listener)</PRE>
602
<A NAME="isSealed()"><!-- --></A><H3>
605
public final boolean <B>isSealed</B>()</PRE>
607
<DD>Checks if this is a sealed ContextFactory.
610
<DT><B>See Also:</B><DD><A HREF="../../../org/mozilla/javascript/ContextFactory.html#seal()"><CODE>seal()</CODE></A></DL>
615
<A NAME="seal()"><!-- --></A><H3>
618
public final void <B>seal</B>()</PRE>
620
<DD>Seal this ContextFactory so any attempt to modify it like to add or
621
remove its listeners will throw an exception.
624
<DT><B>See Also:</B><DD><A HREF="../../../org/mozilla/javascript/ContextFactory.html#isSealed()"><CODE>isSealed()</CODE></A></DL>
629
<A NAME="checkNotSealed()"><!-- --></A><H3>
632
protected final void <B>checkNotSealed</B>()</PRE>
640
<A NAME="call(org.mozilla.javascript.ContextAction)"><!-- --></A><H3>
643
public final java.lang.Object <B>call</B>(<A HREF="../../../org/mozilla/javascript/ContextAction.html" title="interface in org.mozilla.javascript">ContextAction</A> action)</PRE>
645
<DD>Call <A HREF="../../../org/mozilla/javascript/ContextAction.html#run(org.mozilla.javascript.Context)"><CODE>ContextAction.run(Context cx)</CODE></A>
646
using the <A HREF="../../../org/mozilla/javascript/Context.html" title="class in org.mozilla.javascript"><CODE>Context</CODE></A> instance associated with the current thread.
647
If no Context is associated with the thread, then
648
<A HREF="../../../org/mozilla/javascript/ContextFactory.html#makeContext()"><CODE>makeContext()</CODE></A> will be called to construct
649
new Context instance. The instance will be temporary associated
650
with the thread during call to <A HREF="../../../org/mozilla/javascript/ContextAction.html#run(org.mozilla.javascript.Context)"><CODE>ContextAction.run(Context)</CODE></A>.
653
<DT><B>See Also:</B><DD><A HREF="../../../org/mozilla/javascript/ContextFactory.html#call(org.mozilla.javascript.ContextAction)"><CODE>call(ContextAction)</CODE></A>,
654
<A HREF="../../../org/mozilla/javascript/Context.html#call(org.mozilla.javascript.ContextFactory, org.mozilla.javascript.Callable, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[])"><CODE>Context.call(ContextFactory factory, Callable callable,
655
Scriptable scope, Scriptable thisObj,
656
Object[] args)</CODE></A></DL>
659
<!-- ========= END OF CLASS DATA ========= -->
663
<!-- ======= START OF BOTTOM NAVBAR ====== -->
664
<A NAME="navbar_bottom"><!-- --></A>
665
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
666
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
668
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
669
<A NAME="navbar_bottom_firstrow"><!-- --></A>
670
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
671
<TR ALIGN="center" VALIGN="top">
672
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
673
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
674
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
675
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
676
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
677
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
678
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
682
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
688
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
689
<A HREF="../../../org/mozilla/javascript/ContextAction.html" title="interface in org.mozilla.javascript"><B>PREV CLASS</B></A>
690
<A HREF="../../../org/mozilla/javascript/ContextFactory.Listener.html" title="interface in org.mozilla.javascript"><B>NEXT CLASS</B></A></FONT></TD>
691
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
692
<A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>
693
<A HREF="ContextFactory.html" target="_top"><B>NO FRAMES</B></A>
694
<SCRIPT type="text/javascript">
697
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
702
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
708
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
709
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
710
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
711
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
714
<A NAME="skip-navbar_bottom"></A>
715
<!-- ======== END OF BOTTOM NAVBAR ======= -->