mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-02-08 00:21:11 +01:00
The `handler` method contained this code in two inline functions, triggered via callbacks, which made the `handler` method big and harder to read. Moreover, this code relied on variables from the outer scope, which made it harder to reason about because the inputs and outputs weren't easily visible. This commit fixes the problems by extracting the request checking code into a dedicated private method, and modernizing it to use e.g. `const`/ `let` instead of `var` and using template strings. The logic is now self-contained in a single method that can be read from top to bottom without callbacks and with comments annotating each check/section.