feat(libSceNKWebKit): implement WebCore::MIMETypeRegistry extension, path, Java applet and system-preview lookups #19636

Merged
B-Howell merged 6 commits from upstream-pr/19636 into main 2026-11-18 09:35:05 +00:00
B-Howell commented 2026-11-13 17:11:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-11-13T17:11:12Z.


What

Implements five WebCore::MIMETypeRegistry exports that threw: mimeTypeForExtension, mimeTypeForPath, mediaMIMETypeForExtension, isJavaAppletMIMEType and isSystemPreviewMIMEType. All five are static member functions taking const WTF::String&, with no object, so any guest code that imports libSceNKWebKit can call them directly.

  • They follow MIMETypeRegistry.cpp and MIMETypeRegistryPlayStation.cpp of May 2021.
  • Extensions are looked up in the PlayStation extension table this library already has in src/Mime.cpp, which comes from the pinned 11.x source. That table also maps mjs, mp4 and webp, which upstream's table of that time does not.
  • mimeTypeForPath looks up the text after the last . of the path and returns defaultMIMEType() (application/octet-stream) when there is no . or the extension is unknown.
  • mediaMIMETypeForExtension checks the media table first, then falls back to mimeTypeForExtension, as upstream does.
  • isSystemPreviewMIMEType keeps that revision's sorted-array search with ASCII case folding.
  • mediaMIMETypeForExtension returns the empty string for a null extension; upstream dereferences it.
  • The stubs move from Export.cpp and LegacyExports.hpp to typed prototypes in MimeExports.hpp.

systemPreviewMIMETypes still throws NotImplemented_nid_no_patch. Before WebKit/WebKit@c650d41f89 (April 2021) it returns a HashSet reference, and after it a FixedVector by value. Which of the two return ABIs the 3.20 module uses is unverified, and guessing would corrupt the caller's stack. The debt entry records this and that none of these exports have been compared with a console module.

The debt count stays at main's 5939 of 8703: the five stubs were LegacyExports.hpp declarations, not inventory rows.

Tested

