summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2019-04-29 12:08:50 +0300
committerGitHub <noreply@github.com>2019-04-29 12:08:50 +0300
commitcf319d581ca94d304a1a9741a5466c96d9179ce6 (patch)
treef54c35c8893a301f0c135046246ff6f7aae1396a
parentbb1fad0fa728c7e95c6e06dfae63254b2c2e2966 (diff)
downloaduxp-cf319d581ca94d304a1a9741a5466c96d9179ce6.tar.gz
Improve dead compartment collection js/ipc
-rw-r--r--js/ipc/JavaScriptShared.cpp11
-rw-r--r--js/ipc/JavaScriptShared.h3
-rw-r--r--js/ipc/WrapperAnswer.cpp4
3 files changed, 14 insertions, 4 deletions
diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp
index 9786243f21..aba02252d7 100644
--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -61,6 +61,15 @@ IdToObjectMap::find(ObjectId id)
return p->value();
}
+JSObject*
+IdToObjectMap::findPreserveColor(ObjectId id)
+{
+ Table::Ptr p = table_.lookup(id);
+ if (!p)
+ return nullptr;
+ return p->value().unbarrieredGet();
+ }
+
bool
IdToObjectMap::add(ObjectId id, JSObject* obj)
{
@@ -757,4 +766,4 @@ CPOWManager*
mozilla::jsipc::CPOWManagerFor(PJavaScriptChild* aChild)
{
return static_cast<JavaScriptChild*>(aChild);
-}
+} \ No newline at end of file
diff --git a/js/ipc/JavaScriptShared.h b/js/ipc/JavaScriptShared.h
index 4de1538265..d0cd4615b2 100644
--- a/js/ipc/JavaScriptShared.h
+++ b/js/ipc/JavaScriptShared.h
@@ -96,6 +96,7 @@ class IdToObjectMap
bool add(ObjectId id, JSObject* obj);
JSObject* find(ObjectId id);
+ JSObject* findPreserveColor(ObjectId id);
void remove(ObjectId id);
void clear();
@@ -233,4 +234,4 @@ class JavaScriptShared : public CPOWManager
} // namespace jsipc
} // namespace mozilla
-#endif
+#endif \ No newline at end of file
diff --git a/js/ipc/WrapperAnswer.cpp b/js/ipc/WrapperAnswer.cpp
index fc342bbb68..6ae68e01f4 100644
--- a/js/ipc/WrapperAnswer.cpp
+++ b/js/ipc/WrapperAnswer.cpp
@@ -789,10 +789,10 @@ WrapperAnswer::RecvDOMInstanceOf(const ObjectId& objId, const int& prototypeID,
bool
WrapperAnswer::RecvDropObject(const ObjectId& objId)
{
- JSObject* obj = objects_.find(objId);
+ JSObject* obj = objects_.findPreserveColor(objId);
if (obj) {
objectIdMap(objId.hasXrayWaiver()).remove(obj);
objects_.remove(objId);
}
return true;
-}
+} \ No newline at end of file