microsoft / microsoft/BotFramework-WebChat

Investigate: `regeneratorRuntime` not working in strict mode

Open
#3,507 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog feature-request front-burner needs-scope
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

Version

4.10.1

Describe the bug

When using Salesforce Lightning Locker, it said regeneratorRuntime violated "no global" rule.

The Locker Service Console can be used for quick diagnosing issues.

Steps to reproduce

  1. Go to Salesforce Locker Service Console
  2. Enable both "Locker" and "Strict CSP"
  3. Copy and paste webchat.js
  4. Click "Evaluate"

Expected behavior

It should give green light.

Additional context

Currently, the regeneratorRuntime is set to global (a.k.a. pollution). We should find a switch or some ways to scope it to local (inside the module).

Investigator should also check if Locker Service Console is available to use in CI, so we can run it on-demand when we produce a new build.

StackOverflow related question, https://stackoverflow.com/questions/58385471/get-rid-of-regeneratorruntime-is-not-defined-without-importing-the-polyfill.

pdf.js also violated the same rule, https://salesforce.stackexchange.com/questions/285052/i-cant-load-pdf-js-lib-in-lightning-web-component.

Related issue, https://github.com/microsoft/BotFramework-DirectLineJS/issues/312.

After we found a solution, we should propagate the result to SDK and DLJS.

Running Salesforce Lightning linter

The linting tool requires our JS bundle to put inside an Aura component. The CLI below need some refinements.

npm install --global sfdx-cli

sfdx force:lightning:component:create -n webchat
cp webchat*.js /aura/webchat/
sfdx force:lightning:lint .

[Bug]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated webchat.js bundle and reproduce the issue in the Salesforce Locker Service Console with Locker and Strict CSP enabled. Review the sfdx Lightning component and linting commands described in the issue, and determine whether the console can run in CI. Done means regeneratorRuntime is scoped locally and the result can be propagated to the SDK and DLJS.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.