Bug 1639716 - [devtools performance] Cleanup: pass the openAboutProfiling function from panel.js for more simplicity r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D129421
This commit is contained in:
Julien Wajsberg 2022-01-26 17:26:22 +00:00
Родитель 44769eadc9
Коммит 900b1c7aeb
3 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -18,7 +18,7 @@ export interface PanelWindow {
perfFront: PerfFront,
traits: RootTraits,
pageContext: PageContext,
openAboutProfiling?: () => void
openAboutProfiling: () => void
): Promise<void>;
gDestroy(): void;
gIsPanelDestroyed?: boolean;

Просмотреть файл

@ -94,20 +94,13 @@ const {
* makes it possible to change some code path
* depending on the server version.
* @param {PageContext} pageContext - The context that the UI is being loaded in under.
* @param {(() => void)?} openAboutProfiling - Optional call to open about:profiling
* @param {(() => void)} openAboutProfiling - Optional call to open about:profiling
*/
async function gInit(perfFront, traits, pageContext, openAboutProfiling) {
const store = createStore(reducers);
const isSupportedPlatform = await perfFront.isSupportedPlatform();
const supportedFeatures = await perfFront.getSupportedFeatures();
if (!openAboutProfiling) {
openAboutProfiling = () => {
const { openTrustedLink } = require("devtools/client/shared/link");
openTrustedLink("about:profiling", {});
};
}
{
// Expose the store as a global, for testing.
const anyWindow = /** @type {any} */ (window);

Просмотреть файл

@ -68,10 +68,20 @@ class PerformancePanel {
),
};
await this.panelWin.gInit(perfFront, traits, "devtools");
await this.panelWin.gInit(
perfFront,
traits,
"devtools",
this._openAboutProfiling
);
return this;
}
_openAboutProfiling() {
const { openTrustedLink } = require("devtools/client/shared/link");
openTrustedLink("about:profiling", {});
}
// DevToolPanel API:
/**