feat: add support for chrome.tabs.query (#39330)

* feat: add support for tabs.query

* fix: scope to webContents in current session

* test: add test for session behavior
This commit is contained in:
Shelley Vohr 2023-08-09 14:47:19 +02:00 committed by GitHub
parent 0425454687
commit d9329042e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 336 additions and 2 deletions

View file

@ -38,6 +38,12 @@ const handleRequest = (request, sender, sendResponse) => {
break;
}
case 'query': {
const [params] = args;
chrome.tabs.query(params).then(sendResponse);
break;
}
case 'reload': {
chrome.tabs.reload(tabId).then(() => {
sendResponse({ status: 'reloaded' });

View file

@ -15,6 +15,11 @@ const testMap = {
console.log(JSON.stringify(response));
});
},
query (params) {
chrome.runtime.sendMessage({ method: 'query', args: [params] }, response => {
console.log(JSON.stringify(response));
});
},
getZoom () {
chrome.runtime.sendMessage({ method: 'getZoom', args: [] }, response => {
console.log(JSON.stringify(response));