Bug 119329 - Make DOMImplementation::hasFeature() behave according to specification
Summary: Make DOMImplementation::hasFeature() behave according to specification
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: http://dom.spec.whatwg.org/#dom-domim...
Keywords: BlinkMergeCandidate, WebExposed
Depends on:
Blocks:
 
Reported: 2013-07-31 01:29 PDT by Chris Dumez
Modified: 2013-08-28 14:31 PDT (History)
17 users (show)

See Also:


Attachments
WIP patch (60.90 KB, patch)
2013-07-31 03:20 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 (1.80 MB, application/zip)
2013-07-31 04:00 PDT, Build Bot
no flags Details
Patch (80.35 KB, patch)
2013-07-31 04:22 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2013-07-31 01:29:16 PDT
Make DOMImplementation::hasFeature() behave according to the latest specification:
http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature

Specifically, the function should now return true unconditionally for any non-SVG feature.
This behavior is consistent with Firefox and since recently Blink.

hasFeature() originally would report whether the user agent claimed to support a
given DOM feature, but experience proved it was not nearly as reliable or granular
as simply checking whether the desired interfaces, attributes, or methods existed.
As such, it should no longer be used, but continues to exist (and simply returns
true) so that old pages don't stop working.

Corresponding Blink revision:
https://src.chromium.org/viewvc/blink?revision=155050&view=revision
Comment 1 Chris Dumez 2013-07-31 03:20:24 PDT
Created attachment 207825 [details]
WIP patch
Comment 2 Build Bot 2013-07-31 04:00:56 PDT
Comment on attachment 207825 [details]
WIP patch

Attachment 207825 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/1299609

New failing tests:
svg/W3C-SVG-1.1-SE/types-dom-06-f.svg
svg/W3C-SVG-1.1/struct-dom-03-b.svg
Comment 3 Build Bot 2013-07-31 04:00:59 PDT
Created attachment 207829 [details]
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-11  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.4
Comment 4 Chris Dumez 2013-07-31 04:22:19 PDT
Created attachment 207833 [details]
Patch
Comment 5 Chris Dumez 2013-08-09 00:40:13 PDT
Any feedback on this patch? It simplifies the code and makes us in line with the specification, Blink and Gecko.
Comment 6 Ryosuke Niwa 2013-08-09 10:06:43 PDT
Comment on attachment 207833 [details]
Patch

Seems sensible.
Comment 7 WebKit Commit Bot 2013-08-09 10:29:56 PDT
Comment on attachment 207833 [details]
Patch

Clearing flags on attachment: 207833

Committed r153901: <http://trac.webkit.org/changeset/153901>
Comment 8 WebKit Commit Bot 2013-08-09 10:30:00 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Lev Solntsev 2013-08-14 12:48:51 PDT
There is a big catch: since Webkit doesn't support DOM3 Wheel Events (Bug 94081), hasFeature('Event.wheel', '3.0') wheel return false positive on this. It's used wildly because MS IE doesn't have “onwheel” property, so checks like

    var hasWheel = Modernizr.hasEvent('wheel') || document.implementation.hasFeature('Event.wheel', '3.0');

like suggested in corresponding Modernzr bug (https://github.com/Modernizr/Modernizr/issues/985) will fail in Webkit.
Comment 10 Ryosuke Niwa 2013-08-20 17:48:40 PDT
(In reply to comment #9)
> There is a big catch: since Webkit doesn't support DOM3 Wheel Events (Bug 94081), hasFeature('Event.wheel', '3.0') wheel return false positive on this. It's used wildly because MS IE doesn't have “onwheel” property, so checks like
> 
>     var hasWheel = Modernizr.hasEvent('wheel') || document.implementation.hasFeature('Event.wheel', '3.0');
> 
> like suggested in corresponding Modernzr bug (https://github.com/Modernizr/Modernizr/issues/985) will fail in Webkit.

That does sound pretty bad.  Perhaps we should special case this.
Comment 11 Chris Dumez 2013-08-20 22:46:56 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > There is a big catch: since Webkit doesn't support DOM3 Wheel Events (Bug 94081), hasFeature('Event.wheel', '3.0') wheel return false positive on this. It's used wildly because MS IE doesn't have “onwheel” property, so checks like
> > 
> >     var hasWheel = Modernizr.hasEvent('wheel') || document.implementation.hasFeature('Event.wheel', '3.0');
> > 
> > like suggested in corresponding Modernzr bug (https://github.com/Modernizr/Modernizr/issues/985) will fail in Webkit.
> 
> That does sound pretty bad.  Perhaps we should special case this.

Or add support for the wheel event in WebKit? I landed a wheel event support in Blink yesterday. I can port the patch over to WebKit. Wheel event is standard (DOM level 3) and now supported by all major browsers (Chrome, IE, FF) except Safari/WebKit.
Comment 12 Ryosuke Niwa 2013-08-28 14:31:35 PDT
The wheel event support has been added in the bug 94081.