summaryrefslogtreecommitdiffstats
path: root/devtools/client/application/src/actions
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/application/src/actions/index.js12
-rw-r--r--devtools/client/application/src/actions/manifest.js50
-rw-r--r--devtools/client/application/src/actions/moz.build11
-rw-r--r--devtools/client/application/src/actions/page.js20
-rw-r--r--devtools/client/application/src/actions/ui.js20
-rw-r--r--devtools/client/application/src/actions/workers.js51
6 files changed, 164 insertions, 0 deletions
diff --git a/devtools/client/application/src/actions/index.js b/devtools/client/application/src/actions/index.js
new file mode 100644
index 0000000000..67e9cbfd88
--- /dev/null
+++ b/devtools/client/application/src/actions/index.js
@@ -0,0 +1,12 @@
+/* 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 workers = require("resource://devtools/client/application/src/actions/workers.js");
+const page = require("resource://devtools/client/application/src/actions/page.js");
+const ui = require("resource://devtools/client/application/src/actions/ui.js");
+const manifest = require("resource://devtools/client/application/src/actions/manifest.js");
+
+Object.assign(exports, workers, page, ui, manifest);
diff --git a/devtools/client/application/src/actions/manifest.js b/devtools/client/application/src/actions/manifest.js
new file mode 100644
index 0000000000..050fab2b89
--- /dev/null
+++ b/devtools/client/application/src/actions/manifest.js
@@ -0,0 +1,50 @@
+/* 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 {
+ l10n,
+} = require("resource://devtools/client/application/src/modules/l10n.js");
+
+const {
+ services,
+ ManifestDevToolsError,
+} = require("resource://devtools/client/application/src/modules/application-services.js");
+const {
+ FETCH_MANIFEST_FAILURE,
+ FETCH_MANIFEST_START,
+ FETCH_MANIFEST_SUCCESS,
+ RESET_MANIFEST,
+} = require("resource://devtools/client/application/src/constants.js");
+
+function fetchManifest() {
+ return async ({ dispatch, getState }) => {
+ dispatch({ type: FETCH_MANIFEST_START });
+ try {
+ const manifest = await services.fetchManifest();
+ dispatch({ type: FETCH_MANIFEST_SUCCESS, manifest });
+ } catch (error) {
+ let errorMessage = error.message;
+
+ // since Firefox DevTools errors may not make sense for the user, swap
+ // their message for a generic one.
+ if (error instanceof ManifestDevToolsError) {
+ console.error(error);
+ errorMessage = l10n.getString("manifest-loaded-devtools-error");
+ }
+
+ dispatch({ type: FETCH_MANIFEST_FAILURE, error: errorMessage });
+ }
+ };
+}
+
+function resetManifest() {
+ return { type: RESET_MANIFEST };
+}
+
+module.exports = {
+ fetchManifest,
+ resetManifest,
+};
diff --git a/devtools/client/application/src/actions/moz.build b/devtools/client/application/src/actions/moz.build
new file mode 100644
index 0000000000..f2a41f8674
--- /dev/null
+++ b/devtools/client/application/src/actions/moz.build
@@ -0,0 +1,11 @@
+# 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",
+ "page.js",
+ "ui.js",
+ "workers.js",
+)
diff --git a/devtools/client/application/src/actions/page.js b/devtools/client/application/src/actions/page.js
new file mode 100644
index 0000000000..1348a4aaa2
--- /dev/null
+++ b/devtools/client/application/src/actions/page.js
@@ -0,0 +1,20 @@
+/* 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 {
+ UPDATE_DOMAIN,
+} = require("resource://devtools/client/application/src/constants.js");
+
+function updateDomain(url) {
+ return {
+ type: UPDATE_DOMAIN,
+ url,
+ };
+}
+
+module.exports = {
+ updateDomain,
+};
diff --git a/devtools/client/application/src/actions/ui.js b/devtools/client/application/src/actions/ui.js
new file mode 100644
index 0000000000..92de169ab0
--- /dev/null
+++ b/devtools/client/application/src/actions/ui.js
@@ -0,0 +1,20 @@
+/* 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 {
+ UPDATE_SELECTED_PAGE,
+} = require("resource://devtools/client/application/src/constants.js");
+
+function updateSelectedPage(selectedPage) {
+ return {
+ type: UPDATE_SELECTED_PAGE,
+ selectedPage,
+ };
+}
+
+module.exports = {
+ updateSelectedPage,
+};
diff --git a/devtools/client/application/src/actions/workers.js b/devtools/client/application/src/actions/workers.js
new file mode 100644
index 0000000000..375dfe9ba7
--- /dev/null
+++ b/devtools/client/application/src/actions/workers.js
@@ -0,0 +1,51 @@
+/* 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 {
+ START_WORKER,
+ UNREGISTER_WORKER,
+ UPDATE_CAN_DEBUG_WORKERS,
+ UPDATE_WORKERS,
+} = require("resource://devtools/client/application/src/constants.js");
+
+function startWorker(worker) {
+ const { registrationFront } = worker;
+ registrationFront.start();
+
+ return {
+ type: START_WORKER,
+ };
+}
+
+function unregisterWorker(registration) {
+ const { registrationFront } = registration;
+ registrationFront.unregister();
+
+ return {
+ type: UNREGISTER_WORKER,
+ };
+}
+
+function updateWorkers(workers) {
+ return {
+ type: UPDATE_WORKERS,
+ workers,
+ };
+}
+
+function updateCanDebugWorkers(canDebugWorkers) {
+ return {
+ type: UPDATE_CAN_DEBUG_WORKERS,
+ canDebugWorkers,
+ };
+}
+
+module.exports = {
+ startWorker,
+ unregisterWorker,
+ updateCanDebugWorkers,
+ updateWorkers,
+};