Index: html/templates/test-bad-index.js |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/html/templates/test-bad-index.js |
@@ -0,0 +1,43 @@ |
+function init() |
+{ |
+ var errorElement = document.getElementById("errorMessage"); |
+ errorElement.innerHTML = ""; |
+ var settings; |
+ try |
+ { |
+ settings = window.Settings; |
+ } |
+ catch (e) |
+ { |
+ errorElement.innerHTML = "Did not instantiate Settings object"; |
+ return; |
+ } |
+ |
+ var result1 = document.getElementById("result1"); |
+ try |
+ { |
+ settings.TestBadIndex(0); |
+ result1.textContent = "Success"; |
+ } |
+ catch (e) |
+ { |
+ result1.textContent = "Failure"; |
+ errorElement.innerHTML = "TestBadIndex(0) threw an exception, which is not the expected behavior"; |
+ return; |
+ } |
+ |
+ var result2 = document.getElementById("result2"); |
+ try |
+ { |
+ settings.TestBadIndex(1); |
+ result2.textContent = "Failure"; |
+ errorElement.innerHTML = "TestBadIndex(1) did not throw an exception, which is not the expected behavior"; |
+ return; |
+ } |
+ catch (e) |
+ { |
+ result2.textContent = "Success"; |
+ indexException = document.getElementById("indexException"); |
+ indexException.innerHTML = "Index exception: message = " + e.message + ", prototype name = " + e.__proto__.name ; |
+ } |
+} |