1 <html> 2 <head> 3 <title>Content shell remote debugging</title> 4 <style> 5 </style> 6 7 <script> 8 function onLoad() { 9 var tabs_list_request = new XMLHttpRequest(); 10 tabs_list_request.open("GET", "/json/list?t=" + new Date().getTime(), true); 11 tabs_list_request.onreadystatechange = onReady; 12 tabs_list_request.send(); 13 } 14 15 function onReady() { 16 if(this.readyState == 4 && this.status == 200) { 17 if(this.response != null) 18 var responseJSON = JSON.parse(this.response); 19 for (var i = 0; i < responseJSON.length; ++i) 20 appendItem(responseJSON[i]); 21 } 22 } 23 24 function appendItem(item_object) { 25 var frontend_ref; 26 if (item_object.devtoolsFrontendUrl) { 27 frontend_ref = document.createElement("a"); 28 frontend_ref.href = item_object.devtoolsFrontendUrl; 29 frontend_ref.title = item_object.title; 30 } else { 31 frontend_ref = document.createElement("div"); 32 frontend_ref.title = "The tab already has active debugging session"; 33 } 34 35 var text = document.createElement("div"); 36 if (item_object.title) 37 text.innerText = item_object.title; 38 else 39 text.innerText = "(untitled tab)"; 40 text.style.cssText = "background-image:url(" + item_object.faviconUrl + ")"; 41 frontend_ref.appendChild(text); 42 43 var item = document.createElement("p"); 44 item.appendChild(frontend_ref); 45 46 document.getElementById("items").appendChild(item); 47 } 48 </script> 49 </head> 50 <body onload='onLoad()'> 51 <div id='caption'>Inspectable WebContents</div> 52 <div id='items'></div> 53 </body> 54 </html> 55