w3c / beacon

Beacon
https://w3c.github.io/beacon/
Other
46 stars 22 forks source link

corsMode calculation in the "Processing Model" section is broken #53

Closed tyoshino closed 6 years ago

tyoshino commented 6 years ago

/cc @yutakahirano

https://w3c.github.io/beacon/#sec-processing-model

corsMode is declared in one of the substeps in the step 4 but referenced from the step 5. Instead, it should be declared at the top level and modified by the step 4.

I also think the step 5 should be part of the step 4.

headerList should be initialized as an empty header list, not null.

So, it should be:

  1. Let fetchMode be "no-cors".
  2. Let headerList be a new empty header list.
  3. If data is not null:
    • Extract ...
    • If the amount ...
    • If mimeType is not null:
      • If Content-Type/mimeType is not a CORS-safelisted request-header, set fetchMode to "cors".
      • Append Content-Type/mimeType to headerList.
igrigorik commented 6 years ago

@tyoshino thanks, good suggestions! I opened #54 to address this -- ptal.