mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 11:27:49 +00:00
bug 1104160 - crash in CPOWTimer::~CPOWTimer() r=billm
This commit is contained in:
parent
f03d959dfa
commit
58cc323c20
@ -9,10 +9,19 @@
|
||||
#include "xpcprivate.h"
|
||||
#include "CPOWTimer.h"
|
||||
|
||||
CPOWTimer::~CPOWTimer() {
|
||||
CPOWTimer::~CPOWTimer()
|
||||
{
|
||||
/* This is a best effort to find the compartment responsible for this CPOW call */
|
||||
xpc::CompartmentPrivate* compartment = xpc::CompartmentPrivate::Get(js::GetObjectCompartment(mozilla::dom::GetIncumbentGlobal()
|
||||
->GetGlobalJSObject()));
|
||||
nsIGlobalObject *global = mozilla::dom::GetIncumbentGlobal();
|
||||
if (!global)
|
||||
return;
|
||||
JSObject *obj = global->GetGlobalJSObject();
|
||||
if (!obj)
|
||||
return;
|
||||
JSCompartment *compartment = js::GetObjectCompartment(obj);
|
||||
xpc::CompartmentPrivate *compartmentPrivate = xpc::CompartmentPrivate::Get(compartment);
|
||||
if (!compartmentPrivate)
|
||||
return;
|
||||
PRIntervalTime time = PR_IntervalNow() - startInterval;
|
||||
compartment->CPOWTime += time;
|
||||
compartmentPrivate->CPOWTime += time;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user