Use platform over appversion on global navigator object #5389
+12
−8
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.
From Mozilla on appVersion: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/appVersion
Recently, localization tests began failing because of an invalid setting of
global.navigator
:https://github.com/specify/specify7/actions/runs/11707985658/job/32609369992
specify7/specifyweb/frontend/js_src/lib/tests/jsdom.js
Lines 10 to 14 in 7fe1b80
This failing test was remedied in 76871c7, which functionally completely removed the reassignment of
global.navigator
.However, it appears that support for
navigator.appVersion
has been dropped in some capacity, asnavigator.appVersion
was returning undefined:https://github.com/specify/specify7/actions/runs/11726874323/job/32666586609
specify7/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx
Lines 67 to 69 in 7fe1b80
This PR cleans up the code in the JSDOM configuration file, and uses
navigator.platform
instead ofappVersion
.navigator.platform
is itself deprecated: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platformHowever, this use case is explicitly mentioned in the Mozilla docs, and may be a better alternative until a better solution is found...
Checklist
and self-explanatory (or properly documented)