Changeset 201747 in webkit
- Timestamp:
- Jun 7, 2016 3:06:53 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201746 r201747 1 2016-06-07 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr> 2 3 Creating a TouchList with non Touch items should throw an exception 4 https://bugs.webkit.org/show_bug.cgi?id=158302 5 6 Reviewed by Youenn Fablet. 7 8 Only Touch items should be passed to CreateTouchList function as 9 per specification (https://w3c.github.io/touch-events/#extensions-to-the-document-interface). 10 11 Tests have been modified to check whether behavior of CreateTouchList is correct. 12 13 * fast/events/touch/document-create-touch-list-crash-expected.txt: 14 * fast/events/touch/document-create-touch-list-expected.txt: 15 * fast/events/touch/script-tests/document-create-touch-list-crash.js: 16 * fast/events/touch/script-tests/document-create-touch-list.js: 17 1 18 2016-06-07 Joseph Pecoraro <pecoraro@apple.com> 2 19 -
trunk/LayoutTests/fast/events/touch/document-create-touch-list-crash-expected.txt
r119158 r201747 4 4 5 5 6 PASS document.createTouchList(document).item(0) is null 7 PASS document.createTouchList({"a":1}).item(0) is null 8 PASS document.createTouchList(new Array(5)).item(0) is null 9 PASS document.createTouchList("string").item(0) is null 10 PASS document.createTouchList(null).item(0) is null 11 PASS document.createTouchList(undefined).item(0) is null 12 PASS tl.length is 3 6 PASS document.createTouchList(document).item(0) threw exception TypeError: Argument 1 ('touches') to Document.createTouchList must be an instance of Touch. 7 PASS document.createTouchList({"a":1}).item(0) threw exception TypeError: Argument 1 ('touches') to Document.createTouchList must be an instance of Touch. 8 PASS document.createTouchList(new Array(5)).item(0) threw exception TypeError: Argument 1 ('touches') to Document.createTouchList must be an instance of Touch. 9 PASS document.createTouchList("string").item(0) threw exception TypeError: Argument 1 ('touches') to Document.createTouchList must be an instance of Touch. 10 PASS document.createTouchList(null).item(0) threw exception TypeError: Argument 1 ('touches') to Document.createTouchList must be an instance of Touch. 11 PASS document.createTouchList(undefined).item(0) threw exception TypeError: Argument 1 ('touches') to Document.createTouchList must be an instance of Touch. 12 PASS document.createTouchList() did not throw exception. 13 PASS document.createTouchList().length is 0 14 PASS document.createTouchList(t, document, t2); threw exception TypeError: Argument 2 ('touches') to Document.createTouchList must be an instance of Touch. 15 PASS tl.length is 2 13 16 PASS tl.item(0) is non-null. 14 PASS tl.item(1) is null 15 PASS tl.item(2) is non-null. 17 PASS tl.item(1) is non-null. 16 18 PASS successfullyParsed is true 17 19 -
trunk/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt
r138843 r201747 18 18 PASS ts.touches[1].screenY is 120 19 19 PASS ts.ctrlKey is true 20 PASS document.createTouchList(1, 2) threw exception TypeError: Argument 1 ('touches') to Document.createTouchList must be an instance of Touch. 20 21 PASS successfullyParsed is true 21 22 -
trunk/LayoutTests/fast/events/touch/script-tests/document-create-touch-list-crash.js
r119158 r201747 1 1 description("This test ensures that WebKit doesn't crash when the document.createTouchList API is called with non-Touch parameters"); 2 2 3 shouldBeNull('document.createTouchList(document).item(0)'); 4 shouldBeNull('document.createTouchList({"a":1}).item(0)'); 5 shouldBeNull('document.createTouchList(new Array(5)).item(0)'); 6 shouldBeNull('document.createTouchList("string").item(0)'); 7 shouldBeNull('document.createTouchList(null).item(0)'); 8 shouldBeNull('document.createTouchList(undefined).item(0)'); 3 shouldThrow('document.createTouchList(document).item(0)'); 4 shouldThrow('document.createTouchList({"a":1}).item(0)'); 5 shouldThrow('document.createTouchList(new Array(5)).item(0)'); 6 shouldThrow('document.createTouchList("string").item(0)'); 7 shouldThrow('document.createTouchList(null).item(0)'); 8 shouldThrow('document.createTouchList(undefined).item(0)'); 9 shouldNotThrow('document.createTouchList()'); 10 shouldBe('document.createTouchList().length', '0'); 9 11 10 12 var t = document.createTouch(window, document.body, 12341, 60, 65, 100, 105); 11 13 var t2 = document.createTouch(window, document.body, 12342, 50, 55, 115, 120); 12 var tl = document.createTouchList(t, document, t2);13 14 14 shouldBe('tl.length', '3'); 15 shouldThrow('document.createTouchList(t, document, t2);'); 16 17 var tl = document.createTouchList(t, t2); 18 shouldBe('tl.length','2'); 15 19 shouldBeNonNull('tl.item(0)'); 16 shouldBeNull('tl.item(1)'); 17 shouldBeNonNull('tl.item(2)'); 20 shouldBeNonNull('tl.item(1)'); 18 21 19 22 isSuccessfullyParsed(); -
trunk/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js
r138843 r201747 38 38 39 39 // Test createTouchList with invalid arguments which throws exceptions. 40 try { 41 var tl = document.createTouchList(1, 2); 42 } catch(e) { 43 testFailed("An exception was thrown: " + e.message); 44 } 40 shouldThrow("document.createTouchList(1, 2)"); 41 45 42 isSuccessfullyParsed(); 46 43 -
trunk/Source/WebCore/ChangeLog
r201743 r201747 1 2016-06-07 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr> 2 3 Creating a TouchList with non Touch items should throw an exception 4 https://bugs.webkit.org/show_bug.cgi?id=158302 5 6 Reviewed by Youenn Fablet. 7 8 Only Touch items should be passed to CreateTouchList function as per specification 9 (https://w3c.github.io/touch-events/#extensions-to-the-document-interface). 10 CreateTouchList function behavior is modified. An exception is thrown when non Touch items 11 are passed as parameters instead of adding null items in the TouchList. 12 13 Tests have been modified to check whether behavior of CreateTouchList is correct. 14 15 * bindings/js/JSDocumentCustom.cpp: 16 (WebCore::JSDocument::createTouchList): 17 * dom/Document.idl: 18 1 19 2016-06-06 Commit Queue <commit-queue@webkit.org> 2 20 -
trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp
r201739 r201747 134 134 auto touchList = TouchList::create(); 135 135 136 for (size_t i = 0; i < state.argumentCount(); i++) 137 touchList->append(JSTouch::toWrapped(state.argument(i))); 138 139 return toJS(&state, globalObject(), touchList); 136 for (size_t i = 0; i < state.argumentCount(); ++i) { 137 auto* item = JSTouch::toWrapped(state.uncheckedArgument(i)); 138 if (!item) 139 return JSValue::decode(throwArgumentTypeError(state, i, "touches", "Document", "createTouchList", "Touch")); 140 141 touchList->append(item); 142 } 143 return toJSNewlyCreated(&state, globalObject(), WTFMove(touchList)); 140 144 } 141 145 #endif -
trunk/Source/WebCore/dom/Document.idl
r200550 r201747 302 302 optional unrestricted float webkitRotationAngle = NaN, 303 303 optional unrestricted float webkitForce = NaN); 304 [NewObject, Custom , RaisesException] TouchList createTouchList();304 [NewObject, Custom] TouchList createTouchList(Touch... touches); 305 305 #endif 306 306
Note: See TracChangeset
for help on using the changeset viewer.