Revert "Correctly sets default values for Geolocation PositionOptions."

This reverts commit 0c9108c0f832d34e6468bf1b3ed4132053c6a0f3.
This broke the automated build. Not sure why, as it builds fine on my machine. Rolling back while I investigate.
diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp
index 5ecd227..493166c 100644
--- a/WebCore/bindings/js/JSGeolocationCustom.cpp
+++ b/WebCore/bindings/js/JSGeolocationCustom.cpp
@@ -39,140 +39,109 @@
 
 namespace WebCore {
 
-const long PositionOptions::infinity = -1;
-
-static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSValue value)
-{
-    JSObject* object = value.getObject();
-    if (!object) {
-        setDOMException(exec, TYPE_MISMATCH_ERR);
-        return 0;
-    }
-
-    Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame();
-    ASSERT(frame);
-    return JSCustomPositionCallback::create(object, frame);
-}
-
-static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(ExecState* exec, JSValue value)
-{
-    // No value is OK.
-    if (value.isUndefinedOrNull()) {
-        return 0;
-    }
-
-    JSObject* object = value.getObject();
-    if (!object) {
-        setDOMException(exec, TYPE_MISMATCH_ERR);
-        return 0;
-    }
-
-    Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame();
-    ASSERT(frame);
-    return JSCustomPositionErrorCallback::create(object, frame);
-}
-
-// If value represents a non-negative number, the value is truncated to a long
-// and assigned to result, and the function returns true. Otherwise, result is
-// not set, and the function returns false.
-static bool getNonNegativeLong(ExecState* exec, const JSValue& value, long* result)
-{
-    if (!value.isNumber() || (value.toNumber(exec) < 0)) {
-        return false;
-    }
-    *result = value.toNumber(exec);
-    return true;
-}
-
 static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValue value)
 {
-    // Create default options.
-    RefPtr<PositionOptions> options = PositionOptions::create();
-
-    if (value.isUndefinedOrNull()) {
-        // Use default options.
-        return options;
-    }
-
-    JSObject* object = value.getObject();
-    if (!object) {
-        setDOMException(exec, TYPE_MISMATCH_ERR);
+    if (!value.isObject())
         return 0;
-    }
+
+    JSObject* object = asObject(value);
 
     JSValue enableHighAccuracyValue = object->get(exec, Identifier(exec, "enableHighAccuracy"));
-    if (!enableHighAccuracyValue.isUndefinedOrNull()) {
-        if (!enableHighAccuracyValue.isBoolean()) {
-            setDOMException(exec, TYPE_MISMATCH_ERR);
-            return 0;
-        }
-        options->setEnableHighAccuracy(enableHighAccuracyValue.toBoolean(exec));
-    }
+    if (exec->hadException())
+        return 0;
+    bool enableHighAccuracy = enableHighAccuracyValue.toBoolean(exec);
+    if (exec->hadException())
+        return 0;
 
     JSValue timeoutValue = object->get(exec, Identifier(exec, "timeout"));
-    if (!timeoutValue.isUndefinedOrNull()) {
-        long timeout;
-        if (getNonNegativeLong(exec, timeoutValue, &timeout))
-            options->setTimeout(timeout);
-        else {
-            setDOMException(exec, TYPE_MISMATCH_ERR);
-            return 0;
-        }
-    }
+    if (exec->hadException())
+        return 0;
+    unsigned timeout = timeoutValue.toUInt32(exec);
+    if (exec->hadException())
+        return 0;
 
     JSValue maximumAgeValue = object->get(exec, Identifier(exec, "maximumAge"));
-    if (!maximumAgeValue.isUndefinedOrNull()) {
-        long maximumAge;
-        if (getNonNegativeLong(exec, maximumAgeValue, &maximumAge))
-            options->setTimeout(maximumAge);
-        else {
-            setDOMException(exec, TYPE_MISMATCH_ERR);
-            return 0;
-        }
-    }
+    if (exec->hadException())
+        return 0;
+    unsigned maximumAge = maximumAgeValue.toUInt32(exec);
+    if (exec->hadException())
+        return 0;
 
-    return options;
+    return PositionOptions::create(enableHighAccuracy, timeout, maximumAge);
 }
 
 JSValue JSGeolocation::getCurrentPosition(ExecState* exec, const ArgList& args)
 {
     // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions
-
-    RefPtr<PositionCallback> positionCallback = createPositionCallback(exec, args.at(0));
+    RefPtr<PositionCallback> positionCallback;
+    JSObject* object = args.at(0).getObject();
     if (exec->hadException())
         return jsUndefined();
-    ASSERT(positionCallback);
-
-    RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(exec, args.at(1));
-    if (exec->hadException())
+    if (!object) {
+        setDOMException(exec, TYPE_MISMATCH_ERR);
         return jsUndefined();
+    }
 
-    RefPtr<PositionOptions> positionOptions = createPositionOptions(exec, args.at(2));
-    if (exec->hadException())
-        return jsUndefined();
-    ASSERT(positionOptions);
+    if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame())
+        positionCallback = JSCustomPositionCallback::create(object, frame);
+    
+    RefPtr<PositionErrorCallback> positionErrorCallback;
+    if (!args.at(1).isUndefinedOrNull()) {
+        JSObject* object = args.at(1).getObject();
+        if (!object) {
+            setDOMException(exec, TYPE_MISMATCH_ERR);
+            return jsUndefined();
+        }
+
+        if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame())
+            positionErrorCallback = JSCustomPositionErrorCallback::create(object, frame);
+    }
+    
+    RefPtr<PositionOptions> positionOptions;
+    if (!args.at(2).isUndefinedOrNull()) {
+        positionOptions = createPositionOptions(exec, args.at(2));
+        if (exec->hadException())
+            return jsUndefined();
+    }
 
     m_impl->getCurrentPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
