Skip to content

Commit

Permalink
Remove use-strict from js non modern js bundle
Browse files Browse the repository at this point in the history
By default, rollup bundles js in strict mode.
When regenerator-runtime is included in use-strict
mode, they use a Function() call (which is like
a slightly safer eval()) to initialize things.
Specifically
```js
  Function("r", "regeneratorRuntime = r")(runtime);
```
Removing use-strict mode lets regenerator runtime init
without any unsafe evals. Because strict mode
javascript is a subset of regular javascript, this
should not break any code. AFAIK there is no way
to require a script tag to be in 'use strict' mode.

T=https://yextops.zendesk.com/agent/tickets/347915
TEST=manual

tested with a local apache httpd server
added below line to .htaccess, which sets the CSP to
the same as Syncreon

also test csp with a `<meta>` tag

tested both answers.js and answers.min.js
  • Loading branch information
oshi97 committed Sep 3, 2020
1 parent 24c08e4 commit a291373
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions conf/gulp-tasks/library.gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ function legacyBundleIIFE () {
return legacyBundle({
format: 'iife',
name: NAMESPACE,
sourcemap: true
sourcemap: true,
strict: false
},
'answers.js'
);
Expand All @@ -79,7 +80,8 @@ function legacyBundleUMD () {
format: 'umd',
name: NAMESPACE,
export: 'default',
sourcemap: true
sourcemap: true,
strict: false
},
'answers-umd.js'
);
Expand Down
2 changes: 0 additions & 2 deletions src/ui/components/filters/filteroptionscomponent.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/** @module FilterOptionsComponent */

/* global Event */

import Component from '../component';
import { AnswersComponentError } from '../../../core/errors/errors';
import Filter from '../../../core/models/filter';
Expand Down

0 comments on commit a291373

Please sign in to comment.