Bug 43650 - Some IDL attributes don't reflect URL content attributes properly
Summary: Some IDL attributes don't reflect URL content attributes properly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Minor
Assignee: Darin Adler
URL: http://aryeh.name/tests/reflection.html
Keywords:
Depends on:
Blocks: 41077
  Show dependency treegraph
 
Reported: 2010-08-06 15:43 PDT by Aryeh Gregor
Modified: 2010-08-28 22:53 PDT (History)
2 users (show)

See Also:


Attachments
Patch (27.49 KB, patch)
2010-08-09 09:18 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (35.21 KB, patch)
2010-08-27 18:50 PDT, Darin Adler
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aryeh Gregor 2010-08-06 15:43:31 PDT
Version:

Google Chrome	6.0.472.22 (Official Build 54852) dev
WebKit	534.3
V8	2.2.24.8
User Agent	Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.22 Safari/534.3
Command Line	 /opt/google/chrome/google-chrome

Minimal test case:

data:text/html,<!doctype html><script>var el = document.createElement("iframe"); el.setAttribute("src", ""); alert(el.src);</script>

This alerts an empty string, when it should alert the full current URL, according to HTML5:

http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#reflecting-content-attributes-in-idl-attributes

Replace iframe/src by audio/src, base/href, blockquote/cite, embed/src, form/action, ins/cite, source/src, video/src, or video/poster and the same bug occurs.  Replace it by other things, like a/href or img/src, and it does not.  I don't know why.  This problem occurs in real HTML files too, not just data URLs.

If you replace the "" with "foo", and switch from data URL to an actual file (I don't know what "foo" is supposed to resolve to relative to a data URL . . .), it gets weirder.  In a few of the above cases it works correctly -- specifically audio/src, source/src, video/src, video/poster -- but in all other cases it does not.

Safari 5 exhibits a similar problem, but with a somewhat smaller set of attributes: base/href, blockquote/cite, embed/src, form/action, iframe/src, ins/cite.  I'm not sure if it's the same bug but different versions, or entirely different bugs, but in either case it's appropriate for here, I guess.

Opera 10.60 exhibits similarly weird behavior in various different cases.  Firefox matches the spec in all cases I tested except form/action, where it's also wrong when setting to the empty string but right in other cases.  IE8 seems correct per spec in all cases.

(The URL given <http://aryeh.name/tests/reflection.html> is a test suite for IDL reflection that I'm working on right now.  It might not be fully correct yet; I'll try to isolate and file bugs one by one.  But it's a quick way to check all elements at once for this particular failure, if you ignore the other failing tests.)
Comment 1 Alexey Proskuryakov 2010-08-07 01:57:04 PDT
I think this was supposed to be addressed in bug 42087. Do you still see unexpected behavior in more recent builds?
Comment 2 Aryeh Gregor 2010-08-08 10:54:52 PDT
Yes, I still see the same problems with a WebKit nightly as with Safari 5.
Comment 3 Darin Adler 2010-08-08 22:40:08 PDT
In the case of at least iframe/src and base/href, the bug is that the IDL file says [Reflect] and should say [Reflect,URL]. I am trying to figure out now why the fast/dom/script-tests/URL-attribute-reflection.js test gets this wrong.

Aryeh, my test for this is here: <http://trac.webkit.org/export/64963/trunk/LayoutTests/fast/dom/URL-attribute-reflection.html>. Not sure what I did wrong in the test!
Comment 4 Darin Adler 2010-08-08 22:41:48 PDT
I see what happened. My test has expected failures! I haven’t fixed them yet.
Comment 5 Darin Adler 2010-08-08 23:34:03 PDT
Working on the fix. Mostly done.
Comment 6 Darin Adler 2010-08-08 23:35:12 PDT
The reflection for these attributes is completely ignoring the fact that they are URL and always reflecting the DOM attribute’s value directly. The fix is simply to put [URL] in the IDL files, but that in turn requires fixing the isURLAttribute functions. Relatively simple.
Comment 7 Darin Adler 2010-08-09 09:18:54 PDT
Created attachment 63901 [details]
Patch
Comment 8 Darin Adler 2010-08-27 18:50:14 PDT
Created attachment 65801 [details]
Patch
Comment 9 Sam Weinig 2010-08-28 21:43:45 PDT
Comment on attachment 65801 [details]
Patch

My only issue is with the IDL syntax [Reflect,URL]. You seem to leave the space after the comma out everywhere. Is that something we do elsewhere? Otherwise, r=me.
Comment 10 Darin Adler 2010-08-28 21:44:54 PDT
(In reply to comment #9)
> My only issue is with the IDL syntax [Reflect,URL]. You seem to leave the space after the comma out everywhere.

Oops, I should add the space. Somehow it never occurred to me!
Comment 11 Darin Adler 2010-08-28 22:49:38 PDT
http://trac.webkit.org/changeset/66327
Comment 12 Darin Adler 2010-08-28 22:52:24 PDT
http://trac.webkit.org/changeset/66328