mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Backed out changeset e20df5f95e44 (bug 1552434) for devtools failures in devtools/client/framework/test/browser_toolbox_options.js CLOSED TREE
This commit is contained in:
parent
46226cbf2b
commit
14f9191527
@ -33,9 +33,6 @@ const { getAllNotifications } = require("devtools/client/webconsole/selectors/no
|
||||
const { div } = dom;
|
||||
const isMacOS = Services.appinfo.OS === "Darwin";
|
||||
|
||||
// Prefs
|
||||
const { PREFS } = require("devtools/client/webconsole/constants");
|
||||
|
||||
/**
|
||||
* Console root Application component.
|
||||
*/
|
||||
@ -66,35 +63,6 @@ class App extends Component {
|
||||
this.onKeyDown = this.onKeyDown.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
UI,
|
||||
} = PREFS;
|
||||
|
||||
// Toggle the timestamp on preference change. We use a weak observer to not have to
|
||||
// remove the observer (because we don't want to have a componentWillUnmount that
|
||||
// would do extra work).
|
||||
this.timeStampObserver = {
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference,
|
||||
]),
|
||||
|
||||
observe: () => {
|
||||
const enabled = Services.prefs.getBoolPref(UI.MESSAGE_TIMESTAMP);
|
||||
this.props.dispatch(actions.timestampsToggle(enabled));
|
||||
},
|
||||
};
|
||||
|
||||
Services.prefs.addObserver(
|
||||
UI.MESSAGE_TIMESTAMP,
|
||||
this.timeStampObserver,
|
||||
// This is flag needed to register a weak observer.
|
||||
// See https://searchfox.org/mozilla-central/rev/f4c39907e0b527dc4b9356a1eeb8c6e6c62d383a/modules/libpref/nsIPrefBranch.idl#430
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
onKeyDown(event) {
|
||||
const {
|
||||
dispatch,
|
||||
|
@ -69,10 +69,8 @@ const prefs = {
|
||||
INPUT_HISTORY_COUNT: "devtools.webconsole.inputHistoryCount",
|
||||
// Is editor mode enabled.
|
||||
EDITOR: "devtools.webconsole.input.editor",
|
||||
// Display content messages in the browser console.
|
||||
// Display content messages in the browser console
|
||||
CONTENT_MESSAGES: "devtools.browserconsole.contentMessages",
|
||||
// Display timestamp in messages.
|
||||
MESSAGE_TIMESTAMP: "devtools.webconsole.timestampMessages",
|
||||
},
|
||||
FEATURES: {
|
||||
// We use the same pref to enable the sidebar on webconsole and browser console.
|
||||
|
@ -81,7 +81,6 @@ function configureStore(webConsoleUI, options = {}) {
|
||||
? getBoolPref(PREFS.UI.CONTENT_MESSAGES)
|
||||
: true,
|
||||
editor: getBoolPref(PREFS.UI.EDITOR),
|
||||
timestampsVisible: getBoolPref(PREFS.UI.MESSAGE_TIMESTAMP),
|
||||
}),
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,7 @@ loader.lazyRequireGetter(this, "AppConstants", "resource://gre/modules/AppConsta
|
||||
|
||||
const ZoomKeys = require("devtools/client/shared/zoom-keys");
|
||||
|
||||
const PREF_MESSAGE_TIMESTAMP = "devtools.webconsole.timestampMessages";
|
||||
const PREF_SIDEBAR_ENABLED = "devtools.webconsole.sidebarToggle";
|
||||
|
||||
/**
|
||||
@ -39,6 +40,7 @@ class WebConsoleUI {
|
||||
this.isBrowserConsole = this.hud._browserConsole;
|
||||
this.window = this.hud.iframeWindow;
|
||||
|
||||
this._onToolboxPrefChanged = this._onToolboxPrefChanged.bind(this);
|
||||
this._onPanelSelected = this._onPanelSelected.bind(this);
|
||||
this._onChangeSplitConsoleState = this._onChangeSplitConsoleState.bind(this);
|
||||
|
||||
@ -62,6 +64,9 @@ class WebConsoleUI {
|
||||
this._initUI();
|
||||
await this._initConnection();
|
||||
await this.wrapper.init();
|
||||
// Toggle the timestamp on preference change
|
||||
Services.prefs.addObserver(PREF_MESSAGE_TIMESTAMP, this._onToolboxPrefChanged);
|
||||
this._onToolboxPrefChanged();
|
||||
|
||||
const id = WebConsoleUtils.supportsString(this.hudId);
|
||||
if (Services.obs) {
|
||||
@ -74,6 +79,7 @@ class WebConsoleUI {
|
||||
return this._destroyer.promise;
|
||||
}
|
||||
this._destroyer = defer();
|
||||
Services.prefs.removeObserver(PREF_MESSAGE_TIMESTAMP, this._onToolboxPrefChanged);
|
||||
this.React = this.ReactDOM = this.FrameView = null;
|
||||
if (this.jsterm) {
|
||||
this.jsterm.destroy();
|
||||
@ -312,6 +318,14 @@ class WebConsoleUI {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the message timestamp pref changes.
|
||||
*/
|
||||
_onToolboxPrefChanged() {
|
||||
const newValue = Services.prefs.getBoolPref(PREF_MESSAGE_TIMESTAMP);
|
||||
this.wrapper.dispatchTimestampsToggle(newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the focus to JavaScript input field when the web console tab is
|
||||
* selected or when there is a split console present.
|
||||
|
@ -477,6 +477,10 @@ class WebConsoleWrapper {
|
||||
store.dispatch(actions.privateMessagesClear());
|
||||
}
|
||||
|
||||
dispatchTimestampsToggle(enabled) {
|
||||
store.dispatch(actions.timestampsToggle(enabled));
|
||||
}
|
||||
|
||||
dispatchPaused(_, packet) {
|
||||
if (packet.executionPoint) {
|
||||
store.dispatch(actions.setPauseExecutionPoint(packet.executionPoint));
|
||||
|
Loading…
Reference in New Issue
Block a user