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
111
112
113
114
115
116

117
118
119

120
121
122
123
124
125
126
...
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...
209
210
211
212
213
214
215

216

217
218
219
220
221
222
223
...
284
285
286
287
288
289
290

291

292
293
294
295
296
297
298
...
299
300
301
302
303
304
305

306

307
308
309
310
311
312
313
...
340
341
342
343
344
345
346

347

348
349
350
351
352
353
354
...
363
364
365
366
367
368
369

370

371
372
373
374
375
376
377
...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
	var nextFunction = null;
	var chromeCallback = null;

	if (messageEvent.data.target != "cackey") {
		return;
	}


	console.log("START MESSAGE");
	console.log(messageEvent.data);
	console.log("END MESSAGE");


	/*
	 * If we failed for some reason and we have a certificate in the original
	 * request then forget any PIN associated with that certificate
	 */
	if (messageEvent.data.status != "success") {
		if (messageEvent.data.originalrequest.certificate) {
................................................................................
	if (messageEvent.data.id == null) {
		return;
	}

	chromeCallback = cackeyOutstandingCallbacks[messageEvent.data.id];

	if (chromeCallback == null) {
		console.log("[cackey] Discarding outdated message");

		return;
	}

	switch (messageEvent.data.status) {
		case "error":
			console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error);
................................................................................
			}, function(pinWindow) {
				/*
				 * Set the PIN value to blank
				 */
				pinWindowPINValue = "";

				if (!pinWindow) {
					console.log("[cackey] No window was provided for PIN entry, this will not go well.");

					return;
				}

				pinWindowPreviousHandle = pinWindow;

				pinWindow.drawAttention();
................................................................................

					for (messageIdx = 0; messageIdx < cackeyMessagesToRetry.length; messageIdx++) {
						var tmpMessageEvent;

						tmpMessageEvent = cackeyMessagesToRetry[messageIdx];

						if (pinWindowPINValue == "") {

							console.log("[cackey] The PIN dialog was closed without gathering a PIN, treating it as a failure.");


							tmpMessageEvent.data.status = "error";
							tmpMessageEvent.data.error = "PIN window closed without a PIN being provided";

							cackeyMessageIncoming(tmpMessageEvent);
						} else {
							tmpMessageEvent.data.originalrequest.pin = pinWindowPINValue;
................................................................................

/*
 * Handler for messages from Chrome related to listing certificates
 */
function cackeyListCertificates(chromeCallback) {
	var callbackId;


	console.log("[cackey] Asked to provide a list of certificates -- throwing that request over to the NaCl side... ");


	callbackId = cackeyOutstandingCallbackCounter + 1;

	cackeyHandle.postMessage(
		{
			'target': "cackey",
			'command': "listcertificates",
................................................................................
			'id': callbackId
		}
	);

	cackeyOutstandingCallbackCounter = callbackId;
	cackeyOutstandingCallbacks[callbackId] = chromeCallback;


	console.log("[cackey] Thrown.");


	return;
}

/*
 * Handler for messages from Chrome related to signing a hash of some sort
 */
................................................................................

	digest = new Uint8Array(digestHeader.length + signRequest.digest.byteLength);
	digest.set(digestHeader, 0);
	digest.set(new Uint8Array(signRequest.digest), digestHeader.length);

	delete digestHeader;


	console.log("[cackey] Asked to sign a message -- throwing that request over to the NaCl side... ");


	callbackId = cackeyOutstandingCallbackCounter + 1;

	command = {
		'target': "cackey",
		'command': "sign",
		'id': callbackId,
................................................................................
	}

	cackeyHandle.postMessage(command);

	cackeyOutstandingCallbackCounter = callbackId;
	cackeyOutstandingCallbacks[callbackId] = chromeCallback;


	console.log("[cackey] Thrown.");


	return;
}

/*
 * Finish performing initialization that must wait until we have loaded the CACKey module
 */
................................................................................
		}
	);

	/*
	 * Start the Google PCSC Interface
	 */
	new GoogleSmartCard.PcscNacl(cackeyHandle);


	return;
}

/*
 * Initialize CACKey and the PCSC library from Google
 */







