Changeset 206243 in webkit
- Timestamp:
- Sep 21, 2016 4:50:24 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r206240 r206243 1 2016-09-21 Chris Dumez <cdumez@apple.com> 2 3 Setting HTMLMeterElement's attributes to non-finite values throws wrong exception type 4 https://bugs.webkit.org/show_bug.cgi?id=162364 5 6 Reviewed by Darin Adler. 7 8 Update existing test to reflect behavior change. 9 10 * fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js: 11 * fast/dom/HTMLMeterElement/set-meter-properties-expected.txt: 12 1 13 2016-09-21 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js
r203333 r206243 78 78 79 79 debug("Set value to invalid value"); 80 shouldThrow ('m.value = "value";', '"NotSupportedError (DOM Exception 9): The operation is not supported."');80 shouldThrowErrorName('m.value = "value";', 'TypeError'); 81 81 82 82 debug("Set min to NaN"); 83 shouldThrow ('m.min = NaN;', '"NotSupportedError (DOM Exception 9): The operation is not supported."');83 shouldThrowErrorName('m.min = NaN;', 'TypeError'); 84 84 85 85 debug("Set max to Infinity"); 86 shouldThrow ('m.max = Infinity;', '"NotSupportedError (DOM Exception 9): The operation is not supported."');86 shouldThrowErrorName('m.max = Infinity;', 'TypeError'); 87 87 88 88 debug("Set low to invalid value"); 89 shouldThrow ('m.low = "low";', '"NotSupportedError (DOM Exception 9): The operation is not supported."');89 shouldThrowErrorName('m.low = "low";', 'TypeError'); 90 90 91 91 debug("Set high to NaN"); 92 shouldThrow ('m.high = NaN;', '"NotSupportedError (DOM Exception 9): The operation is not supported."');92 shouldThrowErrorName('m.high = NaN;', 'TypeError'); 93 93 94 94 debug("Set optimum to Infinity"); 95 shouldThrow ('m.optimum = Infinity;', '"NotSupportedError (DOM Exception 9): The operation is not supported."');95 shouldThrowErrorName('m.optimum = Infinity;', 'TypeError'); 96 96 97 97 debug("Set attributes to valid numbers"); -
trunk/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt
r203333 r206243 45 45 PASS m.optimum is 12.5 46 46 Set value to invalid value 47 PASS m.value = "value"; threw exception NotSupportedError (DOM Exception 9): The operation is not supported..47 PASS m.value = "value"; threw exception TypeError: The provided value is non-finite. 48 48 Set min to NaN 49 PASS m.min = NaN; threw exception NotSupportedError (DOM Exception 9): The operation is not supported..49 PASS m.min = NaN; threw exception TypeError: The provided value is non-finite. 50 50 Set max to Infinity 51 PASS m.max = Infinity; threw exception NotSupportedError (DOM Exception 9): The operation is not supported..51 PASS m.max = Infinity; threw exception TypeError: The provided value is non-finite. 52 52 Set low to invalid value 53 PASS m.low = "low"; threw exception NotSupportedError (DOM Exception 9): The operation is not supported..53 PASS m.low = "low"; threw exception TypeError: The provided value is non-finite. 54 54 Set high to NaN 55 PASS m.high = NaN; threw exception NotSupportedError (DOM Exception 9): The operation is not supported..55 PASS m.high = NaN; threw exception TypeError: The provided value is non-finite. 56 56 Set optimum to Infinity 57 PASS m.optimum = Infinity; threw exception NotSupportedError (DOM Exception 9): The operation is not supported..57 PASS m.optimum = Infinity; threw exception TypeError: The provided value is non-finite. 58 58 Set attributes to valid numbers 59 59 PASS m.value is 5 -
trunk/LayoutTests/imported/w3c/ChangeLog
r206240 r206243 1 2016-09-21 Chris Dumez <cdumez@apple.com> 2 3 Setting HTMLMeterElement's attributes to non-finite values throws wrong exception type 4 https://bugs.webkit.org/show_bug.cgi?id=162364 5 6 Reviewed by Darin Adler. 7 8 Merge meter test changes from https://github.com/w3c/web-platform-tests/pull/3791. 9 10 * web-platform-tests/html/semantics/forms/the-meter-element/meter-expected.txt: 11 * web-platform-tests/html/semantics/forms/the-meter-element/meter.html: 12 1 13 2016-09-21 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-meter-element/meter-expected.txt
r203333 r206243 4 4 PASS Default values 5 5 PASS Setting values to min, max, low, high and optimum 6 FAIL Invalid floating-point number values The operation is not supported.7 6 PASS max < min 8 7 PASS value < min … … 14 13 PASS optimum < min 15 14 PASS optimum > max 15 PASS Invalid floating-point number values 16 16 PASS value must be 0 when a string is given 17 17 PASS default value of min is 0 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-meter-element/meter.html
r189476 r206243 43 43 {value: 0, expectedValue: 0, expectedMin: 0, expectedMax: 1.0, expectedLow: 0, expectedHigh: 1.0, expectedOptimum: 0.5, testname: "Default values"}, 44 44 {value: 3, expectedValue: 3, min: -10.1, expectedMin: -10.1, max: 10.1, expectedMax: 10.1, low: -9.1, expectedLow: -9.1, high: 9.1, expectedHigh: 9.1, optimum: 3, expectedOptimum: 3, testname: "Setting values to min, max, low, high and optimum"}, 45 {value: "foobar", expectedValue: 0, min: "foobar", expectedMin: 0, max: "foobar", expectedMax: 1.0, low: "foobar", expectedLow: 0, high: "foobar", expectedHigh: 1.0, optimum: "foobar", expectedOptimum: 0.5, testname: "Invalid floating-point number values"},46 45 {value: 0, expectedValue: 0, min: 0, expectedMin: 0, max: -1.0, expectedMax: 0, expectedLow: 0, expectedHigh: 0, expectedOptimum: 0, testname: "max < min"}, 47 46 {value: 0, expectedValue: 10, min: 10, expectedMin: 10, max: 20, expectedMax: 20, expectedLow: 10, expectedHigh: 20, expectedOptimum: 15, testname: "value < min"}, … … 72 71 }, m.testname); 73 72 } 73 test(function() { 74 var meter = document.createElement("meter"); 75 assert_throws(new TypeError(), function() { meter.value = "foobar"; }, "value attribute"); 76 assert_throws(new TypeError(), function() { meter.min = "foobar"; }, "min attribute"); 77 assert_throws(new TypeError(), function() { meter.max = "foobar"; }, "max attribute"); 78 assert_throws(new TypeError(), function() { meter.low = "foobar"; }, "low attribute"); 79 assert_throws(new TypeError(), function() { meter.high = "foobar"; }, "high attribute"); 80 assert_throws(new TypeError(), function() { meter.optimum = "foobar"; }, "optimum attribute"); 81 }, "Invalid floating-point number values"); 74 82 75 83 </script> -
trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/semantics/forms/the-meter-element/meter-expected.txt
r205579 r206243 4 4 PASS Default values 5 5 PASS Setting values to min, max, low, high and optimum 6 FAIL Invalid floating-point number values The operation is not supported.7 6 PASS max < min 8 7 PASS value < min … … 14 13 PASS optimum < min 15 14 PASS optimum > max 15 PASS Invalid floating-point number values 16 16 PASS value must be 0 when a string is given 17 17 PASS default value of min is 0 -
trunk/Source/WebCore/ChangeLog
r206242 r206243 1 2016-09-21 Chris Dumez <cdumez@apple.com> 2 3 Setting HTMLMeterElement's attributes to non-finite values throws wrong exception type 4 https://bugs.webkit.org/show_bug.cgi?id=162364 5 6 Reviewed by Darin Adler. 7 8 Setting HTMLMeterElement's attributes to non-finite values throws wrong exception type. 9 It should throw a TypeError because their type is 'double' but we throw a 10 NOT_SUPPORTED_ERR. 11 12 Specification: 13 - https://html.spec.whatwg.org/#htmlmeterelement 14 15 Firefox and Chrome agree with the specification. 16 17 No new tests, updated existing test. 18 19 * html/HTMLMeterElement.cpp: 20 (WebCore::HTMLMeterElement::setMin): 21 (WebCore::HTMLMeterElement::setMax): 22 (WebCore::HTMLMeterElement::setValue): 23 (WebCore::HTMLMeterElement::setLow): 24 (WebCore::HTMLMeterElement::setHigh): 25 (WebCore::HTMLMeterElement::setOptimum): 26 * html/HTMLMeterElement.h: 27 * html/HTMLMeterElement.idl: 28 1 29 2016-09-21 Anders Carlsson <andersca@apple.com> 2 30 -
trunk/Source/WebCore/html/HTMLMeterElement.cpp
r203324 r206243 84 84 } 85 85 86 void HTMLMeterElement::setMin(double min, ExceptionCode& ec) 87 { 88 if (!std::isfinite(min)) { 89 ec = NOT_SUPPORTED_ERR; 90 return; 91 } 86 void HTMLMeterElement::setMin(double min) 87 { 92 88 setAttributeWithoutSynchronization(minAttr, AtomicString::number(min)); 93 89 } … … 98 94 } 99 95 100 void HTMLMeterElement::setMax(double max, ExceptionCode& ec) 101 { 102 if (!std::isfinite(max)) { 103 ec = NOT_SUPPORTED_ERR; 104 return; 105 } 96 void HTMLMeterElement::setMax(double max) 97 { 106 98 setAttributeWithoutSynchronization(maxAttr, AtomicString::number(max)); 107 99 } … … 113 105 } 114 106 115 void HTMLMeterElement::setValue(double value, ExceptionCode& ec) 116 { 117 if (!std::isfinite(value)) { 118 ec = NOT_SUPPORTED_ERR; 119 return; 120 } 107 void HTMLMeterElement::setValue(double value) 108 { 121 109 setAttributeWithoutSynchronization(valueAttr, AtomicString::number(value)); 122 110 } … … 128 116 } 129 117 130 void HTMLMeterElement::setLow(double low, ExceptionCode& ec) 131 { 132 if (!std::isfinite(low)) { 133 ec = NOT_SUPPORTED_ERR; 134 return; 135 } 118 void HTMLMeterElement::setLow(double low) 119 { 136 120 setAttributeWithoutSynchronization(lowAttr, AtomicString::number(low)); 137 121 } … … 143 127 } 144 128 145 void HTMLMeterElement::setHigh(double high, ExceptionCode& ec) 146 { 147 if (!std::isfinite(high)) { 148 ec = NOT_SUPPORTED_ERR; 149 return; 150 } 129 void HTMLMeterElement::setHigh(double high) 130 { 151 131 setAttributeWithoutSynchronization(highAttr, AtomicString::number(high)); 152 132 } … … 158 138 } 159 139 160 void HTMLMeterElement::setOptimum(double optimum, ExceptionCode& ec) 161 { 162 if (!std::isfinite(optimum)) { 163 ec = NOT_SUPPORTED_ERR; 164 return; 165 } 140 void HTMLMeterElement::setOptimum(double optimum) 141 { 166 142 setAttributeWithoutSynchronization(optimumAttr, AtomicString::number(optimum)); 167 143 } -
trunk/Source/WebCore/html/HTMLMeterElement.h
r203264 r206243 41 41 42 42 double min() const; 43 void setMin(double , ExceptionCode&);43 void setMin(double); 44 44 45 45 double max() const; 46 void setMax(double , ExceptionCode&);46 void setMax(double); 47 47 48 48 double value() const; 49 void setValue(double , ExceptionCode&);49 void setValue(double); 50 50 51 51 double low() const; 52 void setLow(double , ExceptionCode&);52 void setLow(double); 53 53 54 54 double high() const; 55 void setHigh(double , ExceptionCode&);55 void setHigh(double); 56 56 57 57 double optimum() const; 58 void setOptimum(double , ExceptionCode&);58 void setOptimum(double); 59 59 60 60 double valueRatio() const; -
trunk/Source/WebCore/html/HTMLMeterElement.idl
r168302 r206243 21 21 Conditional=METER_ELEMENT 22 22 ] interface HTMLMeterElement : HTMLElement { 23 [SetterRaisesException] attribute unrestricteddouble value;24 [SetterRaisesException] attribute unrestricteddouble min;25 [SetterRaisesException] attribute unrestricteddouble max;26 [SetterRaisesException] attribute unrestricteddouble low;27 [SetterRaisesException] attribute unrestricteddouble high;28 [SetterRaisesException] attribute unrestricteddouble optimum;23 attribute double value; 24 attribute double min; 25 attribute double max; 26 attribute double low; 27 attribute double high; 28 attribute double optimum; 29 29 readonly attribute NodeList labels; 30 30 };
Note: See TracChangeset
for help on using the changeset viewer.