Repository navigation
Ariadne file-pick: a hidden tab's upload keeps its pace; the system dialog's title and folder - #1274
Merged
Merged
Conversation
…ialog's title and folder Found by trying the file picker by hand after #1190. A browser page's picks and reads now call back from the browser's own events (the input's change or cancel, the slice's promise) through cvc_files_settled, not from a 4 ms / 50 ms timer that polled. A hidden tab runs timers about once a second, and once a minute after five minutes, so an upload in a background tab went a chunk or two a second. With 1 KiB chunks in Chrome 157: 70 KB took 35 s hidden before, and now 0.8 s; 1 MiB takes 12 s hidden. A read settles once, even when the copy into the heap throws. A pool thread's read (wasm-mt) waits as before. arigl's system dialog goes through SDL_ShowFileDialogWithProperties, so file-pick's `title` reaches it. Without one it keeps the system's own, in the user's language. `dir` now ends in a separator: SDL took a folder without one for a file, and Windows opened the folder's parent with the folder's name typed in. ARIADNE.md 10.8 says what `title` and `dir` do in each picker. With no `dir`, the system dialog starts where the system chooses, not in the working folder.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three gaps in #1190's file picker, found by trying it by hand on Windows and in Chrome.
A hidden tab's upload crawled
A browser page's picks and reads polled a timer (4 ms for a read, 50 ms for a pick) until the page had answered. A hidden tab runs timers about once a second (once a minute after five minutes hidden), so an upload in a background tab went a chunk or two a second.
Now the page calls back (
cvc_files_settled, anEMSCRIPTEN_KEEPALIVEexport, asbrowser_runtime.cppdoes) from the browser's own events: the input'schange/canceland the slice's promise. An answer the page already has comes from a microtask, after the C++ call returns. A read settles exactly once, even if the copy into the heap throws (before, that would have hung). A pool thread's read in wasm-mt still waits as before (no page timer is involved).Chrome 157, 1 KiB chunks, page hidden (minimized) right after the pick:
The bytes matched each file's sha256, and the program reported the result once the page was shown again.
The system dialog ignored
title, anddiropened the wrong folderariglnow callsSDL_ShowFileDialogWithProperties(SDL ≥ 3.2; deps have 3.4.12), sotitlereaches the dialog. Without atitleit keeps the system's own, in the user's language.dirnow gets a trailing separator: SDL tookC:\...\pick-testas a file, and Windows openedC:\...with "pick-test" typed into the file-name box.Docs
ARIADNE.md §10.8 says what
titleanddirdo in each picker: the composed window's defaults, the system dialog's, and a browser's (no title, its own folder). With nodir, the system dialog starts where the system chooses (usually the folder last used), not in the working folder as the docs said.Verified on Windows
arigldialog:diropens inside the folder, with the filter showing only.bin/.txt.arigl_web_smoke.mjsagainst the new single-threaded build: 6/6.ariadne_files_test: 15/15.Not verified here
ariglx-web (wasm-mt)runs the same smoke file.