getBody/setBody changed to getDOM/setDOM

This commit is contained in:
Fabio Manganiello 2020-06-25 23:20:46 +02:00
parent 4022139bc7
commit d1638b2512
2 changed files with 8 additions and 8 deletions

View file

@ -6,12 +6,12 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
sendResponse(window.location.href); sendResponse(window.location.href);
break; break;
case 'getBody': case 'getDOM':
sendResponse(document.body.innerHTML); sendResponse(document.getElementsByTagName('html')[0].outerHTML);
break; break;
case 'setBody': case 'setDOM':
document.body.innerHTML = message.html; document.getElementsByTagName('html')[0].innerHTML = message.html;
break; break;
} }
}); });

View file

@ -35,14 +35,14 @@ export default {
return await browser.tabs.sendMessage(tab.id, { type: 'getURL' }); return await browser.tabs.sendMessage(tab.id, { type: 'getURL' });
}, },
async getBody() { async getDOM() {
const tab = await this.getCurrentTab(); const tab = await this.getCurrentTab();
return await browser.tabs.sendMessage(tab.id, { type: 'getBody' }); return await browser.tabs.sendMessage(tab.id, { type: 'getDOM' });
}, },
async setBody(html) { async setDOM(html) {
const tab = await this.getCurrentTab(); const tab = await this.getCurrentTab();
await browser.tabs.sendMessage(tab.id, { type: 'setBody', html: html }); await browser.tabs.sendMessage(tab.id, { type: 'setDOM', html: html });
}, },
async run(action, host) { async run(action, host) {