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);
break;
case 'getBody':
sendResponse(document.body.innerHTML);
case 'getDOM':
sendResponse(document.getElementsByTagName('html')[0].outerHTML);
break;
case 'setBody':
document.body.innerHTML = message.html;
case 'setDOM':
document.getElementsByTagName('html')[0].innerHTML = message.html;
break;
}
});

View File

@ -35,14 +35,14 @@ export default {
return await browser.tabs.sendMessage(tab.id, { type: 'getURL' });
},
async getBody() {
async getDOM() {
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();
await browser.tabs.sendMessage(tab.id, { type: 'setBody', html: html });
await browser.tabs.sendMessage(tab.id, { type: 'setDOM', html: html });
},
async run(action, host) {