ace/experiments/chrome_debugger.html

71 строка
2.4 KiB
HTML

<html>
<head>
<script type="text/javascript" src="o3.js"></script>
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript" src="../src/ace/lib/core.js"></script>
<script type="text/javascript" src="../src/ace/lib/oop.js"></script>
<script type="text/javascript" src="../src/ace/lib/lang.js"></script>
<script type="text/javascript" src="../src/ace/MEventEmitter.js"></script>
<script type="text/javascript" src="../src/debug/O3Socket.js"></script>
<script type="text/javascript" src="../src/debug/ChromeDebugMessageStream.js"></script>
<script type="text/javascript" src="../src/debug/DevToolsService.js"></script>
<script type="text/javascript" src="../src/debug/DevToolsMessage.js"></script>
<script type="text/javascript" src="../src/debug/V8DebuggerService.js"></script>
<script type="text/javascript" src="../src/debug/V8Debugger.js"></script>
<script type="text/javascript" src="../src/debug/V8Message.js"></script>
<script type="text/javascript" src="../src/debug/MessageReader.js"></script>
</head>
<body>
<button onClick="testChrome()">start test</button>
<button id="close">close socket</button>
</body>
<script>
function testChrome() {
var o3obj = o3.create("8A66ECAC-63FD-4AFA-9D42-3034D18C88F4", {
oninstallprompt: function() { alert("can't find o3 plugin"); },
product: "O3Demo"
});
var socket = new O3Socket("127.0.0.1", 9222, o3obj);
var msgStream = new ChromeDebugMessageStream(socket);
msgStream.addEventListener("connect", function() {
var dts = new DevToolsService(msgStream);
var v8ds = new V8DebuggerService(msgStream);
dts.getVersion(function(version) {
console.log("ChromeDevTools Version:", version);
alert("ChromeDevTools Version:" + version)
dts.listTabs(function(tabs) {
console.log(tabs);
var tabId = tabs[0][0];
v8ds.attach(tabId, function() {
console.log("attached");
var v8debugger = new V8Debugger(tabId, v8ds);
v8debugger.version(function(version) {
console.log("V8 version:", version.V8Version);
});
v8debugger.scripts(4, null, true, function(scripts) {
console.log("scripts (short)", scripts);
});
});
});
});
});
msgStream.connect();
document.getElementById("close").onclick = function() {
socket.close();
}
};
</script>
</html>