From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../new-console-output/actions/enhancers.js | 20 +++++ .../new-console-output/actions/filters.js | 55 ++++++++++++ .../webconsole/new-console-output/actions/index.js | 18 ++++ .../new-console-output/actions/messages.js | 100 +++++++++++++++++++++ .../new-console-output/actions/moz.build | 12 +++ .../webconsole/new-console-output/actions/ui.js | 27 ++++++ 6 files changed, 232 insertions(+) create mode 100644 devtools/client/webconsole/new-console-output/actions/enhancers.js create mode 100644 devtools/client/webconsole/new-console-output/actions/filters.js create mode 100644 devtools/client/webconsole/new-console-output/actions/index.js create mode 100644 devtools/client/webconsole/new-console-output/actions/messages.js create mode 100644 devtools/client/webconsole/new-console-output/actions/moz.build create mode 100644 devtools/client/webconsole/new-console-output/actions/ui.js (limited to 'devtools/client/webconsole/new-console-output/actions') diff --git a/devtools/client/webconsole/new-console-output/actions/enhancers.js b/devtools/client/webconsole/new-console-output/actions/enhancers.js new file mode 100644 index 000000000..5553942e2 --- /dev/null +++ b/devtools/client/webconsole/new-console-output/actions/enhancers.js @@ -0,0 +1,20 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { BATCH_ACTIONS } = require("../constants"); + +function batchActions(batchedActions) { + return { + type: BATCH_ACTIONS, + actions: batchedActions, + }; +} + +module.exports = { + batchActions +}; diff --git a/devtools/client/webconsole/new-console-output/actions/filters.js b/devtools/client/webconsole/new-console-output/actions/filters.js new file mode 100644 index 000000000..05d080219 --- /dev/null +++ b/devtools/client/webconsole/new-console-output/actions/filters.js @@ -0,0 +1,55 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { getAllFilters } = require("devtools/client/webconsole/new-console-output/selectors/filters"); +const Services = require("Services"); + +const { + FILTER_TEXT_SET, + FILTER_TOGGLE, + FILTERS_CLEAR, + PREFS, +} = require("devtools/client/webconsole/new-console-output/constants"); + +function filterTextSet(text) { + return { + type: FILTER_TEXT_SET, + text + }; +} + +function filterToggle(filter) { + return (dispatch, getState) => { + dispatch({ + type: FILTER_TOGGLE, + filter, + }); + const filterState = getAllFilters(getState()); + Services.prefs.setBoolPref(PREFS.FILTER[filter.toUpperCase()], + filterState.get(filter)); + }; +} + +function filtersClear() { + return (dispatch, getState) => { + dispatch({ + type: FILTERS_CLEAR, + }); + + const filterState = getAllFilters(getState()); + for (let filter in filterState) { + Services.prefs.clearUserPref(PREFS.FILTER[filter.toUpperCase()]); + } + }; +} + +module.exports = { + filterTextSet, + filterToggle, + filtersClear +}; diff --git a/devtools/client/webconsole/new-console-output/actions/index.js b/devtools/client/webconsole/new-console-output/actions/index.js new file mode 100644 index 000000000..5ce76a402 --- /dev/null +++ b/devtools/client/webconsole/new-console-output/actions/index.js @@ -0,0 +1,18 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const actionModules = [ + "enhancers", + "filters", + "messages", + "ui", +].map(filename => require(`./${filename}`)); + +const actions = Object.assign({}, ...actionModules); + +module.exports = actions; diff --git a/devtools/client/webconsole/new-console-output/actions/messages.js b/devtools/client/webconsole/new-console-output/actions/messages.js new file mode 100644 index 000000000..467e27503 --- /dev/null +++ b/devtools/client/webconsole/new-console-output/actions/messages.js @@ -0,0 +1,100 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { + prepareMessage +} = require("devtools/client/webconsole/new-console-output/utils/messages"); +const { IdGenerator } = require("devtools/client/webconsole/new-console-output/utils/id-generator"); +const { batchActions } = require("devtools/client/webconsole/new-console-output/actions/enhancers"); +const { + MESSAGE_ADD, + MESSAGES_CLEAR, + MESSAGE_OPEN, + MESSAGE_CLOSE, + MESSAGE_TYPE, + MESSAGE_TABLE_RECEIVE, +} = require("../constants"); + +const defaultIdGenerator = new IdGenerator(); + +function messageAdd(packet, idGenerator = null) { + if (idGenerator == null) { + idGenerator = defaultIdGenerator; + } + let message = prepareMessage(packet, idGenerator); + const addMessageAction = { + type: MESSAGE_ADD, + message + }; + + if (message.type === MESSAGE_TYPE.CLEAR) { + return batchActions([ + messagesClear(), + addMessageAction, + ]); + } + return addMessageAction; +} + +function messagesClear() { + return { + type: MESSAGES_CLEAR + }; +} + +function messageOpen(id) { + return { + type: MESSAGE_OPEN, + id + }; +} + +function messageClose(id) { + return { + type: MESSAGE_CLOSE, + id + }; +} + +function messageTableDataGet(id, client, dataType) { + return (dispatch) => { + let fetchObjectActorData; + if (["Map", "WeakMap", "Set", "WeakSet"].includes(dataType)) { + fetchObjectActorData = (cb) => client.enumEntries(cb); + } else { + fetchObjectActorData = (cb) => client.enumProperties({ + ignoreNonIndexedProperties: dataType === "Array" + }, cb); + } + + fetchObjectActorData(enumResponse => { + const {iterator} = enumResponse; + iterator.slice(0, iterator.count, sliceResponse => { + let {ownProperties} = sliceResponse; + dispatch(messageTableDataReceive(id, ownProperties)); + }); + }); + }; +} + +function messageTableDataReceive(id, data) { + return { + type: MESSAGE_TABLE_RECEIVE, + id, + data + }; +} + +module.exports = { + messageAdd, + messagesClear, + messageOpen, + messageClose, + messageTableDataGet, +}; + diff --git a/devtools/client/webconsole/new-console-output/actions/moz.build b/devtools/client/webconsole/new-console-output/actions/moz.build new file mode 100644 index 000000000..c7a8ed52c --- /dev/null +++ b/devtools/client/webconsole/new-console-output/actions/moz.build @@ -0,0 +1,12 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +DevToolsModules( + 'enhancers.js', + 'filters.js', + 'index.js', + 'messages.js', + 'ui.js', +) diff --git a/devtools/client/webconsole/new-console-output/actions/ui.js b/devtools/client/webconsole/new-console-output/actions/ui.js new file mode 100644 index 000000000..cf9814d79 --- /dev/null +++ b/devtools/client/webconsole/new-console-output/actions/ui.js @@ -0,0 +1,27 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { getAllUi } = require("devtools/client/webconsole/new-console-output/selectors/ui"); +const Services = require("Services"); + +const { + FILTER_BAR_TOGGLE, + PREFS, +} = require("devtools/client/webconsole/new-console-output/constants"); + +function filterBarToggle(show) { + return (dispatch, getState) => { + dispatch({ + type: FILTER_BAR_TOGGLE + }); + const uiState = getAllUi(getState()); + Services.prefs.setBoolPref(PREFS.UI.FILTER_BAR, uiState.get("filterBarVisible")); + }; +} + +exports.filterBarToggle = filterBarToggle; -- cgit v1.2.3