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

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2015
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

document.queryCommandSupported('copy') is false when executed from Devtools

Project Member Reported by mattgaunt@chromium.org, Apr 10 2015

Issue description

Version: 44.0.2358.0 (Official Build) canary (64-bit)
OS: OS X

What steps will reproduce the problem?
1. Go to any random page in Chrome version 44
2. Open Devtools and go to the console
3. run the command document.queryCommandSupported('copy');

What is the expected output? What do you see instead?
The response should be true, instead it's false. However running code in a jsbin, the API actually returns true. There is a mis-match between these two uses of the API.


 

Comment 1 by tkent@chromium.org, Apr 13 2015

Labels: -Cr-Blink Cr-Blink-Editing
Cc: abhijee...@samsung.com
current implementation of queryCommandSupported() check whether javaScript can access clipboard. As it is not allowed it is returning false. 
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/editing/EditorCommand.cpp&q=supportedCopyCut&sq=package:chromium&l=1179

queryCommandSupported() should only check whether command is present in CommandMap. If it is supported queryCommandEnabled() should check whether is it actually available to use.

Comment 3 by tkent@chromium.org, Apr 16 2015

Cc: dcheng@chromium.org
@ mattgaunt
On Version 44.0.2371.0 canary (64-bit) windows 7
I ran document.queryCommandSupported('copy'); through http://jsfiddle.net/4opw6j05/1/ it is returning FALSE. If u run document.queryCommandSupported('copy'); through console also it is returning FALSE.

Behavior is identical in both scenarios, Could you please verify once again ?
Yup everything is now false.

This is while I raised this bug: https://code.google.com/p/chromium/issues/detail?id=476508

My fear is that  issue 476508  will be fixed and then Devtools will start returning a different value again.

Either close this bug or block it on the other issue and treat this bug as nothing more than a confirmation that Devtools is doing the right thing.
I would agree that this bug should be considered blocked on  issue 476508 .

Comment 7 by yosin@chromium.org, Aug 11 2015

Status: Available

Comment 8 by yosin@chromium.org, Oct 15 2015

Owner: yosin@chromium.org
Status: Started
In review: In review: http://crrev.com/1406713002
Project Member

Comment 9 by bugdroid1@chromium.org, Oct 15 2015

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

commit bf9013658c0eb493db5dd0941532160dc9fdd0c7
Author: yosin <yosin@chromium.org>
Date: Thu Oct 15 09:18:52 2015

Make queryCommandSupported(copy|cut|paste) always return true

This patch makes |document.queryCommandSupported(name)| always return true for
"Copy", "Cut", and "Paste" commands to follow the editing API specification.

Before this patch, |queryCommandSupported()| returns value based on clipboard
accessibility, e.g. "clipboardRead" and "clipboardWrite" permission in Chrome
extensions. This behavior ins't compatible with the editing specification and
its intention. |queryCommandSupported()| should returns true for command
which can be passed to |execCommand()|, and other |queryCommandXXX()|.

Here is a table of return value of |execute()| and |isEnabled()| with
clipboard access permission and Editor.canCopy/Cut/Paste

Can R/W   Editor.can isEnabled execute
Clipboard Copy/Paste
true      true       true      true
true      false      false     true
false     true       false     false
false     false      false     false

BUG= 476508 ,  475868 
TEST=LayoutTests/editing/pasteboard/copy-cut-paste-supported.html

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

Cr-Commit-Position: refs/heads/master@{#354240}

[add] http://crrev.com/bf9013658c0eb493db5dd0941532160dc9fdd0c7/third_party/WebKit/LayoutTests/editing/pasteboard/copy-cut-paste-supported.html
[modify] http://crrev.com/bf9013658c0eb493db5dd0941532160dc9fdd0c7/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp

Comment 10 by yosin@chromium.org, Oct 16 2015

Status: Fixed

Sign in to add a comment