mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 399107: Add API to force cycle collection. r/sr/a=jst
This commit is contained in:
parent
d1d5b7afe6
commit
a02704b46d
@ -47,7 +47,7 @@
|
||||
|
||||
interface nsIDOMElement;
|
||||
|
||||
[scriptable, uuid(25f55fb2-a6f8-4f7f-93c3-3adafd5166bc)]
|
||||
[scriptable, uuid(7a55fc2b-afb3-41c6-9e50-3fee341fa87c)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
@ -156,4 +156,13 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* @param aElement the element to focus
|
||||
*/
|
||||
void focus(in nsIDOMElement aElement);
|
||||
|
||||
/**
|
||||
* Force a garbage collection. This will run the cycle-collector twice to
|
||||
* make sure all garbage is collected.
|
||||
*
|
||||
* Will throw a DOM security error if called without UniversalXPConnect
|
||||
* privileges in non-debug builds. Available to all callers in debug builds.
|
||||
*/
|
||||
void garbageCollect();
|
||||
};
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "nsIWidget.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsCycleCollector.h"
|
||||
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
#include <gdk/gdkx.h>
|
||||
@ -327,3 +328,21 @@ nsDOMWindowUtils::Focus(nsIDOMElement* aElement)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GarbageCollect()
|
||||
{
|
||||
// NOTE: Only do this in NON debug builds, as this function can useful
|
||||
// during debugging.
|
||||
#ifndef DEBUG
|
||||
PRBool hasCap = PR_FALSE;
|
||||
if (NS_FAILED(nsContentUtils::GetSecurityManager()->
|
||||
IsCapabilityEnabled("UniversalXPConnect", &hasCap))
|
||||
|| !hasCap)
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
#endif
|
||||
|
||||
nsCycleCollector_collect();
|
||||
nsCycleCollector_collect();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user