зеркало из https://github.com/mozilla/gecko-dev.git
Bug 942631 part 3. Preserve the wrapper when caching things in its slots if we're an nsWrapperCache. r=peterv
This commit is contained in:
Родитель
3c9332eaf8
Коммит
a55415242a
|
@ -5025,6 +5025,19 @@ if (!${obj}) {
|
||||||
self.descriptor.getDescriptor(self.returnType.unroll().inner.identifier.name).nativeOwnership == 'owned'))
|
self.descriptor.getDescriptor(self.returnType.unroll().inner.identifier.name).nativeOwnership == 'owned'))
|
||||||
|
|
||||||
if self.idlNode.isAttr() and self.idlNode.slotIndex is not None:
|
if self.idlNode.isAttr() and self.idlNode.slotIndex is not None:
|
||||||
|
# For the case of Cached attributes, go ahead and preserve our
|
||||||
|
# wrapper if needed. We need to do this because otherwise the
|
||||||
|
# wrapper could get garbage-collected and the cached value would
|
||||||
|
# suddenly disappear, but the whole premise of cached values is that
|
||||||
|
# they never change without explicit action on someone's part. We
|
||||||
|
# don't do this for StoreInSlot, since those get dealt with during
|
||||||
|
# wrapper setup, and failure would involve us trying to clear an
|
||||||
|
# already-preserved wrapper.
|
||||||
|
if (self.idlNode.getExtendedAttribute("Cached") and
|
||||||
|
self.descriptor.wrapperCache):
|
||||||
|
preserveWrapper = " PreserveWrapper(self);\n"
|
||||||
|
else:
|
||||||
|
preserveWrapper = ""
|
||||||
successCode = (
|
successCode = (
|
||||||
"// Be careful here: Have to wrap the value into the\n"
|
"// Be careful here: Have to wrap the value into the\n"
|
||||||
"// compartment of reflector before storing, since we might\n"
|
"// compartment of reflector before storing, since we might\n"
|
||||||
|
@ -5037,9 +5050,10 @@ if (!${obj}) {
|
||||||
" return false;\n"
|
" return false;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" js::SetReservedSlot(reflector, %d, tempVal);\n"
|
" js::SetReservedSlot(reflector, %d, tempVal);\n"
|
||||||
|
"%s"
|
||||||
"}\n"
|
"}\n"
|
||||||
"return true;" %
|
"return true;" %
|
||||||
memberReservedSlot(self.idlNode))
|
(memberReservedSlot(self.idlNode), preserveWrapper))
|
||||||
else:
|
else:
|
||||||
successCode = None
|
successCode = None
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче