diff --git a/docs/labs/argument-injection.html b/docs/labs/argument-injection.html index ad69ac43..02e90305 100644 --- a/docs/labs/argument-injection.html +++ b/docs/labs/argument-injection.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/assert.html b/docs/labs/assert.html index 021d1e79..b4059fa9 100644 --- a/docs/labs/assert.html +++ b/docs/labs/assert.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/checker.js b/docs/labs/checker.js index 060e5e29..98d120d6 100644 --- a/docs/labs/checker.js +++ b/docs/labs/checker.js @@ -598,30 +598,10 @@ function processHints(requestedHints) { return compiledHints; } -/** Load and parse YAML data, return result to be placed in "info". - * @info: String with YAML (including JSON) data to use - */ -function processYamlToInfo(configurationInfo) { - // This would only allow JSON, but then we don't need to load YAML lib: - // let parsedJson = JSON.parse(configurationInfo); - - let parsedData; // Parsed data, *if* we manage to parse it. - try { - parsedData = jsyaml.load(configurationInfo); - } - catch (e) { - showDebugOutput( - `Lab Error: Cannot process YAML of info.\n${e}`); - throw e; // Rethrow, so containing browser also gets exception - } - - return parsedData; -} - /** Set global values based on other than "correct" and "expected" values. * The correct and expected values may come from elsewhere, but we have to set up the * info-based values first, because info can change how those are interpreted. - * @info: String with YAML (including JSON) data to use + * @configurationInfo: Data to use */ function processInfo(configurationInfo) { const allowedInfoFields = new Set([ @@ -746,17 +726,12 @@ function runSelftest() { * The "info" data includes the regex preprocessing steps, hints, etc. */ function setupInfo() { - // We must load info *first*, because it can affect how other things - // (like pattern preprocessing) is handled. - - // Deprecated approach: Load embedded "info" data in YAML file. - // If there is "info" data embedded in the HTML (e.g., hints), - // load it & set up global variable hints. - let infoElement = document.getElementById('info'); - if (infoElement) { - let configurationYamlText = infoElement.textContent; - // Set global variable "info" - info = processYamlToInfo(configurationYamlText); + // We no longer need a *separate* step to load info, we presume the + // HTML loaded it. + // As a safety check, let's make sure some data *was* loaded. + + if (Object.keys(info).length == 0) { + alert(`ERROR: info has no values set. Load/modify your lab .js file.`); }; // If an "info2" exists, report any differences between it and "info". @@ -768,7 +743,6 @@ function setupInfo() { } }; - // Set global values *except* correct and expected arrays processInfo(info); @@ -830,8 +804,10 @@ function initPage() { attempt.oninput = runCheck; current++; } - for (let hintButton of document.querySelectorAll("button.hintButton")) { + for (let hintButton of document.querySelectorAll("button.hintButton")){ hintButton.addEventListener('click', (e) => { showHint(e); }); + // Precompute inputIndexes to work around problems that occur + // if a user uses a browser's built-in natural language translation. // Presumes button's parent is the form hintButton.dataset.inputIndexes = findIndexes(hintButton.parentNode); if (!hintButton.title) { diff --git a/docs/labs/conversion.html b/docs/labs/conversion.html index b495bd3b..5d17938b 100644 --- a/docs/labs/conversion.html +++ b/docs/labs/conversion.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/csp1.html b/docs/labs/csp1.html index cf438cf5..a610c498 100644 --- a/docs/labs/csp1.html +++ b/docs/labs/csp1.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/deserialization.html b/docs/labs/deserialization.html index 7f80bd0f..38409446 100644 --- a/docs/labs/deserialization.html +++ b/docs/labs/deserialization.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/format-strings.html b/docs/labs/format-strings.html index d5d6b914..27a81819 100644 --- a/docs/labs/format-strings.html +++ b/docs/labs/format-strings.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/free.html b/docs/labs/free.html index 6e699631..8b0acca3 100644 --- a/docs/labs/free.html +++ b/docs/labs/free.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/handling-errors.html b/docs/labs/handling-errors.html index adca8822..e850917c 100644 --- a/docs/labs/handling-errors.html +++ b/docs/labs/handling-errors.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/hardcoded.html b/docs/labs/hardcoded.html index df64bd1f..a73ca782 100644 --- a/docs/labs/hardcoded.html +++ b/docs/labs/hardcoded.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/hello.html b/docs/labs/hello.html index 43616c32..4b82e862 100644 --- a/docs/labs/hello.html +++ b/docs/labs/hello.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/input1.html b/docs/labs/input1.html index 940a725f..3536f8a8 100644 --- a/docs/labs/input1.html +++ b/docs/labs/input1.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/input2.html b/docs/labs/input2.html index 5b1a84c1..2ed03c85 100644 --- a/docs/labs/input2.html +++ b/docs/labs/input2.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/ja_hello.html b/docs/labs/ja_hello.html index fad1756f..fcd6f1d0 100644 --- a/docs/labs/ja_hello.html +++ b/docs/labs/ja_hello.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/oob1.html b/docs/labs/oob1.html index 263676c2..1f156e59 100644 --- a/docs/labs/oob1.html +++ b/docs/labs/oob1.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/redos.html b/docs/labs/redos.html index ed5d5243..4d6550ad 100644 --- a/docs/labs/redos.html +++ b/docs/labs/redos.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/regex0.html b/docs/labs/regex0.html index b72c9784..9b078959 100644 --- a/docs/labs/regex0.html +++ b/docs/labs/regex0.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/regex1.html b/docs/labs/regex1.html index f66491e4..508b0e2e 100644 --- a/docs/labs/regex1.html +++ b/docs/labs/regex1.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/shell-injection.html b/docs/labs/shell-injection.html index bc357674..36cc8ef0 100644 --- a/docs/labs/shell-injection.html +++ b/docs/labs/shell-injection.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/sql-injection.html b/docs/labs/sql-injection.html index f92910bf..d17351f5 100644 --- a/docs/labs/sql-injection.html +++ b/docs/labs/sql-injection.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/template.html b/docs/labs/template.html index 4e29bc90..5316bab7 100644 --- a/docs/labs/template.html +++ b/docs/labs/template.html @@ -5,7 +5,6 @@ - diff --git a/docs/labs/xss.html b/docs/labs/xss.html index 0478cfbc..fe867c7b 100644 --- a/docs/labs/xss.html +++ b/docs/labs/xss.html @@ -5,7 +5,6 @@ -