Bug 1189822 part 5. Remove the now-unnecessary DOMProxyHandler::ClearExternalRefsForWrapperRelease function. r=peterv

All DOMProxyHandler::ClearExternalRefsForWrapperRelease now does is clear a backpointer to the expando, and that's handled during reflector finalization already.
This commit is contained in:
Boris Zbarsky 2017-05-17 00:52:53 -04:00
parent 0c1348b3ef
commit bd29adfa95
3 changed files with 0 additions and 37 deletions

View File

@ -8,7 +8,6 @@
#include "js/Class.h"
#include "js/Proxy.h"
#include "mozilla/dom/DOMJSProxyHandler.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/HoldDropJSObjects.h"
#include "nsCycleCollectionTraversalCallback.h"
@ -50,13 +49,6 @@ void
nsWrapperCache::ReleaseWrapper(void* aScriptObjectHolder)
{
if (PreservingWrapper()) {
// PreserveWrapper puts new DOM bindings in the JS holders hash, but they
// can also be in the DOM expando hash, so we need to try to remove them
// from both here.
JSObject* obj = GetWrapperPreserveColor();
if (IsDOMBinding() && obj && js::IsProxy(obj)) {
DOMProxyHandler::ClearExternalRefsForWrapperRelease(obj);
}
SetPreservingWrapper(false);
cyclecollector::DropJSObjectsImpl(aScriptObjectHolder);
}

View File

@ -70,25 +70,6 @@ struct SetDOMProxyInformation
SetDOMProxyInformation gSetDOMProxyInformation;
// static
void
DOMProxyHandler::ClearExternalRefsForWrapperRelease(JSObject* obj)
{
MOZ_ASSERT(IsDOMProxy(obj), "expected a DOM proxy object");
JS::Value v = js::GetProxyPrivate(obj);
if (v.isUndefined() || v.isObject()) {
// No expando, or an expando that we reference from our slot anyway, so
// don't have to clear state for.
return;
}
// Prevent having a dangling pointer to our expando from the
// ExpandoAndGeneration.
js::ExpandoAndGeneration* expandoAndGeneration =
static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
expandoAndGeneration->expando = UndefinedValue();
}
// static
JSObject*
DOMProxyHandler::GetAndClearExpandoObject(JSObject* obj)

View File

@ -131,16 +131,6 @@ public:
*/
static JSObject* GetExpandoObject(JSObject* obj);
/*
* Clear the "external references" to this object. If you are not
* nsWrapperCAche::ReleaseWrapper, you do NOT want to be calling this method.
*
* XXXbz if we nixed the DOM expando hash and just had a finalizer that
* cleared out the value in the ExpandoAndGeneration in the shadowing case,
* could we just get rid of this function altogether?
*/
static void ClearExternalRefsForWrapperRelease(JSObject* obj);
/*
* Clear the expando object for the given DOM proxy and return it. This
* function will ensure that the returned object is exposed to active JS if