Chrome | 125.0.0 | own | function | function(t,n){return new Promise((r,o)=>{let i=document.querySelector("body > solver-ext-messages");i||(i=document.createElement("solver-ext-messages"),i.style.display="none",document.body.appendChild(i));let a=document.createElement("solver-ext-message");a.dataset.action=t,a.dataset.messageId=Date.now().valueOf().toString(),n&&(a.dataset.data=encodeURIComponent(JSON.stringify(n))),i.appendChild(a);let u=setInterval(()=>{if(a.dataset.response){try{let f=JSON.parse(decodeURIComponent(a.dataset.response));f.error?o(new Error(f.error)):r(f)}catch{o(new Error("Cannot parse message response"))}clearTimeout(u),a.remove(),i.childNodes.length||i.remove()}},200)})} |