diff --git a/dom/public/idl/geolocation/nsIDOMGeoGeolocation.idl b/dom/public/idl/geolocation/nsIDOMGeoGeolocation.idl index d30e6971648..278a94e195b 100644 --- a/dom/public/idl/geolocation/nsIDOMGeoGeolocation.idl +++ b/dom/public/idl/geolocation/nsIDOMGeoGeolocation.idl @@ -41,7 +41,7 @@ interface nsIDOMGeoPositionOptions; interface nsIDOMGeoPositionCallback; interface nsIDOMGeoPositionErrorCallback; -[scriptable, function, uuid(CE495440-C8B9-42DE-B67C-60E6928C0F40)] +[scriptable, function, uuid(0EC70F3F-7E15-45E0-84E9-CDE078CB150A)] interface nsIDOMGeoGeolocation : nsISupports { readonly attribute nsIDOMGeoPosition lastPosition; @@ -50,9 +50,9 @@ interface nsIDOMGeoGeolocation : nsISupports [optional] in nsIDOMGeoPositionErrorCallback errorCallback, [optional] in nsIDOMGeoPositionOptions options); - unsigned short watchPosition(in nsIDOMGeoPositionCallback successCallback, - [optional] in nsIDOMGeoPositionErrorCallback errorCallback, - [optional] in nsIDOMGeoPositionOptions options); + long watchPosition(in nsIDOMGeoPositionCallback successCallback, + [optional] in nsIDOMGeoPositionErrorCallback errorCallback, + [optional] in nsIDOMGeoPositionOptions options); - void clearWatch(in unsigned short watchId); + void clearWatch(in long watchId); }; diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index 8e8886ff8c6..aac3bf251f8 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -753,7 +753,7 @@ NS_IMETHODIMP nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *aCallback, nsIDOMGeoPositionErrorCallback *aErrorCallback, nsIDOMGeoPositionOptions *aOptions, - PRUint16 *_retval NS_OUTPARAM) + PRInt32 *_retval NS_OUTPARAM) { nsCOMPtr prompt = do_GetService(NS_GEOLOCATION_PROMPT_CONTRACTID); if (prompt == nsnull) @@ -778,8 +778,13 @@ nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *aCallback, } NS_IMETHODIMP -nsGeolocation::ClearWatch(PRUint16 aWatchId) +nsGeolocation::ClearWatch(PRInt32 aWatchId) { + PRUint32 count = mWatchingCallbacks.Length(); + + if (aWatchId < 0 || count == 0 || aWatchId > count + 1) + return NS_ERROR_FAILURE; + mWatchingCallbacks[aWatchId]->MarkCleared(); return NS_OK; } diff --git a/dom/tests/mochitest/geolocation/Makefile.in b/dom/tests/mochitest/geolocation/Makefile.in index 90623bd3ecd..821da080306 100644 --- a/dom/tests/mochitest/geolocation/Makefile.in +++ b/dom/tests/mochitest/geolocation/Makefile.in @@ -52,6 +52,7 @@ _TEST_FILES = \ test_cancelCurrent.html \ test_cancelWatch.html \ test_clearWatch.html \ + test_clearWatch_invalid.html \ test_geoPrompt.html \ test_timeoutWatch.html \ prompt_common.js \