Check-in [622c57faac]
Overview
Comment:Support for returning a promise from cackeyListCertificates()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 622c57faac90c7083e6cc7034ff064b6e6d0ddfc
User & Date: rkeene on 2019-01-31 04:33:38
Other Links: manifest | tags
Context
2019-01-31
04:41
Upgrade to latest JS RSA check-in: f0d2c2ccee user: rkeene tags: trunk
04:33
Support for returning a promise from cackeyListCertificates() check-in: 622c57faac user: rkeene tags: trunk
2019-01-30
19:02
Updated tile logo to meet Web Store requirements check-in: 72910e50a1 user: rkeene tags: trunk
Changes

Modified build/chrome/cackey.js from [f4c949a3a4] to [3c60365638].

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







+




+
+
+
+
+
+
+
+
+
+
+
+
+
+



















-
+







}

/*
 * Handler for messages from Chrome related to listing certificates
 */
function cackeyListCertificates(chromeCallback) {
	var callbackId;
	var promiseHandle = null, promiseResolve, promiseReject;

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

	if (!chromeCallback) {
		/*
		 * If no callback supplied, arrange for a promise to be returned instead
		 */
		promiseHandle = new Promise(function(resolve, reject) {
			promiseResolve = resolve;
			promiseReject = reject;
		});

		chromeCallback = function(certs) {
			promiseResolve(certs);
		};
	}

	callbackId = ++cackeyOutstandingCallbackCounter;

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

		cackeyOutstandingCallbacks[callbackId] = chromeCallback;

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

	return;
	return(promiseHandle);
}

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