File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -47,12 +47,6 @@ const HUD = {
47
47
"vimium-hud-frame" ,
48
48
this . handleUIComponentMessage . bind ( this ) ,
49
49
) ;
50
- // Allow to access to the clipboard through iframes.
51
- // This is only valid/necessary for Chrome. Firefox will show this console warning:
52
- // 'Feature Policy: Skipping unsupported feature name "clipboard-read"'
53
- if ( ! Utils . isFirefox ( ) ) {
54
- this . hudUI . iframeElement . allow = "clipboard-read; clipboard-write" ;
55
- }
56
50
}
57
51
// this[data.name]? data
58
52
if ( this . tween == null ) {
Original file line number Diff line number Diff line change @@ -32,6 +32,16 @@ class UIComponent {
32
32
const isDomTests = iframeUrl . includes ( "?dom_tests=true" ) ;
33
33
this . iframeElement = DomUtils . createElement ( "iframe" ) ;
34
34
35
+ // Allow Vimium's iframes to have clipboard access in Chrome. This is needed when triggering
36
+ // some commands, like link hints or copyCurrentUrl, from within the help dialog. Firefox does
37
+ // not support clipboard-read and clipboard-write in the allow attribute. NOTE(philc): this
38
+ // permission has to be set before we append the iframe to the DOM, or Chrome will log the
39
+ // console error "Potential permissions policy violation: clipboard-read is not allowed in this
40
+ // document."
41
+ if ( ! Utils . isFirefox ( ) ) {
42
+ this . iframeElement . allow = "clipboard-read; clipboard-write" ;
43
+ }
44
+
35
45
const styleSheet = DomUtils . createElement ( "style" ) ;
36
46
styleSheet . type = "text/css" ;
37
47
// Default to everything hidden while the stylesheet loads.
Original file line number Diff line number Diff line change 1
1
import * as testHelper from "./test_helper.js" ;
2
+ import "../../lib/utils.js" ;
2
3
import "../../lib/dom_utils.js" ;
3
4
import "../../content_scripts/ui_component.js" ;
4
5
@@ -17,6 +18,7 @@ context("UIComponent", () => {
17
18
setup ( async ( ) => {
18
19
// Which page we load doesn't matter; we just need any DOM.
19
20
await testHelper . jsdomStub ( "pages/help_dialog_page.html" ) ;
21
+ stub ( Utils , "isFirefox" , ( ) => false ) ;
20
22
} ) ;
21
23
22
24
teardown ( ( ) => {
You can’t perform that action at this time.
0 commit comments