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

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: Tweak language 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
« no previous file with comments | « ios/web/web_state/js/resources/dialog_overrides.js ('k') | ios/web/web_state/js/resources/web_bundle.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4cbdc7cfe3ec525a5d728390aca274b054106153
--- /dev/null
+++ b/ios/web/web_state/js/resources/error.js
@@ -0,0 +1,34 @@
+// 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.
+ */
+ window.addEventListener('error', function(event) {
+ // Sadly, event.filename and event.lineno are always 'undefined' and '0'
+ // with UIWebView.
+ // TODO(crbug.com/711359): the aforementioned APIs may be working now in
+ // WKWebView. Evaluate any cleanup / improvement we can do here.
+ __gCrWeb.message.invokeOnHost(
+ {'command': 'window.error', 'message': event.message.toString()});
+ });
+
+ // Flush the message queue.
+ if (__gCrWeb.message) {
+ __gCrWeb.message.invokeQueues();
+ }
+
+}()); // End of anonymous object
« no previous file with comments | « ios/web/web_state/js/resources/dialog_overrides.js ('k') | ios/web/web_state/js/resources/web_bundle.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698