Skip to content

Instantly share code, notes, and snippets.

@Ventero
Created January 25, 2014 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ventero/8620099 to your computer and use it in GitHub Desktop.
Save Ventero/8620099 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head><title>GM #1494 test</title></head>
<body>
<button onclick="sendEvent();">Click</button>
<script>
var div = document.createElement("div");
function sendEvent() {
div.click();
}
window.addEventListener("load", function(){
// this call goes through
div.addEventListener("click", sandbox.GM_openInTab, false);
// this is blocked by apiLeakCheck
div.addEventListener("click", function(){
sandbox.GM_openInTab("foo");
}, false);
},false);
</script>
</body>
</html>
// ==UserScript==
// @name GM #1494 test
// @namespace ventero.de
// @include http://localhost/gm1494.html
// @version 1
// @grant GM_openInTab
// ==/UserScript==
unsafeWindow.sandbox = this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment