Bug 65013 - instanceof HTMLSourceElement Fails
Summary: instanceof HTMLSourceElement Fails
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tom Zakrajsek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-22 00:01 PDT by eclipsechasers2
Modified: 2011-08-22 12:15 PDT (History)
7 users (show)

See Also:


Attachments
HTML source which demonstrates problem (1.14 KB, text/html)
2011-07-22 00:01 PDT, eclipsechasers2
no flags Details
Patch (8.60 KB, patch)
2011-08-19 13:34 PDT, Tom Zakrajsek
rniwa: review-
Details | Formatted Diff | Diff
Patch - per reviewer feedback (8.73 KB, patch)
2011-08-19 16:29 PDT, Tom Zakrajsek
ap: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
Patch (10.15 KB, patch)
2011-08-20 00:27 PDT, Tom Zakrajsek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eclipsechasers2 2011-07-22 00:01:46 PDT
Created attachment 101699 [details]
HTML source which demonstrates problem

For audio/video tag fallback, W3C recommends an onerror which, among other things, tests child nodes of the element to see if they are instanceof HTMLElementSource. This test works (on windows 7) in Firefox, Opera, and IE9; it fails in Safari and Chrome (Uncaught ReferenceError: HTMLSourceElement is not defined). HTML to demonstrate this problem is attached.
Comment 1 Alexey Proskuryakov 2011-07-22 14:45:01 PDT
There is no HTMLSourceElement in DOMWindow.idl; there should be.
Comment 2 Tom Zakrajsek 2011-08-16 19:14:08 PDT
Just to throw it out there, I think the fix to get this working is simple but there's a wrinkle.  The interface is statically conditional on video.  So if the build isn't built with video enabled, you'll still get this exception.
Comment 3 Tom Zakrajsek 2011-08-17 16:53:29 PDT
(In reply to comment #2)
> Just to throw it out there, I think the fix to get this working is simple but there's a wrinkle.  The interface is statically conditional on video.  So if the build isn't built with video enabled, you'll still get this exception.

I was wrong.  The "source" tag (as an HTMLUnknownElement) handles it correctly by not executing the onerror method.  The continued exception was because the "run separate instance" link is calling instanceof HTMLSourceElement unconditionally. That's not ok.  I'll upload the code patch and test-results update shortly.
Comment 4 Tom Zakrajsek 2011-08-19 13:34:10 PDT
Created attachment 104555 [details]
Patch
Comment 5 Alexey Proskuryakov 2011-08-19 13:51:07 PDT
Comment on attachment 104555 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=104555&action=review

> Source/WebCore/page/DOMWindow.idl:472
> +        attribute [Conditional=VIDEO] HTMLSourceElementConstructor HTMLSourceElement;

Should this be EnabledAtRuntime, like HTMLVideoElement?
Comment 6 Ryosuke Niwa 2011-08-19 14:09:46 PDT
Comment on attachment 104555 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=104555&action=review

> Source/WebCore/ChangeLog:7
> +

There's no description was to why we're adding this property nor what it does.
We should definitely add such a description and refer to the relevant part of whatever spec that mandantes this behavior.
r- for the lack of documentation.
Comment 7 Alexey Proskuryakov 2011-08-19 15:57:09 PDT
I don't think that this warrants a lot of discussion - constructors for all elements should be available on DOIMWindow. The missing EnabledAtRuntime should be almost certainly added though.
Comment 8 Tom Zakrajsek 2011-08-19 16:01:51 PDT
I agree about the EnabledAtRuntime, and have re-built and verified the effect.  I was just sitting here toiling with how to describe the necessity for putting this is, other than to say "for consistency with all the other elements".  I guess that will be the note then.  Will upload the patch shortly.
Comment 9 Tom Zakrajsek 2011-08-19 16:29:44 PDT
Created attachment 104589 [details]
Patch - per reviewer feedback
Comment 10 Alexey Proskuryakov 2011-08-19 16:35:12 PDT
Comment on attachment 104589 [details]
Patch - per reviewer feedback

View in context: https://bugs.webkit.org/attachment.cgi?id=104589&action=review

This patch is not marked for review.

> Source/WebCore/ChangeLog:4
> +        Add HTMLSourceElement to DOMWindow.idl for consistency.  Constructors for
> +        all elements should be available on DOMWindow.

This is not how we usually do this. Bug title goes above the bug URL, and explanations go to the lines generated by the script (like "* page/DOMWindow.idl:" line below), or a general overview could go above those lines.
Comment 11 Alexey Proskuryakov 2011-08-19 16:42:59 PDT
Comment on attachment 104589 [details]
Patch - per reviewer feedback

Per IRC discussion, this was meant for review, and I think that this is fine to land.
Comment 12 WebKit Review Bot 2011-08-19 16:49:16 PDT
Comment on attachment 104589 [details]
Patch - per reviewer feedback

Attachment 104589 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/9438511
Comment 13 Tom Zakrajsek 2011-08-20 00:27:22 PDT
Created attachment 104617 [details]
Patch

Fixed V8 bindings.
Comment 14 WebKit Review Bot 2011-08-20 11:40:29 PDT
Comment on attachment 104617 [details]
Patch

Clearing flags on attachment: 104617

Committed r93482: <http://trac.webkit.org/changeset/93482>
Comment 15 WebKit Review Bot 2011-08-20 11:40:34 PDT
All reviewed patches have been landed.  Closing bug.
Comment 16 Darin Adler 2011-08-21 13:20:26 PDT
Comment on attachment 104617 [details]
Patch

This patch missed many affected tests!
Comment 17 Alexey Proskuryakov 2011-08-21 17:14:37 PDT
Adam, Eric, do you know why the commit queue landed the patch if it didn't pass some tests?

/me recalls his unsuccessful argument that mega-tests dumping every property of the global object are evil, as maintaining them is a significant ongoing cost, and benefit is trivial.
Comment 18 Adam Barth 2011-08-21 18:22:34 PDT
The commily tests chromium-linux.  Did any of the tests fail there?  I'd recommend setting up a Mac EWS bot if you'd like folks not to breaks tests on Mac.
Comment 19 Adam Barth 2011-08-21 18:37:42 PDT
(I agree with Alexey that the tests that dump the global object are more work to maintain than they're worth.)
Comment 20 Eric Seidel (no email) 2011-08-22 12:15:44 PDT
They should all just work from some snapshot of objects accessible from the global object. :)