(allowLaunchThroughService: boolean, session: DartDebugSessionInformation & { vmServiceUri: string } | undefined, options: DevToolsOptions, forceShow: boolean)
| 345 | } |
| 346 | |
| 347 | private async launch(allowLaunchThroughService: boolean, session: DartDebugSessionInformation & { vmServiceUri: string } | undefined, options: DevToolsOptions, forceShow: boolean) { |
| 348 | const url = await this.devtoolsUrl; |
| 349 | if (!url) { |
| 350 | this.showError(`DevTools URL not available`); |
| 351 | return; |
| 352 | } |
| 353 | |
| 354 | const queryParams: Record<string, string | undefined> = { |
| 355 | ...this.getDefaultQueryParams(), |
| 356 | ideFeature: options.commandSource, |
| 357 | inspectorRef: options.inspectorRef, |
| 358 | theme: config.useDevToolsDarkTheme && options.location === "external" ? "dark" : undefined, |
| 359 | }; |
| 360 | |
| 361 | const pageId = options.pageId ?? this.getDefaultPage().id; |
| 362 | const page = devToolsPages.find((p) => p.id === pageId); |
| 363 | const routeId = page ? this.routeIdForPage(page) : pageId; |
| 364 | |
| 365 | // Try to launch via service if allowed. |
| 366 | if (allowLaunchThroughService && session && await this.launchThroughService(session, { ...options, queryParams, page: routeId })) |
| 367 | return true; |
| 368 | |
| 369 | // Otherwise, fall back to embedded or launching manually. |
| 370 | if (pageId) |
| 371 | queryParams.page = routeId; |
| 372 | const vmServiceUri = page?.isStaticTool ? undefined : session?.vmServiceUri; |
| 373 | // We currently only support embedded for pages we know about statically, although since we seem |
| 374 | // to only use that for a title, we may be able to relax that. |
| 375 | if (options.location !== "external") { |
| 376 | if (this.dartCapabilities.requiresDevToolsEmbedFlag) |
| 377 | queryParams.embed = "true"; |
| 378 | queryParams.embedMode = "one"; |
| 379 | const fullUrls = await this.buildDevToolsUrl(url, queryParams, vmServiceUri, session?.clientVmServiceUri); |
| 380 | const exposedUrls = await exposeWebViewUrls(fullUrls, this.logger); |
| 381 | |
| 382 | const pageInfo = page ?? { id: pageId, title: pageId.replace(/_ext$/, "") }; |
| 383 | await this.launchInEmbeddedWebView(exposedUrls, session, pageInfo, options.location, options.triggeredAutomatically, forceShow); |
| 384 | } else { |
| 385 | const fullUrls = await this.buildDevToolsUrl(url, queryParams, vmServiceUri, session?.clientVmServiceUri); |
| 386 | // For the browser, we don't care about auth URLs, but call exposeUrl so we get better logging because |
| 387 | // "Open DevTools in Browser" is a convenient way to help troubleshoot URL mapping issues like |
| 388 | // https://github.com/flutter/devtools/issues/9827 |
| 389 | const exposedUrl = await envUtils.exposeUrl(fullUrls.viewUrl, this.logger); |
| 390 | await envUtils.openInBrowser(exposedUrl, this.logger); |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | private getCacheBust(): string { |
| 395 | // Add the version to the querystring to avoid any caching of the index.html page. |
no test coverage detected