Exercise 3: The Silent Fallback Stub Bug — Possible Solution ==================================================================== WHY IT PASSES A DEVELOPER'S OWN TESTING ------------------------------ `"BarcodeDetector" in window` is true in Chrome and Edge (on Android and desktop), so if a developer tests primarily or exclusively in a Chromium-based browser, the native detector branch runs every time and the scanner appears to work perfectly. The unimplemented ZXing fallback branch never executes during that testing, so its absence never surfaces as an error or a failed test. WHICH USERS ARE ACTUALLY AFFECTED ------------------------------ Anyone using Safari on iOS - where BarcodeDetector is not supported - would fall into the `else` branch, which per this chapter is left as a stub. For those users, `"BarcodeDetector" in window` is false, so the app silently does nothing: no error is thrown, no barcode is ever detected, and scanning simply never works, with no visible indication of why. WHY CHROME-BASED TESTING WOULD NEVER CATCH IT ------------------------------ Because the bug is entirely conditional on which browser/API surface is available - there's no code path that fails loudly in Chrome to reveal the missing fallback. The absence only manifests for users on a browser the developer never actually tested against, which is exactly the kind of gap that "it works on my machine" testing reliably misses. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains why Chrome testing gives false confidence (the untested branch simply never runs), correctly identifies iPhone Safari users as the ones actually affected, and explains that the bug produces no error at all, just silent failure, which is precisely why it's easy to miss without deliberately testing on an unsupported browser.