summaryrefslogtreecommitdiffstats
path: root/devtools/client/application/src/types
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /devtools/client/application/src/types
parentInitial commit. (diff)
downloadfirefox-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/application/src/types')
-rw-r--r--devtools/client/application/src/types/index.js18
-rw-r--r--devtools/client/application/src/types/manifest.js89
-rw-r--r--devtools/client/application/src/types/moz.build10
-rw-r--r--devtools/client/application/src/types/routing.js16
-rw-r--r--devtools/client/application/src/types/service-workers.js35
5 files changed, 168 insertions, 0 deletions
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,
+};