Bug 704593 - Remove JS-specific nsGlobalWindow::ClearTimeoutOrInterval(); r=jst

This commit is contained in:
Ms2ger 2011-11-26 11:23:25 +01:00
Родитель 797f71b39c
Коммит 95157cd23b
3 изменённых файлов: 15 добавлений и 60 удалений

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

@ -5559,15 +5559,23 @@ nsGlobalWindow::ScrollByPages(PRInt32 numPages)
}
NS_IMETHODIMP
nsGlobalWindow::ClearTimeout()
nsGlobalWindow::ClearTimeout(PRInt32 aHandle)
{
return ClearTimeoutOrInterval();
if (aHandle <= 0) {
return NS_OK;
}
return ClearTimeoutOrInterval(aHandle);
}
NS_IMETHODIMP
nsGlobalWindow::ClearInterval()
nsGlobalWindow::ClearInterval(PRInt32 aHandle)
{
return ClearTimeoutOrInterval();
if (aHandle <= 0) {
return NS_OK;
}
return ClearTimeoutOrInterval(aHandle);
}
NS_IMETHODIMP
@ -9648,58 +9656,6 @@ nsresult nsGlobalWindow::ResetTimersForNonBackgroundWindow()
return NS_OK;
}
// A JavaScript specific version.
nsresult
nsGlobalWindow::ClearTimeoutOrInterval()
{
FORWARD_TO_INNER(ClearTimeoutOrInterval, (), NS_ERROR_NOT_INITIALIZED);
nsresult rv = NS_OK;
nsAXPCNativeCallContext *ncc = nsnull;
rv = nsContentUtils::XPConnect()->
GetCurrentNativeCallContext(&ncc);
NS_ENSURE_SUCCESS(rv, rv);
if (!ncc)
return NS_ERROR_NOT_AVAILABLE;
JSContext *cx = nsnull;
rv = ncc->GetJSContext(&cx);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 argc;
ncc->GetArgc(&argc);
if (argc < 1) {
// No arguments, return early.
return NS_OK;
}
jsval *argv = nsnull;
ncc->GetArgvPtr(&argv);
int32 timer_id;
JSAutoRequest ar(cx);
// XXXjst: Can we deal with this w/o using GetCurrentNativeCallContext()
if (argv[0] == JSVAL_VOID || !::JS_ValueToInt32(cx, argv[0], &timer_id) ||
timer_id <= 0) {
// Undefined or non-positive number passed as argument, return
// early. Make sure that JS_ValueToInt32 didn't set an exception.
::JS_ClearPendingException(cx);
return NS_OK;
}
return ClearTimeoutOrInterval(timer_id);
}
void
nsGlobalWindow::ClearAllTimeouts()
{

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

@ -684,7 +684,6 @@ protected:
// JS specific timeout functions (JS args grabbed from context).
nsresult SetTimeoutOrInterval(bool aIsInterval, PRInt32* aReturn);
nsresult ClearTimeoutOrInterval();
nsresult ResetTimersForNonBackgroundWindow();
// The timeout implementation functions.

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

@ -38,7 +38,7 @@
#include "domstubs.idl"
[scriptable, uuid(14efb76c-5bd6-449e-b36f-0cbd22981f20)]
[scriptable, uuid(6652c4d2-6b49-424b-aaf9-91f91006fab7)]
interface nsIDOMJSWindow : nsISupports
{
void dump(in DOMString str);
@ -57,8 +57,8 @@ interface nsIDOMJSWindow : nsISupports
* clear. Often in existing code these methods are passed undefined,
* which is a nop so we need to support that as well.
*/
void clearTimeout();
void clearInterval();
void clearTimeout([optional] in long handle);
void clearInterval([optional] in long handle);
/**
* This method is here for backwards compatibility with 4.x only,