Skip to content

Commit 64b83b3

Browse files
committed
Merge branch 'develop' into travis/permalink-routing
2 parents 1bd44a7 + e69f7db commit 64b83b3

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"bluebird": "^3.5.0",
5858
"browser-request": "^0.3.3",
5959
"content-type": "^1.0.2",
60+
"loglevel": "1.6.1",
6061
"memfs": "^2.10.1",
6162
"request": "^2.88.0"
6263
},
@@ -74,7 +75,6 @@
7475
"expect": "^1.20.2",
7576
"istanbul": "^0.4.5",
7677
"jsdoc": "^3.5.5",
77-
"loglevel": "1.6.1",
7878
"lolex": "^1.5.2",
7979
"matrix-mock-request": "^1.2.2",
8080
"mocha": "^5.2.0",

spec/unit/crypto/DeviceList.spec.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,35 @@ describe('DeviceList', function() {
5959
let downloadSpy;
6060
let sessionStore;
6161
let cryptoStore;
62+
let deviceLists = [];
6263

6364
beforeEach(function() {
6465
testUtils.beforeEach(this); // eslint-disable-line no-invalid-this
6566

67+
deviceLists = [];
68+
6669
downloadSpy = expect.createSpy();
6770
const mockStorage = new MockStorageApi();
6871
sessionStore = new WebStorageSessionStore(mockStorage);
6972
cryptoStore = new MemoryCryptoStore();
7073
});
7174

75+
afterEach(function() {
76+
for (const dl of deviceLists) {
77+
dl.stop();
78+
}
79+
});
80+
7281
function createTestDeviceList() {
7382
const baseApis = {
7483
downloadKeysForUsers: downloadSpy,
7584
};
7685
const mockOlm = {
7786
verifySignature: function(key, message, signature) {},
7887
};
79-
return new DeviceList(baseApis, cryptoStore, sessionStore, mockOlm);
88+
const dl = new DeviceList(baseApis, cryptoStore, sessionStore, mockOlm);
89+
deviceLists.push(dl);
90+
return dl;
8091
}
8192

8293
it("should successfully download and store device keys", function() {

src/crypto/DeviceList.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ export default class DeviceList {
146146
}
147147
}
148148

149+
stop() {
150+
if (this._saveTimer !== null) {
151+
clearTimeout(this._saveTimer);
152+
}
153+
}
154+
149155
/**
150156
* Save the device tracking state to storage, if any changes are
151157
* pending other than updating the sync token

src/crypto/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ Crypto.prototype.start = function() {
221221
/** Stop background processes related to crypto */
222222
Crypto.prototype.stop = function() {
223223
this._outgoingRoomKeyRequestManager.stop();
224+
this._deviceList.stop();
224225
};
225226

226227
/**

0 commit comments

Comments
 (0)