| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
var gTestfile = '15.11.7.6-003.js'; |
| 15 |
var UBound = 0; |
| 16 |
var BUGNUMBER = 201989; |
| 17 |
var summary = 'Prototype of predefined error objects should be ReadOnly'; |
| 18 |
var status = ''; |
| 19 |
var statusitems = []; |
| 20 |
var actual = ''; |
| 21 |
var actualvalues = []; |
| 22 |
var expect= ''; |
| 23 |
var expectedvalues = []; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
function testReadOnly(F) |
| 30 |
{ |
| 31 |
var e; |
| 32 |
var orig = F.prototype; |
| 33 |
try |
| 34 |
{ |
| 35 |
F.prototype = new Object(); |
| 36 |
} |
| 37 |
catch (e) |
| 38 |
{ |
| 39 |
} |
| 40 |
return F.prototype === orig; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
var list = [ |
| 45 |
"Error", |
| 46 |
"ConversionError", |
| 47 |
"EvalError", |
| 48 |
"RangeError", |
| 49 |
"ReferenceError", |
| 50 |
"SyntaxError", |
| 51 |
"TypeError", |
| 52 |
"URIError" |
| 53 |
]; |
| 54 |
|
| 55 |
|
| 56 |
for (i in list) |
| 57 |
{ |
| 58 |
var F = this[list[i]]; |
| 59 |
|
| 60 |
|
| 61 |
if (F) |
| 62 |
{ |
| 63 |
status = 'Testing ReadOnly attribute of |' + list[i] + '.prototype|'; |
| 64 |
actual = testReadOnly(F); |
| 65 |
expect = true; |
| 66 |
addThis(); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
test(); |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
function addThis() |
| 79 |
{ |
| 80 |
statusitems[UBound] = status; |
| 81 |
actualvalues[UBound] = actual; |
| 82 |
expectedvalues[UBound] = expect; |
| 83 |
UBound++; |
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
function test() |
| 88 |
{ |
| 89 |
enterFunc('test'); |
| 90 |
printBugNumber(BUGNUMBER); |
| 91 |
printStatus(summary); |
| 92 |
|
| 93 |
for (var i=0; i<UBound; i++) |
| 94 |
{ |
| 95 |
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); |
| 96 |
} |
| 97 |
|
| 98 |
exitFunc ('test'); |
| 99 |
} |