Opened 4 years ago

Last modified 4 years ago

#4353 closed change

Update Js Shell version, replace non-standard "for each" syntax — at Version 8

Reported by: kzar Assignee: kzar
Priority: P3 Milestone:
Module: Automation Keywords:
Cc: sebastian, trev, fhd Blocked By:
Blocking: #4350 Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by kzar)


It would be nice to update Js Shell at some point. Unfortunately the newer versions of Js Shell (for example 45) do not support the non-standard and deprecated for each syntax which is used in many of the Js Hydra scripts:

astDecompile.js:10:33 SyntaxError: missing ( after for:
astDecompile.js:10:33   return [decompileAST(stmt) for each (stmt in ast.body)].join('\n');
astDecompile.js:10:33 .................................^

What to change

Update Js Shell to version 45 in

JSSHELL_DIR = "mozilla-esr45"
               "/2016/05/2016-05-29-00-15-03-%s/" % JSSHELL_DIR)

Replace any non standard "for each" syntax used by the Js Hydra scripts with standard JavaScript.

Change History (8)

comment:1 Changed 4 years ago by kzar

  • Description modified (diff)

comment:2 Changed 4 years ago by kzar

  • Resolution set to rejected
  • Status changed from new to closed

Even modern versions of Js Shell do not support the for (const foo of bar) syntax, so I will have to instead modify punycode.js.

comment:3 Changed 4 years ago by trev

For reference, this is bug 1101653.

comment:4 Changed 4 years ago by sebastian

  • Priority changed from P2 to P3
  • Resolution rejected deleted
  • Status changed from closed to reopened

I thought we removed all for each loops with #301. If we missed some code there, or regressed since then, we should fix that. Feel free to update the issue description to exclude the jsshell update.

comment:5 Changed 4 years ago by kzar

  • Description modified (diff)

Alright then, since I've done most of it already I'll finish it off and upload a review.

comment:6 Changed 4 years ago by trev

Strictly speaking, JSHydra isn't our code (particularly astDecompile.js that this is about) - which is why we didn't touch it yet. At some point we won't be able to avoid it any more however so we need to remove the for each loops there as well.

comment:7 Changed 4 years ago by kzar

  • Review URL(s) modified (diff)
  • Status changed from reopened to reviewing

So far I've just posted a review for removing for each. Updating JS Shell to version 45 required further changes to adblockpluschrome, adblockpluscore and jshdyra. I still haven't got it quite working!

comment:8 Changed 4 years ago by kzar

  • Review URL(s) modified (diff)
Note: See TracTickets for help on using tickets.