Changeset 48503 in webkit
- Timestamp:
- Sep 18, 2009 2:35:20 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r48498 r48503 1 2009-09-18 Steve Block <steveblock@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 Geolocation does not correctly handle Infinity for PositionOptions properties. 6 https://bugs.webkit.org/show_bug.cgi?id=29099 7 8 * fast/dom/Geolocation/resources/argument-types.js: Modified. Test passing positive and negative Infinity to Geolocation methods. 9 * fast/dom/Geolocation/argument-types-expected.txt: Modified. Expected result for above test. 10 1 11 2009-09-17 Brian Weinstein <bweinstein@apple.com> 2 12 -
trunk/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt
r47252 r48503 13 13 PASS navigator.geolocation.getCurrentPosition(true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 14 14 PASS navigator.geolocation.getCurrentPosition(42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 15 PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 16 PASS navigator.geolocation.getCurrentPosition(-Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 15 17 PASS navigator.geolocation.getCurrentPosition("string") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 16 18 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined) did not throw exception. … … 22 24 PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 23 25 PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 26 PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 27 PASS navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 24 28 PASS navigator.geolocation.getCurrentPosition(emptyFunction, "string") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. 25 29 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined) did not throw exception. … … 30 34 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true) did not throw exception. 31 35 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42) did not throw exception. 36 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity) did not throw exception. 37 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity) did not throw exception. 32 38 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string") did not throw exception. 33 39 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:undefined}) did not throw exception. … … 38 44 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:true}) did not throw exception. 39 45 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:42}) did not throw exception. 46 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:Infinity}) did not throw exception. 47 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:-Infinity}) did not throw exception. 40 48 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:"string"}) did not throw exception. 41 49 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:undefined}) did not throw exception. … … 46 54 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:true}) did not throw exception. 47 55 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:42}) did not throw exception. 56 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:Infinity}) did not throw exception. 57 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:-Infinity}) did not throw exception. 48 58 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:"string"}) did not throw exception. 49 59 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:undefined}) did not throw exception. … … 54 64 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:true}) did not throw exception. 55 65 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:42}) did not throw exception. 66 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:Infinity}) did not throw exception. 67 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:-Infinity}) did not throw exception. 56 68 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:"string"}) did not throw exception. 57 69 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:undefined}) did not throw exception. … … 62 74 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:true}) did not throw exception. 63 75 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:42}) did not throw exception. 76 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:Infinity}) did not throw exception. 77 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:-Infinity}) did not throw exception. 64 78 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:"string"}) did not throw exception. 65 79 PASS successfullyParsed is true -
trunk/LayoutTests/fast/dom/Geolocation/resources/argument-types.js
r47252 r48503 44 44 test('navigator.geolocation.getCurrentPosition(true)', true); 45 45 test('navigator.geolocation.getCurrentPosition(42)', true); 46 test('navigator.geolocation.getCurrentPosition(Infinity)', true); 47 test('navigator.geolocation.getCurrentPosition(-Infinity)', true); 46 48 test('navigator.geolocation.getCurrentPosition("string")', true); 47 49 … … 54 56 test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true); 55 57 test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true); 58 test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true); 59 test('navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity)', true); 56 60 test('navigator.geolocation.getCurrentPosition(emptyFunction, "string")', true); 57 61 … … 63 67 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true)', false); 64 68 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42)', false); 69 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity)', false); 70 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity)', false); 65 71 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string")', false); 66 72 … … 72 78 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:true})', false); 73 79 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:42})', false); 80 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:Infinity})', false); 81 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:-Infinity})', false); 74 82 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:"string"})', false); 75 83 … … 81 89 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:true})', false); 82 90 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:42})', false); 91 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:Infinity})', false); 92 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:-Infinity})', false); 83 93 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:"string"})', false); 84 94 … … 90 100 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:true})', false); 91 101 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:42})', false); 102 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:Infinity})', false); 103 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:-Infinity})', false); 92 104 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:"string"})', false); 93 105 … … 99 111 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:true})', false); 100 112 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:42})', false); 113 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:Infinity})', false); 114 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:-Infinity})', false); 101 115 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:"string"})', false); 102 116 -
trunk/WebCore/ChangeLog
r48500 r48503 1 2009-09-18 Steve Block <steveblock@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 Geolocation does not correctly handle Infinity for PositionOptions properties. 6 https://bugs.webkit.org/show_bug.cgi?id=29099 7 8 * bindings/js/JSGeolocationCustom.cpp: Modified. 9 (WebCore::createPositionOptions): Modified. If timeout or maximumAge is positive infinity, applies these values as a special case. 10 * page/PositionOptions.h: Modified. 11 (WebCore::PositionOptions::hasMaximumAge): Added. Determines whether the object has a maximum age. 12 (WebCore::PositionOptions::maximumAge): Modified. Asserts that the object has a maximum age. 13 (WebCore::PositionOptions::clearMaximumAge): Added. Clears the maximum age. 14 (WebCore::PositionOptions::setMaximumAge): Modified. Registers that the maximum age has been set. 15 (WebCore::PositionOptions::PositionOptions): Modified. Registers that the maximum age has been set. 16 1 17 2009-09-17 Sam Weinig <sam@webkit.org> 2 18 -
trunk/WebCore/bindings/js/JSGeolocationCustom.cpp
r48453 r48503 101 101 return 0; 102 102 if (!timeoutValue.isUndefined()) { 103 // Wrap to int32 and force non-negative to match behavior of window.setTimeout. 104 options->setTimeout(max(0, timeoutValue.toInt32(exec))); 103 double timeoutNumber = timeoutValue.toNumber(exec); 105 104 if (exec->hadException()) 106 105 return 0; 106 // If the value is positive infinity, there's nothing to do. 107 if (!(isinf(timeoutNumber) && (timeoutNumber > 0))) { 108 // Wrap to int32 and force non-negative to match behavior of window.setTimeout. 109 options->setTimeout(max(0, timeoutValue.toInt32(exec))); 110 if (exec->hadException()) 111 return 0; 112 } 107 113 } 108 114 … … 111 117 return 0; 112 118 if (!maximumAgeValue.isUndefined()) { 113 // Wrap to int32 and force non-negative to match behavior of window.setTimeout. 114 options->setMaximumAge(max(0, maximumAgeValue.toInt32(exec))); 119 double maximumAgeNumber = maximumAgeValue.toNumber(exec); 115 120 if (exec->hadException()) 116 121 return 0; 122 if (isinf(maximumAgeNumber) && (maximumAgeNumber > 0)) { 123 // If the value is positive infinity, clear maximumAge. 124 options->clearMaximumAge(); 125 } else { 126 // Wrap to int32 and force non-negative to match behavior of window.setTimeout. 127 options->setMaximumAge(max(0, maximumAgeValue.toInt32(exec))); 128 if (exec->hadException()) 129 return 0; 130 } 117 131 } 118 132 -
trunk/WebCore/page/PositionOptions.h
r47252 r48503 50 50 m_timeout = timeout; 51 51 } 52 int maximumAge() const { return m_maximumAge; } 52 bool hasMaximumAge() const { return m_hasMaximumAge; } 53 int maximumAge() const 54 { 55 ASSERT(hasMaximumAge()); 56 return m_maximumAge; 57 } 58 void clearMaximumAge() { m_hasMaximumAge = false; } 53 59 void setMaximumAge(int age) 54 60 { 55 61 ASSERT(age >= 0); 62 m_hasMaximumAge = true; 56 63 m_maximumAge = age; 57 64 } … … 61 68 : m_highAccuracy(false) 62 69 , m_hasTimeout(false) 63 , m_maximumAge(0)64 70 { 71 setMaximumAge(0); 65 72 } 66 73 … … 68 75 bool m_hasTimeout; 69 76 int m_timeout; 77 bool m_hasMaximumAge; 70 78 int m_maximumAge; 71 79 };
Note: See TracChangeset
for help on using the changeset viewer.