Fix the diff viewer JS with modern babel.

Review Request #12102 — Created March 6, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

This fixes an error when loading the diff viewer on release-5.0.x (and
master). Devtools were showing an error that the DiffViewerPage
constructor wasn't a constructor. The issue here seems to be a change in
the way that the newer babel deals with function shorthands inside of an
object. Whereas before it was translating constructor() {...} to
constructor: function constructor() {...}, it now leaves them as-is.
In most cases this works fine, but it seems like browsers are treating
the constructor name specially (since it's a reserved word and used
for classes). Explicitly using the older object attribute syntax fixes
this.

Created a review request with a diff and was able to successfully load
the diff viewer page.

Commits

Files