Handling non-string values being passed to SetValue/LMSSetValue

This commit is contained in:
Jonathan Putney
2019-12-30 11:33:08 -05:00
parent 7b780c4c39
commit a1d94eef97
5 changed files with 90 additions and 2 deletions

View File

@@ -169,6 +169,9 @@ export default class BaseAPI {
checkTerminated: boolean,
CMIElement,
value) {
if (value !== undefined) {
value = String(value);
}
let returnValue = global_constants.SCORM_FALSE;
if (this.checkState(checkTerminated, this.#error_codes.STORE_BEFORE_INIT,
@@ -181,6 +184,7 @@ export default class BaseAPI {
this.lastErrorCode = e.errorCode;
returnValue = global_constants.SCORM_FALSE;
} else {
console.error(e.getMessage());
this.throwSCORMError(this.#error_codes.GENERAL);
}
}

View File

@@ -132,7 +132,12 @@ export const scorm12_values = {
validScoreRange: [
'1',
'50.25',
'70',
'100',
1,
50.25,
70,
100,
],
invalidScoreRange: [
'invalid',