mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 21:54:47 +08:00
There was a regression since http://crrev.com/ffe776a where Inspector capability was introduced. Now devtools frontend expects Inspector domain to be present on any targets and crashes if it's missing. This commit restores usage of capability, adding it to targets that support it to best of my knowledge. R=dgozman@chromium.org, lushnikov@chromium.org Change-Id: I6eab098ef12d5212c65cc65f0d49f619aaf4edd3 Reviewed-on: https://chromium-review.googlesource.com/1042709 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Commit-Queue: Dmitry Gozman <dgozman@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#558447} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: e60fb1f327ca3a14bdc424984c17ddca99857f32
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
/**
|
|
* @implements {Protocol.InspectorDispatcher}
|
|
*/
|
|
Components.TargetDetachedDialog = class extends SDK.SDKModel {
|
|
/**
|
|
* @param {!SDK.Target} target
|
|
*/
|
|
constructor(target) {
|
|
super(target);
|
|
if (target.parentTarget())
|
|
return;
|
|
target.registerInspectorDispatcher(this);
|
|
target.inspectorAgent().enable();
|
|
this._hideCrashedDialog = null;
|
|
Components.TargetDetachedDialog._disconnectedScreenWithReasonWasShown = false;
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
* @param {string} reason
|
|
*/
|
|
detached(reason) {
|
|
Components.TargetDetachedDialog._disconnectedScreenWithReasonWasShown = true;
|
|
UI.RemoteDebuggingTerminatedScreen.show(reason);
|
|
}
|
|
|
|
static webSocketConnectionLost() {
|
|
UI.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected');
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
targetCrashed() {
|
|
const dialog = new UI.Dialog();
|
|
dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent);
|
|
dialog.addCloseButton();
|
|
dialog.setDimmed(true);
|
|
this._hideCrashedDialog = dialog.hide.bind(dialog);
|
|
new UI.TargetCrashedScreen(() => this._hideCrashedDialog = null).show(dialog.contentElement);
|
|
dialog.show();
|
|
}
|
|
|
|
/**
|
|
* @override;
|
|
*/
|
|
targetReloadedAfterCrash() {
|
|
if (this._hideCrashedDialog) {
|
|
this._hideCrashedDialog.call(null);
|
|
this._hideCrashedDialog = null;
|
|
}
|
|
}
|
|
};
|
|
|
|
SDK.SDKModel.register(Components.TargetDetachedDialog, SDK.Target.Capability.Inspector, true);
|