Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-807

The Javascript plugin's obfuscator does not support Javascript 1.5 regular expression syntax

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.2.3-plugins
    • None
    • Plugins
    • None

    Description

      I'm trying to run the javascript obfuscator from the maven-plugin-javascript, and it breaks when it reaches a regular expression, for example for this snippet:

      mytext.split(/=/,2)

      the obfuscator breaks and dumps this:

      Error processing file:stuff/utils.js to file:blackstuff/utils.js
      org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser.ParseException: Encountered "/=" at line 52, column 42.
      Was expecting one of:
      "delete" ...
      "function" ...
      "new" ...
      "this" ...
      "typeof" ...
      "void" ...
      "true" ...
      "false" ...
      "null" ...
      <DECIMAL_LITERAL> ...
      <HEX_LITERAL> ...
      <OCTAL_LITERAL> ...
      <FLOATING_POINT_LITERAL> ...
      <STRING_LITERAL> ...
      <REGULAR_EXPRESSION> ...
      <IDENTIFIER> ...
      "(" ...
      ")" ...
      "{" ...
      "[" ...
      "!" ...
      "~" ...
      "++" ...
      "--" ...
      "+" ...
      "-" ...

      at org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser.JSParser15.generateParseException(JSParser15.java:4389)
      at org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser.JSParser15.jj_consume_token(JSParser15.java:4263)
      at org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser.JSParser15.Arguments(JSParser15.java:262)
      at org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser.JSParser15.PrimarySuffix(JSParser15.java:207)
      at org.apache.myfaces.trinidadbuild.plugin.javascript.obfuscator.javascript15parser.JSParser15.PrimaryExpression(JSParser15.java:90)
      ....

      on the face of it it looks like the obfuscator doesn't understand basic regular expression syntax as documented here: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expressions

      Attachments

        Activity

          People

            Unassigned Unassigned
            guss77 Oded Arbel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: