diff options
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(); |