Skip to content
This repository
Browse code

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

… or not
  • Loading branch information...
commit 351669d751efe29ee04a23a8e015eb30c86c746c 1 parent 668c280
Onur Can Cakmak authored March 03, 2013

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  tracekit.js
5  tracekit.js
@@ -146,7 +146,7 @@ TraceKit.report = (function reportModuleWrapper() {
146 146
         }
147 147
     }
148 148
 
149  
-    var _oldOnerrorHandler;
  149
+    var _oldOnerrorHandler, _onErrorHandlerInstalled;
150 150
 
151 151
     /**
152 152
      * Ensures all global unhandled exceptions are recorded.
@@ -191,11 +191,12 @@ TraceKit.report = (function reportModuleWrapper() {
191 191
 
192 192
     function installGlobalHandler ()
193 193
     {
194  
-        if (window.onerror === traceKitWindowOnError) {
  194
+        if (_onErrorHandlerInstalled === true) {
195 195
             return;
196 196
         }
197 197
         _oldOnerrorHandler = window.onerror;
198 198
         window.onerror = traceKitWindowOnError;
  199
+        _onErrorHandlerInstalled = true;
199 200
     }
200 201
 
201 202
     /**

0 notes on commit 351669d

Please sign in to comment.
Something went wrong with that request. Please try again.