mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-16 09:23:07 +09:00
Issue #2387 - Remove a missed AddRef() which could cause leaks. Update comments explaining how the reference counting works.
This commit is contained in:
parent
eef37b2cd5
commit
3e9fd21a38
1 changed files with 7 additions and 7 deletions
|
|
@ -53,13 +53,12 @@ LoadedScript::LoadedScript(ScriptKind aKind,
|
|||
LoadedScript::~LoadedScript() { DropJSObjects(this); }
|
||||
|
||||
void LoadedScript::AssociateWithScript(JSScript* aScript) {
|
||||
// Set a JSScript's private value to point to this object and
|
||||
// increment our reference count. This is decremented by
|
||||
// HostFinalizeTopLevelScript() below when the JSScript dies.
|
||||
// Set a JSScript's private value to point to this object. The JS engine will
|
||||
// increment our reference count by calling HostAddRefTopLevelScript(). This
|
||||
// is decremented by HostReleaseTopLevelScript() below when the JSScript dies.
|
||||
|
||||
MOZ_ASSERT(JS::GetScriptPrivate(aScript).isUndefined());
|
||||
JS::SetScriptPrivate(aScript, JS::PrivateValue(this));
|
||||
AddRef();
|
||||
}
|
||||
|
||||
inline void CheckModuleScriptPrivate(LoadedScript* script,
|
||||
|
|
@ -163,9 +162,10 @@ ModuleScript::SetModuleRecord(JS::Handle<JSObject*> aModuleRecord)
|
|||
|
||||
mModuleRecord = aModuleRecord;
|
||||
|
||||
// Make module's host defined field point to this object and
|
||||
// increment our reference count. This is decremented by
|
||||
// UnlinkModuleRecord() above.
|
||||
// Make module's host defined field point to this object. The JS engine will
|
||||
// increment our reference count by calling HostAddRefTopLevelScript(). This
|
||||
// is decremented when the field is cleared in UnlinkModuleRecord() above or
|
||||
// when the module record dies.
|
||||
MOZ_ASSERT(JS::GetModulePrivate(mModuleRecord).isUndefined());
|
||||
JS::SetModulePrivate(mModuleRecord, JS::PrivateValue(this));
|
||||
HoldJSObjects(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue