SpeedCurve-Metrics / lux.js

Web performance testing (real user monitoring) by SpeedCurve
https://speedcurve.com/features/lux/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Fix IE bug where we assign to PerformanceNavigationTiming read-only properties #36

Closed josephwynn-sc closed 1 year ago

josephwynn-sc commented 1 year ago

We released v308 and started getting these errors, mostly from Internet Explorer 11:

Assignment to read-only properties is not allowed in strict mode

I'm not 100% sure which property is read-only in IE, but I'm guessing it's navigationStart (even though it shouldn't exist on the object). Perhaps the entire object is read-only in IE. I'm not sure.

Regardless, this PR hopefully fixes the issue by creating a new plain object and copying the PerformanceNavigationTiming values into it. It also calls getNavigationEntry() at point-of-use rather than at script evaluation time, just in case calling this too early has some issues on older browsers (?!).