Rocket.chat: Livechat widget broken in legacy browsers

Created on 5 Dec 2018  路  11Comments  路  Source: RocketChat/Rocket.Chat

Description:

When I enter a page with the livechat widget active in ie11, I get the following error:
SCRIPT1002: Syntax error
File: livechat.js, Line: 27, Column: 289

I went to that line and expanded it, it contains the following (I put a mark in the error placement):

!function() {
    var e = Package.meteor.Meteor, o = Package.meteor.global, t = Package.meteor.meteorEnv,
        s = Package.modules.meteorInstall, a = Package['babel-runtime'].meteorBabelHelpers, r = Package.promise.Promise,
        n, c, l = s({
            node_modules: {
                meteor: {
                    webapp: {
                        'webapp_client.js': function(e, o, t) {
                            t.export({ WebApp: () => s }); <- The error happens here in the '()'
                            const s = { _isCssLoaded: () => 0 === document.styleSheets.length || Array.prototype.find.call(document.styleSheets, e => e.cssText && !e.cssRules ? !e.cssText.match(/meteor-css-not-found-error/) : !Array.prototype.find.call(e.cssRules, e => '.meteor-css-not-found-error' === e.selectorText)) };
                        },
                    },
                },
            },
        }, { extensions: ['.js', '.json'] })('/node_modules/meteor/webapp/webapp_client.js');
    Package._define('webapp', l, { WebApp: void 0 });
}();

Expected behavior:

It works in other browsers so it should work here also.

Actual behavior:

The widget is not rendered due to the error.

Server Setup Information:

  • Version of Rocket.Chat Server: 0.72.0
  • Operating System: linux
  • Deployment Method: tar and docker
  • Number of Running Instances: 1
livechat IE11 bug

All 11 comments

I could not find from where this code came from, might be a dependence or something is hard to find with the minifications and transformations that it suffers.

I think this might be related to this other issue in meteor: https://github.com/meteor/meteor/issues/10274

I found the root of the problem, but I don't know how to fix it.
In IE11 is using this file:
.meteor/local/build/programs/web.browser/packages/webapp.js
when it should use:
.meteor/local/build/programs/web.browser.legacy/packages/webapp.js

I also have this error on Safari 5.1
There it says:
SyntaxError: Unexpected token ')'
SYNTAX_ERR: DOM Exception 12: An invalid or illegal string was specified.
Pointing to the same line on the same file.

Looks like this was due to this PR #12468 they actually updated livechat meteor to 1.9.2

Same issue here

IMHO, I don't think is really a solution to use legacy always, I think it should chose one or the other depending on the browser, isn't it? Maybe I'm wrong.

@edurenye we are developing a new livechat frontend and we hope it will be ready next month (January 2019). It will use webpack as build system and React as UI framework, and will fully replace the current one, that's why I don't think you need to worry about this workaround.

There is a PR for that React version?

@edurenye It is at another repo at the moment: https://github.com/RocketChat/Rocket.Chat.Livechat

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattlin picture mattlin  路  3Comments

mddvul22 picture mddvul22  路  3Comments

djeber picture djeber  路  3Comments

engelgabriel picture engelgabriel  路  3Comments

lunitic picture lunitic  路  3Comments