Skip to content

Instantly share code, notes, and snippets.

@arantius
Created January 20, 2012 15:00
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 arantius/1647737 to your computer and use it in GitHub Desktop.
Save arantius/1647737 to your computer and use it in GitHub Desktop.
Test case for GM issue 1472
// ==UserScript==
// @name Test case for GM issue 1472
// @include http://fiddle.jshell.net/_display/
// ==/UserScript==
dump('Running test case ...\n');
function newLoginSubmit(event) {
dump('Running GM_xhr ...\n');
GM_xmlhttpRequest({
method: 'POST',
url: "http://www.ccsmax.com/max/connect",
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey/0.3',
'Accept': 'text/plain',
'Content-type': 'application/x-www-form-urlencoded',
},
data: "",
onload: function(responseDetails) {
// This is not being called in 9.13 - works in 9.12
dump('Got onload callback.\n');
},
onerror: function(responseDetails) {
// This gets called in 9.13 instead.
dump('Got error callback.\n');
}
});
}
var xpath_result = document.evaluate(
"//form[@name='aspnetForm']", document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if ( xpath_result != null && xpath_result.singleNodeValue != null )
{
var node = xpath_result.singleNodeValue;
//node.addEventListener( "submit", newLoginSubmit, true );
dump('Adding event listener ...\n');
window.addEventListener( "submit", newLoginSubmit, true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment