Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: ios/web/web_state/js/resources/error.js

Issue 2817943002: Fully deprecate core.js. Moved last method to error.js. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698