mark.lam@apple.com | e646f8e | 2016-06-24 23:34:45 +0000 | [diff] [blame] | 1 | { |
| 2 | let errorType = errorTypes[errorTypeIndexToTest]; |
| 3 | let errorTypeName = errorTypeNames[errorTypeIndexToTest]; |
| 4 | |
| 5 | logTitle("Test thrown " + errorTypeName + " from a script from another domain"); |
| 6 | incCaseIndex(); |
| 7 | |
| 8 | try { |
| 9 | console.log(" " + caseStr + " var e = new " + errorTypeName + "('Error thrown from other script with Secret');"); |
| 10 | var e = new errorType("Error thrown from other script with Secret"); |
| 11 | console.log(" " + caseStr + " e.name = 'OtherScript" + errorTypeName + "'"); |
| 12 | e.name = "OtherScript" + errorTypeName; |
| 13 | |
| 14 | let oldInMainScript = inMainScript; |
| 15 | inMainScript = false; |
| 16 | |
| 17 | console.log(" [" + errorTypeName + "] e = '" + e + "'"); |
| 18 | console.log(" [" + errorTypeName + "] e.name = '" + e.name + "'"); |
| 19 | console.log(" [" + errorTypeName + "] e.message = '" + e.message + "'"); |
| 20 | console.log(" [" + errorTypeName + "] e.toString() = '" + e.toString() + "'"); |
| 21 | |
| 22 | inMainScript = oldInMainScript; |
| 23 | |
| 24 | console.log(" " + caseStr + " throw e;"); |
| 25 | throw e; |
| 26 | |
| 27 | } catch (e) { |
| 28 | let oldInMainScript = inMainScript; |
| 29 | inMainScript = false; |
| 30 | |
| 31 | console.log(" " + caseStr + " Caught: " + e); |
| 32 | console.log(" " + caseStr + " re-throw e;"); |
| 33 | |
| 34 | inMainScript = oldInMainScript; |
| 35 | |
| 36 | throw e; |
| 37 | } |
| 38 | } |