+    
     return jsUndefined();
 }
 
 JSValue JSGeolocation::watchPosition(ExecState* exec, const ArgList& args)
 {
     // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions
-
-    RefPtr<PositionCallback> positionCallback = createPositionCallback(exec, args.at(0));
+    RefPtr<PositionCallback> positionCallback;
+    JSObject* object = args.at(0).getObject();
     if (exec->hadException())
         return jsUndefined();
-    ASSERT(positionCallback);
-
-    RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(exec, args.at(1));
-    if (exec->hadException())
+    if (!object) {
+        setDOMException(exec, TYPE_MISMATCH_ERR);
         return jsUndefined();
-
-    RefPtr<PositionOptions> positionOptions = createPositionOptions(exec, args.at(2));
-    if (exec->hadException())
-        return jsUndefined();
-    ASSERT(positionOptions);
+    }
+    
+    if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame())
+        positionCallback = JSCustomPositionCallback::create(object, frame);
+    
+    RefPtr<PositionErrorCallback> positionErrorCallback;
+    if (!args.at(1).isUndefinedOrNull()) {
+        JSObject* object = args.at(1).getObject();
+        if (!object) {
+            setDOMException(exec, TYPE_MISMATCH_ERR);
+            return jsUndefined();
+        }
+        
+        if (Frame* frame = toJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame())
+            positionErrorCallback = JSCustomPositionErrorCallback::create(object, frame);
+    }
+    
+    RefPtr<PositionOptions> positionOptions;
+    if (!args.at(2).isUndefinedOrNull()) {
+        positionOptions = createPositionOptions(exec, args.at(2));
+        if (exec->hadException())
+            return jsUndefined();
+    }
 
     int watchID = m_impl->watchPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
     return jsNumber(exec, watchID);
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index 8bfa093..7010339 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -40,15 +40,11 @@
     , m_options(options)
     , m_timer(this, &Geolocation::GeoNotifier::timerFired)
 {
-    ASSERT(m_successCallback);
-    // If no options were supplied from JS, we should have created a default set
-    // of options in JSGeolocationCustom.cpp.
-    ASSERT(m_options);
 }
 
 void Geolocation::GeoNotifier::startTimer()
 {
-    if (m_errorCallback && m_options->timeout() != PositionOptions::infinity)
+    if (m_errorCallback && m_options)
         m_timer.startOneShot(m_options->timeout() / 1000.0);
 }
 
diff --git a/WebCore/page/PositionOptions.h b/WebCore/page/PositionOptions.h
index a513f61..10845d3 100644
--- a/WebCore/page/PositionOptions.h
+++ b/WebCore/page/PositionOptions.h
@@ -33,33 +33,26 @@
     
 class PositionOptions : public RefCounted<PositionOptions> {
 public:
-    static const long infinity;
-    static PassRefPtr<PositionOptions> create() { return adoptRef(new PositionOptions()); }
+    static PassRefPtr<PositionOptions> create(bool highAccuracy, unsigned timeout, unsigned maximumAge) { return adoptRef(new PositionOptions(highAccuracy, timeout, maximumAge)); }
 
     bool enableHighAccuracy() const { return m_highAccuracy; }
     void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; }
-    long timeout() const { return m_timeout; }
-    void setTimeout(long t) {
-        ASSERT(t == infinity || t >= 0);
-        m_timeout = t;
-    }
-    long maximumAge() const { return m_maximumAge; }
-    void setMaximumAge(long a) {
-        ASSERT(a == infinity || a >= 0);
-        m_maximumAge = a;
-    }
+    unsigned timeout() const { return m_timeout; }
+    void setTimeout(unsigned t) { m_timeout = t; }
+    unsigned maximumAge() const { return m_maximumAge; }
+    void setMaximumAge(unsigned a) { m_maximumAge = a; }
     
 private:
-    PositionOptions()
-        : m_highAccuracy(false)
-        , m_timeout(infinity)
-        , m_maximumAge(0)
+    PositionOptions(bool highAccuracy, unsigned timeout, unsigned maximumAge)
+        : m_highAccuracy(highAccuracy)
+        , m_timeout(timeout)
+        , m_maximumAge(maximumAge)
     {
     }
     
     bool m_highAccuracy;
-    long m_timeout;
-    long m_maximumAge;
+    unsigned m_timeout;
+    unsigned m_maximumAge;
 };
     
 } // namespace WebCore