promise-cross-compartment-subclassing.js (413B)
1 ignoreUnhandledRejections(); 2 3 const global = newGlobal(); 4 const OtherPromise = global.Promise; 5 class SubPromise extends OtherPromise {} 6 7 assertEq(true, new SubPromise(()=>{}) instanceof OtherPromise); 8 assertEq(true, SubPromise.resolve({}) instanceof OtherPromise); 9 assertEq(true, SubPromise.reject({}) instanceof OtherPromise); 10 assertEq(true, SubPromise.resolve({}).then(()=>{}, ()=>{}) instanceof OtherPromise);