You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2017/10/24 18:38:16 UTC

[GitHub] infil00p closed pull request #409: CB-13381: (android) Fix bug checking for console object and console.log function

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


With regards,
Apache Git Services

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