Index: build/chrome/cackey.js ================================================================== --- build/chrome/cackey.js +++ build/chrome/cackey.js @@ -112,11 +112,11 @@ if (messageEvent.data.target != "cackey") { return; } - if (!GoogleSmartCard.IS_DEBUG_BUILD) { + if (GoogleSmartCard.IS_DEBUG_BUILD) { console.log("START MESSAGE"); console.log(messageEvent.data); console.log("END MESSAGE"); } @@ -123,12 +123,14 @@ /* * 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) { - delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)]; + if (messageEvent.data.originalrequest) { + if (messageEvent.data.originalrequest.certificate) { + delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)]; + } } } if (messageEvent.data.id == null) { return; @@ -213,11 +215,11 @@ var tmpMessageEvent; tmpMessageEvent = cackeyMessagesToRetry[messageIdx]; if (pinWindowPINValue == "") { - if (!GoogleSmartCard.IS_DEBUG_BUILD) { + 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"; @@ -290,11 +292,11 @@ * Handler for messages from Chrome related to listing certificates */ function cackeyListCertificates(chromeCallback) { var callbackId; - if (!GoogleSmartCard.IS_DEBUG_BUILD) { + 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; @@ -307,11 +309,11 @@ ); cackeyOutstandingCallbackCounter = callbackId; cackeyOutstandingCallbacks[callbackId] = chromeCallback; - if (!GoogleSmartCard.IS_DEBUG_BUILD) { + if (GoogleSmartCard.IS_DEBUG_BUILD) { console.log("[cackey] Thrown."); } return; } @@ -350,11 +352,11 @@ digest.set(digestHeader, 0); digest.set(new Uint8Array(signRequest.digest), digestHeader.length); delete digestHeader; - if (!GoogleSmartCard.IS_DEBUG_BUILD) { + if (GoogleSmartCard.IS_DEBUG_BUILD) { console.log("[cackey] Asked to sign a message -- throwing that request over to the NaCl side... "); } callbackId = cackeyOutstandingCallbackCounter + 1; @@ -375,11 +377,11 @@ cackeyHandle.postMessage(command); cackeyOutstandingCallbackCounter = callbackId; cackeyOutstandingCallbacks[callbackId] = chromeCallback; - if (!GoogleSmartCard.IS_DEBUG_BUILD) { + if (GoogleSmartCard.IS_DEBUG_BUILD) { console.log("[cackey] Thrown."); } return; }