| // Copyright 2020 The PDFium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| function testLegalConstructor(name, allowed) { |
| const constructorString = name + ".constructor"; |
| constructor = eval(constructorString); |
| app.alert("FAIL: No such " + constructorString); |
| app.alert("FAIL: " + constructorString + "(): returned"); |
| app.alert("PASS: " + constructorString + "(): " + e); |
| var thing = new constructor; |
| app.alert("PASS: new " + constructorString + ": " + thing); |
| app.alert("FAIL: new " + constructorString + ": " + e); |
| function testIllegalConstructor(name, allowed) { |
| const constructorString = name + ".constructor"; |
| constructor = eval(constructorString); |
| app.alert("FAIL: No such " + constructorString); |
| app.alert("FAIL: " + constructorString + "(): returned"); |
| app.alert("PASS: " + constructorString + "(): " + e); |
| app.alert("FAIL: new " + constructorString + ": returned"); |
| app.alert("PASS: new " + constructorString + ": " + e); |