| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview Error handling APIs and listeners. |
| 7 */ |
| 8 |
| 9 goog.provide('__crWeb.error'); |
| 10 |
| 11 goog.require('__crWeb.message'); |
| 12 |
| 13 /** Beginning of anonymouse object */ |
| 14 (function() { |
| 15 |
| 16 /** |
| 17 * JavaScript errors are logged on the main application side. The handler is |
| 18 * added ASAP to catch any errors in startup. |
| 19 */ |
| 20 window.addEventListener('error', function(event) { |
| 21 // Sadly, event.filename and event.lineno are always 'undefined' and '0' |
| 22 // with UIWebView. |
| 23 // TODO(crbug.com/711359): the aforementioned APIs may be working now in |
| 24 // WKWebView. Evaluate any cleanup / improvement we can do here. |
| 25 __gCrWeb.message.invokeOnHost( |
| 26 {'command': 'window.error', 'message': event.message.toString()}); |
| 27 }); |
| 28 |
| 29 // Flush the message queue. |
| 30 if (__gCrWeb.message) { |
| 31 __gCrWeb.message.invokeQueues(); |
| 32 } |
| 33 |
| 34 }()); // End of anonymous object |
| OLD | NEW |