Skip to content
Draft
14 changes: 10 additions & 4 deletions src/vs/workbench/contrib/browserView/common/browserEditorInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ThemeIcon } from '../../../../base/common/themables.js';
import { URI } from '../../../../base/common/uri.js';
import { generateUuid } from '../../../../base/common/uuid.js';
import { BrowserViewUri } from '../../../../platform/browserView/common/browserViewUri.js';
import { BrowserViewSharingState, IBrowserEditorViewState, IBrowserViewWorkbenchService } from './browserView.js';
import { BrowserViewSharingState, BrowserNavigationSource, IBrowserEditorViewState, IBrowserViewWorkbenchService } from './browserView.js';
import { EditorInputCapabilities, IEditorSerializer, IUntypedEditorInput, Verbosity } from '../../../common/editor.js';
import { EditorInput } from '../../../common/editor/editorInput.js';
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
Expand Down Expand Up @@ -157,14 +157,20 @@ export class BrowserEditorInput extends EditorInput {
return this._model ? this._model.sharingState !== BrowserViewSharingState.Unavailable : this.browserViewWorkbenchService.isSharingAvailable;
}

navigate(url: string): void {
navigate(url: string, options?: { source?: BrowserNavigationSource }): void {
// `navigate` is a pure "load this URL" entry point: callers (the URL bar,
// favorites, history, tab restore) pass an already-resolved destination.
// Address bar search routing (query → search-engine URL) happens in the
// nav bar before calling here. `options.source` is forwarded purely for
// telemetry so a search-initiated navigation is tracked as such.
const destination = url.trim();
if (this._model) {
void this._model.loadURL(url);
void this._model.loadURL(destination, options);
} else {
// If the model isn't created yet, update the initial data so that the URL is correct when the model is created
this._initialData = {
id: this._id,
url
url: destination
};
this._onDidChangeLabel.fire();
}
Expand Down
Loading
Loading