diff --git a/test/unit/strict-template-policy.html b/test/unit/strict-template-policy.html
index 4c5d64335b..bfb697dc32 100644
--- a/test/unit/strict-template-policy.html
+++ b/test/unit/strict-template-policy.html
@@ -18,10 +18,11 @@
// Errors thrown in custom element reactions are not thrown up
// the call stack to the dom methods that provoked them, so need
// to catch them here and prevent mocha from complaining about them
- window.addEventListener('error', function(event) {
+ window.addEventListener('error', event => {
+ event.preventDefault();
event.stopImmediatePropagation();
- if (!window.globalError) {
- window.globalError = event;
+ if (!window.uncaughtError) {
+ window.uncaughtError = event;
}
});
@@ -38,7 +39,7 @@
try {
callback();
} catch(error) {
- window.globalError = error;
+ window.onerror(error);
}
});
};
@@ -72,24 +73,46 @@