Home | History | Annotate | Download | only in regress

Lines Matching full:prototype

28 // Test that redefining the 'prototype' property of a function object
34 // Verify that normal assignment of 'prototype' property works properly
37 f.prototype = a;
38 assertSame(f.prototype, a);
39 assertSame(f.prototype.foo, 'bar');
42 assertSame(Object.getOwnPropertyDescriptor(f, 'prototype').value, a);
43 assertTrue(Object.getOwnPropertyDescriptor(f, 'prototype').writable);
45 // Verify that 'prototype' behaves like a data property when it comes to
49 Object.defineProperty(f, 'prototype', { value: b, writable: true });
50 assertSame(f.prototype, b);
51 assertSame(f.prototype.foo, 'baz');
54 assertSame(Object.getOwnPropertyDescriptor(f, 'prototype').value, b);
55 assertTrue(Object.getOwnPropertyDescriptor(f, 'prototype').writable);
60 f.prototype = c;
61 assertSame(f.prototype, c);
62 assertSame(f.prototype.foo, 'other');
65 assertSame(Object.getOwnPropertyDescriptor(f, 'prototype').value, c);
66 assertTrue(Object.getOwnPropertyDescriptor(f, 'prototype').writable);
68 // Verify that 'prototype' can be redefined to contain a different value
71 Object.defineProperty(f, 'prototype', { value: d, writable: false });
72 assertSame(f.prototype, d);
73 assertSame(f.prototype.foo, 'final');
76 assertSame(Object.getOwnPropertyDescriptor(f, 'prototype').value, d);
77 assertFalse(Object.getOwnPropertyDescriptor(f, 'prototype').writable);
79 // Verify that non-writability of redefined 'prototype' is respected.
80 assertThrows("'use strict'; f.prototype = {}");
81 assertThrows("Object.defineProperty(f, 'prototype', { value: {} })");