Bug 1184400, part 2 - XPCWrappedNative::Suspect() should suspect the JS reflector object even if it doesn't own it. r=bholley

This commit is contained in:
Andrew McCreight 2015-07-16 17:50:43 -07:00
Родитель e7070f39fe
Коммит 52b10c8714
2 изменённых файлов: 5 добавлений и 5 удалений

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

@ -104,7 +104,10 @@ XPCWrappedNative::Suspect(nsCycleCollectionNoteRootCallback& cb)
"Suspecting wrapped natives from non-main thread");
// Only record objects that might be part of a cycle as roots, unless
// the callback wants all traces (a debug feature).
// the callback wants all traces (a debug feature). Do this even if
// the XPCWN doesn't own the JS reflector object in case the reflector
// keeps alive other C++ things. This is safe because if the reflector
// had died the reference from the XPCWN to it would have been cleared.
JSObject* obj = GetFlatJSObjectPreserveColor();
if (JS::ObjectIsMarkedGray(obj) || cb.WantAllTraces())
cb.NoteJSRoot(obj);

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

@ -497,10 +497,7 @@ XPCWrappedNativeScope::SuspectAllWrappers(XPCJSRuntime* rt,
{
for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext) {
for (auto i = cur->mWrappedNativeMap->Iter(); !i.Done(); i.Next()) {
auto entry = static_cast<Native2WrappedNativeMap::Entry*>(i.Get());
XPCWrappedNative* wrapper = entry->value;
if (wrapper->HasExternalReference())
wrapper->Suspect(cb);
static_cast<Native2WrappedNativeMap::Entry*>(i.Get())->value->Suspect(cb);
}
if (cur->mDOMExpandoSet) {