mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Issue #1691 - Part 1: Provide a way of associating a private value with a script or module.
This is a prerequisite for dynamic import (cherry picked from commit 2e2972647ee29340df51a804f05e40fc1da2c89b)
This commit is contained in:
parent
d75c6c1815
commit
1a6b3a822c
10 changed files with 129 additions and 43 deletions
|
|
@ -4324,7 +4324,7 @@ extern JS_PUBLIC_API(bool)
|
|||
Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
const char* filename, JS::MutableHandleValue rval);
|
||||
|
||||
using ModuleResolveHook = JSObject* (*)(JSContext*, HandleObject, HandleString);
|
||||
using ModuleResolveHook = JSObject* (*)(JSContext*, HandleValue, HandleString);
|
||||
|
||||
/**
|
||||
* Get the HostResolveImportedModule hook for the runtime.
|
||||
|
|
@ -4347,17 +4347,30 @@ CompileModule(JSContext* cx, const ReadOnlyCompileOptions& options,
|
|||
SourceBufferHolder& srcBuf, JS::MutableHandleObject moduleRecord);
|
||||
|
||||
/**
|
||||
* Set the [[HostDefined]] field of a source text module record to the given
|
||||
* value.
|
||||
* Set a private value associated with a source text module record.
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
SetModuleHostDefinedField(JSObject* module, const JS::Value& value);
|
||||
SetModulePrivate(JSObject* module, const JS::Value& value);
|
||||
|
||||
/**
|
||||
* Get the [[HostDefined]] field of a source text module record.
|
||||
* Get the private value associated with a source text module record.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JS::Value)
|
||||
GetModuleHostDefinedField(JSObject* module);
|
||||
GetModulePrivate(JSObject* module);
|
||||
|
||||
/**
|
||||
* Set a private value associated with a script. Note that this value is shared
|
||||
* by all nested scripts compiled from a single source file.
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
SetScriptPrivate(JSScript* script, const JS::Value& value);
|
||||
|
||||
/**
|
||||
* Get the private value associated with a script. Note that this value is
|
||||
* shared by all nested scripts compiled from a single source file.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JS::Value)
|
||||
GetScriptPrivate(JSScript* script);
|
||||
|
||||
/*
|
||||
* Perform the ModuleInstantiate operation on the given source text module
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue