1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

GreaseMonkey: Don't export wrappedJSObject

It seems to confuse some userscripts thinking that this is Firefox.

This, along with recent values changes should fix compatibility issues
with large portion of userscripts.
Tested with 4chanX as one of the very complex userscript.
This commit is contained in:
David Rosca 2018-01-03 19:15:58 +01:00
parent 30bad61eea
commit ebed38e1c4
2 changed files with 1 additions and 5 deletions

View File

@ -84,10 +84,6 @@ function GM_setClipboard(text) {
external.extra.greasemonkey.setClipboard(text);
}
// Define unsafe window
var unsafeWindow = window;
window.wrappedJSObject = unsafeWindow;
// GM_registerMenuCommand not supported
function GM_registerMenuCommand(caption, commandFunc, accessKey) { }

View File

@ -1,4 +1,4 @@
var GM={info:{script:{description:"",excludes:[],includes:[],matches:[],name:"",namespace:"",resources:{},"run-at":"document-end",version:""},scriptMetaStr:"",scriptHandler:"QupZilla GreaseMonkey",version:"4.0"}};window.GM=GM;function GM_info(){return GM.info}
function GM_xmlhttpRequest(a){a.method=a.method.toUpperCase()||"GET";if(!a.url)throw"GM_xmlhttpRequest requires an URL.";var b=new XMLHttpRequest;"onreadystatechange"in a&&(b.onreadystatechange=function(){a.onreadystatechange(b)});"onload"in a&&(b.onload=function(){a.onload(b)});"onerror"in a&&(b.onerror=function(){a.onerror(b)});b.open(a.method,a.url,!0);if("headers"in a)for(var c in a.headers)b.setRequestHeader(c,a.headers[c]);"data"in a?b.send(a.data):b.send()}
function GM_addStyle(a){var b=document.getElementsByTagName("head")[0];if(void 0===b)document.onreadystatechange=function(){if("interactive"==document.readyState){var b=document.createElement("style");b.setAttribute("type","text/css");b.appendChild(document.createTextNode(a));document.getElementsByTagName("head")[0].appendChild(b)}};else{var c=document.createElement("style");c.setAttribute("type","text/css");c.appendChild(document.createTextNode(a));b.appendChild(c)}}
function GM_log(a){console&&console.log(a)}function GM_openInTab(a){return window.open(a)}function GM_setClipboard(a){external.extra.greasemonkey.setClipboard(a)}var unsafeWindow=window;window.wrappedJSObject=unsafeWindow;function GM_registerMenuCommand(a,b,c){}function GM_getResourceUrl(a){}GM.openInTab=GM_openInTab;GM.setClipboard=GM_setClipboard;GM.xmlhttpRequest=GM_xmlhttpRequest;GM.getResourceUrl=function(a){return new Promise(function(a,c){c()})};
function GM_log(a){console&&console.log(a)}function GM_openInTab(a){return window.open(a)}function GM_setClipboard(a){external.extra.greasemonkey.setClipboard(a)}function GM_registerMenuCommand(a,b,c){}function GM_getResourceUrl(a){}GM.openInTab=GM_openInTab;GM.setClipboard=GM_setClipboard;GM.xmlhttpRequest=GM_xmlhttpRequest;GM.getResourceUrl=function(a){return new Promise(function(a,c){c()})};