GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — checkZFT probes every marker with a synchronous GET: console 404s, main-thread block, double download · Issue #676 · webarkit/jsartoolkitNFT

checkZFT probes every marker with a synchronous GET: console 404s, main-thread block, double download #676

New issue
Copy link
New issue
Copy link
Open
Open
checkZFT probes every marker with a synchronous GET: console 404s, main-thread block, double download#676
Copy link
Assignees
kalwalt
Labels
TypescriptbugSomething isn't workingenhancementNew feature or request

Description

@kalwalt
kalwalt
opened on Sep 26, 2026
Issue body actions

Problem

addNFTMarkers() probes every marker for a compressed .zft descriptor before loading it
(src/ARToolkitNFT.ts,
introduced with #403):

let type = Utils.checkZFT(element + ".zft");

and Utils.checkZFT is a synchronous full GET
(src/Utils.ts):

static checkZFT(url: string): boolean {
    const request = new XMLHttpRequest();
    request.open("GET", url, false); // `false` makes the request synchronous
    request.send(null);
    ...
}

This has three costs:

  1. A console error per marker without a .zft, which is the common case. The browser logs
    every failed request as an error, so an app loading two ordinary descriptor sets starts with
    two red Failed to load resource: 404 (Not Found) lines, even though both markers load fine.
    Users report these as bugs; Aframe-nft now has to explain them in its README.
  2. It blocks the main thread. A synchronous XHR stops rendering and input for a full round
    trip, once per marker. Browsers also deprecate synchronous XHR on the main thread. It hurts
    most when markers are loaded at runtime, which is now common since loading across calls
    landed in 1.13.0 (addNFTMarkers cannot be called more than once — duplicate ids, surfaceSet overwrite, KPM dataset replaced #612, fix: let addNFTMarkers load markers across calls #666).
  3. A .zft is downloaded twice. When it exists, the probe downloads the whole file, then
    ajax() downloads it again to actually load it.

Suggested fix

In order of preference:

  1. Let the URL decide, no probe. Treat a URL that ends in .zft as a compressed descriptor
    and load it directly. Otherwise load .fset / .iset / .fset3 as today. This is explicit,
    costs no extra request and logs no 404. Apps that currently rely on auto-detection would pass
    "…/pinball.zft" instead of "…/pinball", so this is a behaviour change worth a note in the
    release.
  2. Keep auto-detection, but probe asynchronously with HEAD. Use
    fetch(url, { method: "HEAD" }), continue in its promise and fall back on 404. This removes
    the main-thread block and the double download. One 404 per marker without a .zft would still
    be logged.
  3. Make the probe opt-out. For example, an option on loadNFTMarker / loadNFTMarkers to
    skip it when the caller knows no .zft exists.

Option 1 could also accept option 2's auto-detection as a fallback for URLs without an
extension, keeping backward compatibility while new code gets the explicit path.

Seen in

Aframe-nft loads two targets (pinball, kuva) with
1.13.0. The console shows two 404s from checkZFT, then both markers load:

ARToolkitNFT.js:1  Failed to load resource: the server responded with a status of 404 (Not Found)
checkZFT @ ARToolkitNFT.js:1
ARToolkitNFT.js:1  Failed to load resource: the server responded with a status of 404 (Not Found)
checkZFT @ ARToolkitNFT.js:1
ℹ️[webarkit-info:]add NFT marker-> '/markerNFT_0'

Activity

  1. kalwalt
    added
    enhancementNew feature or request
    Typescript
    on Sep 26, 2026
  2. kalwalt
    added 2 commits that reference this issue on Sep 26, 2026

    docs: explain the .zft 404s at start-up; remove an unused .zft

    d9ceb35

    feat: version banner and a quieter console (#20)

    fe98493
  3. kalwalt
    self-assigned this
    on Oct 5, 2026
  4. kalwalt
    added
    bugSomething isn't working
    on Oct 5, 2026
  5. kalwalt commented on Oct 5, 2026

    @kalwalt
    kalwalt
    on Oct 5, 2026
    MemberAuthor
    More actions

    Tracked/addressed as part of #685

  6. kalwalt
    added a commit that references this issue on Oct 23, 2026

    feat: make NFT marker loading Promise-based with fetch (#685) (#736)

    5d82dea
  7. kalwalt commented on Oct 27, 2026

    @kalwalt
    kalwalt
    on Oct 27, 2026
    MemberAuthor
    More actions

    One more case for the .zft probe, raised by the Qodo review of #748 and moved here since it is in the shared loader, not the tracker facade:

    An HTTP 200 that is not a .zft is taken for one. In ARToolkitNFTBase.loadMarkerSource, the probe's res.ok goes straight to storeZFT. A server with an SPA fallback (Vite preview, Netlify / Vercel rewrites, historyApiFallback) answers GET <marker>.zft with 200 and its index.html. The decompression then fails and the marker is reported as format, instead of falling back to the .fset / .iset / .fset3 files that exist.

    Suggested fix, in the probe branch only (an explicit .zft URL should keep failing as format):

    • before storeZFT, check the first bytes of the body against the header the zft writer produces (to be confirmed in WebARKitLib's zft compression code);
    • on a mismatch, treat the response as "no .zft" and fall back to the three files, as for an HTTP error status (D6).

    The Content-Type is not a reliable check: many servers send application/octet-stream, or nothing, for a real .zft.

    Meanwhile #748 adds probeZFT to the tracker's addNFTTargets options (default true, as addNFTMarkers), so the facade can skip the probe as well.

  8. kalwalt
    added 2 commits that reference this issue on Oct 27, 2026

    fix: address the Qodo review of the tracker facade (#720)

    3cdb8a7

    feat: data-oriented NFT tracker facade and worker wrapper (#720) (#748)

    5cf18e8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @kalwalt
    kalwalt

Labels

TypescriptbugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.