OLD | NEW |
---|---|
1 var console = null; | 1 var console = null; |
2 | 2 |
3 function consoleWrite(text) | 3 function consoleWrite(text) |
4 { | 4 { |
5 if (!console && document.body) { | 5 if (!console && document.body) { |
6 console = document.createElement('div'); | 6 console = document.createElement('div'); |
7 document.body.appendChild(console); | 7 document.body.appendChild(console); |
8 } | 8 } |
9 var span = document.createElement('span'); | 9 var span = document.createElement('span'); |
10 span.appendChild(document.createTextNode(text)); | 10 span.appendChild(document.createTextNode(text)); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 // currently no way to report a failed test in the test harness, errors | 116 // currently no way to report a failed test in the test harness, errors |
117 // are reported using force_timeout(). | 117 // are reported using force_timeout(). |
118 if (message) | 118 if (message) |
119 consoleWrite(message + ': ' + error.message); | 119 consoleWrite(message + ': ' + error.message); |
120 else if (error) | 120 else if (error) |
121 consoleWrite(error.message); | 121 consoleWrite(error.message); |
122 | 122 |
123 test.force_timeout(); | 123 test.force_timeout(); |
124 test.done(); | 124 test.done(); |
125 } | 125 } |
126 | |
127 function extractFirstLicenseKey(message) | |
ddorwin
2014/08/08 20:41:14
As mentioned earlier, should this be extractSingle
jrummell
2014/08/08 23:51:28
Done.
| |
128 { | |
129 try { | |
130 var json = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(mes sage))); | |
131 // Decode the first element of 'kids'. | |
132 var decoded_key = atob(json.kids[0]); | |
ddorwin
2014/08/08 20:41:14
FIXME: Switch to base64url
See https://dvcs.w3.or
jrummell
2014/08/08 23:51:28
Done.
| |
133 // Convert to an Uint8Array and return it. | |
134 return stringToUint8Array(decoded_key); | |
135 } | |
136 catch (o) { | |
ddorwin
2014/08/08 20:41:14
Just throw up the stack? It would mean the test is
jrummell
2014/08/08 23:51:28
Done.
| |
137 // Not valid JSON, so return message untouched as Uint8Array. | |
138 return new Uint8Array(message); | |
139 } | |
140 } | |
OLD | NEW |