Issue #1691 - Part 6a: Support private values which contain pointers to cycle-collected C++ objects https://bugzilla.mozilla.org/show_bug.cgi?id=1342012

(cherry picked from commit 1286cca73d58332ba0becd0011f747713b8acfac)
This commit is contained in:
Brian Smith 2023-04-09 12:22:33 -05:00 committed by roytam1
commit 1b811bd711
10 changed files with 107 additions and 23 deletions

View file

@ -641,10 +641,17 @@ class ScriptSourceObject : public NativeObject
void setPrivate(const Value& value) {
setReservedSlot(PRIVATE_SLOT, value);
}
Value getPrivate() const {
return getReservedSlot(PRIVATE_SLOT);
}
Value canonicalPrivate() const {
Value value = getReservedSlot(PRIVATE_SLOT);
MOZ_ASSERT_IF(!isCanonical(), value.isUndefined());
return value;
}
private:
enum {
SOURCE_SLOT = 0,