question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use Strict Directive needs to be preflighted

See original GitHub issue

Found this issue while cleaning up test262 file, not sure if this is possible in meriyah. It’s not a serious bug in real world, as people always put use strict directive at beginning of a scope.

Meriyah rejects following code as per spec:

> parse('"use strict"; "\\1";')
Uncaught:
[ParseError [SyntaxError]: [1:16]: Octal escape sequences are not allowed in strict mode
] {
  index: 16,
  line: 1,
  column: 16,
  description: '[1:16]: Octal escape sequences are not allowed in strict mode',
  loc: { line: 1, column: 16 }
}

But failed to do so if the use strict directive is after the problematic code.

> parse('"\\1"; "use strict";')
{
  type: 'Program',
  sourceType: 'script',
  body: [
    { type: 'ExpressionStatement', expression: [Object] },
    { type: 'ExpressionStatement', expression: [Object] }
  ]
}

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
3cpcommented, Nov 1, 2020

I am not going to try, at least for now. This bug has no impact on real world code. It’s just an edge case in the spec. People has no reason to write code like this, rather than testing a parser’s spec compliance.

1reaction
3cpcommented, Oct 31, 2020

I will try to decipher ecma spec first. That adjacency is weird.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-Origin Resource Sharing (CORS) - MDN Web Docs
Unlike simple requests, for "preflighted" requests the browser first sends an HTTP request using the OPTIONS method to the resource on the other ......
Read more >
Configuring CORS - Apollo GraphQL Docs
If you use graphql-upload you should keep the CSRF prevention feature enabled, and configure your upload clients to send a non-empty Apollo-Require-Preflight ......
Read more >
CORS FAQ - cors-errors.info
A preflight request is just an HTTP request, so it can be sent using Postman. To send the request manually you'll need to...
Read more >
No 'Access-Control-Allow-Origin' - Node / Apache Port Issue
The request origin needs to match the allowed origin(s), and you can also have multiple of them: app.use( cors({origin: ...
Read more >
CSRF, CORS, and HTTP Security headers Demystified
CSRF protection support needs to be added to your application code and cannot ... Note that CORS preflight requests are not made for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found