(classname)
| 138 | }; |
| 139 | |
| 140 | function runGenericTests(classname) { |
| 141 | promise_test(async () => { |
| 142 | const obj = await evalInRealmAndReturn( |
| 143 | constructedRealm, `new parent.constructorRealm.${classname}()`); |
| 144 | assert_equals(obj.constructor, constructorRealm[classname], |
| 145 | 'obj should be in constructor realm'); |
| 146 | }, `a ${classname} object should be associated with the realm the ` + |
| 147 | 'constructor came from'); |
| 148 | |
| 149 | promise_test(async () => { |
| 150 | const objId = await constructAndStore(classname); |
| 151 | const readableGetterId = id(); |
| 152 | readRealm[readableGetterId] = Object.getOwnPropertyDescriptor( |
| 153 | methodRealm[classname].prototype, 'readable').get; |
| 154 | const writableGetterId = id(); |
| 155 | writeRealm[writableGetterId] = Object.getOwnPropertyDescriptor( |
| 156 | methodRealm[classname].prototype, 'writable').get; |
| 157 | const readable = await evalInRealmAndReturn( |
| 158 | readRealm, `${readableGetterId}.call(${objId})`); |
| 159 | const writable = await evalInRealmAndReturn( |
| 160 | writeRealm, `${writableGetterId}.call(${objId})`); |
| 161 | assert_equals(readable.constructor, constructorRealm.ReadableStream, |
| 162 | 'readable should be in constructor realm'); |
| 163 | assert_equals(writable.constructor, constructorRealm.WritableStream, |
| 164 | 'writable should be in constructor realm'); |
| 165 | }, `${classname}'s readable and writable attributes should come from the ` + |
| 166 | 'same realm as the constructor definition'); |
| 167 | } |
| 168 | |
| 169 | function runTextEncoderStreamTests() { |
| 170 | promise_test(async () => { |
no test coverage detected