Bug 1471795 - Part 2: Introduce Runtime class. r?jdescottes
MozReview-Commit-ID: EajaVnn9kR3
--- a/devtools/client/aboutdebugging-new/aboutdebugging.js
+++ b/devtools/client/aboutdebugging-new/aboutdebugging.js
@@ -12,27 +12,30 @@ const { require } = BrowserLoader({
});
const Services = require("Services");
const { createFactory } =
require("devtools/client/shared/vendor/react");
const { render, unmountComponentAtNode } =
require("devtools/client/shared/vendor/react-dom");
+const ThisFirefox = require("./src/runtimes/this-firefox");
+
const App = createFactory(require("./src/components/App"));
const AboutDebugging = {
init() {
if (!Services.prefs.getBoolPref("devtools.enabled", true)) {
// If DevTools are disabled, navigate to about:devtools.
window.location = "about:devtools?reason=AboutDebugging";
return;
}
- render(App(), this.mount);
+ const thisFirefox = new ThisFirefox();
+ render(App({ thisFirefox }), this.mount);
},
destroy() {
unmountComponentAtNode(this.mount);
},
get mount() {
return document.getElementById("mount");
--- a/devtools/client/aboutdebugging-new/src/components/App.js
+++ b/devtools/client/aboutdebugging-new/src/components/App.js
@@ -1,18 +1,27 @@
/* 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 { PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
+const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
+
+const ThisFirefox = require("../runtimes/this-firefox");
class App extends PureComponent {
+ static get propTypes() {
+ return {
+ thisFirefox: PropTypes.instanceOf(ThisFirefox).isRequired,
+ };
+ }
+
render() {
return dom.div(
{
className: "app",
},
);
}
}
--- a/devtools/client/aboutdebugging-new/src/moz.build
+++ b/devtools/client/aboutdebugging-new/src/moz.build
@@ -1,7 +1,8 @@
# 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/.
DIRS += [
'components',
+ 'runtimes',
]
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging-new/src/runtimes/moz.build
@@ -0,0 +1,8 @@
+# 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(
+ 'runtime.js',
+ 'this-firefox.js',
+)
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging-new/src/runtimes/runtime.js
@@ -0,0 +1,13 @@
+/* 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";
+
+/**
+ * This class represents a runtime, such as a remote Firefox.
+ */
+class Runtime {
+}
+
+module.exports = Runtime;
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging-new/src/runtimes/this-firefox.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 Runtime = require("./runtime");
+
+/**
+ * This class represents the Firefox instance which runs in the same environment that
+ * opened about:debugging.
+ */
+class ThisFirefox extends Runtime {
+}
+
+module.exports = ThisFirefox;