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

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

Issue 1029983002: Upstream ios/web/ JS files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/common.js ('k') | ios/web/web_state/js/resources/core.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/console.js
diff --git a/ios/web/web_state/js/resources/console.js b/ios/web/web_state/js/resources/console.js
new file mode 100644
index 0000000000000000000000000000000000000000..0e67644f8f4c0227e02fcf38bb25fbcd02f59b02
--- /dev/null
+++ b/ios/web/web_state/js/resources/console.js
@@ -0,0 +1,44 @@
+// Copyright 2015 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.
+
+// Scripts to allow page console.log() etc. output to be seen on the console
+// of the host application.
+
+goog.provide('__crweb.console');
+
+/**
+ * Namespace for this module.
+ */
+__gCrWeb.console = {};
+
+/* Beginning of anonymous object. */
+new function() {
+ function sendConsoleMessage(method, originalArguments) {
+ message = Array.prototype.slice.call(originalArguments).join(' ');
+ __gCrWeb.message.invokeOnHost({'command': 'console',
+ 'method': method,
+ 'message': message,
+ 'origin': document.location.origin});
+ }
+
+ console.log = function() {
+ sendConsoleMessage('log', arguments);
+ };
+
+ console.debug = function() {
+ sendConsoleMessage('debug', arguments);
+ };
+
+ console.info = function() {
+ sendConsoleMessage('info', arguments);
+ };
+
+ console.warn = function() {
+ sendConsoleMessage('warn', arguments);
+ };
+
+ console.error = function() {
+ sendConsoleMessage('error', arguments);
+ };
+}
« no previous file with comments | « ios/web/web_state/js/resources/common.js ('k') | ios/web/web_state/js/resources/core.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698