New issue
Advanced search Search tips

Issue 735634 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 2
Type: Compat



Sign in to add a comment

ScriptError thrown when crossorigin iframe is touched/clicked

Reported by kue...@amazon.com, Jun 21 2017

Issue description

Steps to reproduce the problem:
1.  Load a webpage that loads an iframe on a different domain than the host (attached example html works).
2. Drag or Tap the crossorigin iframe. 

What is the expected behavior?
No error is thrown derived from the touch event. 

What went wrong?
A SecurityError (DOM Exception 18) is thrown, but propagates up as a ScriptError. 

Stack: 
c - user-script:1:343 
a - user-script:1:356 
l - user-script:1:296 
getElementFromPoint - user-script:1:276 
Global Code - Script Element 110:2 

Did this work before? No 

Chrome version: 58.0.3029.110  Channel: stable
OS Version: 10.3
Flash Version: 

It looks like the problem is here: https://chromium.googlesource.com/chromium/src/+blame/master/ios/web/web_state/js/resources/context_menu.js#220

Similar to https://bugs.chromium.org/p/chromium/issues/detail?id=709132 (chrome autofill issue), but because of location of the script, a script error is thrown instead. Also, the attached example html was taken from the other bug report and can be used to reproduce this issue.
 
index.html
283 bytes View Download

Comment 1 by bokan@chromium.org, Jun 22 2017

Cc: bokan@chromium.org
Components: -Blink Mobile>WebView>Glue
Owner: danyao@chromium.org
Danyao, looks like that file is your domain - mind taking a look and triaging as appropriate?
Status: Assigned (was: Unconfirmed)

Comment 3 by danyao@chromium.org, Jun 28 2017

Labels: -Type-Bug Type-Compat
This is the same issue as  crbug.com/709132 : in both cases, Chrome injects JavaScript to handle context menu and password autofill, but because the script is only injected to the main frame and tries to look into iframes, it triggers the SecurityError when the frame is cross-origin.

The true fix is to inject JavsScript into the iframe (crbug.com/228179). In the mean time, maybe we can work around this by detecting in context-menu.js and autofill.js if the frame is cross origin, and if so, do not poke into them.

Comment 4 by danyao@chromium.org, Jun 28 2017

Status: Started (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 29 2017

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

commit b7bec2eef66b7901300fb18a85f334ce7b6ab2dd
Author: Danyao Wang <danyao@google.com>
Date: Thu Jun 29 14:16:46 2017

Change origin check for context menu to avoid SecurityError.

Accessing contentDocument on a cross-origin iframe causes WebKit to
throw a SecurityError that can't be caught by try/catch. Change the
check to rely on information available in the parent frame (i.e. src)
to avoid the error.

Bug:  735634 
Change-Id: Ia1017dfe7aea411b7b57766a91a06259ea4e7a14
Reviewed-on: https://chromium-review.googlesource.com/553639
Reviewed-by: Eugene But <eugenebut@chromium.org>
Commit-Queue: Danyao Wang <danyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#483357}
[modify] https://crrev.com/b7bec2eef66b7901300fb18a85f334ce7b6ab2dd/ios/web/web_state/js/common_js_unittest.mm
[modify] https://crrev.com/b7bec2eef66b7901300fb18a85f334ce7b6ab2dd/ios/web/web_state/js/resources/common.js
[modify] https://crrev.com/b7bec2eef66b7901300fb18a85f334ce7b6ab2dd/ios/web/web_state/js/resources/context_menu.js

Comment 6 by danyao@chromium.org, Jun 29 2017

Status: Fixed (was: Started)

Sign in to add a comment