From f98c3cba8cde5e6e2b9a49f4489abb2595986565 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Mon, 15 Mar 2021 16:45:42 -0700 Subject: [PATCH] Preliminary support for better performance testing --- ts/textsecure/AccountManager.ts | 19 +++++++++++-------- ts/textsecure/WebAPI.ts | 4 +++- ts/util/lint/exceptions.json | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ts/textsecure/AccountManager.ts b/ts/textsecure/AccountManager.ts index 7b3691c836b4..befb493dd384 100644 --- a/ts/textsecure/AccountManager.ts +++ b/ts/textsecure/AccountManager.ts @@ -211,14 +211,17 @@ export default class AccountManager extends EventTarget { const proto = window.textsecure.protobuf.ProvisioningUuid.decode( request.body ); - setProvisioningUrl( - [ - 'tsdevice:/?uuid=', - proto.uuid, - '&pub_key=', - encodeURIComponent(btoa(utils.getString(pubKey))), - ].join('') - ); + const url = [ + 'tsdevice:/?uuid=', + proto.uuid, + '&pub_key=', + encodeURIComponent(btoa(utils.getString(pubKey))), + ].join(''); + + // eslint-disable-next-line no-console + console._log(`provisioning url ${url}`); + + setProvisioningUrl(url); request.respond(200, 'OK'); } else if ( request.path === '/v1/message' && diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 653c742a539e..39098b47d869 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -448,7 +448,9 @@ async function _promiseAjax( } else if ( (options.responseType === 'json' || options.responseType === 'jsonwithdetails') && - response.headers.get('Content-Type') === 'application/json' + /^application\/json(;.*)?$/.test( + response.headers.get('Content-Type') || '' + ) ) { resultPromise = response.json(); } else if ( diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 69164d720ed0..ba16ed64a776 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -15170,7 +15170,7 @@ "rule": "jQuery-wrap(", "path": "ts/textsecure/WebAPI.ts", "line": " const byteBuffer = window.dcodeIO.ByteBuffer.wrap(", - "lineNumber": 2230, + "lineNumber": 2232, "reasonCategory": "falseMatch", "updated": "2020-09-08T23:07:22.682Z" },