I found this question but trying to use the code given there:
unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
const clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
;
clipboardHelper.copyString('test');
Gives the error message:
A script from «http://example.com» was denied UniversalXPConnect privileges.
I also tried to use (from Mozilla site):
const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
;
gClipboardHelper.copyString("test2");
Which gives the error message: Components.classes is undefined
.
In both cases it doesn't work with the latest Firefox on Windows 7.
What else should I try?