diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-07 04:40:06 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-07 04:40:06 -0700 |
commit | 9d9dbfe4e0be065094e561632b7a013dc111119f (patch) | |
tree | 6dea67ed94568f84aafb6bdbcd789143872f4409 /WebCore/bindings/js/JSGeolocationCustom.cpp | |
parent | fb386a4cb13329c6a64fd29e134184610c2c3dbc (diff) | |
parent | 4bb414d51f2850c0da64c0832fb0dbb0378a5707 (diff) | |
download | external_webkit-9d9dbfe4e0be065094e561632b7a013dc111119f.zip external_webkit-9d9dbfe4e0be065094e561632b7a013dc111119f.tar.gz external_webkit-9d9dbfe4e0be065094e561632b7a013dc111119f.tar.bz2 |
Merge change 23972 into eclair
* changes:
Fixes Geolocation to correctly handle infinite values for PositionOptions properties.
Diffstat (limited to 'WebCore/bindings/js/JSGeolocationCustom.cpp')
-rw-r--r-- | WebCore/bindings/js/JSGeolocationCustom.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp index 6379a1c..8ef8601 100644 --- a/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -101,20 +101,34 @@ static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValu if (exec->hadException()) return 0; if (!timeoutValue.isUndefined()) { - // Wrap to int32 and force non-negative to match behavior of window.setTimeout. - options->setTimeout(max(0, timeoutValue.toInt32(exec))); + double timeoutNumber = timeoutValue.toNumber(exec); if (exec->hadException()) return 0; + // If the value is infinity, there's nothing to do. + if (timeoutNumber != Inf) { + // Wrap to int32 and force non-negative to match behavior of window.setTimeout. + options->setTimeout(max(0, timeoutValue.toInt32(exec))); + if (exec->hadException()) + return 0; + } } JSValue maximumAgeValue = object->get(exec, Identifier(exec, "maximumAge")); if (exec->hadException()) return 0; if (!maximumAgeValue.isUndefined()) { - // Wrap to int32 and force non-negative to match behavior of window.setTimeout. - options->setMaximumAge(max(0, maximumAgeValue.toInt32(exec))); + double maximumAgeNumber = maximumAgeValue.toNumber(exec); if (exec->hadException()) return 0; + if (maximumAgeNumber == Inf) { + // If the value is infinity, clear maximumAge. + options->clearMaximumAge(); + } else { + // Wrap to int32 and force non-negative to match behavior of window.setTimeout. + options->setMaximumAge(max(0, maximumAgeValue.toInt32(exec))); + if (exec->hadException()) + return 0; + } } return options.release(); |