fix: newBootloaderQuery should return a ErrTuple

This commit is contained in:
Derrick Hammer 2023-09-11 07:10:42 -04:00
parent 2369ab7d32
commit 3ee446a9c5
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 6 deletions

View File

@ -676,12 +676,8 @@ function newKernelQuery(
return [sendUpdate, p]; return [sendUpdate, p];
} }
function newBootloaderQuery(method: string, data: any): Promise<any> { function newBootloaderQuery(method: string, data: any): Promise<ErrTuple> {
return new Promise((resolve) => { return new Promise((resolve) => {
let receiveResponse = function (data: any) {
resolve(data.data);
};
initDefer.promise.then(() => { initDefer.promise.then(() => {
if (getKernelIframe().contentWindow === null) { if (getKernelIframe().contentWindow === null) {
console.error( console.error(
@ -690,7 +686,7 @@ function newBootloaderQuery(method: string, data: any): Promise<any> {
return; return;
} }
let nonce = nextNonce(); let nonce = nextNonce();
queries[nonce] = { resolve: receiveResponse }; queries[nonce] = { resolve };
getKernelIframe().contentWindow?.postMessage( getKernelIframe().contentWindow?.postMessage(
{ method, data, nonce }, { method, data, nonce },
kernelOrigin, kernelOrigin,