зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
44769eadc9
Коммит
900b1c7aeb
|
@ -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:
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче