fune/browser/base/content/test/tabs/file_anchor_elements.html
Masayuki Nakano 96bd720118 Bug 1521396 - Make ClickHandlerChild prevent multiple action of middle click on link element for preventing middle click paste r=smaug
When user middle clicks a link, most users must not expect to expose clipboard
content to the web application.  Therefore, we should stop firing paste event
when user click a link with middle button.

This patch makes ClickHandlerChild.handleEvent() prevent multiple action
when it posts middle click event on a link.  Note that even if middle click
event is consumed, default event handler will dispatch paste event.
Unfortunately, this is compatible behavior with the other browsers.
Therefore, we cannot change this behavior with calling preventDefault() and
this is the reason why this patch adds Event.preventMultipleActions().

Out of scope of this bug though, if there is an element which looks like a
link but implemented with JS, web apps can steal clipboard content if user
enables middle click event and user just wants to open the link in new tab.
It might be better to stop dispatching paste event in any browsers and request
to change each web apps.

Differential Revision: https://phabricator.services.mozilla.com/D17209

--HG--
extra : moz-landing-system : lando
2019-01-22 07:28:55 +00:00

12 lines
No EOL
680 B
HTML

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Testing whether paste event is fired at middle click on anchor elements</title>
</head>
<body>
<p>Here is an <a id="a_with_href" href="http://example.com/#a_with_href">anchor element</a></p>
<p contenteditable>Here is an <a id="editable_a_with_href" href="http://example.com/#editable_a_with_href">editable anchor element</a></p>
<p contenteditable>Here is <span contenteditable="false"><a id="non-editable_a_with_href" href="http://example.com/#non-editable_a_with_href">non-editable anchor element</a></span>
<p>Here is an <a id="a_with_name" name="a_with_name">anchor element without href</a></p>
</body>
</html>