Created
January 20, 2012 15:00
-
-
Save arantius/1647737 to your computer and use it in GitHub Desktop.
Test case for GM issue 1472
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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