Chromium Code Reviews| Index: ios/web/web_state/js/resources/error.js |
| diff --git a/ios/web/web_state/js/resources/error.js b/ios/web/web_state/js/resources/error.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0e86282dc96ce9a6f9dd471e25e301ba92f60462 |
| --- /dev/null |
| +++ b/ios/web/web_state/js/resources/error.js |
| @@ -0,0 +1,33 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview Error handling APIs and listeners. |
| + */ |
| + |
| +goog.provide('__crWeb.error'); |
| + |
| +goog.require('__crWeb.message'); |
| + |
| +/** Beginning of anonymouse object */ |
| +(function() { |
| + |
| + /** |
| + * JavaScript errors are logged on the main application side. The handler is |
| + * added ASAP to catch any errors in startup. Note this does not appear to |
|
Eugene But (OOO till 7-30)
2017/04/13 16:30:06
Could you please drop "Note this does not appear t
danyao
2017/04/13 17:40:45
Done.
|
| + * work in iOS < 5. |
| + */ |
| + window.addEventListener('error', function(event) { |
| + // Sadly, event.filename and event.lineno are always 'undefined' and '0' |
|
Eugene But (OOO till 7-30)
2017/04/13 16:30:06
WKWebView may support this now. Could you please f
danyao
2017/04/13 17:40:45
Done.
|
| + // with UIWebView. |
| + __gCrWeb.message.invokeOnHost( |
| + {'command': 'window.error', 'message': event.message.toString()}); |
| + }); |
| + |
| + // Flush the message queue. |
| + if (__gCrWeb.message) { |
| + __gCrWeb.message.invokeQueues(); |
| + } |
| + |
| +}()); // End of anonymous object |