(f)
| 72 | var constructs = [CreateFromConstructor, CreateFromApi]; |
| 73 | |
| 74 | function TestAllCreates(f) { |
| 75 | // The depth of the prototype chain up the. |
| 76 | for (var depth = 0; depth < 3; ++depth) { |
| 77 | // Introduce readonly-ness this far up the chain. |
| 78 | for (var up = 0; up <= depth; ++up) { |
| 79 | // Try different construction methods. |
| 80 | for (var k = 0; k < constructs.length; ++k) { |
| 81 | // Construct a fresh prototype chain from above functions. |
| 82 | for (var i = 0; i < bases.length; ++i) { |
| 83 | var p = bases[i](); |
| 84 | // There may be a preexisting property under the insertion point... |
| 85 | for (var j = 0; j < depth - up; ++j) { |
| 86 | p = inherits[Math.floor(inherits.length * Math.random())](p)(); |
| 87 | } |
| 88 | // ...but not above it. |
| 89 | for (var j = 0; j < up; ++j) { |
| 90 | p = constructs[Math.floor(constructs.length * Math.random())](p)(); |
| 91 | } |
| 92 | // Create a fresh constructor. |
| 93 | var c = constructs[k](p); |
| 94 | f(function() { |
| 95 | var o = c(); |
| 96 | o.up = o; |
| 97 | for (var j = 0; j < up; ++j) o.up = Object.getPrototypeOf(o.up); |
| 98 | return o; |
| 99 | }); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | |
| 107 | // Different ways to make a property read-only. |
no test coverage detected