From 8296db887368bbffa3379f995a1e628ddbe8421f Mon Sep 17 00:00:00 2001 From: Rezvan Mahdavi Hezaveh Date: Thu, 26 Dec 2024 12:19:20 -0800 Subject: [PATCH] [explicit-resource-management] Return undefined from dispose builtin This CL fixes the bug of returning true in dispose method of DisposableStack. Bug: 385547086 Change-Id: Iddb72962bd5f7de1ee9346cda3094e98e0565119 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6119280 Reviewed-by: Shu-yu Guo Commit-Queue: Rezvan Mahdavi Hezaveh Cr-Commit-Position: refs/heads/main@{#97920} --- ...tack-dispose-async-resolved-by-undefined.js | 18 ++++++++++++++++++ ...isposable-stack-dispose-return-undefined.js | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/staging/explicit-resource-management/async-disposable-stack-dispose-async-resolved-by-undefined.js create mode 100644 test/staging/explicit-resource-management/disposable-stack-dispose-return-undefined.js diff --git a/test/staging/explicit-resource-management/async-disposable-stack-dispose-async-resolved-by-undefined.js b/test/staging/explicit-resource-management/async-disposable-stack-dispose-async-resolved-by-undefined.js new file mode 100644 index 0000000000..e32160e1ea --- /dev/null +++ b/test/staging/explicit-resource-management/async-disposable-stack-dispose-async-resolved-by-undefined.js @@ -0,0 +1,18 @@ +// Copyright (C) 2024 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + AsyncDisposableStack resolved with undefned. +includes: [asyncHelpers.js] +flags: [async] +features: [explicit-resource-management] +---*/ + +asyncTest(async function() { + async function TestAsyncDisposableStackDefer() { + let stack = new AsyncDisposableStack(); + assert.sameValue(await stack.disposeAsync(), undefined); + }; + await TestAsyncDisposableStackDefer(); + }); diff --git a/test/staging/explicit-resource-management/disposable-stack-dispose-return-undefined.js b/test/staging/explicit-resource-management/disposable-stack-dispose-return-undefined.js new file mode 100644 index 0000000000..ccf19280c1 --- /dev/null +++ b/test/staging/explicit-resource-management/disposable-stack-dispose-return-undefined.js @@ -0,0 +1,13 @@ +// Copyright (C) 2024 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + DisposableStack return undefned. +features: [explicit-resource-management] +---*/ + +(function TestDisposableStackDisposeReturnsUndefined() { + let stack = new DisposableStack(); + assert.sameValue(stack.dispose(), undefined); +})();