fixing oops dialog text index lookups

This commit is contained in:
Wayne Chen 2018-09-25 18:21:51 -07:00
parent 26b6967ba6
commit 42579f3d16

View file

@ -18,8 +18,9 @@
function getOopsText() { function getOopsText() {
error = Window.getLastDomainConnectionError(); error = Window.getLastDomainConnectionError();
if (hardRefusalErrors.indexOf(error) >= 0) { var errorMessageMapIndex = hardRefusalErrors.indexOf(error);
return ERROR_MESSAGE_MAP[error]; if (errorMessageMapIndex >= 0) {
return ERROR_MESSAGE_MAP[errorMessageMapIndex];
} else { } else {
// some other text. // some other text.
return ERROR_MESSAGE_MAP[4]; return ERROR_MESSAGE_MAP[4];
@ -84,12 +85,13 @@
function toggleOverlays() { function toggleOverlays() {
var overlaysVisible = false; var overlaysVisible = false;
error = Window.getLastDomainConnectionError(); error = Window.getLastDomainConnectionError();
var errorMessageMapIndex = hardRefusalErrors.indexOf(error);
var oopsText = ""; var oopsText = "";
if (error === -1) { if (error === -1) {
overlaysVisible = false; overlaysVisible = false;
} else if (hardRefusalErrors.indexOf(error) >= 0) { } else if (errorMessageMapIndex >= 0) {
overlaysVisible = true; overlaysVisible = true;
oopsText = ERROR_MESSAGE_MAP[error]; oopsText = ERROR_MESSAGE_MAP[errorMessageMapIndex];
} else { } else {
overlaysVisible = true; overlaysVisible = true;
oopsText = ERROR_MESSAGE_MAP[4]; oopsText = ERROR_MESSAGE_MAP[4];