mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
fix(core): [CORE-25] read defaults without navigator
This commit is contained in:
1 parent
4a299eb2d4
commit
3b016970f2
26 files changed
+916
-35
No files matched your search
@@ -47,11 +47,12 @@ the actual child version. Reports and failure logs are `runtime-node-<version>.*
|
||||
the same package output directory. Old reports without source/toolchain fields must
|
||||
be rebuilt. CI restores canonical Node before running browser tools.
|
||||
|
||||
CORE-25 remains an explicit defect: both published and candidate static defaults throw
|
||||
without navigator. The fixture tests that exact failure on every runtime, then uses an
|
||||
identical controlled language for default-value comparison and restores the global.
|
||||
`knownRuntimeBlockers=1` prevents strict release success; ordinary observation tests
|
||||
passing do not mean the defect is fixed. See [Node evidence](../../refactor/changes/2026-09-13-CI-01-node-consumers.md).
|
||||
CORE-25 fixed candidate static defaults without navigator. The fixture preserves the
|
||||
published ReferenceError while requiring candidate main/legacy/ESM defaults to succeed,
|
||||
then uses an identical controlled language for comparison and restores the global.
|
||||
The fixture now reports zero known runtime blockers; it is still only core/chapter
|
||||
acceptance, not full release readiness. See [the fix](../../refactor/changes/2026-09-13-CORE-25-defaults-ssr.md)
|
||||
and the earlier [Node evidence](../../refactor/changes/2026-09-13-CI-01-node-consumers.md).
|
||||
|
||||
The optional core `artplayer/runtime` entry has eight additional strict consumer
|
||||
groups: TS 5.1.6 and 5.9.3 each check Node10 CommonJS, NodeNext CJS/ESM and Bundler.
|
||||
|
||||
@@ -189,10 +189,21 @@ const vm = require('node:vm');
|
||||
const defaultNavigator = Object.getOwnPropertyDescriptor(globalThis, 'navigator')
|
||||
try {
|
||||
assert(delete globalThis.navigator)
|
||||
// CORE-25 tracks this reproduced published and candidate failure separately.
|
||||
assert.throws(() => core.option, { name: 'ReferenceError', message: 'navigator is not defined' })
|
||||
observations.defaultsWithoutNavigator = { name: 'ReferenceError', message: 'navigator is not defined', historical: !!expected.baseline, resolved: false }
|
||||
check('SSR.defaults-missing-navigator-known-failure', true)
|
||||
if (expected.baseline) {
|
||||
assert.throws(() => core.option, { name: 'ReferenceError', message: 'navigator is not defined' })
|
||||
observations.defaultsWithoutNavigator = { name: 'ReferenceError', message: 'navigator is not defined', historical: true, resolved: false }
|
||||
check('SSR.defaults-missing-navigator-known-failure', true)
|
||||
}
|
||||
else {
|
||||
const defaults = core.option
|
||||
assert.equal(defaults.lang, undefined)
|
||||
assert(Object.hasOwn(defaults, 'lang'))
|
||||
assert.notEqual(core.option, defaults)
|
||||
for (const Class of [esm.default, legacy.default, require('artplayer/legacy')])
|
||||
assert.equal(Class.option.lang, undefined)
|
||||
observations.defaultsWithoutNavigator = { historical: false, resolved: true, ownLang: true, langType: typeof defaults.lang }
|
||||
check('SSR.defaults-without-navigator', true)
|
||||
}
|
||||
Object.defineProperty(globalThis, 'navigator', { configurable: true, value: { language: 'en-US' } })
|
||||
observations.api = { static: shape(core), prototype: shape(core.prototype), emitter: shape(core.Emitter.prototype), factory: shape(chapter), defaults: JSON.parse(JSON.stringify(core.option, (_, value) => typeof value === 'function' ? '$function' : value)) }
|
||||
check('API.defaults-controlled-language', observations.api.defaults.lang === 'en-us')
|
||||
|
||||
Reference in new issue
Block a user