Bug 931912 - Suppress an exact rooting hazard false positive in nsWindowSH::Finalize; r=sfink

--HG--
extra : rebase_source : 3934e7cd7e21e37de20aadac203db6a285021691
This commit is contained in:
Terrence Cole 2013-11-05 15:02:35 -08:00
parent 99ef56df98
commit 2bd8f8f148
2 changed files with 14 additions and 1 deletions

View File

@ -3651,6 +3651,14 @@ NS_IMETHODIMP
nsWindowSH::Finalize(nsIXPConnectWrappedNative *wrapper, JSFreeOp *fop,
JSObject *obj)
{
// Since this call is virtual, the exact rooting hazard static analysis is
// not able to determine that it happens during finalization and should be
// ignored. Moreover, the analysis cannot discover and validate the
// potential targets of the virtual call to OnFinalize below because of the
// indirection through nsCOMMPtr. Thus, we annotate the analysis here so
// that it does not report OnFinalize as GCing with |obj| on stack.
JS::AutoAssertNoGC nogc;
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryWrappedNative(wrapper));
NS_ENSURE_TRUE(sgo, NS_ERROR_UNEXPECTED);

View File

@ -213,13 +213,18 @@ WasIncrementalGC(JSRuntime *rt);
extern JS_FRIEND_API(size_t)
GetGCNumber();
class AutoAssertNoGC {
class JS_PUBLIC_API(AutoAssertNoGC)
{
#ifdef DEBUG
size_t gcNumber;
public:
AutoAssertNoGC();
~AutoAssertNoGC();
#else
public:
/* Prevent unreferenced local warnings in opt builds. */
AutoAssertNoGC() {}
#endif
};