Bug 22612

Summary: Add test to verify type enforcement in DOM setters
Product: WebKit Reporter: Pam Greene (IRC:pamg) <pam>
Component: DOMAssignee: Adam Barth <abarth>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
New test + result darin: review+

Description Pam Greene (IRC:pamg) 2008-12-02 17:25:29 PST
Another test.
Comment 1 Pam Greene (IRC:pamg) 2008-12-02 17:28:18 PST
Created attachment 25695 [details]
New test + result

This test could be made much more comprehensive, but to be honest, I don't know enough about underlying DOM structure to know what ought to be possible and what not.  These are the only two examples we actually encountered in the wild.
Comment 2 Darin Adler 2008-12-03 09:11:27 PST
(In reply to comment #1)
> This test could be made much more comprehensive, but to be honest, I don't know
> enough about underlying DOM structure to know what ought to be possible and
> what not.

Our usual approach is to make a more comprehensive test without worrying unduly about whether the current behavior is correct or not -- a regression test has lots of value even if it has to be revised later once we understand what's correct and what's not.

So my approach if I was writing a test would be to make a long list of functions and make a test that covers them as completely as possible. I'll review this soon; although someone else is welcome to. Still wading through a lot of correspondence after my return from "vacation".
Comment 3 Darin Adler 2008-12-04 09:16:23 PST
Comment on attachment 25695 [details]
New test + result

For a test like this, the preferred form is to have the entire test in a .js file and let the make-js-test-wrappers test create a boilerplate wrapper.

It's a little strange to have this test only these two specific setters. It would be way better to have something that made an attempt to be exhaustive.

r=me
Comment 4 Adam Barth 2008-12-17 11:22:50 PST
Will land.
Comment 5 Pam Greene (IRC:pamg) 2008-12-17 11:55:52 PST
Sorry for leaving this on the queue. I was hoping to write a more complete test, but I've since gotten mired in other things and won't be getting back to this for a bit.  So you're welcome to land it; I'll improve it later.
Comment 6 Adam Barth 2008-12-17 13:41:21 PST
LayoutTests/ChangeLog: locally modified
LayoutTests/fast/dom/null-document-xmlhttprequest-open.html: locally modified
LayoutTests/fast/dom/xmlhttprequest-invalid-values.html: locally modified
	M	LayoutTests/ChangeLog
	A	fast/dom/setter-type-enforcement-expected.txt
	A	fast/dom/setter-type-enforcement.html
Committed r39363
	A	fast/dom/setter-type-enforcement-expected.txt
	A	fast/dom/setter-type-enforcement.html
	M	LayoutTests/ChangeLog
r39363 = 6e34f4ececac5729488eae7cb0d6359322c15107 (trunk)
Comment 7 Adam Barth 2008-12-17 13:42:38 PST
No worries.  It makes me feel useful to clean out some things in the commit queue.
Comment 8 Pam Greene (IRC:pamg) 2008-12-18 09:58:12 PST
>         A       fast/dom/setter-type-enforcement-expected.txt
>         A       fast/dom/setter-type-enforcement.html
>         M       LayoutTests/ChangeLog

Moved the tests from root level into LayoutTests/fast/dom/ in r39375.
Comment 9 Adam Barth 2008-12-18 19:14:30 PST
Test fails on buildbot.  I thought it passed on my machine, but I might have been mistaken.  Here's the diff:

--- layout-test-results/fast/dom/setter-type-enforcement-expected.txt	2008-12-18 18:04:24.000000000 -0800
+++ layout-test-results/fast/dom/setter-type-enforcement-actual.txt	2008-12-18 18:04:24.000000000 -0800
@@ -8,12 +8,6 @@
 PASS successfullyParsed is true
 
 TEST COMPLETE
-
-Tests type enforcement on DOM setters.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
 PASS document.body = nodelist; threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
 PASS table.tHead = nodelist; threw exception Error: NOT_FOUND_ERR: DOM Exception 8.
 PASS successfullyParsed is true
Comment 10 Pam Greene (IRC:pamg) 2008-12-19 10:58:04 PST
(In reply to comment #9)
> Test fails on buildbot.  I thought it passed on my machine, but I might have
> been mistaken.

Patching error.  Both the test and the expected results in the repository were doubled copies of the patch attached here.  See

http://trac.webkit.org/browser/trunk/LayoutTests/fast/dom/setter-type-enforcement.html?rev=39375

http://trac.webkit.org/browser/trunk/LayoutTests/fast/dom/setter-type-enforcement-expected.txt?rev=39375

I'll resubmit corrected copies.
Comment 11 Pam Greene (IRC:pamg) 2008-12-19 11:12:02 PST
Resubmitted in r39410.
Comment 12 Adam Barth 2008-12-19 13:18:52 PST
(In reply to comment #10)
> Patching error.  Both the test and the expected results in the repository were
> doubled copies of the patch attached here.  See

Oops.  Sorry about that.  I must have screwed up my pre-submit git rebase somehow.