Check-in [1c45a8940d]
Overview
Comment:ChromeOS: Fix debug
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1c45a8940dc0cbef20747e45c9a639b224a97f52
User & Date: rkeene on 2017-03-09 02:15:05
Other Links: manifest | tags
Context
2017-03-09
02:41
Updated to try more application IDs for CACs check-in: fbed2df898 user: rkeene tags: trunk
02:15
ChromeOS: Fix debug check-in: 1c45a8940d user: rkeene tags: trunk
01:19
Reverted [317e74ef9b], moving PIN dialog changes to a different branch check-in: ecf15c25f8 user: rkeene tags: trunk
Changes

Modified build/chrome/cackey.js from [db44d71906] to [b94f09a4f5].

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
	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) {
			if (messageEvent.data.originalrequest.certificate) {
				delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)];
			}
		}
	}

	if (messageEvent.data.command == "init" && messageEvent.data.status == "success") {
		if (GoogleSmartCard.IS_DEBUG_BUILD) {
			console.log("[cackey] Initialization completed, resending any queued messages");
		}

		cackeyInitPCSCCompleted("success");
	}

	if (messageEvent.data.id == null) {







|


















|







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
	var nextFunction = null;
	var chromeCallback = null;

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

	if (goog.DEBUG) {
		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) {
			if (messageEvent.data.originalrequest.certificate) {
				delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)];
			}
		}
	}

	if (messageEvent.data.command == "init" && messageEvent.data.status == "success") {
		if (goog.DEBUG) {
			console.log("[cackey] Initialization completed, resending any queued messages");
		}

		cackeyInitPCSCCompleted("success");
	}

	if (messageEvent.data.id == null) {
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316

					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);







|







302
303
304
305
306
307
308
309
310
311
312
313
314
315
316

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

						tmpMessageEvent = cackeyMessagesToRetry[messageIdx];

						if (pinWindowPINValue == "") {
							if (goog.DEBUG) {
								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);
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465

/*
 * 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;

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

		cackeyOutstandingCallbacks[callbackId] = chromeCallback;

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

	return;
}

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

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

	callbackId = ++cackeyOutstandingCallbackCounter;

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

		cackeyOutstandingCallbacks[callbackId] = chromeCallback;

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

	return;
}








|
















|













|
















|







403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465

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

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

	callbackId = ++cackeyOutstandingCallbackCounter;

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

		cackeyOutstandingCallbacks[callbackId] = chromeCallback;

		if (goog.DEBUG) {
			console.log("[cackey] Thrown.");
		}
	}, chromeCallback);

	return;
}

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

	if (goog.DEBUG) {
		console.log("[cackey] Asked to provide a list of readers -- throwing that request over to the NaCl side... ");
	}

	callbackId = ++cackeyOutstandingCallbackCounter;

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

		cackeyOutstandingCallbacks[callbackId] = chromeCallback;

		if (goog.DEBUG) {
			console.log("[cackey] Thrown.");
		}
	}, chromeCallback);

	return;
}

495
496
497
498
499
500
501
502
503
504
505
506
507
508
509

	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;

	command = {
		'target': "cackey",







|







495
496
497
498
499
500
501
502
503
504
505
506
507
508
509

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

	delete digestHeader;

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

	callbackId = ++cackeyOutstandingCallbackCounter;

	command = {
		'target': "cackey",
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
	}

	cackeyInitPCSC(function() {
		cackeyHandle.postMessage(command);

		cackeyOutstandingCallbacks[callbackId] = chromeCallback;

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

	return;
}








|







522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
	}

	cackeyInitPCSC(function() {
		cackeyHandle.postMessage(command);

		cackeyOutstandingCallbacks[callbackId] = chromeCallback;

		if (goog.DEBUG) {
			console.log("[cackey] Thrown.");
		}
	}, chromeCallback);

	return;
}

768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
		console.log("[cackey] cackeyInit(): Already initialized.  Returning.");

		return;
	}

	/* Verify that we can register callbacks */
	if (!chrome.certificateProvider) {
		if (!GoogleSmartCard.IS_DEBUG_BUILD) {
			console.info("[cackey] This extension's primary functionality only works on ChromeOS!  You won't be able to do much with it.");
		}
	}

	elementEmbed = document.createElement('embed');
	elementEmbed.type = "application/x-pnacl";
	elementEmbed.width = 0;







|







768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
		console.log("[cackey] cackeyInit(): Already initialized.  Returning.");

		return;
	}

	/* Verify that we can register callbacks */
	if (!chrome.certificateProvider) {
		if (!goog.DEBUG) {
			console.info("[cackey] This extension's primary functionality only works on ChromeOS!  You won't be able to do much with it.");
		}
	}

	elementEmbed = document.createElement('embed');
	elementEmbed.type = "application/x-pnacl";
	elementEmbed.width = 0;