Opened 2 months ago

Last modified 2 months ago

#7455 new defect

snippets arguments containing quotes

Reported by: agiammarchi Assignee:
Priority: Unknown Milestone:
Module: Core Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by mjethani)

Summary

Any snippet that passes through parseScript function might be affected by a not so UX friendly bug.

How to reproduce

  1. Try to use site.xxx#$#abort-current-inline-script window.Object wi'n
  2. See the resulting RegExp will not match the string wi'n
  3. See that writing site.xxx#$#abort-current-inline-script window.Object wi\'n instead works, but see that writing an extra argument after won't

Observed behaviour

The parseScript function apparently eats, or misunderstands, single quotes parts of an argument that is being already parsed, and the resulting RegExp won't match the expected.

Expected behaviour

Either arguments containing ' should be mandatorily escaped and put in single quotes, or we need to change the parseScript logic so that when a single quote is encountered, but it's part of an argument being parsed (i.e. no space before) the quote shouldn't be considered as opener of the argument, but handled like any other chars.

This way expectations are preserved, and UX is improved for fancy cases, like in searching specific text that might contain single or double quotes.

Notes

This is a known quirk of the parser (#6853). We even have tests for it.

Change History (1)

comment:1 Changed 2 months ago by mjethani

  • Description modified (diff)
Note: See TracTickets for help on using tickets.