summaryrefslogtreecommitdiff
path: root/src/content/dynamicNS.js
diff options
context:
space:
mode:
authorhackademix2018-08-27 00:31:37 +0200
committerhackademix2018-08-27 18:55:00 +0200
commite2b63cf98204a45f4c55ba446689d20e524c188c (patch)
treefa9739889307b55777d4b48326bbad38136dabf0 /src/content/dynamicNS.js
parent6e80d3f130773fc9a9123c5c4c2e97d63e90fa2a (diff)
downloadnoscript-e2b63cf98204a45f4c55ba446689d20e524c188c.tar.gz
noscript-e2b63cf98204a45f4c55ba446689d20e524c188c.tar.xz
noscript-e2b63cf98204a45f4c55ba446689d20e524c188c.zip
Further CSP refactoring and removal of obsolete fallbacks.
Diffstat (limited to 'src/content/dynamicNS.js')
-rw-r--r--src/content/dynamicNS.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/content/dynamicNS.js b/src/content/dynamicNS.js
new file mode 100644
index 0000000..cdd7a0e
--- /dev/null
+++ b/src/content/dynamicNS.js
@@ -0,0 +1,21 @@
+'use strict';
+
+// ensure the order which manifest scripts and dynamically registered scripts
+// are executed in doesn't matter for initialization, by using a stub.
+
+if (!this.ns) {
+ let deferredSetup = null;
+ let nsStub = this.ns = {
+ config: {},
+ setup(DEFAULT, MARKER) {
+ deferredSetup = [DEFAULT, MARKER];
+ },
+ merge: ns => {
+ ns.config = Object.assign(ns.config, nsStub.config);
+ this.ns = ns;
+ if (deferredSetup) {
+ ns.setup(...deferredSetup);
+ }
+ }
+ }
+}