]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/exception-in-to-property-key-should-be-handled-early-in-object-methods.js
4 throw new Error("propertyKey.toString is called.");
8 function shouldThrow(func
, message
) {
16 throw new Error("not thrown.");
17 if (String(error
) !== message
)
18 throw new Error("bad error: " + String(error
));
23 shouldThrow(function () {
24 object
.hasOwnProperty(propertyKey
);
25 }, "Error: propertyKey.toString is called.");
27 shouldThrow(function () {
28 Object
.prototype.hasOwnProperty
.call(null, propertyKey
);
29 }, "Error: propertyKey.toString is called.");
31 shouldThrow(function () {
32 Object
.prototype.hasOwnProperty
.call(null, 'ok');
33 }, "TypeError: null is not an object (evaluating 'Object.prototype.hasOwnProperty.call(null, 'ok')')");
35 shouldThrow(function () {
36 object
.propertyIsEnumerable(propertyKey
);
37 }, "Error: propertyKey.toString is called.");
39 // ToPropertyKey is first, ToObject is following.
40 shouldThrow(function () {
41 Object
.prototype.propertyIsEnumerable
.call(null, propertyKey
);
42 }, "Error: propertyKey.toString is called.");
44 shouldThrow(function () {
45 // ToPropertyKey is first, ToObject is following.
46 Object
.prototype.propertyIsEnumerable
.call(null, 'ok');
47 }, "TypeError: null is not an object (evaluating 'Object.prototype.propertyIsEnumerable.call(null, 'ok')')");
49 shouldThrow(function () {
50 object
.__defineGetter__(propertyKey
, function () {
53 }, "Error: propertyKey.toString is called.");
55 if (Object
.getOwnPropertyDescriptor(object
, ''))
56 throw new Error("bad descriptor");
58 shouldThrow(function () {
59 object
.__defineSetter__(propertyKey
, function () {
62 }, "Error: propertyKey.toString is called.");
64 if (Object
.getOwnPropertyDescriptor(object
, ''))
65 throw new Error("bad descriptor");
67 shouldThrow(function () {
68 object
.__lookupGetter__(propertyKey
);
69 }, "Error: propertyKey.toString is called.");
71 shouldThrow(function () {
72 object
.__lookupSetter__(propertyKey
);
73 }, "Error: propertyKey.toString is called.");