Diff

Differences From Artifact [130898c1ff]:

To Artifact [7034902175]:


18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
..
97
98
99
100
101
102
103
104









105
106
107
108
109
110
111
...
118
119
120
121
122
123
124


125
126
127
128
129
130
131
132


133
134
135
136
137
138
139
140
...
172
173
174
175
176
177
178


179
180
181
182
183
184
185
 */
var cackeyOutstandingCallbacks = []
var cackeyOutstandingCallbackCounter = -1;

/*
 * Communication with the PIN entry window
 */
var pinWindowDidWork = 0;


/*
 * Handle a response from the NaCl side regarding certificates available
 */
function cackeyMessageIncomingListCertificates(message, chromeCallback) {
	var idx;
	var certificates = [];
................................................................................
		case "error":
			console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error);

			chromeCallback();

			break;
		case "retry":
			pinWindowDidWork = 0;










			chrome.app.window.create("pin.html", {
				"id": "cackeyPINEntry",
				"resizable": false,
				"alwaysOnTop": true,
				"focused": true,
				"visibleOnAllWorkspaces": true,
................................................................................
			}, function(pinWindow) {
				if (!pinWindow) {
					console.log("[cackey] No window was provided for PIN entry, this will not go well.");

					return;
				}



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

				/*
				 * Register a handler to handle the window being closed without
				 * having sent anything
				 */
				pinWindow.onClosed.addListener(function() {


					if (pinWindowDidWork != 1) {
						console.log("[cackey] The PIN dialog was closed without resubmitting the request, treating it as a failure");

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

						cackeyMessageIncoming(messageEvent);
					}
................................................................................
	}

	if (nextFunction != null) {
		nextFunction(messageEvent.data, chromeCallback);
	}

	delete cackeyOutstandingCallbacks[messageEvent.data.id];



	return;
}

/*
 * Handler for messages from Chrome related to listing certificates
 */







|
>







 







|
>
>
>
>
>
>
>
>
>







 







>
>








>
>
|







 







>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
...
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
 */
var cackeyOutstandingCallbacks = []
var cackeyOutstandingCallbackCounter = -1;

/*
 * Communication with the PIN entry window
 */
var pinWindowPINValue = "";
var pinWindowPreviousHandle = null;

/*
 * Handle a response from the NaCl side regarding certificates available
 */
function cackeyMessageIncomingListCertificates(message, chromeCallback) {
	var idx;
	var certificates = [];
................................................................................
		case "error":
			console.error("[cackey] Failed to execute command '" + messageEvent.data.command + "': " + messageEvent.data.error);

			chromeCallback();

			break;
		case "retry":
			pinWindowPINValue = "";

			if (pinWindowPreviousHandle) {
				/*
				 * An existing PIN entry is in progress
				 * Wait for it to complete and tie this request to that one.
				 */

				/* XXX:TODO */
			}

			chrome.app.window.create("pin.html", {
				"id": "cackeyPINEntry",
				"resizable": false,
				"alwaysOnTop": true,
				"focused": true,
				"visibleOnAllWorkspaces": true,
................................................................................
			}, function(pinWindow) {
				if (!pinWindow) {
					console.log("[cackey] No window was provided for PIN entry, this will not go well.");

					return;
				}

				pinWindowPreviousHandle = pinWindow;

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

				/*
				 * Register a handler to handle the window being closed without
				 * having sent anything
				 */
				pinWindow.onClosed.addListener(function() {
					pinWindowPreviousHandle = null;

					if (pinWindowPINValue == "") {
						console.log("[cackey] The PIN dialog was closed without resubmitting the request, treating it as a failure");

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

						cackeyMessageIncoming(messageEvent);
					}
................................................................................
	}

	if (nextFunction != null) {
		nextFunction(messageEvent.data, chromeCallback);
	}

	delete cackeyOutstandingCallbacks[messageEvent.data.id];

	pinWindowPINValue = "";

	return;
}

/*
 * Handler for messages from Chrome related to listing certificates
 */