quickwin 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.en.md +2 -1
  2. package/README.md +2 -1
  3. package/examples/PdfCanvas.js +3 -3
  4. package/examples/PdfCanvas.tsx +3 -3
  5. package/examples/pdf_preview2.js +34 -19
  6. package/examples/pdf_preview2.ts +34 -20
  7. package/examples/pdf_viewer.js +956 -215
  8. package/examples/pdf_viewer.tsx +29 -19
  9. package/examples/test_gallery.js +922 -194
  10. package/examples/test_react_lazy.js +905 -177
  11. package/examples/test_react_listbox.js +905 -177
  12. package/examples/test_root_window.js +905 -177
  13. package/examples/test_tab.js +905 -177
  14. package/lib/fetch.js +35 -7
  15. package/lib/fetch.ts +24 -4
  16. package/lib/ffi-bind.js +85 -0
  17. package/lib/ffi-bind.ts +170 -0
  18. package/lib/ffi-struct.js +224 -0
  19. package/lib/ffi-struct.ts +239 -0
  20. package/lib/react-qw/components/DateTimePicker.js +21 -15
  21. package/lib/react-qw/components/Link.js +4 -6
  22. package/lib/react-qw/components/ListView.js +84 -40
  23. package/lib/react-qw/components/PathPicker.js +40 -24
  24. package/lib/react-qw/components/Tab.js +21 -10
  25. package/lib/react-qw/components/Tooltip.js +27 -15
  26. package/lib/react-qw/components/TreeView.js +23 -33
  27. package/lib/react-qw/nmhdr.js +26 -0
  28. package/lib/react-qw/nmhdr.ts +32 -0
  29. package/lib/text-measure.js +14 -24
  30. package/lib/text-measure.ts +14 -24
  31. package/lib/win-common-structs.js +39 -0
  32. package/lib/win-common-structs.ts +41 -0
  33. package/main.js +46 -0
  34. package/package.json +2 -1
  35. package/quickwin.d.ts +7 -2
  36. package/qwin-nowasm-x86.exe +0 -0
  37. package/qwin-nowasm.exe +0 -0
  38. package/qwin-x86.exe +0 -0
  39. package/qwin.exe +0 -0
  40. package/test/run.js +3 -0
  41. package/test/run.ts +3 -0
  42. package/test/test_ffi.js +12 -8
  43. package/test/test_ffi.ts +12 -12
  44. package/test/test_ffi_bind.js +42 -0
  45. package/test/test_ffi_bind.ts +46 -0
  46. package/test/test_ffi_struct.js +201 -0
  47. package/test/test_ffi_struct.ts +223 -0
  48. package/test/test_net_fetch.js +62 -0
  49. package/test/test_net_fetch.ts +72 -0
  50. package/test/test_react_complex.js +908 -180
  51. package/test/test_react_counter.js +905 -177
  52. package/test/test_react_flex.js +905 -177
  53. package/test/test_react_hidden.js +907 -179
  54. package/test/test_react_listview_link.js +905 -177
  55. package/test/test_react_render.js +905 -177
  56. package/test/test_wolfssl_read.js +201 -0
  57. package/test/test_wolfssl_read.ts +181 -0
@@ -1,5 +1,6 @@
1
1
  import '../lib/fetch.js'
2
2
  import * as std from 'std'
3
+ import * as os from 'os'
3
4
  import { Tester } from './test_helper.js'
4
5
 
5
6
  export const suite = {
@@ -234,5 +235,76 @@ export const suite = {
234
235
  } else {
235
236
  assert('https endpoint reachable', false)
236
237
  }
238
+
239
+ // ── large HTTPS body (wolfSSL_read null regression) ──
240
+ // Pre-fix: wolfSSL_read returned number -1 on WANT_READ →
241
+ // receivedBytes became NaN → stream never closed → hang.
242
+ t.section('large HTTPS body')
243
+ {
244
+ const LARGE = 200000
245
+ try {
246
+ const r = await Promise.race([
247
+ fetch(`https://localhost:18924/large/${LARGE}`, { timeout: 15000 }),
248
+ new Promise<never>((_, rej) =>
249
+ os.setTimeout(() => rej(new Error('Body hang watchdog 15s')), 15000)
250
+ )
251
+ ])
252
+ assert('large HTTPS status 200', r.status === 200)
253
+ const buf = await Promise.race([
254
+ r.arrayBuffer(),
255
+ new Promise<never>((_, rej) =>
256
+ os.setTimeout(() => rej(new Error('arrayBuffer hang watchdog 15s')), 15000)
257
+ )
258
+ ])
259
+ assert('large HTTPS byteLength exact', buf.byteLength === LARGE)
260
+ } catch (e: unknown) {
261
+ assert('large HTTPS completed without hang (' + String((e as Error).message) + ')', false)
262
+ }
263
+ }
264
+
265
+ // ── large HTTP body (sock.recv path same null contract) ──
266
+ t.section('large HTTP body')
267
+ {
268
+ const LARGE = 200000
269
+ try {
270
+ const r = await Promise.race([
271
+ fetch(`http://localhost:18923/large/${LARGE}`, { timeout: 15000 }),
272
+ new Promise<never>((_, rej) =>
273
+ os.setTimeout(() => rej(new Error('Body hang watchdog 15s')), 15000)
274
+ )
275
+ ])
276
+ assert('large HTTP status 200', r.status === 200)
277
+ const buf = await Promise.race([
278
+ r.arrayBuffer(),
279
+ new Promise<never>((_, rej) =>
280
+ os.setTimeout(() => rej(new Error('arrayBuffer hang watchdog 15s')), 15000)
281
+ )
282
+ ])
283
+ assert('large HTTP byteLength exact', buf.byteLength === LARGE)
284
+ } catch (e: unknown) {
285
+ assert('large HTTP completed (' + String((e as Error).message) + ')', false)
286
+ }
287
+ }
288
+
289
+ // ── body timeout after headers (armTimeout after doResolve) ──
290
+ t.section('HTTPS body timeout')
291
+ {
292
+ let rejected = false
293
+ let msg = ''
294
+ try {
295
+ const r = await fetch('https://localhost:18924/stall', { timeout: 2000 })
296
+ await Promise.race([
297
+ r.arrayBuffer(),
298
+ new Promise<never>((_, rej) =>
299
+ os.setTimeout(() => rej(new Error('Body timeout')), 8000)
300
+ )
301
+ ])
302
+ } catch (e: unknown) {
303
+ rejected = true
304
+ msg = String((e as Error).message)
305
+ }
306
+ assert('stall body rejects (timeout)', rejected)
307
+ assert('stall error mentions timeout', /timeout/i.test(msg))
308
+ }
237
309
  }
238
310
  }