Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions chromium/background-scripts/update.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
/* global update_channels */
/* global pako */
/* global __dirname */

"use strict";

// Determine if we're in the tests. If so, define some necessary components.
if(typeof(window) == "undefined"){
const fs = require('fs');
const WebCrypto = require("node-webcrypto-ossl"),
if (typeof window === "undefined") {
var WebCrypto = require("node-webcrypto-ossl"),
crypto = new WebCrypto(),
atob = require("atob"),
btoa = require("btoa"),
encoding = require('text-encoding');

var window = {
crypto: new WebCrypto(),
atob,
btoa
};

var update_channels = Function(fs.readFileSync(__dirname + '/update_channels.js').toString() + "return update_channels;")(),
pako = Function(fs.readFileSync(__dirname + '/../external/pako-1.0.5/pako_inflate.min.js').toString() + "return pako;")(),
TextDecoder = encoding.TextDecoder,
chrome = require("sinon-chrome");
pako = require('../external/pako-1.0.5/pako_inflate.min.js'),
{ TextDecoder } = require('text-encoding'),
chrome = require("sinon-chrome"),
window = { atob, btoa, chrome, crypto, pako, TextDecoder };
}

(function(exports) {

const { update_channels } = require('./update_channels');
const util = require('./util');

let store,
background_callback;

Expand Down
24 changes: 17 additions & 7 deletions chromium/background-scripts/update_channels.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
/* exported update_channels */

"use strict";
'use strict';

var update_channels = [{
name: "EFF (Full)",
(function (exports) {

exports.update_channels = [{
name: 'EFF (Full)',
jwk: {
kty: "RSA",
e: "AQAB",
n: "1cwvFQu3Kw-Pz8bcEFuV5zx0ZheDsc4Tva7Qv6BL90_sDLqCW79Y543nDkPtNVfFH_89pt2kSPp_IcS5XnYiw6zBQeFuILFw5JpvZt14K0s4e025Q9CXfhYKIBKT9PnqihwAacjMa6rQb7RTu7XxVvqxRb3b0vx2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X9L3DJIaB3VPYPTSIPUr7oi1' +
'6agsuamOyiOtlZiRpEvoNg2ksJMZtwnj5xhBQydkdhMW2ZpHDzcLuZlhJYZL_l3_7wuzRM7vpyA9obP92CpZRFJErGZmFxJC93I4U9-0B0wg' +
'-sbyMKGJ5j1BWTnibCklDXtWzXtuiz18EgE'
},
update_path_prefix: "https://www.https-rulesets.org/v1/"
update_path_prefix: 'https://www.https-rulesets.org/v1/'
}];

})(typeof exports === 'undefined' ? require.scopes.update_channels = {} : exports);
4 changes: 2 additions & 2 deletions chromium/test/update_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const assert = require('chai').assert,
sinon = require('sinon');

const fs = require('fs'),
update_channels = Function(fs.readFileSync(__dirname + '/../background-scripts/update_channels.js').toString() + "return update_channels;")(),
pako = Function(fs.readFileSync(__dirname + '/../external/pako-1.0.5/pako_inflate.min.js').toString() + "return pako;")();
{ update_channels } = require('../background-scripts/update_channels'),
pako = require('../external/pako-1.0.5/pako_inflate.min.js');

util.setDefaultLogLevel(util.WARN);

Expand Down