fix(polyfill): complete window timer and EventTarget aliases - #151
Conversation
NativeScript may install global.addEventListener before window exists, so the old both-undefined guard left window.addEventListener missing. Browser libraries bind window.setTimeout/clearTimeout/matchMedia and documentElement.dataset / style.setProperty. Fill each alias independently.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The red AudioContext jobs are not from this diff.
The last The relevant job for this change is Build Native / Canvas iOS + visionOS. |
Problem
canvas-polyfillonly installedwindow.addEventListenerwhen bothglobalandwindowlacked it. NativeScript often already hasglobal.addEventListener, sowindow.addEventListenerstayed missing.window.setTimeoutwas set withoutclearTimeout. Games that callwindow.matchMedia,document.documentElement.dataset, orstyle.setPropertythrow at module eval.Change
Fill each missing alias independently. Preserve existing implementations. Add
clearTimeout/clearInterval, amatchMediastub,devicePixelRatio,document.hidden/visibilityState,HTMLElement.dataset, andCSSStyleDeclaration.setProperty.Test plan
Four listener-ownership cases (none / global / window / both) plus
matchMediaare in NEONLEAPnative/tests/window-host.test.ts. They fail on unpatched a2c279b8 and pass with this diff.Independent of the empty-
measureTextPR.