Bug 1471795 - Part 2: Introduce Runtime class. r=jdescottes

MozReview-Commit-ID: EajaVnn9kR3

--HG--
extra : rebase_source : c682161aa226880bb17efe342f144a87458e55cf
This commit is contained in:
Daisuke Akatsuka 2018-07-26 17:52:10 +09:00
parent 6db8153aa8
commit e41d8f7704
6 changed files with 51 additions and 1 deletions

View File

@ -17,6 +17,8 @@ const { createFactory } =
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 = {
@ -27,7 +29,8 @@ const AboutDebugging = {
return;
}
render(App(), this.mount);
const thisFirefox = new ThisFirefox();
render(App({ thisFirefox }), this.mount);
},
destroy() {

View File

@ -6,8 +6,17 @@
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(
{

View File

@ -4,4 +4,5 @@
DIRS += [
'components',
'runtimes',
]

View File

@ -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',
)

View File

@ -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;

View File

@ -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;