OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 // Scripts to allow page console.log() etc. output to be seen on the console |
| 6 // of the host application. |
| 7 |
| 8 goog.provide('__crweb.console'); |
| 9 |
| 10 /** |
| 11 * Namespace for this module. |
| 12 */ |
| 13 __gCrWeb.console = {}; |
| 14 |
| 15 /* Beginning of anonymous object. */ |
| 16 new function() { |
| 17 function sendConsoleMessage(method, originalArguments) { |
| 18 message = Array.prototype.slice.call(originalArguments).join(' '); |
| 19 __gCrWeb.message.invokeOnHost({'command': 'console', |
| 20 'method': method, |
| 21 'message': message, |
| 22 'origin': document.location.origin}); |
| 23 } |
| 24 |
| 25 console.log = function() { |
| 26 sendConsoleMessage('log', arguments); |
| 27 }; |
| 28 |
| 29 console.debug = function() { |
| 30 sendConsoleMessage('debug', arguments); |
| 31 }; |
| 32 |
| 33 console.info = function() { |
| 34 sendConsoleMessage('info', arguments); |
| 35 }; |
| 36 |
| 37 console.warn = function() { |
| 38 sendConsoleMessage('warn', arguments); |
| 39 }; |
| 40 |
| 41 console.error = function() { |
| 42 sendConsoleMessage('error', arguments); |
| 43 }; |
| 44 } |
OLD | NEW |