cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-13381) In projects where window.console.log = console.log = null; console logging in cordova.js template file for android platform results in error such as Uncaught TypeError: console.log is not a function
Date Tue, 24 Oct 2017 18:39:00 GMT

    [ https://issues.apache.org/jira/browse/CB-13381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16217424#comment-16217424
] 

ASF GitHub Bot commented on CB-13381:
-------------------------------------

infil00p closed pull request #409: CB-13381: (android) Fix bug checking for console object
and console.log function
URL: https://github.com/apache/cordova-android/pull/409
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bin/templates/project/assets/www/cordova.js b/bin/templates/project/assets/www/cordova.js
index f71ab4d6d..a1cafaf61 100644
--- a/bin/templates/project/assets/www/cordova.js
+++ b/bin/templates/project/assets/www/cordova.js
@@ -320,7 +320,7 @@ var cordova = {
             try {
                 func();
             } catch(e) {
-                console.log("Failed to run constructor: " + e);
+                console && console.log && console.log("Failed to run constructor:
" + e);
             }
         });
     }
@@ -539,7 +539,7 @@ function clobber(obj, key, value) {
 function assignOrWrapInDeprecateGetter(obj, key, value, message) {
     if (message) {
         utils.defineGetter(obj, key, function() {
-            console.log(message);
+            console && console.log && console.log(message);
             delete obj[key];
             clobber(obj, key, value);
             return value;
@@ -1119,7 +1119,7 @@ function processMessage(message) {
         buildPayload(payload, payloadMessage);
         cordova.callbackFromNative(callbackId, success, status, payload, keepCallback);
     } else {
-        console.log("processMessage failed: invalid message: " + JSON.stringify(message));
+        console && console.log && console.log("processMessage failed: invalid
message: " + JSON.stringify(message));
     }
 }
 
@@ -1180,7 +1180,7 @@ module.exports = {
 
     // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback,
errorCallback, options) {...},...);
     add:function(id,proxyObj) {
-        console.log("adding proxy for " + id);
+        console && console.log && console.log("adding proxy for " + id);
         CommandProxyMap[id] = proxyObj;
         return proxyObj;
     },
@@ -1214,14 +1214,14 @@ var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
 function logUnfiredChannels(arr) {
     for (var i = 0; i < arr.length; ++i) {
         if (arr[i].state != 2) {
-            console.log('Channel not fired: ' + arr[i].type);
+            console && console.log && console.log('Channel not fired: ' +
arr[i].type);
         }
     }
 }
 
 window.setTimeout(function() {
     if (channel.onDeviceReady.state != 2) {
-        console.log('deviceready has not fired after 5 seconds.');
+        console && console.log && console.log('deviceready has not fired
after 5 seconds.');
         logUnfiredChannels(platformInitChannelsArray);
         logUnfiredChannels(channel.deviceReadyChannelsArray);
     }
@@ -1345,14 +1345,14 @@ cordova.exec = require('cordova/exec');
 function logUnfiredChannels(arr) {
     for (var i = 0; i < arr.length; ++i) {
         if (arr[i].state != 2) {
-            console.log('Channel not fired: ' + arr[i].type);
+            console && console.log && console.log('Channel not fired: ' +
arr[i].type);
         }
     }
 }
 
 window.setTimeout(function() {
     if (channel.onDeviceReady.state != 2) {
-        console.log('deviceready has not fired after 5 seconds.');
+        console && console.log && console.log('deviceready has not fired
after 5 seconds.');
         logUnfiredChannels(platformInitChannelsArray);
         logUnfiredChannels(channel.deviceReadyChannelsArray);
     }
@@ -1953,7 +1953,7 @@ function findCordovaPath() {
 exports.load = function(callback) {
     var pathPrefix = findCordovaPath();
     if (pathPrefix === null) {
-        console.log('Could not find cordova.js script tag. Plugin loading may fail.');
+        console && console.log && console.log('Could not find cordova.js
script tag. Plugin loading may fail.');
         pathPrefix = '';
     }
     injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function()
{


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> In projects where window.console.log = console.log = null; console logging in cordova.js
template file for android platform results in error such as Uncaught TypeError: console.log
is not a function
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-13381
>                 URL: https://issues.apache.org/jira/browse/CB-13381
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-js
>    Affects Versions: Master
>         Environment: cordova.js template for android platform
>            Reporter: Shubham Jha
>            Assignee: Joe Bowser
>            Priority: Minor
>              Labels: beginner, easyfix
>             Fix For: Master
>
>
> In projects where window.console.log = console.log = null; console logging in cordova.js
template file for android platform cause Uncaught TypeError: console.log is not a function



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message