Skip to content
Version 1.49.4

- New JavaScript features! This version of GJS is based on SpiderMonkey 52, an
  upgrade from the previous ESR (Extended Support Release) of SpiderMonkey 38.
  GJS now uses the latest ESR in its engine and the plan is to upgrade again
  when SpiderMonkey 59 is released in March 2018, pending maintainer
  availability. Here are the highlights of the new JavaScript features.
  For more information, look them up on MDN or

  * New language features
    + ES6 classes
    + Async functions and await operator
    + Reflect - built-in object with methods for interceptable operations

  * New syntax
    + Exponentiation operator: `**`
    + Variable-length Unicode code point escapes: `"\u{1f369}"`
    + Destructured default arguments: `function f([x, y]=[1, 2], {z: z}={z: 3})`
    + Destructured rest parameters: `function f(...[a, b, c])`
    + `` allows a constructor access to the original constructor that
      was invoked
    + Unicode (u) flag for regular expressions, and corresponding RegExp.unicode
    + Trailing comma in function parameter lists now allowed

  * New APIs
    + New Array, String, and TypedArray method: includes()
    + TypedArray sort(), toLocaleString(), and toString() methods, to correspond
      with regular arrays
    + New Object.getOwnPropertyDescriptors() and Object.values() methods
    + New Proxy traps: getPrototypeOf() and setPrototypeOf()
    + [Symbol.toPrimitive] property specifying how to convert an object to a
      primitive value
    + [Symbol.species] property allowing to override the default constructor
      for objects
    + [Symbol.match], [Symbol.replace], [], and [Symbol.split]
      properties allowing to customize matching behaviour in RegExp subclasses
    + [Symbol.hasInstance] property allowing to customize the behaviour of
      the instanceof operator for objects
    + [Symbol.toStringTag] property allowing to customize the message printed
      by Object.toString() without overriding it
    + [Symbol.isConcatSpreadable] property allowing to control the behaviour of
      an array subclass in an argument list to Array.concat()
    + [Symbol.unscopables] property allowing to control which object properties
      are lifted into the scope of a with statement
    + New Intl.getCanonicalLocales() method
    + Date.toString() and RegExp.toString() generic methods
    + Typed arrays can now be constructed from any iterable object
    + Array.toLocaleString() gained optional locales and options arguments, to
      correspond with other toLocaleString() methods

  * New behaviour
    + The "arguments" object is now iterable
    + Date.prototype, WeakMap.prototype, and WeakSet.prototype are now ordinary
      objects, not instances
    + Full ES6-compliant implementation of let keyword
    + RegExp.sticky ('y' flag) behaviour is ES6 standard, it used to be subject
      to a long-standing bug in Firefox
    + RegExp constructor with RegExp first argument and flags no longer throws
      an exception (`new RegExp(/ab+c/, 'i')` works now)
    + Generators are no longer constructible, as per ES6 (`function* f {}`
      followed by `new f` will not work)
    + It is now required to construct ArrayBuffer, TypedArray, Map, Set, and
      WeakMap with the new operator
    + Block-level functions (e.g. `{ function foo() {} }`) are now allowed in
      strict mode; they are scoped to their block
    + The options.timeZone argument to Date.toLocaleDateString(),
      Date.toLocaleString(), Date.toLocaleTimeString(), and the constructor of
      Intl.DateTimeFormat now understands IANA time zone names (such as

  * Backwards-incompatible changes
    + Non-standard "let expressions" and "let blocks" (e.g.,
      `let (x = 5) { use(x) }`) are not supported any longer
    + Non-standard flags argument to String.match(), String.replace(), and (e.g. `str.replace('foo', 'bar', 'g')`) is now ignored
    + Non-standard WeakSet.clear() method has been removed
    + Variables declared with let and const are now 'global lexical bindings',
      as per the ES6 standard, meaning that they will not be exported in
      modules. We are maintaining the old behaviour for the time being as a
      compatibility workaround, but please change "let" or "const" to "var"
      inside your module file. A warning will remind you of this. For more
      information, read:

  * Experimental features (may change in future versions)
    + String.padEnd(), String.padStart() methods (proposed in ES2017)
    + Intl.DateTimeFormat.formatToParts() method (proposed in ES2017)
    + Object.entries() method (proposed in ES2017)
    + Atomics, SharedArrayBuffer, and WebAssembly are disabled by default, but
      can be enabled if you compile mozjs yourself

- Closed bugs:

  * Prepare for SpiderMonkey 45 and 52 [#781429, Philip Chimento]
  * Add a static analysis tool as a make target [#783214, Claudio André]
  * Fix the build with debug logs enabled [#784469, Tomas Popela]
  * Switch to SpiderMonkey 52 [#784196, Philip Chimento, Chun-wei Fan]
  * Test suite fails when run with JIT enabled [#616193, Philip Chimento]