Changeset 186265 in webkit
- Timestamp:
- Jul 3, 2015 1:54:15 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r186264 r186265 1 2015-07-03 Daniel Bates <dabates@apple.com> 2 3 REGRESSION (r178097): JavaScript TypeError after clicking on compose button in Yahoo Mail 4 https://bugs.webkit.org/show_bug.cgi?id=146515 5 <rdar://problem/21348421> 6 7 Reviewed by Chris Dumez. 8 9 Add new sub-tests to LayoutTests/fast/dom/HTMLSelectElement/{add, options-collection-add}.html, 10 simplify existing test code, share common code, and update expected results. 11 12 Additionally, update results for tests in LayoutTests/fast/canvas now that we ignore extra 13 arguments passed to a Web IDL overloaded function whose implementation is generated by the 14 bindings generator script. 15 16 * fast/canvas/canvas-overloads-drawImage-expected.txt: 17 * fast/canvas/canvas-overloads-setFillColor-expected.txt: 18 * fast/canvas/canvas-overloads-setShadow-expected.txt: 19 * fast/canvas/canvas-overloads-setStrokeColor-expected.txt: 20 * fast/canvas/script-tests/canvas-overloads-drawImage.js: 21 * fast/canvas/script-tests/canvas-overloads-setFillColor.js: 22 * fast/canvas/script-tests/canvas-overloads-setShadow.js: 23 * fast/canvas/script-tests/canvas-overloads-setStrokeColor.js: 24 * fast/dom/HTMLSelectElement/add-expected.txt: 25 * fast/dom/HTMLSelectElement/add.html: 26 * fast/dom/HTMLSelectElement/options-collection-add-expected.txt: 27 * fast/dom/HTMLSelectElement/options-collection-add.html: 28 * fast/dom/HTMLSelectElement/resources/html-select-and-options-collection-utilities.js: Added. 29 (createSelectElementWithTestData): 30 (deepCopy): 31 (createOption): 32 (createGroup): 33 1 34 2015-07-03 Chris Dumez <cdumez@apple.com> 2 35 -
trunk/LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt
r134613 r186265 14 14 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error. 15 15 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0) is undefined 16 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.17 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.16 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0) is undefined 17 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) is undefined 18 18 PASS ctx.drawImage(canvasElement) threw exception TypeError: Not enough arguments. 19 19 PASS ctx.drawImage(canvasElement, 0) threw exception TypeError: Not enough arguments. … … 25 25 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error. 26 26 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0) threw exception Error: IndexSizeError: DOM Exception 1. 27 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.28 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.27 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception Error: IndexSizeError: DOM Exception 1. 28 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception Error: IndexSizeError: DOM Exception 1. 29 29 PASS successfullyParsed is true 30 30 -
trunk/LayoutTests/fast/canvas/canvas-overloads-setFillColor-expected.txt
r126562 r186265 11 11 PASS ctx.setFillColor(0, 0, 0, 0) is undefined 12 12 PASS ctx.setFillColor(0, 0, 0, 0, 0) is undefined 13 PASS ctx.setFillColor(0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.13 PASS ctx.setFillColor(0, 0, 0, 0, 0, 0) is undefined 14 14 PASS successfullyParsed is true 15 15 -
trunk/LayoutTests/fast/canvas/canvas-overloads-setShadow-expected.txt
r126562 r186265 17 17 PASS ctx.setShadow(0, 0, 0, 0, 0, 0, 0) is undefined 18 18 PASS ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0) is undefined 19 PASS ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.19 PASS ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0, 0) is undefined 20 20 PASS successfullyParsed is true 21 21 -
trunk/LayoutTests/fast/canvas/canvas-overloads-setStrokeColor-expected.txt
r126562 r186265 11 11 PASS ctx.setStrokeColor(0, 0, 0, 0) is undefined 12 12 PASS ctx.setStrokeColor(0, 0, 0, 0, 0) is undefined 13 PASS ctx.setStrokeColor(0, 0, 0, 0, 0, 0) threw exception TypeError: Type error.13 PASS ctx.setStrokeColor(0, 0, 0, 0, 0, 0) is undefined 14 14 PASS successfullyParsed is true 15 15 -
trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-drawImage.js
r134613 r186265 17 17 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0)", "TypeError"); 18 18 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 19 should Throw("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError");20 should Throw("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError");19 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 20 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 21 21 22 22 var canvasElement = document.createElement("canvas"); … … 30 30 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0)", "TypeError"); 31 31 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0)", "'Error: IndexSizeError: DOM Exception 1'"); 32 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", " TypeError");33 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", " TypeError");32 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "'Error: IndexSizeError: DOM Exception 1'"); 33 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "'Error: IndexSizeError: DOM Exception 1'"); -
trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setFillColor.js
r126562 r186265 13 13 shouldBe("ctx.setFillColor(0, 0, 0, 0)", "undefined"); 14 14 shouldBe("ctx.setFillColor(0, 0, 0, 0, 0)", "undefined"); 15 should Throw("ctx.setFillColor(0, 0, 0, 0, 0, 0)", "TypeError");15 shouldBe("ctx.setFillColor(0, 0, 0, 0, 0, 0)", "undefined"); -
trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js
r126562 r186265 19 19 shouldBe("ctx.setShadow(0, 0, 0, 0, 0, 0, 0)", "undefined"); 20 20 shouldBe("ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 21 should Throw("ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError");21 shouldBe("ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); -
trunk/LayoutTests/fast/canvas/script-tests/canvas-overloads-setStrokeColor.js
r126562 r186265 13 13 shouldBe("ctx.setStrokeColor(0, 0, 0, 0)", "undefined"); 14 14 shouldBe("ctx.setStrokeColor(0, 0, 0, 0, 0)", "undefined"); 15 should Throw("ctx.setStrokeColor(0, 0, 0, 0, 0, 0)", "TypeError");15 shouldBe("ctx.setStrokeColor(0, 0, 0, 0, 0, 0)", "undefined"); -
trunk/LayoutTests/fast/dom/HTMLSelectElement/add-expected.txt
r178097 r186265 1 Test select.add() with index parameter1 Test that HTMLSelectElement.add() works when passing an index or an HTML option element as its second argument. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 list elements are = 0,1,2 7 PASS testAdd1(createOption("Y1")) is "0,1,2,Y1" 8 PASS testAdd3(createOption("Y2"), null) is "0,1,2,Y2" 9 PASS testAdd3(createOption("Y3"), 0) is "Y3,0,1,2" 10 PASS testAdd3(createOption("Y4"), 1) is "0,Y4,1,2" 11 PASS testAdd3(createOption("Y5"), 2) is "0,1,Y5,2" 12 PASS testAdd3(createOption("Y6"), 3) is "0,1,2,Y6" 13 PASS testAdd3(createOption("Y7"), 100) is "0,1,2,Y7" 14 PASS testAdd3(createOption("Y8"), -100) is "0,1,2,Y8" 15 PASS testAdd3(createOption("Y9"), "0") is "Y9,0,1,2" 16 PASS testAdd3(createOption("Y10"), "1") is "0,Y10,1,2" 17 PASS testAdd3(createOption("Y11"), "2") is "0,1,Y11,2" 18 PASS testAdd3(createOption("Y12"), true) is "0,Y12,1,2" 19 PASS testAdd3(createOption("Y13"), false) is "Y13,0,1,2" 20 PASS testAdd3(createOption("Y14"), 2147483647) is "0,1,2,Y14" 21 PASS testAdd3(createOption("Y15"), 2147483648) is "0,1,2,Y15" 22 PASS testAdd3(createOption("Y16"), -2147483647) is "0,1,2,Y16" 23 PASS testAdd3(createOption("Y17"), -2147483648) is "0,1,2,Y17" 24 PASS testAdd3(createOption("Y18"), -2147483649) is "0,1,2,Y18" 25 PASS testAdd3(createOption("Y19"), Infinity) is "Y19,0,1,2" 26 PASS testAdd3(createOption("Y20"), -Infinity) is "Y20,0,1,2" 27 PASS testAdd3(createOption("Y21"), "foo") is "Y21,0,1,2" 28 PASS testAdd3(createOption("Y22"), NaN) is "Y22,0,1,2" 29 PASS testAdd3(createOption("Y23"), undefined) is "Y23,0,1,2" 30 PASS testAdd3(createOption("Y24"), -2) is "0,1,2,Y24" 31 PASS testAdd4(createOption("Y25"), 0, 1) threw exception TypeError: Type error. 32 PASS testAdd4(createOption("Y25"), mySelect.options[0], 1) threw exception TypeError: Type error. 33 list elements are = 0,1,2 34 PASS mySelect.add("foo") threw exception TypeError: Type error. 35 PASS mySelect.add("foo", 0) threw exception TypeError: Type error. 36 PASS mySelect.add(undefined) threw exception TypeError: Type error. 37 PASS mySelect.add(undefined, 0) threw exception TypeError: Type error. 38 PASS mySelect.add(null, 0) threw exception TypeError: Type error. 39 PASS mySelect.add(null) threw exception TypeError: Type error. 40 PASS mySelect.add() threw exception TypeError: Not enough arguments. 6 7 Call HTMLSelectElement.add() with zero arguments: 8 PASS testAdd() threw exception TypeError: Not enough arguments. 9 10 Call HTMLSelectElement.add() with one argument: 11 PASS testAdd(createOption("Y1")) is "0,1,2,Y1" 12 PASS testAdd("foo") threw exception TypeError: Type error. 13 PASS testAdd(undefined) threw exception TypeError: Type error. 14 PASS testAdd(null) threw exception TypeError: Type error. 15 16 Call HTMLSelectElement.add() with two arguments: 17 PASS testAdd(createOption("Y2"), null) is "0,1,2,Y2" 18 PASS testAdd(createOption("Y3"), 0) is "Y3,0,1,2" 19 PASS testAdd(createOption("Y4"), 1) is "0,Y4,1,2" 20 PASS testAdd(createOption("Y5"), 2) is "0,1,Y5,2" 21 PASS testAdd(createOption("Y6"), 3) is "0,1,2,Y6" 22 PASS testAdd(createOption("Y7"), 100) is "0,1,2,Y7" 23 PASS testAdd(createOption("Y8"), -100) is "0,1,2,Y8" 24 PASS testAdd(createOption("Y9"), "0") is "Y9,0,1,2" 25 PASS testAdd(createOption("Y10"), "1") is "0,Y10,1,2" 26 PASS testAdd(createOption("Y11"), "2") is "0,1,Y11,2" 27 PASS testAdd(createOption("Y12"), true) is "0,Y12,1,2" 28 PASS testAdd(createOption("Y13"), false) is "Y13,0,1,2" 29 PASS testAdd(createOption("Y14"), 2147483647) is "0,1,2,Y14" 30 PASS testAdd(createOption("Y15"), 2147483648) is "0,1,2,Y15" 31 PASS testAdd(createOption("Y16"), -2147483647) is "0,1,2,Y16" 32 PASS testAdd(createOption("Y17"), -2147483648) is "0,1,2,Y17" 33 PASS testAdd(createOption("Y18"), -2147483649) is "0,1,2,Y18" 34 PASS testAdd(createOption("Y19"), Infinity) is "Y19,0,1,2" 35 PASS testAdd(createOption("Y20"), -Infinity) is "Y20,0,1,2" 36 PASS testAdd(createOption("Y21"), "foo") is "Y21,0,1,2" 37 PASS testAdd(createOption("Y22"), NaN) is "Y22,0,1,2" 38 PASS testAdd(createOption("Y23"), undefined) is "Y23,0,1,2" 39 PASS testAdd(createOption("Y24"), -2) is "0,1,2,Y24" 40 PASS testAdd(createOption("X"), mySelect.options[0]) is "X,0,1,2" 41 PASS testAdd(createOption("X"), mySelect.options[1]) is "0,X,1,2" 42 PASS testAdd(createOption("X"), mySelect.options[2]) is "0,1,X,2" 43 PASS testAdd("foo", 0) threw exception TypeError: Type error. 44 PASS testAdd(undefined, 0) threw exception TypeError: Type error. 45 PASS testAdd(null, 0) threw exception TypeError: Type error. 46 47 Call HTMLSelectElement.add() with three arguments (when it only takes two arguments): 48 PASS testAdd(createOption("X"), 0, "unnecessary extra argument - should be ignored") is "X,0,1,2" 49 PASS testAdd(createOption("X"), mySelect.options[1], "unnecessary extra argument - should be ignored") is "0,X,1,2" 41 50 PASS successfullyParsed is true 42 51 -
trunk/LayoutTests/fast/dom/HTMLSelectElement/add.html
r178097 r186265 3 3 <head> 4 4 <script src="../../../resources/js-test.js"></script> 5 <script src="resources/html-select-and-options-collection-utilities.js"></script> 5 6 </head> 6 7 <body> 7 8 <script> 8 description('Test select.add() with index parameter'); 9 10 var mySelect; 9 description("Test that HTMLSelectElement.add() works when passing an index or an HTML option element as its second argument."); 11 10 12 function resetSelection() { 13 mySelect = document.createElement('select'); 14 mySelect.appendChild(new Option("0", "0", false, false)); 15 mySelect.appendChild(new Option("1", "1", false, false)); 16 mySelect.appendChild(new Option("2", "2", false, false)); 11 var mySelect = createSelectElementWithTestData(); 12 13 function testAdd() 14 { 15 HTMLSelectElement.prototype.add.apply(mySelect, arguments); 16 var result = deepCopy(mySelect); 17 mySelect = createSelectElementWithTestData(); // Reset 18 return result; 17 19 } 18 20 19 function deepCopy() { 20 var copy = []; 21 for(var i = 0; i < mySelect.options.length; ++i) 22 copy.push(mySelect.options[i].value); 23 return copy.join(","); 24 } 25 26 function createOption(value) { 27 return new Option(value + "X", value, false, false); 28 } 21 debug("<br>Call HTMLSelectElement.add() with zero arguments:"); 22 shouldThrow("testAdd()"); 29 23 30 function testAdd1(element) { 31 resetSelection();32 mySelect.add(element);33 return deepCopy();34 } 24 debug("<br>Call HTMLSelectElement.add() with one argument:"); 25 shouldBeEqualToString('testAdd(createOption("Y1"))', "0,1,2,Y1"); 26 shouldThrow('testAdd("foo")'); 27 shouldThrow("testAdd(undefined)"); 28 shouldThrow("testAdd(null)"); 35 29 36 function testAdd3(newelement, index) { 37 resetSelection(); 38 mySelect.add(newelement, index); 39 return deepCopy(); 40 } 30 debug("<br>Call HTMLSelectElement.add() with two arguments:"); 31 shouldBeEqualToString('testAdd(createOption("Y2"), null)', "0,1,2,Y2"); 32 shouldBeEqualToString('testAdd(createOption("Y3"), 0)', "Y3,0,1,2"); 33 shouldBeEqualToString('testAdd(createOption("Y4"), 1)', "0,Y4,1,2"); 34 shouldBeEqualToString('testAdd(createOption("Y5"), 2)', "0,1,Y5,2"); 35 shouldBeEqualToString('testAdd(createOption("Y6"), 3)', "0,1,2,Y6"); 36 shouldBeEqualToString('testAdd(createOption("Y7"), 100)', "0,1,2,Y7"); 37 shouldBeEqualToString('testAdd(createOption("Y8"), -100)', "0,1,2,Y8"); 38 shouldBeEqualToString('testAdd(createOption("Y9"), "0")', "Y9,0,1,2"); 39 shouldBeEqualToString('testAdd(createOption("Y10"), "1")', "0,Y10,1,2"); 40 shouldBeEqualToString('testAdd(createOption("Y11"), "2")', "0,1,Y11,2"); 41 shouldBeEqualToString('testAdd(createOption("Y12"), true)', "0,Y12,1,2"); 42 shouldBeEqualToString('testAdd(createOption("Y13"), false)', "Y13,0,1,2"); 43 shouldBeEqualToString('testAdd(createOption("Y14"), 2147483647)', "0,1,2,Y14"); 44 shouldBeEqualToString('testAdd(createOption("Y15"), 2147483648)', "0,1,2,Y15"); 45 shouldBeEqualToString('testAdd(createOption("Y16"), -2147483647)', "0,1,2,Y16"); 46 shouldBeEqualToString('testAdd(createOption("Y17"), -2147483648)', "0,1,2,Y17"); 47 shouldBeEqualToString('testAdd(createOption("Y18"), -2147483649)', "0,1,2,Y18"); 48 shouldBeEqualToString('testAdd(createOption("Y19"), Infinity)', "Y19,0,1,2"); 49 shouldBeEqualToString('testAdd(createOption("Y20"), -Infinity)', "Y20,0,1,2"); 50 shouldBeEqualToString('testAdd(createOption("Y21"), "foo")', "Y21,0,1,2"); 51 shouldBeEqualToString('testAdd(createOption("Y22"), NaN)', "Y22,0,1,2"); 52 shouldBeEqualToString('testAdd(createOption("Y23"), undefined)', "Y23,0,1,2"); 53 shouldBeEqualToString('testAdd(createOption("Y24"), -2)', "0,1,2,Y24"); 54 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[0])', "X,0,1,2"); 55 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[1])', "0,X,1,2"); 56 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[2])', "0,1,X,2"); 57 shouldThrow('testAdd("foo", 0)', "'TypeError: Type error'"); 58 shouldThrow('testAdd(undefined, 0)', "'TypeError: Type error'"); 59 shouldThrow('testAdd(null, 0)', "'TypeError: Type error'"); 41 60 42 function testAdd4(newelement, element, index) { 43 resetSelection(); 44 mySelect.add(newelement, element, index); 45 return deepCopy(); 46 } 47 48 resetSelection(); 49 debug('list elements are = ' + deepCopy()); 50 shouldBeEqualToString('testAdd1(createOption("Y1"))', '0,1,2,Y1'); 51 shouldBeEqualToString('testAdd3(createOption("Y2"), null)', '0,1,2,Y2'); 52 shouldBeEqualToString('testAdd3(createOption("Y3"), 0)', 'Y3,0,1,2'); 53 shouldBeEqualToString('testAdd3(createOption("Y4"), 1)', '0,Y4,1,2'); 54 shouldBeEqualToString('testAdd3(createOption("Y5"), 2)', '0,1,Y5,2'); 55 shouldBeEqualToString('testAdd3(createOption("Y6"), 3)', '0,1,2,Y6'); 56 shouldBeEqualToString('testAdd3(createOption("Y7"), 100)', '0,1,2,Y7'); 57 shouldBeEqualToString('testAdd3(createOption("Y8"), -100)', '0,1,2,Y8'); 58 shouldBeEqualToString('testAdd3(createOption("Y9"), "0")', 'Y9,0,1,2'); 59 shouldBeEqualToString('testAdd3(createOption("Y10"), "1")', '0,Y10,1,2'); 60 shouldBeEqualToString('testAdd3(createOption("Y11"), "2")', '0,1,Y11,2'); 61 shouldBeEqualToString('testAdd3(createOption("Y12"), true)', '0,Y12,1,2'); 62 shouldBeEqualToString('testAdd3(createOption("Y13"), false)', 'Y13,0,1,2'); 63 shouldBeEqualToString('testAdd3(createOption("Y14"), 2147483647)', '0,1,2,Y14'); 64 shouldBeEqualToString('testAdd3(createOption("Y15"), 2147483648)', '0,1,2,Y15'); 65 shouldBeEqualToString('testAdd3(createOption("Y16"), -2147483647)', '0,1,2,Y16'); 66 shouldBeEqualToString('testAdd3(createOption("Y17"), -2147483648)', '0,1,2,Y17'); 67 shouldBeEqualToString('testAdd3(createOption("Y18"), -2147483649)', '0,1,2,Y18'); 68 shouldBeEqualToString('testAdd3(createOption("Y19"), Infinity)', 'Y19,0,1,2'); 69 shouldBeEqualToString('testAdd3(createOption("Y20"), -Infinity)', 'Y20,0,1,2'); 70 shouldBeEqualToString('testAdd3(createOption("Y21"), "foo")', 'Y21,0,1,2'); 71 shouldBeEqualToString('testAdd3(createOption("Y22"), NaN)', 'Y22,0,1,2'); 72 shouldBeEqualToString('testAdd3(createOption("Y23"), undefined)', 'Y23,0,1,2'); 73 shouldBeEqualToString('testAdd3(createOption("Y24"), -2)','0,1,2,Y24'); 74 shouldThrow('testAdd4(createOption("Y25"), 0, 1)'); 75 shouldThrow('testAdd4(createOption("Y25"), mySelect.options[0], 1)'); 76 resetSelection(); 77 debug('list elements are = ' + deepCopy()); 78 shouldThrow('mySelect.add("foo")'); 79 shouldThrow('mySelect.add("foo", 0)'); 80 shouldThrow('mySelect.add(undefined)'); 81 shouldThrow('mySelect.add(undefined, 0)'); 82 shouldThrow('mySelect.add(null, 0)'); 83 shouldThrow('mySelect.add(null)'); 84 shouldThrow('mySelect.add()'); 85 61 debug("<br>Call HTMLSelectElement.add() with three arguments (when it only takes two arguments):"); 62 shouldBeEqualToString('testAdd(createOption("X"), 0, "unnecessary extra argument - should be ignored")', "X,0,1,2"); 63 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[1], "unnecessary extra argument - should be ignored")', "0,X,1,2"); 86 64 </script> 87 65 </body> -
trunk/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add-expected.txt
r178097 r186265 4 4 5 5 6 list elements are = 0,1,2 7 PASS testAdd3(createGroup("Y1", "Y2"), null) is "0,1,2,Y1,Y2" 8 PASS testAdd3(createGroup("Y3", "Y4"), 0) is "Y3,Y4,0,1,2" 9 PASS testAdd3(createGroup("Y5", "Y6"), 2) is "0,1,Y5,Y6,2" 10 PASS testAdd1(createGroup("Y7", "Y8")) is "0,1,2,Y7,Y8" 11 PASS testAdd1(createOption("Y9")) is "0,1,2,Y9" 12 list elements are = 0,1,2 13 PASS testAdd2(createOption("Y10"), mySelect.options[2]) is "0,1,Y10,2" 14 PASS testAdd2(createOption("Y11"), mySelect.options[1]) is "0,Y11,1,Y10,2" 15 list elements are = 0,1,2 16 PASS testAdd2(createGroup("Y12", "Y13"), mySelect.options[1]) is "0,Y12,Y13,1,2" 17 PASS testAdd2(createGroup("Y14", "Y15"), mySelect.options[3]) is "0,Y12,Y13,Y14,Y15,1,2" 18 list elements are = 0,1,2 19 PASS testAdd2(createOption("Y16"), createOption("Y17")) threw exception Error: NotFoundError: DOM Exception 8. 20 list elements are = 0,1,2 21 PASS testAdd1(createOption("Y1")) is "0,1,2,Y1" 22 PASS testAdd3(createOption("Y2"), null) is "0,1,2,Y2" 23 PASS testAdd3(createOption("Y3"), 0) is "Y3,0,1,2" 24 PASS testAdd3(createOption("Y4"), 1) is "0,Y4,1,2" 25 PASS testAdd3(createOption("Y5"), 2) is "0,1,Y5,2" 26 PASS testAdd3(createOption("Y6"), 3) is "0,1,2,Y6" 27 PASS testAdd3(createOption("Y7"), 100) is "0,1,2,Y7" 28 PASS testAdd3(createOption("Y8"), -100) is "0,1,2,Y8" 29 PASS testAdd3(createOption("Y9"), "0") is "Y9,0,1,2" 30 PASS testAdd3(createOption("Y10"), "1") is "0,Y10,1,2" 31 PASS testAdd3(createOption("Y11"), "2") is "0,1,Y11,2" 32 PASS testAdd3(createOption("Y12"), true) is "0,Y12,1,2" 33 PASS testAdd3(createOption("Y13"), false) is "Y13,0,1,2" 34 PASS testAdd3(createOption("Y14"), 2147483647) is "0,1,2,Y14" 35 PASS testAdd3(createOption("Y15"), 2147483648) is "0,1,2,Y15" 36 PASS testAdd3(createOption("Y16"), -2147483647) is "0,1,2,Y16" 37 PASS testAdd3(createOption("Y17"), -2147483648) is "0,1,2,Y17" 38 PASS testAdd3(createOption("Y18"), -2147483649) is "0,1,2,Y18" 39 PASS testAdd3(createOption("Y19"), Infinity) is "Y19,0,1,2" 40 PASS testAdd3(createOption("Y20"), -Infinity) is "Y20,0,1,2" 41 PASS testAdd3(createOption("Y21"), "foo") is "Y21,0,1,2" 42 PASS testAdd3(createOption("Y22"), NaN) is "Y22,0,1,2" 43 PASS testAdd3(createOption("Y23"), undefined) is "Y23,0,1,2" 44 PASS testAdd3(createOption("Y24"), -2) is "0,1,2,Y24" 45 PASS testAdd4(createOption("Y25"), 0, 1) threw exception TypeError: Type error. 46 PASS testAdd4(createOption("Y25"), mySelect.options[0], 1) threw exception TypeError: Type error. 47 list elements are = 0,1,2 48 PASS mySelect.options.add("foo") threw exception TypeError: Type error. 49 PASS mySelect.options.add("foo", 0) threw exception TypeError: Type error. 50 PASS mySelect.options.add(undefined) threw exception TypeError: Type error. 51 PASS mySelect.options.add(undefined, 0) threw exception TypeError: Type error. 52 PASS mySelect.options.add(null, 0) threw exception TypeError: Type error. 53 PASS mySelect.options.add(null) threw exception TypeError: Type error. 54 PASS mySelect.options.add() threw exception TypeError: Not enough arguments. 6 7 Call HTMLOptionsCollection.add() with zero arguments: 8 PASS testAdd() threw exception TypeError: Not enough arguments. 9 10 Call HTMLOptionsCollection.add() with only one argument: 11 PASS testAdd(createOption("Y9")) is "0,1,2,Y9" 12 PASS testAdd("foo") threw exception TypeError: Type error. 13 PASS testAdd(undefined) threw exception TypeError: Type error. 14 PASS testAdd(null) threw exception TypeError: Type error. 15 16 Call HTMLOptionsCollection.add() with two arguments: 17 PASS testAdd(createGroup("Y1", "Y2"), null) is "0,1,2,Y1,Y2" 18 PASS testAdd(createGroup("Y3", "Y4"), 0) is "Y3,Y4,0,1,2" 19 PASS testAdd(createGroup("Y5", "Y6"), 2) is "0,1,Y5,Y6,2" 20 PASS testAdd(createGroup("Y7", "Y8")) is "0,1,2,Y7,Y8" 21 PASS testAddWithoutResettingListOptions(createOption("Y10"), mySelect.options[2]) is "0,1,Y10,2" 22 PASS testAdd(createOption("Y11"), mySelect.options[1]) is "0,Y11,1,Y10,2" 23 PASS testAddWithoutResettingListOptions(createGroup("Y12", "Y13"), mySelect.options[1]) is "0,Y12,Y13,1,2" 24 PASS testAdd(createGroup("Y14", "Y15"), mySelect.options[3]) is "0,Y12,Y13,Y14,Y15,1,2" 25 PASS testAdd(createOption("Y16"), createOption("Y17")) threw exception Error: NotFoundError: DOM Exception 8. 26 PASS testAdd(createOption("Y1")) is "0,1,2,Y1" 27 PASS testAdd(createOption("Y2"), null) is "0,1,2,Y2" 28 PASS testAdd(createOption("Y3"), 0) is "Y3,0,1,2" 29 PASS testAdd(createOption("Y4"), 1) is "0,Y4,1,2" 30 PASS testAdd(createOption("Y5"), 2) is "0,1,Y5,2" 31 PASS testAdd(createOption("Y6"), 3) is "0,1,2,Y6" 32 PASS testAdd(createOption("Y7"), 100) is "0,1,2,Y7" 33 PASS testAdd(createOption("Y8"), -100) is "0,1,2,Y8" 34 PASS testAdd(createOption("Y9"), "0") is "Y9,0,1,2" 35 PASS testAdd(createOption("Y10"), "1") is "0,Y10,1,2" 36 PASS testAdd(createOption("Y11"), "2") is "0,1,Y11,2" 37 PASS testAdd(createOption("Y12"), true) is "0,Y12,1,2" 38 PASS testAdd(createOption("Y13"), false) is "Y13,0,1,2" 39 PASS testAdd(createOption("Y14"), 2147483647) is "0,1,2,Y14" 40 PASS testAdd(createOption("Y15"), 2147483648) is "0,1,2,Y15" 41 PASS testAdd(createOption("Y16"), -2147483647) is "0,1,2,Y16" 42 PASS testAdd(createOption("Y17"), -2147483648) is "0,1,2,Y17" 43 PASS testAdd(createOption("Y18"), -2147483649) is "0,1,2,Y18" 44 PASS testAdd(createOption("Y19"), Infinity) is "Y19,0,1,2" 45 PASS testAdd(createOption("Y20"), -Infinity) is "Y20,0,1,2" 46 PASS testAdd(createOption("Y21"), "foo") is "Y21,0,1,2" 47 PASS testAdd(createOption("Y22"), NaN) is "Y22,0,1,2" 48 PASS testAdd(createOption("Y23"), undefined) is "Y23,0,1,2" 49 PASS testAdd(createOption("Y24"), -2) is "0,1,2,Y24" 50 PASS testAdd(createOption("X"), mySelect.options[0]) is "X,0,1,2" 51 PASS testAdd(createOption("X"), mySelect.options[1]) is "0,X,1,2" 52 PASS testAdd(createOption("X"), mySelect.options[2]) is "0,1,X,2" 53 PASS testAdd(createOption("Y25"), 0, 1) is "Y25,0,1,2" 54 PASS testAdd(createOption("Y25"), mySelect.options[0], 1) is "Y25,0,1,2" 55 PASS testAdd("foo", 0) threw exception TypeError: Type error. 56 PASS testAdd(undefined, 0) threw exception TypeError: Type error. 57 PASS testAdd(null, 0) threw exception TypeError: Type error. 58 59 Call HTMLOptionsCollection.add() with three arguments (when it only takes two arguments): 60 PASS testAdd(createOption("X"), 0, "unnecessary extra argument - should be ignored") is "X,0,1,2" 61 PASS testAdd(createOption("X"), mySelect.options[1], "unnecessary extra argument - should be ignored") is "0,X,1,2" 62 PASS testAdd(createGroup("G1", "G2"), 1, "unnecessary extra argument - should be ignored") is "0,G1,G2,1,2" 55 63 PASS successfullyParsed is true 56 64 -
trunk/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add.html
r178097 r186265 3 3 <head> 4 4 <script src="../../../resources/js-test.js"></script> 5 <script src="resources/html-select-and-options-collection-utilities.js"></script> 5 6 </head> 6 7 <body> 7 8 <script> 8 9 description('Test select.options.add() with optgroup and with index parameter'); 9 10 var mySelect;11 10 12 function resetSelection() { 13 mySelect = document.createElement('select'); 14 mySelect.appendChild(new Option("0", "0", false, false)); 15 mySelect.appendChild(new Option("1", "1", false, false)); 16 mySelect.appendChild(new Option("2", "2", false, false)); 11 var mySelect = createSelectElementWithTestData(); 12 13 function testAdd() 14 { 15 HTMLOptionsCollection.prototype.add.apply(mySelect.options, arguments); 16 var result = deepCopy(mySelect); 17 mySelect = createSelectElementWithTestData(); // Reset 18 return result; 17 19 } 18 20 19 function deepCopy() { 20 var copy = []; 21 for(var i = 0; i < mySelect.options.length; ++i) 22 copy.push(mySelect.options[i].value); 23 return copy.join(","); 24 } 25 26 function createOption(value) { 27 return new Option(value + "X", value, false, false); 21 function testAddWithoutResettingListOptions() 22 { 23 HTMLOptionsCollection.prototype.add.apply(mySelect.options, arguments); 24 return deepCopy(mySelect); 28 25 } 29 26 30 function createGroup(value1, value2) { 31 var group = document.createElement('optgroup'); 32 group.appendChild(new Option(value1 + "X", value1, false, false)); 33 group.appendChild(new Option(value2 + "Y", value2, false, false)); 34 return group; 35 } 27 debug("<br>Call HTMLOptionsCollection.add() with zero arguments:"); 28 shouldThrow("testAdd()"); 36 29 37 function testAdd1(element) { 38 resetSelection();39 mySelect.options.add(element);40 return deepCopy();41 } 30 debug("<br>Call HTMLOptionsCollection.add() with only one argument:"); 31 shouldBeEqualToString('testAdd(createOption("Y9"))', "0,1,2,Y9"); 32 shouldThrow('testAdd("foo")'); 33 shouldThrow("testAdd(undefined)"); 34 shouldThrow("testAdd(null)"); 42 35 43 function testAdd2(newelement, element) { 44 mySelect.options.add(newelement, element); 45 return deepCopy(); 46 } 36 debug("<br>Call HTMLOptionsCollection.add() with two arguments:"); 37 shouldBeEqualToString('testAdd(createGroup("Y1", "Y2"), null)', "0,1,2,Y1,Y2"); 38 shouldBeEqualToString('testAdd(createGroup("Y3", "Y4"), 0)', "Y3,Y4,0,1,2"); 39 shouldBeEqualToString('testAdd(createGroup("Y5", "Y6"), 2)', "0,1,Y5,Y6,2"); 40 shouldBeEqualToString('testAdd(createGroup("Y7", "Y8"))', "0,1,2,Y7,Y8"); 47 41 48 function testAdd3(newelement, index) { 49 resetSelection(); 50 mySelect.options.add(newelement, index); 51 return deepCopy(); 52 } 42 shouldBeEqualToString('testAddWithoutResettingListOptions(createOption("Y10"), mySelect.options[2])', "0,1,Y10,2"); 43 shouldBeEqualToString('testAdd(createOption("Y11"), mySelect.options[1])', "0,Y11,1,Y10,2"); 53 44 54 function testAdd4(newelement, element, index) { 55 resetSelection(); 56 mySelect.options.add(newelement, element, index); 57 return deepCopy(); 58 } 45 shouldBeEqualToString('testAddWithoutResettingListOptions(createGroup("Y12", "Y13"), mySelect.options[1])', "0,Y12,Y13,1,2"); 46 shouldBeEqualToString('testAdd(createGroup("Y14", "Y15"), mySelect.options[3])', "0,Y12,Y13,Y14,Y15,1,2"); 59 47 60 resetSelection(); 61 debug('list elements are = ' + deepCopy()); 62 shouldBeEqualToString('testAdd3(createGroup("Y1", "Y2"), null)', '0,1,2,Y1,Y2'); 63 shouldBeEqualToString('testAdd3(createGroup("Y3", "Y4"), 0)', 'Y3,Y4,0,1,2'); 64 shouldBeEqualToString('testAdd3(createGroup("Y5", "Y6"), 2)', '0,1,Y5,Y6,2'); 65 shouldBeEqualToString('testAdd1(createGroup("Y7", "Y8"))', '0,1,2,Y7,Y8'); 66 shouldBeEqualToString('testAdd1(createOption("Y9"))', '0,1,2,Y9'); 67 resetSelection(); 68 debug('list elements are = ' + deepCopy()); 69 shouldBeEqualToString('testAdd2(createOption("Y10"), mySelect.options[2])', '0,1,Y10,2'); 70 shouldBeEqualToString('testAdd2(createOption("Y11"), mySelect.options[1])', '0,Y11,1,Y10,2'); 71 resetSelection(); 72 debug('list elements are = ' + deepCopy()); 73 shouldBeEqualToString('testAdd2(createGroup("Y12", "Y13"), mySelect.options[1])', '0,Y12,Y13,1,2'); 74 shouldBeEqualToString('testAdd2(createGroup("Y14", "Y15"), mySelect.options[3])', '0,Y12,Y13,Y14,Y15,1,2'); 75 resetSelection(); 76 debug('list elements are = ' + deepCopy()); 77 shouldThrow('testAdd2(createOption("Y16"), createOption("Y17"))'); 78 resetSelection(); 79 debug('list elements are = ' + deepCopy()); 80 shouldBeEqualToString('testAdd1(createOption("Y1"))', '0,1,2,Y1'); 81 shouldBeEqualToString('testAdd3(createOption("Y2"), null)', '0,1,2,Y2'); 82 shouldBeEqualToString('testAdd3(createOption("Y3"), 0)', 'Y3,0,1,2'); 83 shouldBeEqualToString('testAdd3(createOption("Y4"), 1)', '0,Y4,1,2'); 84 shouldBeEqualToString('testAdd3(createOption("Y5"), 2)', '0,1,Y5,2'); 85 shouldBeEqualToString('testAdd3(createOption("Y6"), 3)', '0,1,2,Y6'); 86 shouldBeEqualToString('testAdd3(createOption("Y7"), 100)', '0,1,2,Y7'); 87 shouldBeEqualToString('testAdd3(createOption("Y8"), -100)', '0,1,2,Y8'); 88 shouldBeEqualToString('testAdd3(createOption("Y9"), "0")', 'Y9,0,1,2'); 89 shouldBeEqualToString('testAdd3(createOption("Y10"), "1")', '0,Y10,1,2'); 90 shouldBeEqualToString('testAdd3(createOption("Y11"), "2")', '0,1,Y11,2'); 91 shouldBeEqualToString('testAdd3(createOption("Y12"), true)', '0,Y12,1,2'); 92 shouldBeEqualToString('testAdd3(createOption("Y13"), false)', 'Y13,0,1,2'); 93 shouldBeEqualToString('testAdd3(createOption("Y14"), 2147483647)', '0,1,2,Y14'); 94 shouldBeEqualToString('testAdd3(createOption("Y15"), 2147483648)', '0,1,2,Y15'); 95 shouldBeEqualToString('testAdd3(createOption("Y16"), -2147483647)', '0,1,2,Y16'); 96 shouldBeEqualToString('testAdd3(createOption("Y17"), -2147483648)', '0,1,2,Y17'); 97 shouldBeEqualToString('testAdd3(createOption("Y18"), -2147483649)', '0,1,2,Y18'); 98 shouldBeEqualToString('testAdd3(createOption("Y19"), Infinity)', 'Y19,0,1,2'); 99 shouldBeEqualToString('testAdd3(createOption("Y20"), -Infinity)', 'Y20,0,1,2'); 100 shouldBeEqualToString('testAdd3(createOption("Y21"), "foo")', 'Y21,0,1,2'); 101 shouldBeEqualToString('testAdd3(createOption("Y22"), NaN)', 'Y22,0,1,2'); 102 shouldBeEqualToString('testAdd3(createOption("Y23"), undefined)', 'Y23,0,1,2'); 103 shouldBeEqualToString('testAdd3(createOption("Y24"), -2)','0,1,2,Y24'); 104 shouldThrow('testAdd4(createOption("Y25"), 0, 1)'); 105 shouldThrow('testAdd4(createOption("Y25"), mySelect.options[0], 1)'); 106 resetSelection(); 107 debug('list elements are = ' + deepCopy()); 108 shouldThrow('mySelect.options.add("foo")'); 109 shouldThrow('mySelect.options.add("foo", 0)'); 110 shouldThrow('mySelect.options.add(undefined)'); 111 shouldThrow('mySelect.options.add(undefined, 0)'); 112 shouldThrow('mySelect.options.add(null, 0)'); 113 shouldThrow('mySelect.options.add(null)'); 114 shouldThrow('mySelect.options.add()'); 115 48 shouldThrow('testAdd(createOption("Y16"), createOption("Y17"))'); 49 50 shouldBeEqualToString('testAdd(createOption("Y1"))', "0,1,2,Y1"); 51 shouldBeEqualToString('testAdd(createOption("Y2"), null)', "0,1,2,Y2"); 52 shouldBeEqualToString('testAdd(createOption("Y3"), 0)', "Y3,0,1,2"); 53 shouldBeEqualToString('testAdd(createOption("Y4"), 1)', "0,Y4,1,2"); 54 shouldBeEqualToString('testAdd(createOption("Y5"), 2)', "0,1,Y5,2"); 55 shouldBeEqualToString('testAdd(createOption("Y6"), 3)', "0,1,2,Y6"); 56 shouldBeEqualToString('testAdd(createOption("Y7"), 100)', "0,1,2,Y7"); 57 shouldBeEqualToString('testAdd(createOption("Y8"), -100)', "0,1,2,Y8"); 58 shouldBeEqualToString('testAdd(createOption("Y9"), "0")', "Y9,0,1,2"); 59 shouldBeEqualToString('testAdd(createOption("Y10"), "1")', "0,Y10,1,2"); 60 shouldBeEqualToString('testAdd(createOption("Y11"), "2")', "0,1,Y11,2"); 61 shouldBeEqualToString('testAdd(createOption("Y12"), true)', "0,Y12,1,2"); 62 shouldBeEqualToString('testAdd(createOption("Y13"), false)', "Y13,0,1,2"); 63 shouldBeEqualToString('testAdd(createOption("Y14"), 2147483647)', "0,1,2,Y14"); 64 shouldBeEqualToString('testAdd(createOption("Y15"), 2147483648)', "0,1,2,Y15"); 65 shouldBeEqualToString('testAdd(createOption("Y16"), -2147483647)', "0,1,2,Y16"); 66 shouldBeEqualToString('testAdd(createOption("Y17"), -2147483648)', "0,1,2,Y17"); 67 shouldBeEqualToString('testAdd(createOption("Y18"), -2147483649)', "0,1,2,Y18"); 68 shouldBeEqualToString('testAdd(createOption("Y19"), Infinity)', "Y19,0,1,2"); 69 shouldBeEqualToString('testAdd(createOption("Y20"), -Infinity)', "Y20,0,1,2"); 70 shouldBeEqualToString('testAdd(createOption("Y21"), "foo")', "Y21,0,1,2"); 71 shouldBeEqualToString('testAdd(createOption("Y22"), NaN)', "Y22,0,1,2"); 72 shouldBeEqualToString('testAdd(createOption("Y23"), undefined)', "Y23,0,1,2"); 73 shouldBeEqualToString('testAdd(createOption("Y24"), -2)', "0,1,2,Y24"); 74 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[0])', "X,0,1,2"); 75 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[1])', "0,X,1,2"); 76 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[2])', "0,1,X,2"); 77 shouldBeEqualToString('testAdd(createOption("Y25"), 0, 1)', "Y25,0,1,2"); 78 shouldBeEqualToString('testAdd(createOption("Y25"), mySelect.options[0], 1)', "Y25,0,1,2"); 79 shouldThrow('testAdd("foo", 0)', "'TypeError: Type error'"); 80 shouldThrow('testAdd(undefined, 0)', "'TypeError: Type error'"); 81 shouldThrow('testAdd(null, 0)', "'TypeError: Type error'"); 82 83 debug("<br>Call HTMLOptionsCollection.add() with three arguments (when it only takes two arguments):"); 84 shouldBeEqualToString('testAdd(createOption("X"), 0, "unnecessary extra argument - should be ignored")', "X,0,1,2"); 85 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[1], "unnecessary extra argument - should be ignored")', "0,X,1,2"); 86 shouldBeEqualToString('testAdd(createGroup("G1", "G2"), 1, "unnecessary extra argument - should be ignored")', "0,G1,G2,1,2"); 116 87 </script> 117 88 </body> -
trunk/Source/WebCore/ChangeLog
r186263 r186265 1 2015-07-03 Daniel Bates <dabates@apple.com> 2 3 REGRESSION (r178097): JavaScript TypeError after clicking on compose button in Yahoo Mail 4 https://bugs.webkit.org/show_bug.cgi?id=146515 5 <rdar://problem/21348421> 6 7 Reviewed by Chris Dumez. 8 9 Fixes an issue where extra arguments passed to a Web IDL overloaded function, whose implementation 10 is generated by the bindings generator script, are not ignored as per the note in section "Interface object [[Call]] method" 11 of the Web IDL spec, <http://www.w3.org/TR/2012/CR-WebIDL-20120419/> (19 April 2012). 12 13 Currently for an overloaded function the JavaScript bindings generator script emits code to 14 throw a TypeError when it cannot find a candidate function that takes the same number of 15 arguments as passed by a caller. Prior to the change made in bug #139179 (r178097), the 16 bindings code for HTMLSelectElement.add() was written by hand and ignored extra arguments 17 that were passed to it. Following this change, the bindings code for HTMLSelectElement.add() 18 is generated by the bindings generator script. Therefore, we throw a TypeError when Yahoo Mail 19 calls HTMLSelectElement.add() with extra arguments because the code emitted by the bindings 20 generator script does not ignore them. 21 22 * bindings/scripts/CodeGeneratorJS.pm: 23 (LengthOfLongestFunctionParameterList): Added. Computes the length of longest overload parameter list. 24 (GenerateOverloadedFunction): Emit code that ignores more arguments than LengthOfLongestFunctionParameterList(). 25 (GenerateOverloadedConstructorDefinition): Ditto. 26 * bindings/scripts/test/JS/JSTestObj.cpp: 27 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12): Added; expected result for an overloaded 28 function that takes a variadic number of Blob elements. 29 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Update expected result. The added 30 if-conditional expression for the IDL declaration overloadedMethod(Blob... blobArgs) is empty 31 because we do not support overloading of functions with variadic arguments. 32 (WebCore::jsTestObjConstructorFunctionOverloadedMethod1): 33 * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: 34 (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors5): Added; expected 35 result for an overloaded constructors that takes a variadic number of long arguments. 36 (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors): Update expected 37 result. The added if-conditional expression for the IDL declaration Constructor(long... longArgs) is empty 38 because we do not support overloading of constructors with variadic arguments. 39 * bindings/scripts/test/TestObj.idl: Added declaration overloadedMethod(Blob...). Also fixed 40 typo in license block text. 41 * bindings/scripts/test/TestOverloadedConstructors.idl: Added declaration Constructor(long... longArgs). 42 Also fixed typo in license block text. 43 1 44 2015-07-03 Mario Sanchez Prada <mario@endlessm.com> 2 45 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r186257 r186265 1454 1454 } 1455 1455 1456 sub LengthOfLongestFunctionParameterList 1457 { 1458 my ($overloads) = @_; 1459 my $result = 0; 1460 foreach my $overload (@{$overloads}) { 1461 my @parameters = @{$overload->parameters}; 1462 $result = @parameters if $result < @parameters; 1463 } 1464 return $result; 1465 } 1466 1456 1467 sub GenerateOverloadedFunction 1457 1468 { … … 1469 1480 my $functionName = "js${interfaceName}${kind}Function" . $codeGenerator->WK_ucfirst($function->signature->name); 1470 1481 1482 # FIXME: Implement support for overloaded functions with variadic arguments. 1483 my $lengthOfLongestOverloadedFunctionParameterList = LengthOfLongestFunctionParameterList($function->{overloads}); 1484 1471 1485 push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); 1472 1486 push(@implContent, <<END); 1473 1487 { 1474 size_t argsCount = exec->argumentCount();1488 size_t argsCount = std::min<size_t>($lengthOfLongestOverloadedFunctionParameterList, exec->argumentCount()); 1475 1489 END 1476 1490 … … 4501 4515 4502 4516 my $functionName = "${className}Constructor::construct${className}"; 4517 4518 # FIXME: Implement support for overloaded constructors with variadic arguments. 4519 my $lengthOfLongestOverloadedConstructorParameterList = LengthOfLongestFunctionParameterList($interface->constructors); 4520 4503 4521 push(@$outputArray, <<END); 4504 4522 EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec) 4505 4523 { 4506 size_t argsCount = exec->argumentCount();4524 size_t argsCount = std::min<size_t>($lengthOfLongestOverloadedConstructorParameterList, exec->argumentCount()); 4507 4525 END 4508 4526 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r186257 r186265 3919 3919 } 3920 3920 3921 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod12(ExecState* exec) 3922 { 3923 JSValue thisValue = exec->thisValue(); 3924 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue); 3925 if (UNLIKELY(!castedThis)) 3926 return throwThisTypeError(*exec, "TestObj", "overloadedMethod"); 3927 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); 3928 auto& impl = castedThis->impl(); 3929 Vector<Blob*> blobArgs; 3930 for (unsigned i = 0, count = exec->argumentCount(); i < count; ++i) { 3931 if (!exec->uncheckedArgument(i).inherits(JSBlob::info())) 3932 return throwArgumentTypeError(*exec, i, "blobArgs", "TestObj", "overloadedMethod", "Blob"); 3933 blobArgs.append(JSBlob::toWrapped(exec->uncheckedArgument(i))); 3934 } 3935 impl.overloadedMethod(blobArgs); 3936 return JSValue::encode(jsUndefined()); 3937 } 3938 3921 3939 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) 3922 3940 { 3923 size_t argsCount = exec->argumentCount();3941 size_t argsCount = std::min<size_t>(2, exec->argumentCount()); 3924 3942 JSValue arg0(exec->argument(0)); 3925 3943 JSValue arg1(exec->argument(1)); … … 3946 3964 if (argsCount == 1) 3947 3965 return jsTestObjPrototypeFunctionOverloadedMethod11(exec); 3966 if () 3967 return jsTestObjPrototypeFunctionOverloadedMethod12(exec); 3948 3968 if (argsCount < 1) 3949 3969 return throwVMError(exec, createNotEnoughArgumentsError(exec)); … … 4010 4030 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(ExecState* exec) 4011 4031 { 4012 size_t argsCount = exec->argumentCount();4032 size_t argsCount = std::min<size_t>(1, exec->argumentCount()); 4013 4033 #if ENABLE(Condition1) 4014 4034 if (argsCount == 1) -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
r185373 r186265 87 87 static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestOverloadedConstructors3(JSC::ExecState*); 88 88 static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestOverloadedConstructors4(JSC::ExecState*); 89 static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestOverloadedConstructors5(JSC::ExecState*); 89 90 static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&); 90 91 }; … … 138 139 } 139 140 141 EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors5(ExecState* exec) 142 { 143 auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee()); 144 Vector<int> longArgs = toNativeArguments<int>(exec, 0); 145 if (UNLIKELY(exec->hadException())) 146 return JSValue::encode(jsUndefined()); 147 RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(longArgs); 148 return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get()))); 149 } 150 140 151 EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors(ExecState* exec) 141 152 { 142 size_t argsCount = exec->argumentCount();153 size_t argsCount = std::min<size_t>(1, exec->argumentCount()); 143 154 JSValue arg0(exec->argument(0)); 144 155 if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSArrayBuffer::info())))) … … 150 161 if (argsCount == 1) 151 162 return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors4(exec); 163 if () 164 return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors5(exec); 152 165 if (argsCount < 1) 153 166 return throwVMError(exec, createNotEnoughArgumentsError(exec)); -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r186257 r186265 17 17 * 18 18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 * EXPRESS OR IMPLIED WARRANTIE strArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY … … 188 188 void overloadedMethod(sequence<unsigned long> arrayArg); 189 189 void overloadedMethod(DOMString strArg); 190 191 // FIXME: Implement support for overloaded functions with variadic arguments. 192 void overloadedMethod(Blob... blobArgs); 190 193 #endif 191 194 -
trunk/Source/WebCore/bindings/scripts/test/TestOverloadedConstructors.idl
r165676 r186265 16 16 * 17 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 18 * EXPRESS OR IMPLIED WARRANTIE strArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY … … 31 31 Constructor(Blob blob), 32 32 Constructor(DOMString string), 33 Constructor(long... longArgs) // FIXME: Implement support for overloaded constructors with variadic arguments. 33 34 ] interface TestOverloadedConstructors { 34 35 };
Note: See TracChangeset
for help on using the changeset viewer.