Check-in [d06273088d]
Overview
SHA1:d06273088d1301518c9d3ca37b430395d62ce7fd
Date: 2016-02-26 19:55:40
User: rkeene
Comment:ChromeOS: Clean up console logs in non-debug builds
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-02-26
20:00
[620c0e591e] ChromeOS: Fixed bug in debug message logic being inverted and possible undefined dereference (user: rkeene, tags: trunk)
19:55
[d06273088d] ChromeOS: Clean up console logs in non-debug builds (user: rkeene, tags: trunk)
19:50
[b8c2cad6d9] ChromeOS: Accept the "Enter" key to click OK at the PIN prompt (user: rkeene, tags: trunk)
Changes

Modified build/chrome/cackey.js from [3ee1c2da74] to [c88468545b].

   110    110   	var nextFunction = null;
   111    111   	var chromeCallback = null;
   112    112   
   113    113   	if (messageEvent.data.target != "cackey") {
   114    114   		return;
   115    115   	}
   116    116   
   117         -	console.log("START MESSAGE");
   118         -	console.log(messageEvent.data);
   119         -	console.log("END MESSAGE");
          117  +	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          118  +		console.log("START MESSAGE");
          119  +		console.log(messageEvent.data);
          120  +		console.log("END MESSAGE");
          121  +	}
   120    122   
   121    123   	/*
   122    124   	 * If we failed for some reason and we have a certificate in the original
   123    125   	 * request then forget any PIN associated with that certificate
   124    126   	 */
   125    127   	if (messageEvent.data.status != "success") {
   126    128   		if (messageEvent.data.originalrequest.certificate) {
................................................................................
   131    133   	if (messageEvent.data.id == null) {
   132    134   		return;
   133    135   	}
   134    136   
   135    137   	chromeCallback = cackeyOutstandingCallbacks[messageEvent.data.id];
   136    138   
   137    139   	if (chromeCallback == null) {
   138         -		console.log("[cackey] Discarding outdated message");
          140  +		console.error("[cackey] Discarding outdated message");
   139    141   
   140    142   		return;
   141    143   	}
   142    144   
   143    145   	switch (messageEvent.data.status) {
   144    146   		case "error":
   145    147   			console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error);
................................................................................
   184    186   			}, function(pinWindow) {
   185    187   				/*
   186    188   				 * Set the PIN value to blank
   187    189   				 */
   188    190   				pinWindowPINValue = "";
   189    191   
   190    192   				if (!pinWindow) {
   191         -					console.log("[cackey] No window was provided for PIN entry, this will not go well.");
          193  +					console.error("[cackey] No window was provided for PIN entry, this will not go well.");
   192    194   
   193    195   					return;
   194    196   				}
   195    197   
   196    198   				pinWindowPreviousHandle = pinWindow;
   197    199   
   198    200   				pinWindow.drawAttention();
................................................................................
   209    211   
   210    212   					for (messageIdx = 0; messageIdx < cackeyMessagesToRetry.length; messageIdx++) {
   211    213   						var tmpMessageEvent;
   212    214   
   213    215   						tmpMessageEvent = cackeyMessagesToRetry[messageIdx];
   214    216   
   215    217   						if (pinWindowPINValue == "") {
   216         -							console.log("[cackey] The PIN dialog was closed without gathering a PIN, treating it as a failure.");
          218  +							if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          219  +								console.log("[cackey] The PIN dialog was closed without gathering a PIN, treating it as a failure.");
          220  +							}
   217    221   
   218    222   							tmpMessageEvent.data.status = "error";
   219    223   							tmpMessageEvent.data.error = "PIN window closed without a PIN being provided";
   220    224   
   221    225   							cackeyMessageIncoming(tmpMessageEvent);
   222    226   						} else {
   223    227   							tmpMessageEvent.data.originalrequest.pin = pinWindowPINValue;
................................................................................
   284    288   
   285    289   /*
   286    290    * Handler for messages from Chrome related to listing certificates
   287    291    */
   288    292   function cackeyListCertificates(chromeCallback) {
   289    293   	var callbackId;
   290    294   
   291         -	console.log("[cackey] Asked to provide a list of certificates -- throwing that request over to the NaCl side... ");
          295  +	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          296  +		console.log("[cackey] Asked to provide a list of certificates -- throwing that request over to the NaCl side... ");
          297  +	}
   292    298   
   293    299   	callbackId = cackeyOutstandingCallbackCounter + 1;
   294    300   
   295    301   	cackeyHandle.postMessage(
   296    302   		{
   297    303   			'target': "cackey",
   298    304   			'command': "listcertificates",
................................................................................
   299    305   			'id': callbackId
   300    306   		}
   301    307   	);
   302    308   
   303    309   	cackeyOutstandingCallbackCounter = callbackId;
   304    310   	cackeyOutstandingCallbacks[callbackId] = chromeCallback;
   305    311   
   306         -	console.log("[cackey] Thrown.");
          312  +	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          313  +		console.log("[cackey] Thrown.");
          314  +	}
   307    315   
   308    316   	return;
   309    317   }
   310    318   
   311    319   /*
   312    320    * Handler for messages from Chrome related to signing a hash of some sort
   313    321    */
................................................................................
   340    348   
   341    349   	digest = new Uint8Array(digestHeader.length + signRequest.digest.byteLength);
   342    350   	digest.set(digestHeader, 0);
   343    351   	digest.set(new Uint8Array(signRequest.digest), digestHeader.length);
   344    352   
   345    353   	delete digestHeader;
   346    354   
   347         -	console.log("[cackey] Asked to sign a message -- throwing that request over to the NaCl side... ");
          355  +	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          356  +		console.log("[cackey] Asked to sign a message -- throwing that request over to the NaCl side... ");
          357  +	}
   348    358   
   349    359   	callbackId = cackeyOutstandingCallbackCounter + 1;
   350    360   
   351    361   	command = {
   352    362   		'target': "cackey",
   353    363   		'command': "sign",
   354    364   		'id': callbackId,
................................................................................
   363    373   	}
   364    374   
   365    375   	cackeyHandle.postMessage(command);
   366    376   
   367    377   	cackeyOutstandingCallbackCounter = callbackId;
   368    378   	cackeyOutstandingCallbacks[callbackId] = chromeCallback;
   369    379   
   370         -	console.log("[cackey] Thrown.");
          380  +	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          381  +		console.log("[cackey] Thrown.");
          382  +	}
   371    383   
   372    384   	return;
   373    385   }
   374    386   
   375    387   /*
   376    388    * Finish performing initialization that must wait until we have loaded the CACKey module
   377    389    */
................................................................................
   395    407   		}
   396    408   	);
   397    409   
   398    410   	/*
   399    411   	 * Start the Google PCSC Interface
   400    412   	 */
   401    413   	new GoogleSmartCard.PcscNacl(cackeyHandle);
   402         -
   403    414   
   404    415   	return;
   405    416   }
   406    417   
   407    418   /*
   408    419    * Initialize CACKey and the PCSC library from Google
   409    420    */