Fix several definitions for TS 0.9

Also add some tests for chrome.js