зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1672132 - [devtools] Inline renderPanel into boostrapApp. r=jdescottes.
`boostrapApp` had a check for supporting the Launchpad, that we can now remove. And since `renderPanel` is only called from there, we can safely inline it. Differential Revision: https://phabricator.services.mozilla.com/D94083
This commit is contained in:
Родитель
f5c6d9e6a5
Коммит
e88dedbbe0
|
@ -34,32 +34,6 @@ import type { Panel } from "../client/firefox/types";
|
|||
|
||||
let parser;
|
||||
|
||||
function renderPanel(component, store, panel: Panel) {
|
||||
const root = document.createElement("div");
|
||||
root.className = "launchpad-root theme-body";
|
||||
root.style.setProperty("flex", "1");
|
||||
const mount = document.querySelector("#mount");
|
||||
if (!mount) {
|
||||
return;
|
||||
}
|
||||
mount.appendChild(root);
|
||||
|
||||
const toolboxDoc = panel.panelWin.parent.document;
|
||||
|
||||
ReactDOM.render(
|
||||
React.createElement(
|
||||
Provider,
|
||||
{ store },
|
||||
React.createElement(
|
||||
ToolboxProvider,
|
||||
{ store: panel.getToolboxStore() },
|
||||
React.createElement(component, { toolboxDoc })
|
||||
)
|
||||
),
|
||||
root
|
||||
);
|
||||
}
|
||||
|
||||
type Workers = {
|
||||
sourceMaps: typeof SourceMaps,
|
||||
evaluationsParser: typeof ParserDispatcher,
|
||||
|
@ -124,12 +98,30 @@ export function teardownWorkers(): void {
|
|||
}
|
||||
|
||||
export function bootstrapApp(store: any, panel: Panel): void {
|
||||
if (isFirefoxPanel()) {
|
||||
renderPanel(App, store, panel);
|
||||
} else {
|
||||
const { renderRoot } = require("devtools-launchpad");
|
||||
renderRoot(React, ReactDOM, App, store);
|
||||
const root = document.createElement("div");
|
||||
root.className = "launchpad-root theme-body";
|
||||
root.style.setProperty("flex", "1");
|
||||
const mount = document.querySelector("#mount");
|
||||
if (!mount) {
|
||||
return;
|
||||
}
|
||||
|
||||
mount.appendChild(root);
|
||||
|
||||
const toolboxDoc = panel.panelWin.parent.document;
|
||||
|
||||
ReactDOM.render(
|
||||
React.createElement(
|
||||
Provider,
|
||||
{ store },
|
||||
React.createElement(
|
||||
ToolboxProvider,
|
||||
{ store: panel.getToolboxStore() },
|
||||
React.createElement(App, { toolboxDoc })
|
||||
)
|
||||
),
|
||||
root
|
||||
);
|
||||
}
|
||||
|
||||
function registerStoreObserver(store, subscriber) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче