Bug 1392500 - Name the users of setTimeout() in Timer.jsm. r=billm,mccr8

1. Make nsINamed queriable on WrappedJSHolder.
2. Identify callers via |Cu.generateXPCWrappedJS(aCallback).QueryInterface(Ci.nsINamed).name|.

--HG--
extra : amend_source : 5d4201059f66e46c869c30a963921b6f7b91c389
This commit is contained in:
Bevis Tseng 2017-08-24 14:56:18 +08:00
Родитель c83a6c17e7
Коммит 215842a23c
2 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -3182,7 +3182,18 @@ class WrappedJSHolder : public nsISupports
private:
virtual ~WrappedJSHolder() {}
};
NS_IMPL_ISUPPORTS0(WrappedJSHolder);
NS_IMPL_ADDREF(WrappedJSHolder)
NS_IMPL_RELEASE(WrappedJSHolder)
// nsINamed is always supported by nsXPCWrappedJSClass.
// We expose this interface only for the identity in telemetry analysis.
NS_INTERFACE_TABLE_HEAD(WrappedJSHolder)
if (aIID.Equals(NS_GET_IID(nsINamed))) {
return mWrappedJS->QueryInterface(aIID, aInstancePtr);
}
NS_INTERFACE_TABLE0(WrappedJSHolder)
NS_INTERFACE_TABLE_TAIL
NS_IMETHODIMP
nsXPCComponents_Utils::GenerateXPCWrappedJS(HandleValue aObj, HandleValue aScope,

Просмотреть файл

@ -45,8 +45,8 @@ function _setTimeoutOrIsInterval(aCallback, aMilliseconds, aIsInterval,
},
// nsINamed
name: aIsInterval ? "setInterval() in Timer.jsm"
: "setTimeout() in Timer.jsm",
name: (aIsInterval ? "setInterval() for " : "setTimeout() for ") +
Cu.generateXPCWrappedJS(aCallback).QueryInterface(Ci.nsINamed).name,
};
timer.initWithCallback(callback, aMilliseconds,