Had to do that in JavaScript as doing it server-side would have made refactoring large parts of the extension necessary. Bug: 38141 Change-Id: I60ecd2fc0edf2aee89974d8069cc0b075cda3f93