| 1 |
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ |
| 2 |
/* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 |
|
| 6 |
//----------------------------------------------------------------------------- |
| 7 |
var BUGNUMBER = 333728; |
| 8 |
var summary = 'Throw ReferenceErrors for typeof(...undef)'; |
| 9 |
var actual = ''; |
| 10 |
var expect = 'ReferenceError'; |
| 11 |
|
| 12 |
printBugNumber(BUGNUMBER); |
| 13 |
printStatus (summary); |
| 14 |
|
| 15 |
try |
| 16 |
{ |
| 17 |
actual = typeof (0, undef); |
| 18 |
} |
| 19 |
catch(ex) |
| 20 |
{ |
| 21 |
actual = ex.name; |
| 22 |
} |
| 23 |
|
| 24 |
reportCompare(expect, actual, summary + ': typeof (0, undef)'); |
| 25 |
|
| 26 |
try |
| 27 |
{ |
| 28 |
actual = typeof (0 || undef); |
| 29 |
} |
| 30 |
catch(ex) |
| 31 |
{ |
| 32 |
actual = ex.name; |
| 33 |
} |
| 34 |
|
| 35 |
reportCompare(expect, actual, summary + ': typeof (0 || undef)'); |
| 36 |
|
| 37 |
try |
| 38 |
{ |
| 39 |
actual = typeof (1 && undef); |
| 40 |
} |
| 41 |
catch(ex) |
| 42 |
{ |
| 43 |
actual = ex.name; |
| 44 |
} |
| 45 |
|
| 46 |
reportCompare(expect, actual, summary + ': typeof (1 && undef)'); |
| 47 |
|
| 48 |
/* |
| 49 |
try |
| 50 |
{ |
| 51 |
actual = typeof (0 ? 0 : undef); |
| 52 |
} |
| 53 |
catch(ex) |
| 54 |
{ |
| 55 |
actual = ex.name; |
| 56 |
} |
| 57 |
|
| 58 |
reportCompare(expect, actual, summary + ': typeof (0 ? 0 : undef)'); |
| 59 |
*/ |
| 60 |
|
| 61 |
/* |
| 62 |
try |
| 63 |
{ |
| 64 |
actual = typeof (1 ? undef : 0); |
| 65 |
} |
| 66 |
catch(ex) |
| 67 |
{ |
| 68 |
actual = ex.name; |
| 69 |
} |
| 70 |
|
| 71 |
reportCompare(expect, actual, summary + ': typeof (1 ? undef : 0)'); |
| 72 |
*/ |
| 73 |
|
| 74 |
try |
| 75 |
{ |
| 76 |
actual = typeof (!this ? 0 : undef); |
| 77 |
} |
| 78 |
catch(ex) |
| 79 |
{ |
| 80 |
actual = ex.name; |
| 81 |
} |
| 82 |
|
| 83 |
reportCompare(expect, actual, summary + ': typeof (!this ? 0 : undef)'); |