nsresult rv; NS_WITH_SERVICE(nsIJSRuntimeService, rtsvc, "nsJSRuntimeService", &rv); if (NS_SUCCEEDED(rv)) { JSRuntime *rt; rv = rtsvc->GetRuntime(&rt); if (NS_SUCCEEDED(rv) && rt) JS_RemoveRootRT(rt, &mScriptObject); }
nsXULPrototypeDocument::~nsXULPrototypeDocument(){    delete mRoot;    nsresult rv;    NS_WITH_SERVICE(nsIJSRuntimeService, rtsvc, "nsJSRuntimeService", &rv);    if (NS_SUCCEEDED(rv)) {        JSRuntime *rt;        rv = rtsvc->GetRuntime(&rt);        if (NS_SUCCEEDED(rv) && rt)            JS_RemoveRootRT(rt, &mScriptObject);    }}