1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

tabsQuery fix

This commit is contained in:
Kyle Spearrin 2019-08-16 10:54:19 -04:00
parent 31a257a5a3
commit d90279a596

View File

@ -32,7 +32,7 @@ export class BrowserApi {
});
}
static tabsQuery(options: any): Promise<any[]> {
static async tabsQuery(options: any): Promise<any[]> {
if (BrowserApi.isChromeApi) {
return new Promise((resolve) => {
chrome.tabs.query(options, (tabs: any[]) => {
@ -40,7 +40,8 @@ export class BrowserApi {
});
});
} else if (BrowserApi.isSafariApi) {
let wins: any[] = [];
const tabs = await SafariApp.sendMessageToApp('tabs_query', JSON.stringify(options));
return tabs;
// TODO
/*
if (options.currentWindow) {
@ -68,7 +69,6 @@ export class BrowserApi {
return Promise.resolve(returnedTabs);
*/
return Promise.resolve([]);
}
}
@ -93,7 +93,7 @@ export class BrowserApi {
return BrowserApi.tabSendMessage(tab, obj);
}
static async tabSendMessage(tab: any, obj: any, options: any = null): Promise<any> {
static tabSendMessage(tab: any, obj: any, options: any = null): Promise<any> {
if (!tab || !tab.id) {
return;
}
@ -108,8 +108,6 @@ export class BrowserApi {
});
});
} else if (BrowserApi.isSafariApi) {
const tabs = await SafariApp.sendMessageToApp('tabs_query', JSON.stringify(options));
return tabs;
// TODO
/*
let t = tab.safariTab;
@ -138,6 +136,8 @@ export class BrowserApi {
t.page.dispatchMessage('bitwarden', obj);
}
*/
return Promise.resolve();
}
}