Bug 1503722: Check for null in JSScript::freeScriptData r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D11472

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Iain Ireland 2018-11-09 16:38:08 +00:00
parent fe0e9340b4
commit 9c33f619f8
2 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,10 @@
// |jit-test| skip-if: !('oomAtAllocation' in this) || helperThreadCount() === 0
let THREAD_TYPE_PARSE = 4;
let t = cacheEntry("function f() { function g() { }; return 3; };");
evaluate(t, { sourceIsLazy: true, saveIncrementalBytecode: true });
for (var i = 1; i < 20; ++i) {
oomAtAllocation(i, THREAD_TYPE_PARSE);
offThreadDecodeScript(t);
gc();
}

View File

@ -2814,8 +2814,10 @@ JSScript::createSharedScriptData(JSContext* cx, uint32_t codeLength,
void
JSScript::freeScriptData()
{
scriptData_->decRefCount();
scriptData_ = nullptr;
if (scriptData_) {
scriptData_->decRefCount();
scriptData_ = nullptr;
}
}
void