ChromeRepl - a remote REPL client for Google Chrome

2009-11-07 15:50

Today is a little party about Chromium extension at Shibuya. And so I wrote a small extension to learn about Chromium and Google Chrome.

Developer Tools Protocol

Yesterday, I hear about Google Chrome Developer Tools from co-worker. He said “I tried Eclipse debugger but not works well…”. Um, I don’t know Eclipse. Sorry.

However I found a Google Chrome Developer Tools Protocol from Developer Tools page. It’s simple, text based protocol over TCP/IP. User can control Chrome from a remote client.

Protocol

Developer Tools Protocol have some Tools. DevToolsService is not fun, V8Debugger is powerful and interesting, and ExtensionPorts is most flexible. This tool used to talk to a Chrome extension.

How to use ChromeRepl

So I wrote a extension, Ruby client library and script. Repository is chrome-repl.

ChromeRepl is proof-of-concept quality yet. First, launch Chrome with –remote-shell-port and load extension from chrome://extensions/.

% /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-shell-port=9222
...

Second, edit extension ID of chrome-repl script and launch on another console.

% ruby -I lib ./bin/chrome-repl 9222
> 1 + 2
3
> chrome.tabs
{"onRemoved"=>{"listeners_"=>[], "eventName_"=>"tabs.onRemoved"}, "onAttached"=>{"listeners_"=>[], "eventName_"=>"tabs.onAttached"}, "onDetached"=>{"listeners_"=>[], "eventName_"=>"tabs.onDetached"}, "onSelectionChanged"=>{"listeners_"=>[], "eventName_"=>"tabs.onSelectionChanged"}, "onMoved"=>{"listeners_"=>[], "eventName_"=>"tabs.onMoved"}, "onCreated"=>{"listeners_"=>[], "eventName_"=>"tabs.onCreated"}, "onUpdated"=>{"listeners_"=>[], "eventName_"=>"tabs.onUpdated"}}

I’ll make chrome-repl.crx soon. Please wait a moment.

Leave a Reply