Commit 6a706895 authored by lushnikov's avatar lushnikov Committed by Commit bot

DevTools: [hosted mode] avoid exception in devtools_compatibility:addExtensions

The addExtensions command gets sent on front-end relatively early,
when the onload event gets triggered.

However, in case of hosted mode, the load event happens before actual
InspectorFrontendHost initialization, since Runtime.js starts loading
and evaling all the dependencies by itself.

This patch protects from this race so that there's no annoying exception
thrown.

BUG=none
R=dgozman

Review-Url: https://codereview.chromium.org/2744573002
Cr-Commit-Position: refs/heads/master@{#455993}
parent 09a524bf
......@@ -64,10 +64,14 @@
*/
addExtensions(extensions) {
// Support for legacy front-ends (<M41).
if (window['WebInspector'] && window['WebInspector']['addExtensions'])
if (window['WebInspector'] && window['WebInspector']['addExtensions']) {
window['WebInspector']['addExtensions'](extensions);
else
} else if (window['InspectorFrontendAPI']) {
// The addExtensions command is sent as the onload event happens for
// DevTools front-end. In case of hosted mode, this
// happens before the InspectorFrontendAPI is initialized.
this._dispatchOnInspectorFrontendAPI('addExtensions', [extensions]);
}
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment