Bug 1695659 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

_Firefox 88.0a1 (2021-03-01) (64-bit) Win7_

**Info**
- activeTab permission
- paste into `textarea`, `input` and `contenteditable`
- Pasting from clipboard into above on context-menu onclick
- same origin `file:///C:/Users/....` in test
- using `tabs.executeScript()` to inject
- Injection into all applicable frames are confirmed
- there are no errors
- `document.execCommand('paste')` returns `true` when works and returns `false` when it fails


**Testing on 2 HTML pages**

- An HTML page with `input`, `textarea` & `contenteditable` elements
- As above plus an `iframe` that also has `input`, `textarea` & `contenteditable` elements

Also tested on random web pages. 

**allFrames: false**
```js
const code = `(() => document.execCommand('paste'))();`;
chrome.tabs.executeScript({code}, (result = []) => {
  console.log(result);
});
```
**result**
- tab with 1 frame: ✅ paste works in top-frame `// Array [ true ]`
- tab with 1+ frames: ❌ paste fails in top-frame `// Array [ false ]`
- tab with 1+ frames: ❌ paste fails in sub-frame `// Array [ false ]`

**allFrames: true**
```js
const code = `(() => document.execCommand('paste'))();`;
chrome.tabs.executeScript({code, allFrames: true}, (result = []) => {
  console.log(result);
});
```
**result**

- tab with 1 frame: ✅ paste works in top-frame `// Array [ true ]`
- tab with 1+ frames: ❌ paste fails in top-frame `// Array [ false, true ]`
- tab with 1+ frames: ✅ paste works in sub-frame `// Array [ false, true ]`


**Result summary**
The behaviour of `document.execCommand('paste')` appears to be inconsistent when there are more than one frames in a tab.
_Firefox 88.0a1 (2021-03-01) (64-bit) Win7_

**Info**
- activeTab permission
- paste into `textarea`, `input` and `contenteditable`
- Pasting from clipboard into above on context-menu onclick
- same origin `file:///C:/Users/....` in test
- using `tabs.executeScript()` to inject
- Injection into all applicable frames are confirmed
- there are no errors
- `document.execCommand('paste')` returns `true` when works and returns `false` when it fails


**Testing on 2 HTML pages**

- An HTML page with `input`, `textarea` & `contenteditable` elements
- As above plus an `iframe` that also has `input`, `textarea` & `contenteditable` elements

Also tested on random web pages. 

**allFrames: false**
```js
const code = `(() => document.execCommand('paste'))();`;
chrome.tabs.executeScript({code}, (result = []) => {
  console.log(result);
});
```
**Result**
- tab with 1 frame: ✅ paste works in top-frame `// Array [ true ]`
- tab with 1+ frames: ❌ paste fails in top-frame `// Array [ false ]`
- tab with 1+ frames: ❌ paste fails in sub-frame `// Array [ false ]`

**allFrames: true**
```js
const code = `(() => document.execCommand('paste'))();`;
chrome.tabs.executeScript({code, allFrames: true}, (result = []) => {
  console.log(result);
});
```
**Result**

- tab with 1 frame: ✅ paste works in top-frame `// Array [ true ]`
- tab with 1+ frames: ❌ paste fails in top-frame `// Array [ false, true ]`
- tab with 1+ frames: ✅ paste works in sub-frame `// Array [ false, true ]`


**Result Summary**
The behaviour of `document.execCommand('paste')` appears to be inconsistent when there are more than one frames in a tab.

Back to Bug 1695659 Comment 0