ext.NavigationTiming: Refactor Random and inSample methods

Authored by Imarlier on Fri, Dec 1, 7:37 PM.

Description

ext.NavigationTiming: Refactor Random and inSample methods

  • Centralise the Math.floor() logic and add tests for it.
  • Make getRandom() easier to change.
  • Document why we duplicated mw.eventLog.inSample().
  • Remove use of needless jQuery isNumeric overhead in favour of a stricter type check.
  • Use crypto for random number instead of Math.random(), if possible

Bug: T182262
Change-Id: Ib96f7949489fd6cd258c095261442d930632c233

Details

Committed
ImarlierWed, Dec 6, 10:21 PM
Parents
rENTI6f765ccc7105: build: Always exclude vendor and node_modules
Branches
Unknown
Tags
Unknown
References
refs/changes/48/394648/6
ChangeId
Ib96f7949489fd6cd258c095261442d930632c233