Bug 1376954 part 1. Ensure that we don't try to nursery-allocate non-wrappercached DOM objects. r=smaug

This commit is contained in:
Boris Zbarsky 2017-06-30 10:15:51 -07:00
Родитель 6cccc9defa
Коммит 239e1057ca
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -453,6 +453,9 @@ class CGDOMJSClass(CGThing):
traceHook = 'nullptr'
reservedSlots = slotCount
if self.descriptor.interface.hasProbablyShortLivingWrapper():
if not self.descriptor.wrapperCache:
raise TypeError("Need a wrapper cache to support nursery "
"allocation of DOM objects")
classFlags += " | JSCLASS_SKIP_NURSERY_FINALIZE"
if self.descriptor.interface.getExtendedAttribute("NeedResolve"):

Просмотреть файл

@ -260,6 +260,10 @@ public:
bool AreGCGrayBitsValid() const;
void GarbageCollect(uint32_t aReason) const;
// This needs to be an nsWrapperCache, not a JSObject, because we need to know
// when our object gets moved. But we can't trace it (and hence update our
// storage), because we do not want to keep it alive. nsWrapperCache handles
// this for us via its "object moved" handling.
void NurseryWrapperAdded(nsWrapperCache* aCache);
void NurseryWrapperPreserved(JSObject* aWrapper);
void JSObjectsTenured();