DevTools: Address timing issue during load

During frontend load, there are a couple async points after
DOMContentLoaded before the UI can finish initializing. The first
is waiting for all modules to load. The second is waiting for
preferences to be retrieved.

The event for DevTools extensions was being fired on window
load, but it was possible for the above async work to take too long
and the event listener would not be subscribed in time.

This patch addresses this race condition by caching the event info
inside devtools_compatibility and using a callback instead of relying
on Extensions.ExtensionsServer to be constructed before window load.

Bug: 973701
Change-Id: I638a6915f7b7c37a32cebe3d876cbca4f94e9f49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1658433
Commit-Queue: Jeff Fisher <jeffish@microsoft.com>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Joel Einbinder <einbinder@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672273}
5 files changed