Last active
December 12, 2015 02:49
-
-
Save varunkumar/4701998 to your computer and use it in GitHub Desktop.
Testing the behavior of window.onerror in Firefox with and without crossorigin attribute.
This file contains hidden or 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html> | |
<head> | |
<title>CORS for static resources</title> | |
</head> | |
<body> | |
<img src="http://slides.varunkumar.me/static/images/may2012.jpg" crossorigin=""> | |
<!-- www.varunkumar.me doesn't set CORS headers --> | |
<!--script src="http://www.varunkumar.me/static/js/calculator.js"></script> | |
<script src="http://www.varunkumar.me/static/js/calculator.js" crossorigin=""></script--> | |
<!-- slides.varunkumar.me sets CORS headers --> | |
<!--script src="http://slides.varunkumar.me/static/js/calculator.js"></script--> | |
<script src="http://slides.varunkumar.me/static/js/calculator.js" crossorigin=""></script> | |
<script> | |
window.onerror = function(errorMsg, url, lineNumber) { | |
console.log('[' + url + ':' + lineNumber + '] ' + errorMsg); | |
return true; | |
} | |
Calculator.add(10, 20); | |
Calculator.add(10, 'One'); // This should throw an exception | |
dummyObj.dosomething(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment