mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 22:38:41 +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
|
|
@ -4710,15 +4710,27 @@ JS::CompileModule(JSContext* cx, const ReadOnlyCompileOptions& options,
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::SetModuleHostDefinedField(JSObject* module, const JS::Value& value)
|
||||
JS::SetModulePrivate(JSObject* module, const JS::Value& value)
|
||||
{
|
||||
module->as<ModuleObject>().setHostDefinedField(value);
|
||||
module->as<ModuleObject>().scriptSourceObject()->setPrivate(value);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JS::Value)
|
||||
JS::GetModuleHostDefinedField(JSObject* module)
|
||||
JS::GetModulePrivate(JSObject* module)
|
||||
{
|
||||
return module->as<ModuleObject>().hostDefinedField();
|
||||
return module->as<ModuleObject>().scriptSourceObject()->getPrivate();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::SetScriptPrivate(JSScript* script, const JS::Value& value)
|
||||
{
|
||||
script->scriptSourceUnwrap().setPrivate(value);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JS::Value)
|
||||
JS::GetScriptPrivate(JSScript* script)
|
||||
{
|
||||
return script->scriptSourceUnwrap().getPrivate();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue