Permalink
Browse files

Use an internal flag to check whether the global handler is installed…

… or not
  • Loading branch information...
occ committed Mar 3, 2013
1 parent 668c280 commit 351669d751efe29ee04a23a8e015eb30c86c746c
Showing with 3 additions and 2 deletions.
  1. +3 −2 tracekit.js
View
@@ -146,7 +146,7 @@ TraceKit.report = (function reportModuleWrapper() {
}
}
- var _oldOnerrorHandler;
+ var _oldOnerrorHandler, _onErrorHandlerInstalled;
/**
* Ensures all global unhandled exceptions are recorded.
@@ -191,11 +191,12 @@ TraceKit.report = (function reportModuleWrapper() {
function installGlobalHandler ()
{
- if (window.onerror === traceKitWindowOnError) {
+ if (_onErrorHandlerInstalled === true) {
return;
}
_oldOnerrorHandler = window.onerror;
window.onerror = traceKitWindowOnError;
+ _onErrorHandlerInstalled = true;
}
/**

0 comments on commit 351669d

Please sign in to comment.