%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; // Test API calls for instance data. const common = require('../../common'); if (module !== require.main) { // When required as a module, run the tests. const test_instance_data = require(`./build/${common.buildType}/test_instance_data`); // Test that instance data can be used in an async work callback. new Promise((resolve) => test_instance_data.asyncWorkCallback(resolve)) // Test that the buffer finalizer can access the instance data. .then(() => new Promise((resolve) => { test_instance_data.testBufferFinalizer(resolve); global.gc(); })) // Test that the thread-safe function can access the instance data. .then(() => new Promise((resolve) => test_instance_data.testThreadsafeFunction(common.mustCall(), common.mustCall(resolve)))); } else { // When launched as a script, run tests in either a child process or in a // worker thread. const assert = require('assert'); const requireAs = require('../../common/require-as'); const runOptions = { stdio: ['inherit', 'pipe', 'inherit'] }; const { spawnSync } = require('child_process'); // Run tests in a child process. requireAs(__filename, ['--expose-gc'], runOptions, 'child'); // Run tests in a worker thread in a child process. requireAs(__filename, ['--expose-gc'], runOptions, 'worker'); function testProcessExit(addonName) { // Make sure that process exit is clean when the instance data has // references to JS objects. const path = require .resolve(`./build/${common.buildType}/${addonName}`) // Replace any backslashes with double backslashes because they'll be re- // interpreted back to single backslashes in the command line argument // to the child process. Windows needs this. .replace(/\\/g, '\\\\'); const child = spawnSync(process.execPath, ['-e', `require('${path}');`]); assert.strictEqual(child.signal, null); assert.strictEqual(child.status, 0); assert.strictEqual(child.stderr.toString(), 'addon_free'); } testProcessExit('test_ref_then_set'); testProcessExit('test_set_then_ref'); }