@@ -66,6 +66,18 @@ function escapeHTML(unsafe) {
66
66
. replace ( / \' / g, "'" ) ) ;
67
67
}
68
68
69
+ /* Compute Set difference lhs \ rhs.
70
+ * @lhs - Set to start with
71
+ * @rhs - Set to remove from the lhs
72
+ * Set difference is in Firefox nightly, but is not yet released.
73
+ * So we compute it ourselves. This is equivalent to lhs.difference(rhs)
74
+ */
75
+ function setDifference ( lhs , rhs ) {
76
+ let lhsArray = Array . from ( lhs ) ;
77
+ let result = lhsArray . filter ( ( x ) => { ! rhs . has ( x ) } ) ;
78
+ return new Set ( result ) ;
79
+ }
80
+
69
81
/*
70
82
* Show debug output in debug region and maybe via alert box
71
83
* @debugOutput - the debug information to show
@@ -276,7 +288,7 @@ function processHints(requestedHints) {
276
288
277
289
// Complain about unknown fields
278
290
let usedFields = new Set ( Object . keys ( hint ) ) ;
279
- let forbiddenFields = usedFields . difference ( allowedHintFields ) ;
291
+ let forbiddenFields = setDifference ( usedFields , allowedHintFields ) ;
280
292
if ( forbiddenFields . size != 0 ) {
281
293
showDebugOutput (
282
294
`Unknown field(s) in hint[${ i } ]: ` +
@@ -329,7 +341,7 @@ function processInfo(configurationInfo) {
329
341
'hints' , 'successes' , 'failures' , 'correct' , 'expected' ,
330
342
'preprocessing' , 'preprocessingTests' , 'debug' ] ) ;
331
343
let usedFields = new Set ( Object . keys ( info ) ) ;
332
- let forbiddenFields = usedFields . difference ( allowedInfoFields ) ;
344
+ let forbiddenFields = setDifference ( usedFields , allowedInfoFields ) ;
333
345
if ( forbiddenFields . size != 0 ) {
334
346
showDebugOutput (
335
347
`Unknown field(s) in info: ` +
0 commit comments