diff --git a/mozilla/js/docs/jsref.xml b/mozilla/js/docs/jsref.xml
index 4ed54339337..68d24f3ae77 100644
--- a/mozilla/js/docs/jsref.xml
+++ b/mozilla/js/docs/jsref.xml
@@ -692,7 +692,7 @@ JSPROP_INDEX
JSFUN_BOUND_METHOD
- This macro is deprecated. JSFUN_BOUND_METHOD is a flag that indicates a method associated with an object is bound to the object's parent. This macro is no longer needed because the JS engine now supports closures.
+ This macro is deprecated. JSFUN_BOUND_METHOD is a flag that indicates a method associated with an object is bound to the method's parent, the object on which the method is called.
This macro exists only for backward compatibility with existing applications. Its
@@ -2168,7 +2168,7 @@ void JS_Finish(JSRuntime *rt);
void JS_Lock(JSRuntime *rt);
- JS_Lock is an empty, API hook function for developers so that they provide an exclusive locking mechanism for the JSRuntime on a specific platform or for a specific application. Developers must create their own locking function that takes a single argument, rt, the JS run-time environment to lock. Locking the runtime protects critical sections in a threaded environment. After performing one or more exclusive lock operations, the runtime should be unlocked with a call to JS_Unlock.
+ JS_Lock is a deprecated API; don't use it.
@@ -2185,7 +2185,7 @@ void JS_Unlock(JSRuntime *rt);
- JS_Unlock is an empty, API hook function for developers so that they can provide a mechanism for unlocking the JS run-time environment after having previously locked it with a call to JS_Lock. Developers must create their own unlocking function that takes a single argument, rt, the JS run-time environment to unlock. JS_Unlock must undo the actions taken by the developer's implementation of JS_Lock.
+ JS_Unlock is a deprecated API; don't use it.
@@ -2871,16 +2871,18 @@ JSBool JS_RemoveRoot(JSContext *cx, void *rp);
- Indicates to the JS engine that the application is starting a thread.
+ Indicates to the JS engine that an application thread is entering a critical section that calls the JS API freely but does not block.
void JS_BeginRequest(JSContext *cx);
- When your application start a new thread, JS_BeginRequest safely increments the thread counter for the JS engine runtime associated with a given context, cx. In order to increment the counter, this function first checks that garbage collection is not in process. If it is, JS_BeginRequest waits until garbage collection is complete before locking the JS engine runtime and incrementing the thread counter. After incrementing the counter, JS_BeginRequest unlocks the runtime if it previously locked it.
+ When your multi-threaded application wants to execute JS API calls on a thread, it should use JS_BeginRequest and JS_EndRequest to bracket maximal non-blocking hunks of native code that call the JS API. This "request model" serves two purposes: to interlock with the global mark/sweep garbage collector, and to optimize object locking to be lock-free in most cases. In order to achieve these purposes, JS_BeginRequest first checks that garbage collection is not in process. If it is, JS_BeginRequest waits until garbage collection is complete before locking the JS engine runtime and incrementing its request counter. After incrementing the counter, JS_BeginRequest unlocks the runtime if it previously locked it.
+ It is therefore imperative that native code executing within an active request on cx not block, or simply take too long. Any blocking native call, or lengthy computation that can race safely with the garbage collector, must be bracketed within the native method or function with JS_SuspendRequest and JS_ResumeRequest.
+ It is safe to nest calls to JS_BeginRequest so long as each call is balanced by a matching JS_EndRequest.
- JS_BeginRequest is only available if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
+ JS_BeginRequest is available only if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
@@ -2889,16 +2891,17 @@ void JS_BeginRequest(JSContext *cx);
- Indicates to the JS engine that the application no longer requires a thread.
+ Indicates to the JS engine that an application thread is leaving a critical section that calls the JS API freely but does not block.
void JS_EndRequest(JSContext *cx);
- When your application no longer requires a thread, JS_EndRequest safely decrements the thread counter for the JS engine runtime associated with a given context, cx. If decrementing the counter reduces it to zero, JS_EndRequest locks the runtime and notifies the garbage collector so that values no longer in use can be cleaned up. To avoid garbage collection notification, call JS_SuspendRequest instead of JS_EndRequest.
+ When your multi-threaded application has called JS_BeginRequest and no longer needs to call the JS API in a non-blocking burst of activity, JS_EndRequest safely decrements the request counter for the JS engine runtime associated with a given context, cx. If decrementing the counter reduces it to zero, JS_EndRequest locks the runtime and notifies the garbage collector so that values no longer in use can be cleaned up.
+ The application may nest calls to JS_BeginRequest provided it balances each such call with a matching JS_EndRequest.
- JS_EndRequest is only available if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
+ JS_EndRequest is available only if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
@@ -2907,16 +2910,16 @@ void JS_EndRequest(JSContext *cx);
- Indicates to the JS engine that the application is temporarily suspending a thread.
+ Indicates to the JS engine that an application thread executing JS API calls in a request can suspend its API-calling critical section and block.
-void JS_SuspendRequest(JSContext *cx);
+jsrefcount JS_SuspendRequest(JSContext *cx);
- When your application suspends use of a thread, JS_SuspendRequest safely decrements the thread counter for the JS engine runtime associated with a given context, cx.
+ When your multi-threaded application is in a request but needs to block or perform lengthy computation that can race safely with the garbage collector, it should call JS_SuspendRequest before the blocking or length call, and JS_ResumeRequest after. JS_SuspendRequest safely decrements the request counter for the JS engine runtime associated with a given context, cx. JS_SuspendRequest returns the saved value of the request-depth counter stored in cx, which must be passed to the matching JS_SuspendRequest after the blocking or length code completes.
- JS_SuspendRequest is only available if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
+ JS_SuspendRequest is available only if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
@@ -2925,16 +2928,18 @@ void JS_SuspendRequest(JSContext *cx);
+ Indicates to the JS engine that an application thread in a suspended request wants to resume executing JS API calls from non-blocking code.
Restarts a previously suspended thread.
-void JS_ResumeRequest(JSContext *cx);
+void JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth);
- When your application restart a previously suspended thread, JS_BeginRequest safely increments the thread counter for the JS engine runtime associated with a given context, cx. In order to increment the counter, this function first checks that garbage collection is not in process. If it is, JS_ResumeRequest waits until garbage collection is complete before locking the JS engine runtime and incrementing the thread counter. After incrementing the counter, JS_ResumeRequest unlocks the runtime if it previously locked it.
+ When your multi-threaded application restarts a previously suspended request, JS_ResumeRequest safely restores the request depth counter from saveDepth for the given context, cx. It does this by calling JS_BeginRequest exactly saveDepth times, so saveDepth must come from the return value of a prior JS_SuspendRequest call.
+
- JS_ResumeRequest is only available if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
+ JS_ResumeRequest is available only if you compile the JS engine with JS_THREADSAFE defined. In a default engine compilation, JS_THREADSAFE is undefined.
@@ -5547,7 +5552,7 @@ JSScript * JS_CompileFile(JSContext *cx, JSObject *obj,
JS_CompileFile compiles the text of script in an external file location for execution by the JS engine.
- JS_CompileFile is only available if you compile the JS engine with the JSFILE macro defined.
+ JS_CompileFile is available only if you compile the JS engine with the JSFILE macro defined.
filename is the name of the file (or URL) containing the script to compile.
If a script compiles successfully, JS_CompileFile returns a pointer to the compiled script. Otherwise JS_CompileFile returns NULL.