Exercise 3: Why an Unimplemented ZXing Fallback Passes Testing and Still Ships a Bug — Possible Solution ==================================================================== WHY IT COULD PASS ALL OF A DEVELOPER'S OWN TESTING ------------------------------ "BarcodeDetector" in window evaluates to true in Chrome and Edge, on both Android and desktop — almost certainly the browser a developer is using during their own everyday testing. In those browsers, the code takes the native BarcodeDetector branch every time, and the empty else branch is never actually reached or exercised at all. Nothing errors, nothing warns; the feature simply appears to work in every test the developer personally ran. WHICH USERS WOULD ACTUALLY BE AFFECTED ------------------------------ Anyone on Safari — every iPhone user, and any Mac user on Safari specifically — since BarcodeDetector isn't available there. "BarcodeDetector" in window evaluates to false for them, sending execution into the empty else branch, which does nothing at all. The scan screen renders, the camera turns on, and no barcode is ever detected, with no error message anywhere to explain why. For a phone-camera-based app, iPhone Safari users are a large, ordinary share of the real audience, not an edge case. WHY CHROME-BASED TESTING WOULD NEVER CATCH IT ------------------------------ The failure is entirely branch-dependent, not a runtime error. Testing exclusively in a browser where the native API exists means the failing branch is structurally never executed, so no amount of testing in that one browser — however thorough — can surface a bug that only exists in a different, untested branch. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains the browser-support gap behind the silent failure, correctly names the real affected audience (iPhone Safari users specifically), and correctly identifies why the bug is structurally invisible to single-browser testing — because the broken code path is only reachable in a browser the developer never actually tested in.