test_remoteTroubleshoot.html (921B)
1 <!DOCTYPE HTML> 2 <html> 3 <script> 4 5 // Set up a promise to wait for a response to our remote request. 6 window.remoteTroubleShootingResult = new Promise(resolve => { 7 window.addEventListener("WebChannelMessageToContent", function (event) { 8 if (event.detail.id == "remote-troubleshooting") { 9 // Store the result our DOM just for good measure/diagnostics. 10 document.getElementById("troubleshooting").textContent = 11 JSON.stringify(event.detail.message, null, 2); 12 13 resolve(event.detail.message); 14 } 15 }); 16 }); 17 18 // Make a request for the troubleshooting data as we load. 19 window.onload = function() { 20 var event = new window.CustomEvent("WebChannelMessageToChrome", { 21 detail: JSON.stringify({ 22 id: "remote-troubleshooting", 23 message: { 24 command: "request", 25 }, 26 }), 27 }); 28 window.dispatchEvent(event); 29 }; 30 </script> 31 32 <body> 33 <pre id="troubleshooting"/> 34 </body> 35 36 </html>