Make ThreadedMessagingProxyBase and ParentFrameTaskRunners friendly to nested workers

Don't assuming things are running on the main thread or the ExecutionContext is
a Document.

Bug: 829119

Change-Id: I2506c8aeb8d47d773fb0b9b393212af80acd8eca
Reviewed-on: https://chromium-review.googlesource.com/996467
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548941}
6 files changed