diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/netmonitor/src/components/request-list/RequestListColumnSetCookies.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/netmonitor/src/components/request-list/RequestListColumnSetCookies.js')
-rw-r--r-- | devtools/client/netmonitor/src/components/request-list/RequestListColumnSetCookies.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/src/components/request-list/RequestListColumnSetCookies.js b/devtools/client/netmonitor/src/components/request-list/RequestListColumnSetCookies.js new file mode 100644 index 0000000000..0ee8164411 --- /dev/null +++ b/devtools/client/netmonitor/src/components/request-list/RequestListColumnSetCookies.js @@ -0,0 +1,61 @@ +/* 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 { + Component, +} = require("resource://devtools/client/shared/vendor/react.js"); +const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); +const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js"); +const { + fetchNetworkUpdatePacket, +} = require("resource://devtools/client/netmonitor/src/utils/request-utils.js"); + +class RequestListColumnSetCookies extends Component { + static get propTypes() { + return { + connector: PropTypes.object.isRequired, + item: PropTypes.object.isRequired, + }; + } + + componentDidMount() { + const { item, connector } = this.props; + fetchNetworkUpdatePacket(connector.requestData, item, ["responseCookies"]); + } + + // FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=1774507 + UNSAFE_componentWillReceiveProps(nextProps) { + const { item, connector } = nextProps; + fetchNetworkUpdatePacket(connector.requestData, item, ["responseCookies"]); + } + + shouldComponentUpdate(nextProps) { + let { responseCookies: currResponseCookies = { cookies: [] } } = + this.props.item; + let { responseCookies: nextResponseCookies = { cookies: [] } } = + nextProps.item; + currResponseCookies = currResponseCookies.cookies || currResponseCookies; + nextResponseCookies = nextResponseCookies.cookies || nextResponseCookies; + return currResponseCookies !== nextResponseCookies; + } + + render() { + let { responseCookies = { cookies: [] } } = this.props.item; + responseCookies = responseCookies.cookies || responseCookies; + const responseCookiesLength = responseCookies.length + ? responseCookies.length + : ""; + return dom.td( + { + className: "requests-list-column requests-list-set-cookies", + title: responseCookiesLength, + }, + responseCookiesLength + ); + } +} + +module.exports = RequestListColumnSetCookies; |