Bug 96295 - window.Touch and TouchList should exist when touch events are enabled
Summary: window.Touch and TouchList should exist when touch events are enabled
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rick Byers
URL:
Keywords: WebExposed
Depends on: 106071
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-10 11:23 PDT by Rick Byers
Modified: 2013-07-10 01:34 PDT (History)
11 users (show)

See Also:


Attachments
Patch (1.62 KB, patch)
2012-11-21 20:49 PST, Rick Byers
no flags Details | Formatted Diff | Diff
Patch (7.66 KB, patch)
2012-11-22 12:57 PST, Rick Byers
no flags Details | Formatted Diff | Diff
Diff against ToT for testing (10.60 KB, patch)
2013-01-03 19:54 PST, Rick Byers
no flags Details | Formatted Diff | Diff
Diff against bug 106071 for review (14.29 KB, patch)
2013-01-03 19:56 PST, Rick Byers
no flags Details | Formatted Diff | Diff
Patch for landing (14.16 KB, patch)
2013-01-04 11:49 PST, Rick Byers
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Byers 2012-09-10 11:23:18 PDT
W3C TouchEvent spec conformance tests (http://w3c-test.org/webevents/tests/touch-events-v1/submissions/Mozilla/single-touch.html) fail with:
Interface names are correct.	TouchList is not defined

I.e., 'e instanceof TouchList' throws, even when e is in fact an instance of a TouchList.  Maybe something wrong with the bindings here.

Tested on ChromeOS and Android.  I've also hear this fails on Nokia devices (qt port?)
Comment 1 Rick Byers 2012-11-21 20:49:45 PST
Created attachment 175578 [details]
Patch
Comment 2 Adam Barth 2012-11-21 22:54:48 PST
Comment on attachment 175578 [details]
Patch

Looks fine, but we need a test.  It should be very easy to test.
Comment 3 Rick Byers 2012-11-22 11:45:14 PST
(In reply to comment #2)
> (From update of attachment 175578 [details])
> Looks fine, but we need a test.  It should be very easy to test.

Thanks!  I intentionally didn't set r? yet because I still needed a test (just trying to find out which pattern to follow for this sort of test - was a little confused by the existing window property tests, wanted to see what failed in EWS due to the new member - apparently nothing!).  I should have included 'no for review' in the patch description.
Comment 4 Rick Byers 2012-11-22 12:44:57 PST
Touch is also missing.
TouchEvent exists.
Comment 5 Rick Byers 2012-11-22 12:57:52 PST
Created attachment 175705 [details]
Patch
Comment 6 WebKit Review Bot 2012-11-22 23:45:26 PST
Comment on attachment 175705 [details]
Patch

Clearing flags on attachment: 175705

Committed r135562: <http://trac.webkit.org/changeset/135562>
Comment 7 WebKit Review Bot 2012-11-22 23:45:32 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Rick Byers 2013-01-03 18:33:59 PST
I'm reverting this version (in bug 106071) as it broke a poorly written website's mobile device detection logic.  Instead I think we should add these properties dynamically to temporarily mitigate the compat issue, exactly as we do for window.ontouchstart, etc.
Comment 9 Rick Byers 2013-01-03 19:54:27 PST
Created attachment 181270 [details]
Diff against ToT for testing
Comment 10 Rick Byers 2013-01-03 19:56:05 PST
Created attachment 181271 [details]
Diff against bug 106071 for review
Comment 11 Rick Byers 2013-01-03 20:00:48 PST
This mostly just re-lands the original patch, except that I also mark all 3 touch event constructors (the 2 new ones, as well as window.TouchEvent) as V8EnabledAtRuntime.  Rather than add 2 new runtime-enabled feature APIs, I consolodated them all under the single 'enableTouch' API.

I tried to write a test that validates all these APIs are undefined when the runtime feature has been disabled, but it's not clear to me how to do it.  Doing it in a LayoutTest via InternalSettings is too late - V8 has already created the window object, etc.  I couldn't find any other example where this is tested (checked a few other V8EnabledAtRuntime features), and given the simplicity of the code I figure it's fine not to explicitly test that.  Let me know if this is really worth trying to test explicitly.
Comment 12 Kentaro Hara 2013-01-04 09:44:33 PST
Comment on attachment 181271 [details]
Diff against bug 106071 for review

LGTM
Comment 13 Rick Byers 2013-01-04 11:49:19 PST
Created attachment 181351 [details]
Patch for landing
Comment 14 Rick Byers 2013-01-04 11:55:03 PST
Thanks!
Comment 15 WebKit Review Bot 2013-01-04 13:14:17 PST
Comment on attachment 181351 [details]
Patch for landing

Clearing flags on attachment: 181351

Committed r138843: <http://trac.webkit.org/changeset/138843>
Comment 16 WebKit Review Bot 2013-01-04 13:14:23 PST
All reviewed patches have been landed.  Closing bug.