Re: [web-nfc] Fix #592: allow multiple readers but no multiple scans on any reader (#611)

> Arno tried removing the flag and resulted in the renderer crashing at a second invocation of `scan()` because it ran into the `DCHECK()` in the beginning of `NfcProxy::StartReading()`. Which IMHO is an implementation bug, since it was supposed to fail the promise on that condition, not to crash the renderer. The `has_pending_scan_request_` seems to be a _workaround_ for that bug, not an algorithmic necessity.

Crashing will only happen on Debug builds (hence *D*CHECK) and is only for chromium developers to debug non expected cases.

> The existing WPT should be working as defined with the current specification of the scan algorithm.

I believe we should update one web platform test to make sure it's fully working:

```diff
 nfc_test(async (t, mockNFC) => {
   const ndef = new NDEFReader();
   const controller = new AbortController();
   await ndef.scan({signal : controller.signal});
+  await promise_rejects_dom(t, 'InvalidStateError', ndef.scan());
   controller.abort();
   await ndef.scan();
 }, "Test that NDEFReader.scan can be started after the previous scan is aborted.");
```


-- 
GitHub Notification of comment by beaufortfrancois
Please view or discuss this issue at https://github.com/w3c/web-nfc/pull/611#issuecomment-751609834 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 28 December 2020 07:15:26 UTC