From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- devtools/client/application/src/types/index.js | 18 +++++ devtools/client/application/src/types/manifest.js | 89 ++++++++++++++++++++++ devtools/client/application/src/types/moz.build | 10 +++ devtools/client/application/src/types/routing.js | 16 ++++ .../application/src/types/service-workers.js | 35 +++++++++ 5 files changed, 168 insertions(+) create mode 100644 devtools/client/application/src/types/index.js create mode 100644 devtools/client/application/src/types/manifest.js create mode 100644 devtools/client/application/src/types/moz.build create mode 100644 devtools/client/application/src/types/routing.js create mode 100644 devtools/client/application/src/types/service-workers.js (limited to 'devtools/client/application/src/types') diff --git a/devtools/client/application/src/types/index.js b/devtools/client/application/src/types/index.js new file mode 100644 index 0000000000..bf15f187a6 --- /dev/null +++ b/devtools/client/application/src/types/index.js @@ -0,0 +1,18 @@ +/* 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 manifestTypes = require("resource://devtools/client/application/src/types/manifest.js"); +const routingTypes = require("resource://devtools/client/application/src/types/routing.js"); +const workersTypes = require("resource://devtools/client/application/src/types/service-workers.js"); + +module.exports = Object.assign( + {}, + { + ...manifestTypes, + ...routingTypes, + ...workersTypes, + } +); diff --git a/devtools/client/application/src/types/manifest.js b/devtools/client/application/src/types/manifest.js new file mode 100644 index 0000000000..7f49522a25 --- /dev/null +++ b/devtools/client/application/src/types/manifest.js @@ -0,0 +1,89 @@ +/* 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 PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js"); + +const { + MANIFEST_ISSUE_LEVELS, +} = require("resource://devtools/client/application/src/constants.js"); +const { + MANIFEST_MEMBER_VALUE_TYPES, +} = require("resource://devtools/client/application/src/constants.js"); + +const manifestIssue = { + level: PropTypes.oneOf(Object.values(MANIFEST_ISSUE_LEVELS)).isRequired, + message: PropTypes.string.isRequired, + // NOTE: we are currently ignoring the 'type' field that platform adds to errors +}; + +const manifestIssueArray = PropTypes.arrayOf(PropTypes.shape(manifestIssue)); + +const manifestItemColor = { + label: PropTypes.string.isRequired, + value: PropTypes.string, +}; + +const manifestItemIcon = { + label: PropTypes.shape({ + contentType: PropTypes.string, + sizes: PropTypes.string, + }).isRequired, + value: PropTypes.shape({ + src: PropTypes.string.isRequired, + purpose: PropTypes.string.isRequired, + }).isRequired, +}; + +const manifestItemUrl = { + label: PropTypes.string.isRequired, + value: PropTypes.string, +}; + +const manifestMemberColor = { + key: manifestItemColor.label, + value: manifestItemColor.value, + type: PropTypes.oneOf([MANIFEST_MEMBER_VALUE_TYPES.COLOR]), +}; + +const manifestMemberIcon = { + key: manifestItemIcon.label, + value: manifestItemIcon.value, + type: PropTypes.oneOf([MANIFEST_MEMBER_VALUE_TYPES.ICON]), +}; + +const manifestMemberString = { + key: PropTypes.string.isRequired, + value: PropTypes.string, + type: PropTypes.oneOf([MANIFEST_MEMBER_VALUE_TYPES.STRING]), +}; + +const manifest = { + // members + identity: PropTypes.arrayOf(PropTypes.shape(manifestMemberString)).isRequired, + presentation: PropTypes.arrayOf( + PropTypes.oneOfType([ + PropTypes.shape(manifestMemberColor), + PropTypes.shape(manifestMemberString), + ]) + ).isRequired, + icons: PropTypes.arrayOf(PropTypes.shape(manifestMemberIcon)).isRequired, + // validation issues + validation: manifestIssueArray.isRequired, + // misc + url: PropTypes.string.isRequired, +}; + +module.exports = { + // full manifest + manifest, + // specific manifest items + manifestItemColor, + manifestItemIcon, + manifestItemUrl, + // manifest issues + manifestIssue, + manifestIssueArray, +}; diff --git a/devtools/client/application/src/types/moz.build b/devtools/client/application/src/types/moz.build new file mode 100644 index 0000000000..c8161f448d --- /dev/null +++ b/devtools/client/application/src/types/moz.build @@ -0,0 +1,10 @@ +# 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( + "index.js", + "manifest.js", + "routing.js", + "service-workers.js", +) diff --git a/devtools/client/application/src/types/routing.js b/devtools/client/application/src/types/routing.js new file mode 100644 index 0000000000..a1d922ab3d --- /dev/null +++ b/devtools/client/application/src/types/routing.js @@ -0,0 +1,16 @@ +/* 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 PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js"); +const { + PAGE_TYPES, +} = require("resource://devtools/client/application/src/constants.js"); + +const page = PropTypes.oneOf(Object.values(PAGE_TYPES)); + +module.exports = { + page, +}; diff --git a/devtools/client/application/src/types/service-workers.js b/devtools/client/application/src/types/service-workers.js new file mode 100644 index 0000000000..bf913fb264 --- /dev/null +++ b/devtools/client/application/src/types/service-workers.js @@ -0,0 +1,35 @@ +/* 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 PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js"); + +const worker = { + id: PropTypes.string.isRequired, + state: PropTypes.number.isRequired, + stateText: PropTypes.string.isRequired, + url: PropTypes.string.isRequired, + workerDescriptorFront: PropTypes.object, + registrationFront: PropTypes.object, +}; + +const workerArray = PropTypes.arrayOf(PropTypes.shape(worker)); + +const registration = { + id: PropTypes.string.isRequired, + lastUpdateTime: PropTypes.number, + registrationFront: PropTypes.object.isRequired, + scope: PropTypes.string.isRequired, + workers: workerArray.isRequired, +}; + +const registrationArray = PropTypes.arrayOf(PropTypes.shape(registration)); + +module.exports = { + registration, + registrationArray, + worker, + workerArray, +}; -- cgit v1.2.3