Temporarily disable Javascript for inactive Chrome tabs (except for whitelisted urls) - until active again?
Solution 1:
I wanted something like this but I only wanted to pause the JavaScript v8 context for inactive tabs as this is less disruptive to the page than turning JavaScript off. As what I found also somewhat answers the OP's question I'll put what I found here.
I found out that doing that was possible with chrome.experimental.debugger and they provide an sample extension which uses the debugger which creates an icon which allows one to pause and unpause the current tab.
I haven't yet tested whether that could be adapted to automatically pause tabs when inactive and unpause them when they become active.
Solution 2:
Wrench Menu > Options > Under the Hood > Privacy 'Content settings' > Javascript
In the above section, you can completely turn off javascript for all sites and then mark as exception the whitelist of sites like GMail, and Facebook.
There is no way Google Chrome will automatically figure which tabs are active and disable javascript for the inactive ones. Not yet anyway.