1// Copyright JS Foundation and other contributors, http://js.foundation 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15'use strict'; 16 17var temp; 18 19try 20{ 21 a = 1; 22 23 assert (false); 24} catch (e) 25{ 26 assert (e instanceof ReferenceError); 27} 28 29try 30{ 31 NaN = 1; 32 33 assert (false); 34} catch (e) 35{ 36 assert (e instanceof TypeError); 37} 38 39function f() 40{ 41 assert(this === undefined); 42} 43 44f(); 45 46Object.function_prop = function () 47{ 48 assert (this === Object); 49} 50 51Object.function_prop (); 52 53try 54{ 55 var temp = f.caller; 56 57 assert (false); 58} catch (e) 59{ 60 assert (e instanceof TypeError); 61} 62 63try 64{ 65 delete this.NaN; 66 67 assert (false); 68} catch (e) 69{ 70 assert (e instanceof TypeError); 71} 72 73try 74{ 75 eval ("'\\" + "101'"); 76 77 assert (false); 78} catch (e) 79{ 80 assert (e instanceof SyntaxError); 81} 82 83try 84{ 85 var str1 = "'\\" + "0'"; 86 var str2 = "'\\x" + "00'"; 87 eval (str1); 88 89 assert (eval (str1) === eval (str2)); 90} catch (e) 91{ 92 assert (false); 93} 94 95try 96{ 97 var str1 = "'\\" + "0" + "\\" + "0" + "\\" + "0'"; 98 var str2 = "'\\x" + "00" + "\\x" + "00" + "\\x" + "00'"; 99 eval (str1); 100 101 assert (eval (str1) === eval (str2)); 102} catch (e) 103{ 104 assert (false); 105} 106 107try 108{ 109 var str1 = "'foo\\" + "0" + "bar'"; 110 var str2 = "'foo\\x" + "00" + "bar'"; 111 eval (str1); 112 113 assert (eval (str1) === eval (str2)); 114} catch (e) 115{ 116 assert (false); 117} 118 119(function (a) { 120 (function (a) { 121 }); 122}); 123