Browse code

Disable website use of the clipboard

Robert Cranston authored on 25/11/2024 04:05:10
Showing 1 changed files

... ...
@@ -107,3 +107,29 @@ user_pref("dom.security.https_only_mode_ever_enabled", true);
107 107
 /// User interface
108 108
 // Don't hide toolbars in fullscreen
109 109
 user_pref("browser.fullscreen.autohide", false);
110
+
111
+/// Clipboard
112
+// Disable legacy `document.execCommand()` with `"cut"` and `"copy"` arguments.
113
+// <https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#cut>
114
+// <https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#copy>
115
+user_pref("dom.allow_cut_copy", false);
116
+// Disable `document.addEventListener()` with `"cut"`, `"copy"`, and `"paste"`
117
+// arguments.
118
+// <https://developer.mozilla.org/en-US/docs/Web/API/Document/cut_event>
119
+// <https://developer.mozilla.org/en-US/docs/Web/API/Document/copy_event>
120
+// <https://developer.mozilla.org/en-US/docs/Web/API/Document/paste_event>
121
+user_pref("dom.event.clipboardevents.enabled", false);
122
+// Disable `window.navigator.clipboard` `read{,Text}` and `write{,Text}` async
123
+// calls, which take/return a `ClipboardItem` (formerly `DataTransfer`). (Only
124
+// `read` requires explicit permission from the user, not `write`.)
125
+// <https://developer.mozilla.org/en-US/docs/Web/API/Window/navigator>
126
+// <https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard>
127
+// <https://developer.mozilla.org/en-US/docs/Web/API/Clipboard>
128
+// <https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem>
129
+// <https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent>
130
+// <https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem>
131
+// <https://hg.mozilla.org/mozilla-central/rev/7ea0b5653ebeb4ccf6f697bac20698725e2b44c7>
132
+// <https://hg.mozilla.org/mozilla-central/rev/7dedaec9dba5faa3d3549ca868ccc278e293db42>
133
+user_pref("dom.events.asyncClipboard.dataTransfer", false);
134
+user_pref("dom.events.asyncClipboard.clipboardItem", false);
135
+user_pref("dom.events.asyncClipboard.readText", false);