GoogleChrome / samples

A repo containing samples tied to new functionality in each release of Google Chrome.
https://www.chromestatus.com/samples
Apache License 2.0
5.77k stars 2.39k forks source link

Chrome browser crashes when calling ndef.scan multiple times without browser refresh, affects single-page web app #795

Closed ngaffer closed 1 year ago

ngaffer commented 1 year ago

Chrome browser crashes when 'ndef.scan' is called immediately after physically scanning an NFC tag. If you physically scan an NFC tag, refresh the browser, and then call ndef.scan again, the browser will not crash.

When I use the Angular Router to navigate within my single-page web app without refreshing the page, the browser crashes when I navigate away and then back to my route that has the component with the NDEFReader object and ndef.scan call.

const ndef = new NDEFReader();
await ndef.scan();

Full code: https://github.com/GoogleChrome/samples/blob/gh-pages/web-nfc/index.js

Steps to reproduce

  1. Navigate to the official sample content https://googlechrome.github.io/samples/web-nfc/
  2. Click the 'Scan' button
  3. Scan an NFC tag
  4. Now click the 'Scan' button again
  5. Notice that the browser crashes
beaufortfrancois commented 1 year ago

I'll close this issue and will continue on https://bugs.chromium.org/p/chromium/issues/detail?id=1424208. Thank you!