| // Copyright 2016 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // This code sets up a reporting mechanism for uncaught javascript errors |
| // to the server. It reports at most every THRESHOLD_MS milliseconds and |
| // each report contains error signatures with counts. |
| if (last && now < last + THRESHOLD_MS) { |
| timer = setTimeout(function() { |
| }, THRESHOLD_MS + last - now); |
| let flushErrs = throttle(function() { |
| let data = {errors: JSON.stringify(errBuff)}; |
| CS_doPost('/_/clientmon.do', null, data); |
| window.addEventListener('error', function(evt) { |
| let signature = evt.message; |
| if (evt.error instanceof Error) { |
| signature += '\n' + evt.error.stack; |
| if (!errBuff[signature]) { |