Bug 1733869 [wpt PR 30916] - Add a note about counterintuitive send_keys() code point...
[gecko.git] / js / public / ScriptPrivate.h
blob1c7f1801fe069d6decfd2ef24741f61cfd567227
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef js_ScriptPrivate_h
8 #define js_ScriptPrivate_h
10 #include "jstypes.h"
12 #include "js/TypeDecls.h"
14 namespace JS {
16 /**
17 * Set a private value associated with a script. Note that this value is shared
18 * by all nested scripts compiled from a single source file.
20 extern JS_PUBLIC_API void SetScriptPrivate(JSScript* script,
21 const JS::Value& value);
23 /**
24 * Get the private value associated with a script. Note that this value is
25 * shared by all nested scripts compiled from a single source file.
27 extern JS_PUBLIC_API JS::Value GetScriptPrivate(JSScript* script);
29 /**
30 * Return the private value associated with currently executing script or
31 * module, or undefined if there is no such script.
33 extern JS_PUBLIC_API JS::Value GetScriptedCallerPrivate(JSContext* cx);
35 /**
36 * Hooks called when references to a script private value are created or
37 * destroyed. This allows use of a reference counted object as the
38 * script private.
40 using ScriptPrivateReferenceHook = void (*)(const JS::Value&);
42 /**
43 * Set the script private finalize hook for the runtime to the given function.
45 extern JS_PUBLIC_API void SetScriptPrivateReferenceHooks(
46 JSRuntime* rt, ScriptPrivateReferenceHook addRefHook,
47 ScriptPrivateReferenceHook releaseHook);
49 } // namespace JS
51 #endif // js_ScriptPrivate_h