Make thread state changes opt-in for clients with an onThreadState handler (bug 1037514); r=fitzgen

--HG--
extra : rebase_source : 94232bb18e4f3dbeef3df827b05b5cc1be37b36e