New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 653860 link

Starred by 7 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 1
Type: Bug



Sign in to add a comment

setPointerCapture API throws invalid DOMError inside iframe

Reported by sebp.mue...@gmail.com, Oct 7 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36

Example URL:
http://live.yworks.com/demobrowser/#Graph-Viewer

Steps to reproduce the problem:
1. Put the following code into an Iframe:

<div id="target" style="background: blue; width: 200px; height: 200px;">Drag me</div>

 <script>
   var target = document.getElementById("target");

   function touchDownListener(evt) {
     if (evt.pointerType === "touch") {
       target.setPointerCapture(evt.pointerId);
     }
   }
   target.addEventListener("pointerdown", touchDownListener);
 </script>

2. Open the iframe container file
3. Open dev tools and press the toggle device button to simulate touch events and enable "break on exception"
4. Start press the mouse / touch down on the blue div
5. You will get an exception in the code line where setPointerCapture is called saying:
"Failed to execute 'setPointerCapture' on 'Element': InvalidPointerId"

What is the expected behavior?
This should work just like it does in other browsers that support the point API and like it does when you open the iframe as a top-level window.

What went wrong?
An exception is thrown and the pointer capture cannot be obtained.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 55.0.2883.0  Channel: canary
OS Version: 10.0
Flash Version: Shockwave Flash 23.0 r0

This is a blocker for the release of the pointer events API since code that is written to be browser agnostic and works with existing implementations now breaks if run inside Chrome.
 
Cc: dtapu...@chromium.org mustaq@chromium.org rbyers@chromium.org
Components: -Blink Blink>Input
Labels: -Pri-2 M-55 ReleaseBlock-Stable Pri-1
Owner: nzolghadr@chromium.org
Status: Assigned (was: Unconfirmed)
Labels: PointerEvent Hotlist-Input-Dev

Comment 3 by ajha@chromium.org, Oct 12 2016

