[foozzie] Mock WeakRef and FinalizationRegistry

WeakRef and FinalizationRegistry are intrinsically observably
nondeterministic because they depend on GC timing.

TBR=clemensb@chromium.org,machenbach@chromium.org

Bug: chromium:1074235
Change-Id: I8f28fdc46a3109218d69b106406860211ee9f258
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2165880
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67383}
This commit is contained in:
Shu-yu Guo 2020-04-24 16:24:31 -07:00 committed by Commit Bot
parent 3f270f34a1
commit 6f69ae49a7

View File

@ -175,3 +175,11 @@ Object.defineProperty(
// Mock Realm.
Realm.eval = function(realm, code) { return eval(code) };
// Mock the nondeterministic parts of WeakRef and FinalizationRegistry.
WeakRef.prototype.deref = function() { };
FinalizationRegistry = function(callback) { };
FinalizationRegistry.prototype.register = function(target, holdings) { };
FinalizationRegistry.prototype.unregister = function(unregisterToken) { };
FinalizationRegistry.prototype.cleanupSome = function() { };
FinalizationRegistry.prototype[Symbol.toStringTag] = "FinalizationRegistry";