mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-05 14:57:30 +09:00
Issue MoonchildProductions/UXP#2306: Add pref-gated WeakRef with safe stub when disabled
* Add javascript.options.weakrefs and plumb it through context options, XPConnect, and workers * Keep referents alive via strong tracing when the pref is off so deref() still returns the target * Retain weak-edge semantics when the pref is enabled
This commit is contained in:
parent
2a6ec52f2f
commit
3cf82e2ca1
7 changed files with 32 additions and 8 deletions
|
|
@ -998,7 +998,9 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
werror_(false),
|
||||
strictMode_(false),
|
||||
extraWarnings_(false),
|
||||
arrayProtoValues_(true)
|
||||
arrayProtoValues_(true),
|
||||
streams_(true),
|
||||
weakRefs_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -1138,6 +1140,16 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool weakRefs() const { return weakRefs_; }
|
||||
ContextOptions& setWeakRefs(bool flag) {
|
||||
weakRefs_ = flag;
|
||||
return *this;
|
||||
}
|
||||
ContextOptions& toggleWeakRefs() {
|
||||
weakRefs_ = !weakRefs_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
bool baseline_ : 1;
|
||||
bool ion_ : 1;
|
||||
|
|
@ -1155,6 +1167,7 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
bool extraWarnings_ : 1;
|
||||
bool arrayProtoValues_ : 1;
|
||||
bool streams_ : 1;
|
||||
bool weakRefs_ : 1;
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(ContextOptions&)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue