Files
scriptc/tests/fixtures/server/cases/h2c-js/main.js
Chris Tate 6b6445ab90 Retire the "DOM" nickname in comments, internal docs, and message prose: the checked-dynamic tree / dyn values
- The ratified rename rider (world-unification §7 lane 5): "DOM" collided with the browser DOM and, post-lane-1, the structure is no longer a document tree. Comments and doc prose now say "the checked-dynamic tree" for the noun and "dyn" adjectivally; runtime symbol names (scr_dyn_*), the error.domClone libCall, and the real web DOMException family are unchanged.
- The few user-facing strings carrying the nickname move with it (the structuredClone cyclic message, the dc subscriber/publish fences, two emitter ICE texts); diagnostics snapshots regenerated (96 pass). One private compiler constant (DOM_PROTO_METHOD_NAMES -> DYN_PROTO_METHOD_NAMES) rides along.
- Mechanical sweep, 142 files, comments/prose only — no behavior change.
2026-07-24 11:14:58 -05:00

29 lines
1.1 KiB
JavaScript

/* The JS-lane h2c loop: a common.mustCall-shaped wrapper makes the
* listeners checked-dynamic (the Node-suite shape), so the stream and
* session handles cross into dyn code and dispatch their members through
* the h2 dyn handle ops. Self-contained; stdout compared across lanes. */
'use strict';
function mustCall(fn) {
return function (...args) { return fn.apply(this, args); };
}
const http2 = require('http2');
const server = http2.createServer();
server.on('stream', mustCall((stream, headers) => {
console.log('S: path', headers[':path']);
stream.respond({ ':status': 201, 'content-type': 'text/plain' });
stream.end('hello');
}));
server.listen(0, mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
const req = client.request({ ':path': '/js' });
req.setEncoding('utf8');
let data = '';
req.on('response', mustCall((h) => { console.log('C: status', h[':status']); }));
req.on('data', (d) => { data += d; });
req.on('end', mustCall(() => { console.log('C: body', data); }));
req.on('close', () => { client.close(); server.close(); });
}));