diff options
Diffstat (limited to 'deps/v8/test/mjsunit/harmony/weakrefs/basics.js')
-rw-r--r-- | deps/v8/test/mjsunit/harmony/weakrefs/basics.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/basics.js b/deps/v8/test/mjsunit/harmony/weakrefs/basics.js index c1ec4070f4..df599ebd40 100644 --- a/deps/v8/test/mjsunit/harmony/weakrefs/basics.js +++ b/deps/v8/test/mjsunit/harmony/weakrefs/basics.js @@ -85,7 +85,25 @@ (function TestUnregisterWithNonExistentKey() { let fg = new FinalizationGroup(() => {}); - fg.unregister({"k": "whatever"}); + let success = fg.unregister({"k": "whatever"}); + assertFalse(success); +})(); + +(function TestUnregisterWithNonFinalizationGroup() { + assertThrows(() => FinalizationGroup.prototype.unregister.call({}, {}), + TypeError); +})(); + +(function TestUnregisterWithNonObjectUnregisterToken() { + let fg = new FinalizationGroup(() => {}); + assertThrows(() => fg.unregister(1), TypeError); + assertThrows(() => fg.unregister(1n), TypeError); + assertThrows(() => fg.unregister('one'), TypeError); + assertThrows(() => fg.unregister(Symbol()), TypeError); + assertThrows(() => fg.unregister(true), TypeError); + assertThrows(() => fg.unregister(false), TypeError); + assertThrows(() => fg.unregister(undefined), TypeError); + assertThrows(() => fg.unregister(null), TypeError); })(); (function TestWeakRefConstructor() { @@ -138,3 +156,15 @@ let rv = FinalizationGroup.prototype.cleanupSome.call(fg); assertEquals(undefined, rv); })(); + +(function TestCleanupSomeWithNonCallableCallback() { + let fg = new FinalizationGroup(() => {}); + assertThrows(() => fg.cleanupSome(1), TypeError); + assertThrows(() => fg.cleanupSome(1n), TypeError); + assertThrows(() => fg.cleanupSome(Symbol()), TypeError); + assertThrows(() => fg.cleanupSome({}), TypeError); + assertThrows(() => fg.cleanupSome('foo'), TypeError); + assertThrows(() => fg.cleanupSome(true), TypeError); + assertThrows(() => fg.cleanupSome(false), TypeError); + assertThrows(() => fg.cleanupSome(null), TypeError); +})(); |