Check-in [620c0e591e]
Overview
SHA1:620c0e591e9e2bd3837231972ccce9e25b8f1a62
Date: 2016-02-26 20:00:41
User: rkeene
Comment:ChromeOS: Fixed bug in debug message logic being inverted and possible undefined dereference
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:24
[b297c8220e] ChromeOS: Updated PIN entry prompt to accept "Escape" to close it (user: rkeene, tags: trunk)
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)
Changes

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

   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         -	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          117  +	if (GoogleSmartCard.IS_DEBUG_BUILD) {
   118    118   		console.log("START MESSAGE");
   119    119   		console.log(messageEvent.data);
   120    120   		console.log("END MESSAGE");
   121    121   	}
   122    122   
   123    123   	/*
   124    124   	 * If we failed for some reason and we have a certificate in the original
   125    125   	 * request then forget any PIN associated with that certificate
   126    126   	 */
   127    127   	if (messageEvent.data.status != "success") {
   128         -		if (messageEvent.data.originalrequest.certificate) {
   129         -			delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)];
          128  +		if (messageEvent.data.originalrequest) {
          129  +			if (messageEvent.data.originalrequest.certificate) {
          130  +				delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)];
          131  +			}
   130    132   		}
   131    133   	}
   132    134   
   133    135   	if (messageEvent.data.id == null) {
   134    136   		return;
   135    137   	}
   136    138   
................................................................................
   211    213   
   212    214   					for (messageIdx = 0; messageIdx < cackeyMessagesToRetry.length; messageIdx++) {
   213    215   						var tmpMessageEvent;
   214    216   
   215    217   						tmpMessageEvent = cackeyMessagesToRetry[messageIdx];
   216    218   
   217    219   						if (pinWindowPINValue == "") {
   218         -							if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          220  +							if (GoogleSmartCard.IS_DEBUG_BUILD) {
   219    221   								console.log("[cackey] The PIN dialog was closed without gathering a PIN, treating it as a failure.");
   220    222   							}
   221    223   
   222    224   							tmpMessageEvent.data.status = "error";
   223    225   							tmpMessageEvent.data.error = "PIN window closed without a PIN being provided";
   224    226   
   225    227   							cackeyMessageIncoming(tmpMessageEvent);
................................................................................
   288    290   
   289    291   /*
   290    292    * Handler for messages from Chrome related to listing certificates
   291    293    */
   292    294   function cackeyListCertificates(chromeCallback) {
   293    295   	var callbackId;
   294    296   
   295         -	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          297  +	if (GoogleSmartCard.IS_DEBUG_BUILD) {
   296    298   		console.log("[cackey] Asked to provide a list of certificates -- throwing that request over to the NaCl side... ");
   297    299   	}
   298    300   
   299    301   	callbackId = cackeyOutstandingCallbackCounter + 1;
   300    302   
   301    303   	cackeyHandle.postMessage(
   302    304   		{
................................................................................
   305    307   			'id': callbackId
   306    308   		}
   307    309   	);
   308    310   
   309    311   	cackeyOutstandingCallbackCounter = callbackId;
   310    312   	cackeyOutstandingCallbacks[callbackId] = chromeCallback;
   311    313   
   312         -	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          314  +	if (GoogleSmartCard.IS_DEBUG_BUILD) {
   313    315   		console.log("[cackey] Thrown.");
   314    316   	}
   315    317   
   316    318   	return;
   317    319   }
   318    320   
   319    321   /*
................................................................................
   348    350   
   349    351   	digest = new Uint8Array(digestHeader.length + signRequest.digest.byteLength);
   350    352   	digest.set(digestHeader, 0);
   351    353   	digest.set(new Uint8Array(signRequest.digest), digestHeader.length);
   352    354   
   353    355   	delete digestHeader;
   354    356   
   355         -	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          357  +	if (GoogleSmartCard.IS_DEBUG_BUILD) {
   356    358   		console.log("[cackey] Asked to sign a message -- throwing that request over to the NaCl side... ");
   357    359   	}
   358    360   
   359    361   	callbackId = cackeyOutstandingCallbackCounter + 1;
   360    362   
   361    363   	command = {
   362    364   		'target': "cackey",
................................................................................
   373    375   	}
   374    376   
   375    377   	cackeyHandle.postMessage(command);
   376    378   
   377    379   	cackeyOutstandingCallbackCounter = callbackId;
   378    380   	cackeyOutstandingCallbacks[callbackId] = chromeCallback;
   379    381   
   380         -	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
          382  +	if (GoogleSmartCard.IS_DEBUG_BUILD) {
   381    383   		console.log("[cackey] Thrown.");
   382    384   	}
   383    385   
   384    386   	return;
   385    387   }
   386    388   
   387    389   /*