Bug 16856

Summary: Tests depend on incorrect javascript URL implementation that does not replace the document
Product: WebKit Reporter: Adam Barth <abarth>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Fixes wrong tests
darin: review-
Improved patch darin: review+

Adam Barth
Reported 2008-01-12 13:22:59 PST
A few LayoutTests have bugs that assume WebKit's buggy implementation of javascript URLs (see Bug 16855). I audited all the LayoutTests and found bugs in: fast/replaced/image-map.html fast/events/event-listener-html-non-html-confusion.html svg/custom/prevent-default.svg I'll attach a patch for the tests shortly.
Attachments
Fixes wrong tests (2.64 KB, patch)
2008-01-12 13:28 PST, Adam Barth
darin: review-
Improved patch (3.90 KB, patch)
2008-06-07 00:00 PDT, Adam Barth
darin: review+
Adam Barth
Comment 1 2008-01-12 13:28:44 PST
Created attachment 18410 [details] Fixes wrong tests These tests to not intend to replace the document when navigating to their javascript URLs. This patch wraps the calls in void, which always returns undefined. This also keeps the old version of image-map.html to retain a regression test for Bug 16782, but maybe it should be turned into a reduced test case for that bug.
Alexey Proskuryakov
Comment 2 2008-01-12 14:39:16 PST
Sorry for what may be a stupid question, but would something like "javascript:document.getElementById('rect').style.fill='red'" also replace the current document when entered in address bar? I'm not seeing such behavior in other browsers.
Adam Barth
Comment 3 2008-01-12 14:50:03 PST
Try typing <javascript:document.getElementById('rect').style.fill='red'> into <http://crypto.stanford.edu/~abarth/research/webkit/16856/ap.html> in Firefox and IE. What's going on is the "=" operator returns the value 'red', which then becomes the current document. This is currently broken in Safari.
Alexey Proskuryakov
Comment 4 2008-01-13 00:01:15 PST
Indeed. I was so sure that I never saw this, that I couldn't be bothered to double-check :).
Darin Adler
Comment 5 2008-01-13 11:21:24 PST
Comment on attachment 18410 [details] Fixes wrong tests +<map name="map"><area shape="poly" coords="0,0,0,100,100,100,100,0" href="void(javascript:document.getElementById('result').innerHTML='area clicked')"></map> You put "void" in the wrong place here. Did you try it? Did it work? Also need ChangeLog so we can land this.
Darin Adler
Comment 6 2008-01-13 11:24:44 PST
Comment on attachment 18410 [details] Fixes wrong tests Patch also needs to include expected results for the new image-map-bug16782.html test.
Adam Barth
Comment 7 2008-06-07 00:00:56 PDT
Created attachment 21545 [details] Improved patch Here is a patch that should work. Sorry about the confusion earlier. Now that I have a Mac, I can actually run the tests properly.
Darin Adler
Comment 8 2008-06-08 13:56:28 PDT
Comment on attachment 21545 [details] Improved patch r=me
Adam Barth
Comment 9 2008-06-09 00:41:37 PDT
Fixed in r34463.
Note You need to log in before you can comment on or make changes to this bug.