Lines Matching refs:obj
45 var obj = { x: 42, z: 'foobar' }; variable
46 var desc = Object.getOwnPropertyDescriptor(obj, 'x');
51 desc = Object.getOwnPropertyDescriptor(obj, 'z');
56 assertTrue(Object.isExtensible(obj));
57 assertFalse(Object.isFrozen(obj));
59 Object.freeze(obj);
62 assertFalse(Object.isExtensible(obj));
63 assertTrue(Object.isFrozen(obj));
65 obj.foo = 42;
66 assertEquals(obj.foo, undefined);
68 desc = Object.getOwnPropertyDescriptor(obj, 'x');
73 desc = Object.getOwnPropertyDescriptor(obj, 'z');
80 obj.x = "tete";
81 assertEquals(42, obj.x);
82 obj.x = { get: function() {return 43}, set: function() {} };
83 assertEquals(42, obj.x);
184 obj = { x: 42, y: 'foo' };
185 Object.defineProperty(obj, 'y', {enumerable: false});
186 Object.freeze(obj);
187 assertTrue(Object.isFrozen(obj));
188 desc = Object.getOwnPropertyDescriptor(obj, 'x');
190 desc = Object.getOwnPropertyDescriptor(obj, 'y');
194 obj = { x: 42, y: 'foo' }; variable
195 assertTrue(%HasFastProperties(obj));
196 Object.freeze(obj);
197 assertTrue(Object.isFrozen(obj));
198 assertTrue(%HasFastProperties(obj));
201 obj = { prop1: 1, prop2: 2 }; variable
203 assertTrue(%HaveSameMap(obj, obj2));
204 Object.freeze(obj);
206 assertTrue(Object.isFrozen(obj));
208 assertTrue(%HaveSameMap(obj, obj2));
211 obj = { prop1: 1, prop2: 2, 75: 'foo' }; variable
213 assertTrue(%HaveSameMap(obj, obj2));
214 Object.freeze(obj);
216 assertTrue(Object.isFrozen(obj));
218 assertTrue(%HaveSameMap(obj, obj2));
221 obj = { prop: 'thing' }; variable
222 Object.freeze(obj);
223 assertTrue(Object.isFrozen(obj));
224 obj[0] = 'hello';
225 assertFalse(obj.hasOwnProperty(0));
229 obj = { };
231 obj['x' + i] = i;
234 Object.defineProperty(obj, 'accessor', {
241 assertFalse(%HasFastProperties(obj));
242 Object.freeze(obj);
243 assertFalse(%HasFastProperties(obj));
244 assertTrue(Object.isFrozen(obj));
245 assertFalse(Object.isExtensible(obj));
247 desc = Object.getOwnPropertyDescriptor(obj, 'x' + i);
251 assertEquals(42, obj.accessor);
253 obj.accessor = 'ignored value';
271 obj = {};
272 Object.defineProperty(obj, 'accessor', {
278 assertTrue(%HasFastProperties(obj));
279 Object.freeze(obj);
280 assertTrue(Object.isFrozen(obj));
281 assertTrue(%HasFastProperties(obj));
282 assertEquals(42, obj.accessor);
284 obj.accessor = 'ignored value';
292 obj = {};
293 Object.defineProperty(obj, 'accessor2', {
299 obj.data = 'foo';
300 assertTrue(%HasFastProperties(obj));
301 Object.freeze(obj);
302 assertTrue(%HasFastProperties(obj));
303 assertTrue(Object.isFrozen(obj));
306 obj = [1,2,3];
307 Object.freeze(obj);
310 assertTrue(Object.isSealed(obj));
313 assertThrows(function() { obj.push(); }, TypeError);
314 assertThrows(function() { obj.unshift(); }, TypeError);
315 assertThrows(function() { obj.splice(0,0); }, TypeError);
316 assertTrue(Object.isFrozen(obj));
319 assertThrows(function() { obj.splice(0,1,1); }, TypeError);
320 assertTrue(Object.isFrozen(obj));
324 obj = [1,,3];
325 obj.__proto__[1] = 1;
326 assertEquals(1, obj[1]);
327 Object.freeze(obj);
328 assertThrows(function() { obj.unshift(); }, TypeError);
331 var obj = { foo: 'bar', 0: 'element' };
332 Object.seal(obj);
333 assertTrue(Object.isSealed(obj));
334 assertFalse(Object.isFrozen(obj));
335 Object.freeze(obj);
336 assertTrue(Object.isSealed(obj));
337 assertTrue(Object.isFrozen(obj));
354 var obj = new Constructor();
355 obj.foo = 2;
356 assertSame(1, obj.foo);