Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #416 from arv/fix-window-onerror-test
Browse files Browse the repository at this point in the history
Make the window.onerror test more resilient to old browsers
  • Loading branch information
dfreedm committed Apr 9, 2014
2 parents a86a1b9 + 3171298 commit fece95b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -1391,19 +1391,26 @@ test('retarget order (multiple shadow roots)', function() {
var msg = 'Intentional error';
var errorCount = 0;

window.onerror = function(msg, source, lineNumber, columnNumber, error) {
window.onerror = function(msg, source, lineNumber, columnNumber, err) {
document.removeEventListener('click', f);
window.onerror = old;
assert.isTrue(msg.indexOf(msg) >= 0);
assert.typeOf(source, 'string');
assert.typeOf(lineNumber, 'number');
assert.typeOf(columnNumber, 'number');
// error is not available in IE11.
// Firefox 28 does not pass the columnNumber, error
// Safari 6 does not pass the columnNumber, error
// IE11 does not pass the error
if (arguments.length >= 4)
assert.typeOf(columnNumber, 'number');
if (arguments.length >= 5)
assert.equal(err, error);

errorCount++;
};

var error = new Error(msg);
document.addEventListener('click', f = function(e) {
throw new Error(msg);
throw error;
});

document.body.click();
Expand Down

0 comments on commit fece95b

Please sign in to comment.