11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// Flags: --expose-gc 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst test_exception = require(`./build/${common.buildType}/test_exception`); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci// Make sure that exceptions that occur during finalization are propagated. 91cb0ef41Sopenharmony_cifunction testFinalize(binding) { 101cb0ef41Sopenharmony_ci let x = test_exception[binding](); 111cb0ef41Sopenharmony_ci x = null; 121cb0ef41Sopenharmony_ci global.gc(); 131cb0ef41Sopenharmony_ci process.on('uncaughtException', (err) => { 141cb0ef41Sopenharmony_ci assert.strictEqual(err.message, 'Error during Finalize'); 151cb0ef41Sopenharmony_ci }); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci // To assuage the linter's concerns. 181cb0ef41Sopenharmony_ci (function() {})(x); 191cb0ef41Sopenharmony_ci} 201cb0ef41Sopenharmony_citestFinalize('createExternalBuffer'); 21