Friendly ping to get an update on this issue from  nzolghadr@. 
Status: Started (was: Assigned)
I am seeing reports of this bug for this UAString:
Mozilla/5.0 (Linux; Android 4.2.2; GT-P5113 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.50 Safari/537.36

Can you please confirm which GA versions of Chrome are affected by this bug? 
Also I would like to know if there is a workaround other than doing browser sniffing and reverting to the touch API. Any progress on this issue would be very much appreciated; especially if this has already been released. Thank you.
The issue should be in M54 (only if you enable web-experimental-flag to get pointerevents API enabled) and in M55 which is still in Canary.
The CL is uploaded for the issue. Waiting to go through the reviews.

There is a workaround only if your iframe is in the same domain as the main page. Basically you can redirect the capture API to the root frame and ask the root frame to capture it to the element inside the inner iframe. But I assume it would only work if they are from the same domain so they have access to the elements inside each other.
Project Member

Comment 7 by bugdroid1@chromium.org, Oct 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/85c41444f11d3c24ea24d3c776d96dbe913cad03

commit 85c41444f11d3c24ea24d3c776d96dbe913cad03
Author: nzolghadr <nzolghadr@chromium.org>
Date: Wed Oct 19 15:49:00 2016

Check the root pointer events as well for capture

Touch pointer events events are being routed to
the target directly without passing all the
iframes' EventHandlers. As a result the inner
EventHandler has no clue whether a given pointerId
is active or capturable if that is a touch pointer
event.
This CL adds the check to every iframe to also
checks the root frame for the pointer event and
it allows the capture if that pointer event was
sent to a node inside the requested iframe.

BUG= 653860 

Review-Url: https://chromiumcodereview.appspot.com/2408133007
Cr-Commit-Position: refs/heads/master@{#426205}

[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-capture-in-iframe-expected.txt
[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-capture-in-iframe.html
[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/Source/core/events/PointerEventFactory.h
[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/Source/core/input/EventHandler.h
[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/Source/core/input/PointerEventManager.cpp
[modify] https://crrev.com/85c41444f11d3c24ea24d3c776d96dbe913cad03/third_party/WebKit/Source/core/input/PointerEventManager.h

Labels: Merge-Request-55

Comment 9 by dimu@chromium.org, Oct 21 2016

Labels: -Merge-Request-55 Merge-Approved-55 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M55 (branch: 2883)
Project Member

Comment 10 by bugdroid1@chromium.org, Oct 24 2016

Labels: -merge-approved-55 merge-merged-2883
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/094b89dce56c46509a394689c3bc391d57660d00

commit 094b89dce56c46509a394689c3bc391d57660d00
Author: Navid Zolghadr <nzolghadr@chromium.org>
Date: Mon Oct 24 18:01:07 2016

Check the root pointer events as well for capture

Touch pointer events events are being routed to
the target directly without passing all the
iframes' EventHandlers. As a result the inner
EventHandler has no clue whether a given pointerId
is active or capturable if that is a touch pointer
event.
This CL adds the check to every iframe to also
checks the root frame for the pointer event and
it allows the capture if that pointer event was
sent to a node inside the requested iframe.

BUG= 653860 

Review-Url: https://chromiumcodereview.appspot.com/2408133007
Cr-Commit-Position: refs/heads/master@{#426205}
(cherry picked from commit 85c41444f11d3c24ea24d3c776d96dbe913cad03)

Review URL: https://codereview.chromium.org/2447773004 .

Cr-Commit-Position: refs/branch-heads/2883@{#242}
Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768}

[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-capture-in-iframe-expected.txt
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-capture-in-iframe.html
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/events/PointerEventFactory.h
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/EventHandler.h
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/PointerEventManager.cpp
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/PointerEventManager.h

Status: Fixed (was: Started)
I have tested the fix with Canary and it worked. Just merged it to 55.
Cc: kavvaru@chromium.org
Labels: TE-Verified-M55 TE-Verified-55.0.2883.28
Tested the issue on Windows 7 using chrome version 55.0.2883.28 with the below steps

1.Go to http://live.yworks.com/demobrowser/#Graph-Viewer
2.Open dev tools and press the toggle device button and enable "break on exception"
3.clicked on blue div not observed the error message .

Please find the attached screen cast for the same.Adding TE-Verified labels.

Thanks,
653860.mp4
2.3 MB View Download
I can confirm the bug has been fixed for our demo. Thank you all.
Thanks for reporting the bug and confirming the fix. Please do report any bug or unexpected behavior you see with the pointer events and cc me and I'll take a look as soon as possible.
Just one more question about your video: I cannot understand nor reproduce what you are doing in the video. I checked this on the current beta and canary version and when I drag the pointer across the screen this always moves the contents of the canvas (the elements on the screen move around like they do when you use the mouse). In your video you run into a breakpoint or exception in the end that is very unrelated to the original issue - it *is* a pointer event listener, but I don't see why you run into the breakpoint/exception/whatever. That shouldn't be the case as far as I can see and it does not happen in my tests. Can you provide more details?
What kavvaru@ did was to press pause button at the end of the video and the very next script that ran stopped at the very first line. So basically it didn't break on exception. It hit the break on the very first line that script start executing after kavvaru@ pressed that pause button on the left side of the panel. I don't think that was particularly related to this issue but anyway it was in the video. So don't worry about that.
Project Member

Comment 17 by bugdroid1@chromium.org, Oct 27 2016

Labels: merge-merged-2840
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/094b89dce56c46509a394689c3bc391d57660d00

commit 094b89dce56c46509a394689c3bc391d57660d00
Author: Navid Zolghadr <nzolghadr@chromium.org>
Date: Mon Oct 24 18:01:07 2016

Check the root pointer events as well for capture

Touch pointer events events are being routed to
the target directly without passing all the
iframes' EventHandlers. As a result the inner
EventHandler has no clue whether a given pointerId
is active or capturable if that is a touch pointer
event.
This CL adds the check to every iframe to also
checks the root frame for the pointer event and
it allows the capture if that pointer event was
sent to a node inside the requested iframe.

BUG= 653860 

Review-Url: https://chromiumcodereview.appspot.com/2408133007
Cr-Commit-Position: refs/heads/master@{#426205}
(cherry picked from commit 85c41444f11d3c24ea24d3c776d96dbe913cad03)

Review URL: https://codereview.chromium.org/2447773004 .

Cr-Commit-Position: refs/branch-heads/2883@{#242}
Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768}

[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-capture-in-iframe-expected.txt
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-capture-in-iframe.html
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/events/PointerEventFactory.h
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/EventHandler.cpp
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/EventHandler.h
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/PointerEventManager.cpp
[modify] https://crrev.com/094b89dce56c46509a394689c3bc391d57660d00/third_party/WebKit/Source/core/input/PointerEventManager.h

Comment 18 by dimu@google.com, Nov 4 2016

Labels: -merge-merged-2840
[Automated comment] removing mislabelled merge-merged-2840

Sign in to add a comment