Ubuntu WSL2, GCC 11.4, Release, Ninja.

  • Red control: the new test cases do not build against main's untyped stubs.
  • On c7e3d232f4b (main dc19132bac2): nkwebkit_mimetyperegistry passes 3/3. The new TestLegacyLookups checks the following:
    • upper-case, unknown and null extensions;
    • paths with several dots, a trailing dot, no extension, empty and null;
    • media types, including the fallback to the general table;
    • Java applet prefixes and near misses;
    • the four system-preview types in mixed case and near misses such as model/usdz and model/us.
  • fdeccae456e only shortens the debt entry. 8bbf2498927 is an ordinary merge of main at 667dbde5131; main's 14 new commits touch no libSceNKWebKit file, so it was not rebuilt.
  • tools/check_conventions.py --base origin/main passed on 8bbf2498927.
  • tools/pr_overlap.py --jobs 8 failed closed: a git diff subprocess exited with 0xC0000142 on Windows. By hand: none of the 78 open PRs touching libSceNKWebKit names these symbols or their NIDs in changed lines.
  • Windows, by @JJenkx (comment): head 8bbf249892 merged onto main d261fa6f56 (68712fd96f, clean merge), Windows 11, WinLibs GCC 15.2 UCRT, Release: nkwebkit_mimetyperegistry passed 3/3, none skipped.
  • 2026-11-14: comment-only commit 7e233f67b9c adds the Derived from lines naming MIMETypeRegistry.cpp and MIMETypeRegistryPlayStation.cpp at e12a212a531a to src/Mime.cpp (maintainer ruling, #19819 comment). No code changed, so no rebuild; tools/check_conventions.py --base origin/main passes and git diff --check is clean.
  • Debt fragment e891549c59: merged main c3d38470e0c and moved this PR's debt edits into docs/dev/debt/changes/claude-nkwebkit-mimetype-lookups.md; the debt files match main, and the fragment applied to main gives the same debt lines as the previous head. debt_fold.py --check and check_conventions.py --base origin/main pass. Documentation only, no build.
  • Main merge 0906ab6d4c2 (main e48e6d9f53c): one conflict at the end of src/Mime.cpp, where #22751 added the NKWebKit::WebCoreAbi scheme queries after the extern "C" block this PR extends; kept both. Ubuntu WSL2, GCC 11.4, Release: nkwebkit_mimetyperegistry and nkwebkit_securityorigin pass. Debt files match main; debt_fold.py --check and check_conventions.py --base origin/main pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#15853 also appends to MimeExports.hpp and src/Mime.cpp; whichever merges second needs a trivial merge)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5299720737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19636). Originally posted by [B-Howell](https://github.com/B-Howell) on 2026-11-13T17:11:12Z. --- ### What Implements five `WebCore::MIMETypeRegistry` exports that threw: `mimeTypeForExtension`, `mimeTypeForPath`, `mediaMIMETypeForExtension`, `isJavaAppletMIMEType` and `isSystemPreviewMIMEType`. All five are static member functions taking `const WTF::String&`, with no object, so any guest code that imports libSceNKWebKit can call them directly. - They follow [MIMETypeRegistry.cpp](https://github.com/WebKit/WebKit/blob/e12a212a531aeddc11259e8515671cf5188e038d/Source/WebCore/platform/MIMETypeRegistry.cpp#L274-L689) and [MIMETypeRegistryPlayStation.cpp](https://github.com/WebKit/WebKit/blob/e12a212a531aeddc11259e8515671cf5188e038d/Source/WebCore/platform/playstation/MIMETypeRegistryPlayStation.cpp#L60-L66) of May 2021. - Extensions are looked up in the PlayStation extension table this library already has in `src/Mime.cpp`, which comes from the pinned 11.x source. That table also maps `mjs`, `mp4` and `webp`, which upstream's table of that time does not. - `mimeTypeForPath` looks up the text after the last `.` of the path and returns `defaultMIMEType()` (`application/octet-stream`) when there is no `.` or the extension is unknown. - `mediaMIMETypeForExtension` checks the media table first, then falls back to `mimeTypeForExtension`, as upstream does. - `isSystemPreviewMIMEType` keeps that revision's sorted-array search with ASCII case folding. - `mediaMIMETypeForExtension` returns the empty string for a null extension; upstream dereferences it. - The stubs move from `Export.cpp` and `LegacyExports.hpp` to typed prototypes in `MimeExports.hpp`. `systemPreviewMIMETypes` still throws `NotImplemented_nid_no_patch`. Before WebKit/WebKit@c650d41f8945 (April 2021) it returns a `HashSet` reference, and after it a `FixedVector` by value. Which of the two return ABIs the 3.20 module uses is unverified, and guessing would corrupt the caller's stack. The debt entry records this and that none of these exports have been compared with a console module. The debt count stays at main's 5939 of 8703: the five stubs were `LegacyExports.hpp` declarations, not inventory rows. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Ubuntu WSL2, GCC 11.4, Release, Ninja. - Red control: the new test cases do not build against main's untyped stubs. - On `c7e3d232f4b` (main `dc19132bac2`): `nkwebkit_mimetyperegistry` passes 3/3. The new `TestLegacyLookups` checks the following: - upper-case, unknown and null extensions; - paths with several dots, a trailing dot, no extension, empty and null; - media types, including the fallback to the general table; - Java applet prefixes and near misses; - the four system-preview types in mixed case and near misses such as `model/usdz` and `model/us`. - `fdeccae456e` only shortens the debt entry. `8bbf2498927` is an ordinary merge of main at `667dbde5131`; main's 14 new commits touch no libSceNKWebKit file, so it was not rebuilt. - `tools/check_conventions.py --base origin/main` passed on `8bbf2498927`. - `tools/pr_overlap.py --jobs 8` failed closed: a `git diff` subprocess exited with 0xC0000142 on Windows. By hand: none of the 78 open PRs touching libSceNKWebKit names these symbols or their NIDs in changed lines. - Windows, by @JJenkx ([comment](https://github.com/boykopovar/AnyPS5/pull/19636#issuecomment-6862744067)): head `8bbf249892` merged onto `main` `d261fa6f56` (`68712fd96f`, clean merge), Windows 11, WinLibs GCC 15.2 UCRT, Release: `nkwebkit_mimetyperegistry` passed 3/3, none skipped. - 2026-11-14: comment-only commit `7e233f67b9c` adds the `Derived from` lines naming MIMETypeRegistry.cpp and MIMETypeRegistryPlayStation.cpp at e12a212a531a to `src/Mime.cpp` (maintainer ruling, [#19819 comment](https://github.com/boykopovar/AnyPS5/pull/19819#issuecomment-6868889186)). No code changed, so no rebuild; `tools/check_conventions.py --base origin/main` passes and `git diff --check` is clean. - Debt fragment `e891549c59`: merged main `c3d38470e0c` and moved this PR's debt edits into `docs/dev/debt/changes/claude-nkwebkit-mimetype-lookups.md`; the debt files match main, and the fragment applied to main gives the same debt lines as the previous head. `debt_fold.py --check` and `check_conventions.py --base origin/main` pass. Documentation only, no build. - Main merge `0906ab6d4c2` (main `e48e6d9f53c`): one conflict at the end of `src/Mime.cpp`, where #22751 added the `NKWebKit::WebCoreAbi` scheme queries after the `extern "C"` block this PR extends; kept both. Ubuntu WSL2, GCC 11.4, Release: `nkwebkit_mimetyperegistry` and `nkwebkit_securityorigin` pass. Debt files match main; `debt_fold.py --check` and `check_conventions.py --base origin/main` pass. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#15853 also appends to `MimeExports.hpp` and `src/Mime.cpp`; whichever merges second needs a trivial merge) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-13 18:02:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-13T18:02:13Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 8bbf249892:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_mimetyperegistry_tests built cleanly.
  • CTest (nkwebkit_mimetyperegistry):
    1/1 Test #3897: nkwebkit_mimetyperegistry ........   Passed    0.03 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/MimeExports.hpp, core/libs/prx/libSceNKWebKit/src/Mime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE safely handles null path.impl, empty strings, trailing dots ('x.png.'), multiple dots ('archive.tar.HTML'), and extensionless paths, returning defaultMIMEType ('application/octet-stream') when unmatched.
    • core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE handles null and empty inputs, case-insensitive prefixes ('APPLICATION/X-JAVA-VM'), and negative cases ('application/java', 'application/x-java').
    • core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE and LiteralLessThanASCIICaseFolding preserve strict weak ordering for std::lower_bound over kSystemPreviewMIMETypes with null, mixed-case, and boundary strings ('model/us', 'model/usdz').
    • core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE handles null and empty extension inputs safely through ToString without bounds violations.
    • core/libs/prx/libSceNKWebKit/Export.cpp and LegacyExports.hpp: verified all five implemented WebCore::MIMETypeRegistry stubs calling NotImplemented_nid_no_patch were removed and re-exported with typed signatures in MimeExports.hpp.
  • Concerns:
    • core/libs/prx/libSceNKWebKit/src/Mime.cpp:1: Lines 1-50 introduce 50 lines of block comments containing Apple and Sony copyright notices. AGENTS.md strictly prohibits comments in code: 'No comments in code, except #endif and namespace ends.'
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5895772590 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19636#pullrequestreview-5895772590). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-13T18:02:13Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `8bbf249892`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_mimetyperegistry_tests` built cleanly. - **CTest** (`nkwebkit_mimetyperegistry`): ``` 1/1 Test #3897: nkwebkit_mimetyperegistry ........ Passed 0.03 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/MimeExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Mime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE safely handles null path.impl, empty strings, trailing dots ('x.png.'), multiple dots ('archive.tar.HTML'), and extensionless paths, returning defaultMIMEType ('application/octet-stream') when unmatched. - core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE handles null and empty inputs, case-insensitive prefixes ('APPLICATION/X-JAVA-VM'), and negative cases ('application/java', 'application/x-java'). - core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE and LiteralLessThanASCIICaseFolding preserve strict weak ordering for std::lower_bound over kSystemPreviewMIMETypes with null, mixed-case, and boundary strings ('model/us', 'model/usdz'). - core/libs/prx/libSceNKWebKit/src/Mime.cpp: verified _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE handles null and empty extension inputs safely through ToString without bounds violations. - core/libs/prx/libSceNKWebKit/Export.cpp and LegacyExports.hpp: verified all five implemented WebCore::MIMETypeRegistry stubs calling NotImplemented_nid_no_patch were removed and re-exported with typed signatures in MimeExports.hpp. - **Concerns**: - core/libs/prx/libSceNKWebKit/src/Mime.cpp:1: Lines 1-50 introduce 50 lines of block comments containing Apple and Sony copyright notices. AGENTS.md strictly prohibits comments in code: 'No comments in code, except #endif and namespace ends.' - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-14 01:23:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T01:23:31Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 7e233f67b9:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_mimetyperegistry_tests built cleanly.
  • CTest (nkwebkit_mimetyperegistry):
    1/1 Test #3897: nkwebkit_mimetyperegistry ........   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/MimeExports.hpp, core/libs/prx/libSceNKWebKit/src/Mime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE correctly searches backwards for the last dot using GetChar, correctly handles null/empty paths, and returns _ZN7WebCore15defaultMIMETypeEv() (application/octet-stream) matching upstream WebCore reverseFind('.') logic.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE correctly tests prefixes application/x-java-applet, application/x-java-bean, and application/x-java-vm ignoring ASCII case, and safely rejects empty or null string inputs.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE and IsSystemPreviewMIMEType correctly perform case-folding binary search over sorted array kSystemPreviewMIMETypes (model/usd, model/vnd.pixar.usd, model/vnd.reality, model/vnd.usdz+zip) without out-of-bounds indexing on null or arbitrary inputs.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE correctly delegates to MimeTypeForExtension via ToString, looking up extensions in kPlatformMediaTypes with ASCII case insensitivity.
    • Verified core/libs/prx/libSceNKWebKit/Export.cpp and LegacyExports.hpp: cleanly removed legacy NotImplemented_nid_no_patch stubs and untyped prototypes for all 5 implemented WebCore::MIMETypeRegistry exports.
    • Verified docs/dev/debt/libSceNKWebKit.md: documented technical debt entry for MIME type lookups by extension and path, correctly preserving NotImplemented_nid_no_patch for systemPreviewMIMETypes due to unverified HashSet vs FixedVector return ABI.
  • Concerns:
    • core/libs/prx/libSceNKWebKit/src/Mime.cpp:562-569: In MediaMIMETypeForExtension, MimeTypeForExtension(ext) is queried before kCommonMediaTypes and without validating that the returned MIME type is a supported media MIME type. When called with non-media file extensions present in kPlatformMediaTypes (such as extension "png", "html", "css", "js", "pdf", or "zip"), MediaMIMETypeForExtension returns non-media types (e.g. "image/png", "text/html", "text/css", "application/javascript", "application/pdf") instead of returning an empty string (""). Upstream WebCore mediaMIMETypeForExtension checks getMediaMIMETypeForExtension first and only falls back to mimeTypeForExtension if isSupportedMediaMIMEType(type) evaluates to true.
    • core/libs/prx/libSceNKWebKit/tests/MimeTypeRegistry.cpp:377: The unit test assertion Require(Equals(_ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE(MakeString("png")), "image/png")) asserts that mediaMIMETypeForExtension returns "image/png" for the image extension "png", validating and locking in the defect where non-media extensions return non-media MIME types instead of verifying that non-media extensions return an empty string.
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5900385340 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19636#pullrequestreview-5900385340). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-14T01:23:31Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `7e233f67b9`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_mimetyperegistry_tests` built cleanly. - **CTest** (`nkwebkit_mimetyperegistry`): ``` 1/1 Test #3897: nkwebkit_mimetyperegistry ........ Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/MimeExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Mime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE correctly searches backwards for the last dot using GetChar, correctly handles null/empty paths, and returns _ZN7WebCore15defaultMIMETypeEv() (application/octet-stream) matching upstream WebCore reverseFind('.') logic. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE correctly tests prefixes application/x-java-applet, application/x-java-bean, and application/x-java-vm ignoring ASCII case, and safely rejects empty or null string inputs. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE and IsSystemPreviewMIMEType correctly perform case-folding binary search over sorted array kSystemPreviewMIMETypes (model/usd, model/vnd.pixar.usd, model/vnd.reality, model/vnd.usdz+zip) without out-of-bounds indexing on null or arbitrary inputs. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE correctly delegates to MimeTypeForExtension via ToString, looking up extensions in kPlatformMediaTypes with ASCII case insensitivity. - Verified core/libs/prx/libSceNKWebKit/Export.cpp and LegacyExports.hpp: cleanly removed legacy NotImplemented_nid_no_patch stubs and untyped prototypes for all 5 implemented WebCore::MIMETypeRegistry exports. - Verified docs/dev/debt/libSceNKWebKit.md: documented technical debt entry for MIME type lookups by extension and path, correctly preserving NotImplemented_nid_no_patch for systemPreviewMIMETypes due to unverified HashSet vs FixedVector return ABI. - **Concerns**: - core/libs/prx/libSceNKWebKit/src/Mime.cpp:562-569: In MediaMIMETypeForExtension, MimeTypeForExtension(ext) is queried before kCommonMediaTypes and without validating that the returned MIME type is a supported media MIME type. When called with non-media file extensions present in kPlatformMediaTypes (such as extension "png", "html", "css", "js", "pdf", or "zip"), MediaMIMETypeForExtension returns non-media types (e.g. "image/png", "text/html", "text/css", "application/javascript", "application/pdf") instead of returning an empty string (""). Upstream WebCore mediaMIMETypeForExtension checks getMediaMIMETypeForExtension first and only falls back to mimeTypeForExtension if isSupportedMediaMIMEType(type) evaluates to true. - core/libs/prx/libSceNKWebKit/tests/MimeTypeRegistry.cpp:377: The unit test assertion Require(Equals(_ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE(MakeString("png")), "image/png")) asserts that mediaMIMETypeForExtension returns "image/png" for the image extension "png", validating and locking in the defect where non-media extensions return non-media MIME types instead of verifying that non-media extensions return an empty string. - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-15 21:01:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T21:01:08Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 7e233f67b9:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_mimetyperegistry_tests built cleanly.
  • CTest (nkwebkit_mimetyperegistry):
    1/1 Test #3897: nkwebkit_mimetyperegistry ........   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/MimeExports.hpp, core/libs/prx/libSceNKWebKit/src/Mime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/Export.cpp and core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp: all five WebCore::MIMETypeRegistry stub exports (_ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE) are cleanly removed and re-declared with typed prototypes in core/libs/prx/libSceNKWebKit/include/MimeExports.hpp.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE safely handles null or empty StringImpl pointers, scans backwards for the last '.', looks up the extension via MimeTypeForExtension, and falls back to defaultMIMEType() ("application/octet-stream") matching upstream WebCore and PS5 11.x WebKit behavior.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, and _ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE handle null/empty WTF::String inputs safely, perform ASCII case-insensitive comparisons, and follow the pinned PS5 11.x WebKit lookup precedence.
    • Verified mechanical gates, cross-platform compatibility (Linux x86_64 and Windows UCRT test runs), and AGENTS.md compliance including upstream WebKit license notice conventions and technical debt documentation in docs/dev/debt/libSceNKWebKit.md.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912913997 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19636#pullrequestreview-5912913997). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T21:01:08Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `7e233f67b9`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_mimetyperegistry_tests` built cleanly. - **CTest** (`nkwebkit_mimetyperegistry`): ``` 1/1 Test #3897: nkwebkit_mimetyperegistry ........ Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/MimeExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Mime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/Export.cpp and core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp: all five WebCore::MIMETypeRegistry stub exports (_ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE) are cleanly removed and re-declared with typed prototypes in core/libs/prx/libSceNKWebKit/include/MimeExports.hpp. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE safely handles null or empty StringImpl pointers, scans backwards for the last '.', looks up the extension via MimeTypeForExtension, and falls back to defaultMIMEType() ("application/octet-stream") matching upstream WebCore and PS5 11.x WebKit behavior. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, and _ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE handle null/empty WTF::String inputs safely, perform ASCII case-insensitive comparisons, and follow the pinned PS5 11.x WebKit lookup precedence. - Verified mechanical gates, cross-platform compatibility (Linux x86_64 and Windows UCRT test runs), and AGENTS.md compliance including upstream WebKit license notice conventions and technical debt documentation in docs/dev/debt/libSceNKWebKit.md. Looks Good To Me
PrivacyOnion commented 2026-11-15 23:57:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T23:57:53Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against e891549c59:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_mimetyperegistry_tests built cleanly.
  • CTest (nkwebkit_mimetyperegistry):
    1/1 Test #4232: nkwebkit_mimetyperegistry ........   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/MimeExports.hpp, core/libs/prx/libSceNKWebKit/src/Mime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/Export.cpp and core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp: all five WebCore::MIMETypeRegistry stub exports (_ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE) are cleanly removed and declared with matching typed prototypes in core/libs/prx/libSceNKWebKit/include/MimeExports.hpp.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE safely handles null or empty StringImpl pointers, scans backwards for the last '.', and falls back to defaultMIMEType ("application/octet-stream") matching upstream WebCore and PS5 11.x WebKit behavior.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, and _ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE handle null/empty WTF::String inputs safely, perform ASCII case-insensitive comparisons, and follow the pinned PS5 11.x WebKit lookup precedence.
    • Verified mechanical gates, cross-platform compatibility (Linux x86_64 and Windows UCRT test runs), and AGENTS.md compliance including upstream WebKit license notice conventions and technical debt documentation in docs/dev/debt/changes/claude-nkwebkit-mimetype-lookups.md.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5913621553 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19636#pullrequestreview-5913621553). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T23:57:53Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `e891549c59`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_mimetyperegistry_tests` built cleanly. - **CTest** (`nkwebkit_mimetyperegistry`): ``` 1/1 Test #4232: nkwebkit_mimetyperegistry ........ Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/MimeExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Mime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/Export.cpp and core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp: all five WebCore::MIMETypeRegistry stub exports (_ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE) are cleanly removed and declared with matching typed prototypes in core/libs/prx/libSceNKWebKit/include/MimeExports.hpp. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry15mimeTypeForPathERKN3WTF6StringE safely handles null or empty StringImpl pointers, scans backwards for the last '.', and falls back to defaultMIMEType ("application/octet-stream") matching upstream WebCore and PS5 11.x WebKit behavior. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: _ZN7WebCore16MIMETypeRegistry20isJavaAppletMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry23isSystemPreviewMIMETypeERKN3WTF6StringE, _ZN7WebCore16MIMETypeRegistry20mimeTypeForExtensionERKN3WTF6StringE, and _ZN7WebCore16MIMETypeRegistry25mediaMIMETypeForExtensionERKN3WTF6StringE handle null/empty WTF::String inputs safely, perform ASCII case-insensitive comparisons, and follow the pinned PS5 11.x WebKit lookup precedence. - Verified mechanical gates, cross-platform compatibility (Linux x86_64 and Windows UCRT test runs), and AGENTS.md compliance including upstream WebKit license notice conventions and technical debt documentation in docs/dev/debt/changes/claude-nkwebkit-mimetype-lookups.md. Looks Good To Me
PrivacyOnion commented 2026-11-18 08:28:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T08:28:08Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 0906ab6d4c:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_mimetyperegistry_tests built cleanly.
  • CTest (nkwebkit_mimetyperegistry):
    1/1 Test #4522: nkwebkit_mimetyperegistry ........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/MimeExports.hpp, core/libs/prx/libSceNKWebKit/src/Mime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: MIMETypeRegistry::mimeTypeForPath safely handles null/empty StringImpl pointers, parses the extension after the final dot without out-of-bounds indexing, and falls back to defaultMIMEType() ('application/octet-stream') in accordance with upstream WebCore and PS5 11.x WebKit behavior.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: MIMETypeRegistry::mimeTypeForExtension and mediaMIMETypeForExtension safely handle null/empty extensions, perform case-insensitive matching across kPlatformMediaTypes and kCommonMediaTypes tables, and properly return an empty WTF::String on unknown extensions.
    • Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: MIMETypeRegistry::isJavaAppletMIMEType and isSystemPreviewMIMEType handle null/empty inputs safely, perform ASCII case-insensitive comparisons, and adhere to WebCore specifications.
    • Verified core/libs/prx/libSceNKWebKit/Export.cpp and LegacyExports.hpp: the five stub exports are cleanly removed and replaced with typed declarations in core/libs/prx/libSceNKWebKit/include/MimeExports.hpp with matching APS5_VABI signatures.
    • Verified AGENTS.md compliance: upstream BSD/SIE copyright notice retained verbatim as requested by maintainer, technical debt logged in docs/dev/debt/changes/claude-nkwebkit-mimetype-lookups.md, and tests in core/libs/prx/libSceNKWebKit/tests/MimeTypeRegistry.cpp thoroughly exercise valid, unknown, empty, and null inputs.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5953064940 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19636#pullrequestreview-5953064940). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-18T08:28:08Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `0906ab6d4c`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_mimetyperegistry_tests` built cleanly. - **CTest** (`nkwebkit_mimetyperegistry`): ``` 1/1 Test #4522: nkwebkit_mimetyperegistry ........ Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/MimeExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Mime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: MIMETypeRegistry::mimeTypeForPath safely handles null/empty StringImpl pointers, parses the extension after the final dot without out-of-bounds indexing, and falls back to defaultMIMEType() ('application/octet-stream') in accordance with upstream WebCore and PS5 11.x WebKit behavior. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: MIMETypeRegistry::mimeTypeForExtension and mediaMIMETypeForExtension safely handle null/empty extensions, perform case-insensitive matching across kPlatformMediaTypes and kCommonMediaTypes tables, and properly return an empty WTF::String on unknown extensions. - Verified core/libs/prx/libSceNKWebKit/src/Mime.cpp: MIMETypeRegistry::isJavaAppletMIMEType and isSystemPreviewMIMEType handle null/empty inputs safely, perform ASCII case-insensitive comparisons, and adhere to WebCore specifications. - Verified core/libs/prx/libSceNKWebKit/Export.cpp and LegacyExports.hpp: the five stub exports are cleanly removed and replaced with typed declarations in core/libs/prx/libSceNKWebKit/include/MimeExports.hpp with matching APS5_VABI signatures. - Verified AGENTS.md compliance: upstream BSD/SIE copyright notice retained verbatim as requested by maintainer, technical debt logged in docs/dev/debt/changes/claude-nkwebkit-mimetype-lookups.md, and tests in core/libs/prx/libSceNKWebKit/tests/MimeTypeRegistry.cpp thoroughly exercise valid, unknown, empty, and null inputs. Looks Good To Me
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!19636
No description provided.