revert all non-build changes
This commit is contained in:
parent
c424ad6758
commit
814bf0d311
|
|
@ -134,14 +134,7 @@ export async function installRootRedirect(server: HttpServer, traceUrls: string[
|
|||
for (const reporter of options.reporter || [])
|
||||
params.append('reporter', reporter);
|
||||
|
||||
let baseUrl = '';
|
||||
if (process.env.PW_HMR === '1') {
|
||||
params.set('testServerPort', '' + server.port());
|
||||
baseUrl = 'http://localhost:44223'; // port is hardcoded in build.js
|
||||
}
|
||||
|
||||
const urlPath = `${baseUrl}/trace/${options.webApp || 'index.html'}?${params.toString()}`;
|
||||
|
||||
const urlPath = `./trace/${options.webApp || 'index.html'}?${params.toString()}`;
|
||||
server.routePath('/', (_, response) => {
|
||||
response.statusCode = 302;
|
||||
response.setHeader('Location', urlPath);
|
||||
|
|
|
|||
|
|
@ -85,8 +85,7 @@ async function doFetch(event: FetchEvent): Promise<Response> {
|
|||
// the https urls.
|
||||
const isDeployedAsHttps = self.registration.scope.startsWith('https://');
|
||||
|
||||
// test server runs on a different port in HMR mode, so we only look at the hostname
|
||||
if (new URL(request.url).hostname === new URL(self.registration.scope).hostname) {
|
||||
if (request.url.startsWith(self.registration.scope)) {
|
||||
const url = new URL(unwrapPopoutUrl(request.url));
|
||||
const relativePath = url.pathname.substring(scopePath.length - 1);
|
||||
if (relativePath === '/ping') {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import type { StackFrame } from '@protocol/channels';
|
|||
import { CopyToClipboard } from './copyToClipboard';
|
||||
import { ToolbarButton } from '@web/components/toolbarButton';
|
||||
import { Toolbar } from '@web/components/toolbar';
|
||||
import { filePathToTraceURL } from './uiModeTraceView';
|
||||
|
||||
export const SourceTab: React.FunctionComponent<{
|
||||
stack?: StackFrame[],
|
||||
|
|
@ -74,7 +73,7 @@ export const SourceTab: React.FunctionComponent<{
|
|||
try {
|
||||
let response = await fetch(`sha1/src@${sha1}.txt`);
|
||||
if (response.status === 404)
|
||||
response = await fetch(filePathToTraceURL(file));
|
||||
response = await fetch(`file?path=${encodeURIComponent(file)}`);
|
||||
if (response.status >= 400)
|
||||
source.content = `<Unable to read "${file}">`;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import type { ContextEntry } from '../types/entries';
|
|||
import type { SourceLocation } from './modelUtil';
|
||||
import { MultiTraceModel } from './modelUtil';
|
||||
import { Workbench } from './workbench';
|
||||
import { testServerBaseURL } from './uiModeView';
|
||||
|
||||
export const TraceView: React.FC<{
|
||||
item: { treeItem?: TreeItem, testFile?: SourceLocation, testCase?: reporterTypes.TestCase },
|
||||
|
|
@ -127,7 +126,7 @@ function formatUrl(traceURL: URL) {
|
|||
}
|
||||
|
||||
export function filePathToTraceURL(path: string) {
|
||||
const url = new URL('file', testServerBaseURL);
|
||||
const url = new URL('file', location.href);
|
||||
url.searchParams.set('path', path);
|
||||
return url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,9 @@ const xtermDataSource: XtermDataSource = {
|
|||
resize: () => {},
|
||||
};
|
||||
|
||||
export const testServerBaseURL = new URL(window.location.href);
|
||||
const searchParams = testServerBaseURL.searchParams;
|
||||
testServerBaseURL.port = searchParams.get('testServerPort') ?? testServerBaseURL.port;
|
||||
const wsURL = new URL(`/${searchParams.get('ws')}`, testServerBaseURL);
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
const guid = searchParams.get('ws');
|
||||
const wsURL = new URL(`../${guid}`, window.location.toString());
|
||||
wsURL.protocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:');
|
||||
const queryParams = {
|
||||
args: searchParams.getAll('arg'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue