Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Use an internal flag to check whether the global handler is installed…
Browse files Browse the repository at this point in the history
… or not
  • Loading branch information
occ committed Mar 3, 2013
1 parent 668c280 commit 351669d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tracekit.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ TraceKit.report = (function reportModuleWrapper() {
}
}

var _oldOnerrorHandler;
var _oldOnerrorHandler, _onErrorHandlerInstalled;

/**
* Ensures all global unhandled exceptions are recorded.
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 351669d

Please sign in to comment.