Bug 16856 - Tests depend on incorrect javascript URL implementation that does not replace the document
Summary: Tests depend on incorrect javascript URL implementation that does not replace...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-12 13:22 PST by Adam Barth
Modified: 2008-06-09 00:41 PDT (History)
2 users (show)

See Also:


Attachments
Fixes wrong tests (2.64 KB, patch)
2008-01-12 13:28 PST, Adam Barth
darin: review-
Details | Formatted Diff | Diff
Improved patch (3.90 KB, patch)
2008-06-07 00:00 PDT, Adam Barth
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Barth 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.
Comment 1 Adam Barth 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.
Comment 2 Alexey Proskuryakov 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.
Comment 3 Adam Barth 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.
Comment 4 Alexey Proskuryakov 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 :).
Comment 5 Darin Adler 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.
Comment 6 Darin Adler 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.
Comment 7 Adam Barth 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.
Comment 8 Darin Adler 2008-06-08 13:56:28 PDT
Comment on attachment 21545 [details]
Improved patch

r=me
Comment 9 Adam Barth 2008-06-09 00:41:37 PDT
Fixed in r34463.