Skip to content

Commit ae81b72

Browse files
Drop script-loader because it uses eval but CSP doesn't allow eval [WAL-2469]
See also: webpack-contrib/script-loader#39
1 parent b666ba4 commit ae81b72

File tree

5 files changed

+58
-79
lines changed

5 files changed

+58
-79
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
"redux-logger": "^3.0.6",
157157
"redux-mock-store": "^1.2.3",
158158
"sass-loader": "^7.1.0",
159-
"script-loader": "^0.7.2",
160159
"serve": "^10.0.2",
161160
"source-map-loader": "^0.2.4",
162161
"start-server-and-test": "^1.7.11",

src/class.js

-64
This file was deleted.

src/index-template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<!-- Allow installing the app to the homescreen. Temporarily disabled due to caching issues. -->
1212
<!-- link rel="manifest" href="manifest.json" -->
1313
</head>
14-
<body class="fixed-sidebar {{$state.current.data.bodyClass}}" id="page-top">
14+
<body class="fixed-sidebar {{$state.current.data.bodyClass}}" id="page-top" ng-csp="no-unsafe-eval">
1515
<div class="loading-screen" ng-if="::false">
1616
<style>
1717
.loading-screen {

src/shims/class.js

+57-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
1-
require('!script-loader!../class');
1+
/* eslint-disable */
2+
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
3+
// The base Class implementation (does nothing)
4+
window.Class = function(){};
5+
6+
// Create a new Class that inherits from this class
7+
window.Class.extend = function(prop) {
8+
var _super = this.prototype;
9+
10+
// Instantiate a base class (but only create the instance,
11+
// don't run the init constructor)
12+
initializing = true;
13+
var prototype = new this();
14+
initializing = false;
15+
16+
// Copy the properties over onto the new prototype
17+
for (var name in prop) {
18+
// Check if we're overwriting an existing function
19+
prototype[name] = typeof prop[name] == "function" &&
20+
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
21+
(function(name, fn){
22+
return function() {
23+
var tmp = this._super;
24+
25+
// Add a new ._super() method that is the same method
26+
// but on the super-class
27+
this._super = _super[name];
28+
29+
// The method only need to be bound temporarily, so we
30+
// remove it when we're done executing
31+
var ret = fn.apply(this, arguments);
32+
this._super = tmp;
33+
34+
return ret;
35+
};
36+
})(name, prop[name]) :
37+
prop[name];
38+
}
39+
40+
// The dummy class constructor
41+
function Class() {
42+
// All construction is actually done in the init method
43+
if ( !initializing && this.init )
44+
this.init.apply(this, arguments);
45+
}
46+
47+
// Populate our constructed prototype object
48+
Class.prototype = prototype;
49+
50+
// Enforce the constructor to be what we expect
51+
Class.prototype.constructor = Class;
52+
53+
// And make this class extendable
54+
Class.extend = arguments.callee;
55+
56+
return Class;
57+
};

yarn.lock

-12
Original file line numberDiff line numberDiff line change
@@ -9584,11 +9584,6 @@ [email protected]:
95849584
iconv-lite "0.4.23"
95859585
unpipe "1.0.0"
95869586

9587-
raw-loader@~0.5.1:
9588-
version "0.5.1"
9589-
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"
9590-
integrity sha1-DD0L6u2KAclm2Xh793goElKpeao=
9591-
95929587
rc@^1.0.1, rc@^1.1.6, rc@^1.2.7:
95939588
version "1.2.8"
95949589
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
@@ -10506,13 +10501,6 @@ schema-utils@^1.0.0:
1050610501
ajv-errors "^1.0.0"
1050710502
ajv-keywords "^3.1.0"
1050810503

10509-
script-loader@^0.7.2:
10510-
version "0.7.2"
10511-
resolved "https://registry.yarnpkg.com/script-loader/-/script-loader-0.7.2.tgz#2016db6f86f25f5cf56da38915d83378bb166ba7"
10512-
integrity sha512-UMNLEvgOAQuzK8ji8qIscM3GIrRCWN6MmMXGD4SD5l6cSycgGsCo0tX5xRnfQcoghqct0tjHjcykgI1PyBE2aA==
10513-
dependencies:
10514-
raw-loader "~0.5.1"
10515-
1051610504
scss-tokenizer@^0.2.3:
1051710505
version "0.2.3"
1051810506
resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1"

0 commit comments

Comments
 (0)