RESOLVED FIXED Bug 43650
Some IDL attributes don't reflect URL content attributes properly
https://bugs.webkit.org/show_bug.cgi?id=43650
Summary Some IDL attributes don't reflect URL content attributes properly
Aryeh Gregor
Reported 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.)
Attachments
Patch (27.49 KB, patch)
2010-08-09 09:18 PDT, Darin Adler
no flags
Patch (35.21 KB, patch)
2010-08-27 18:50 PDT, Darin Adler
sam: review+
Alexey Proskuryakov
Comment 1 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?
Aryeh Gregor
Comment 2 2010-08-08 10:54:52 PDT
Yes, I still see the same problems with a WebKit nightly as with Safari 5.
Darin Adler
Comment 3 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!
Darin Adler
Comment 4 2010-08-08 22:41:48 PDT
I see what happened. My test has expected failures! I haven’t fixed them yet.
Darin Adler
Comment 5 2010-08-08 23:34:03 PDT
Working on the fix. Mostly done.
Darin Adler
Comment 6 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.
Darin Adler
Comment 7 2010-08-09 09:18:54 PDT
Darin Adler
Comment 8 2010-08-27 18:50:14 PDT
Sam Weinig
Comment 9 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.
Darin Adler
Comment 10 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!
Darin Adler
Comment 11 2010-08-28 22:49:38 PDT
Darin Adler
Comment 12 2010-08-28 22:52:24 PDT
Note You need to log in before you can comment on or make changes to this bug.