>
|
|
|
>







 







|







 







|







 







>
|
>







 







>
|
>







 







>
|
>







 







>
|
>







 







>
|
>







 







<







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
...
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
...
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
...
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
...
407
408
409
410
411
412
413

414
415
416
417
418
419
420
	var nextFunction = null;
	var chromeCallback = null;

	if (messageEvent.data.target != "cackey") {
		return;
	}

	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
		console.log("START MESSAGE");
		console.log(messageEvent.data);
		console.log("END MESSAGE");
	}

	/*
	 * If we failed for some reason and we have a certificate in the original
	 * request then forget any PIN associated with that certificate
	 */
	if (messageEvent.data.status != "success") {
		if (messageEvent.data.originalrequest.certificate) {
................................................................................
	if (messageEvent.data.id == null) {
		return;
	}

	chromeCallback = cackeyOutstandingCallbacks[messageEvent.data.id];

	if (chromeCallback == null) {
		console.error("[cackey] Discarding outdated message");

		return;
	}

	switch (messageEvent.data.status) {
		case "error":
			console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error);
................................................................................
			}, function(pinWindow) {
				/*
				 * Set the PIN value to blank
				 */
				pinWindowPINValue = "";

				if (!pinWindow) {
					console.error("[cackey] No window was provided for PIN entry, this will not go well.");

					return;
				}

				pinWindowPreviousHandle = pinWindow;

				pinWindow.drawAttention();
................................................................................

					for (messageIdx = 0; messageIdx < cackeyMessagesToRetry.length; messageIdx++) {
						var tmpMessageEvent;

						tmpMessageEvent = cackeyMessagesToRetry[messageIdx];

						if (pinWindowPINValue == "") {
							if (!GoogleSmartCard.IS_DEBUG_BUILD) {
								console.log("[cackey] The PIN dialog was closed without gathering a PIN, treating it as a failure.");
							}

							tmpMessageEvent.data.status = "error";
							tmpMessageEvent.data.error = "PIN window closed without a PIN being provided";

							cackeyMessageIncoming(tmpMessageEvent);
						} else {
							tmpMessageEvent.data.originalrequest.pin = pinWindowPINValue;
................................................................................

/*
 * Handler for messages from Chrome related to listing certificates
 */
function cackeyListCertificates(chromeCallback) {
	var callbackId;

	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
		console.log("[cackey] Asked to provide a list of certificates -- throwing that request over to the NaCl side... ");
	}

	callbackId = cackeyOutstandingCallbackCounter + 1;

	cackeyHandle.postMessage(
		{
			'target': "cackey",
			'command': "listcertificates",
................................................................................
			'id': callbackId
		}
	);

	cackeyOutstandingCallbackCounter = callbackId;
	cackeyOutstandingCallbacks[callbackId] = chromeCallback;

	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
		console.log("[cackey] Thrown.");
	}

	return;
}

/*
 * Handler for messages from Chrome related to signing a hash of some sort
 */
................................................................................

	digest = new Uint8Array(digestHeader.length + signRequest.digest.byteLength);
	digest.set(digestHeader, 0);
	digest.set(new Uint8Array(signRequest.digest), digestHeader.length);

	delete digestHeader;

	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
		console.log("[cackey] Asked to sign a message -- throwing that request over to the NaCl side... ");
	}

	callbackId = cackeyOutstandingCallbackCounter + 1;

	command = {
		'target': "cackey",
		'command': "sign",
		'id': callbackId,
................................................................................
	}

	cackeyHandle.postMessage(command);

	cackeyOutstandingCallbackCounter = callbackId;
	cackeyOutstandingCallbacks[callbackId] = chromeCallback;

	if (!GoogleSmartCard.IS_DEBUG_BUILD) {
		console.log("[cackey] Thrown.");
	}

	return;
}

/*
 * Finish performing initialization that must wait until we have loaded the CACKey module
 */
................................................................................
		}
	);

	/*
	 * Start the Google PCSC Interface
	 */
	new GoogleSmartCard.PcscNacl(cackeyHandle);


	return;
}

/*
 * Initialize CACKey and the PCSC library from Google
 */