1

I want to understand why some extensions use escaping for <all_urls> angle brackets, whereas another extensions don't.

Some manifests don't use escaping at all, some use escaping for opening angle bracket, and some for both. Examples:

"permissions": [
    "<all_urls>"
]

"permissions": [
    "\u003Call_urls>"
]

and even

"permissions": [
    "\u003Call\u005Furls\u003E"
]

What's the purpose behind these replacements and should / should not I escape it?


Update. As live examples, here are few extensions offered by Google, which are using escaping: Share to Classroom, Google Dictionary and High Contrast. There are probably more. These 3 is just a result of my own brief research.

Also, here is assumption that escaping is for validation (link):

Although the manifest.json should be Unicode-encoded, I've seen a lot of extensions escaping the <, _ and >, to their's equivalent Unicode-format of "\u003Call\u005Furls\u003E". I've asked around, and apparently some developers have used validation mechanism, which then validated the JSON "invalid" because of those characters.

But, Google extensions which I gave as live examples, escapes only opening angle bracket, that is:

\u003Call_urls>

That's why, from my point of view, the quote above doesn't actually answer the question.

Community
  • 1
  • 1
john c. j.
  • 725
  • 5
  • 28
  • 81
  • Because they blindly copypaste some ancient broken example produced by a broken site script that could not properly balance quoting/unquoting of the special symbols. There's no need to escape these. – wOxxOm May 17 '17 at 22:02
  • @wOxxOm For example, [High Contrast](https://chrome.google.com/webstore/detail/high-contrast/djcfdncoelnlbldjfhinnjlhdjlikmph). This extension is marked as "By Google". And I see `\u003Call_urls>` in it's manifest. – john c. j. May 18 '17 at 07:51
  • You'd be amazed by the amount of legacy/buggy code produced by the mighty google. – wOxxOm May 18 '17 at 07:58
  • BTW you can open an issue on https://crbug.com and point out the unnecessary escaping in those extensions which confuses some developers who use buggy JSON validators. Note, the documentation [isn't crippled](https://developer.chrome.com/extensions/match_patterns). – wOxxOm May 18 '17 at 09:27
  • @wOxxOm Yes, it's a good idea. – john c. j. May 18 '17 at 09:38

0 Answers0