Make ServiceWorker an EventTarget and dispatch statechange to it.

Some infelicities with the event when reusing a service worker, and
unregistering service workers, are noted in FIXMEs in the test. Those
fixes must come later.

BUG=363413
R=kinuko@chromium.org

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=171525

Review URL: https://codereview.chromium.org/236823002

git-svn-id: svn://svn.chromium.org/blink/trunk@171538 bbb929c8-8fbe-4397-9dbb-9b2b20218538