always fetch zip from testServer
This commit is contained in:
parent
39a7f54d73
commit
6077fc8181
|
|
@ -45,7 +45,7 @@ import { EmbeddedWorkbenchLoader } from './ui/embeddedWorkbenchLoader';
|
||||||
if (window.location.protocol !== 'file:') {
|
if (window.location.protocol !== 'file:') {
|
||||||
if (!navigator.serviceWorker)
|
if (!navigator.serviceWorker)
|
||||||
throw new Error(`Service workers are not supported.\nMake sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);
|
throw new Error(`Service workers are not supported.\nMake sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);
|
||||||
navigator.serviceWorker.register('sw.bundle.js');
|
navigator.serviceWorker.register('sw.bundle.js' + window.location.search);
|
||||||
if (!navigator.serviceWorker.controller) {
|
if (!navigator.serviceWorker.controller) {
|
||||||
await new Promise<void>(f => {
|
await new Promise<void>(f => {
|
||||||
navigator.serviceWorker.oncontrollerchange = () => f();
|
navigator.serviceWorker.oncontrollerchange = () => f();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import { WorkbenchLoader } from './ui/workbenchLoader';
|
||||||
await new Promise(f => setTimeout(f, 1000));
|
await new Promise(f => setTimeout(f, 1000));
|
||||||
if (!navigator.serviceWorker)
|
if (!navigator.serviceWorker)
|
||||||
throw new Error(`Service workers are not supported.\nMake sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);
|
throw new Error(`Service workers are not supported.\nMake sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);
|
||||||
navigator.serviceWorker.register('sw.bundle.js');
|
navigator.serviceWorker.register('sw.bundle.js' + window.location.search);
|
||||||
if (!navigator.serviceWorker.controller) {
|
if (!navigator.serviceWorker.controller) {
|
||||||
await new Promise<void>(f => {
|
await new Promise<void>(f => {
|
||||||
navigator.serviceWorker.oncontrollerchange = () => f();
|
navigator.serviceWorker.oncontrollerchange = () => f();
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import { RecorderView } from './ui/recorder/recorderView';
|
||||||
if (window.location.protocol !== 'file:') {
|
if (window.location.protocol !== 'file:') {
|
||||||
if (!navigator.serviceWorker)
|
if (!navigator.serviceWorker)
|
||||||
throw new Error(`Service workers are not supported.\nMake sure to serve the Recorder (${window.location}) via HTTPS or localhost.`);
|
throw new Error(`Service workers are not supported.\nMake sure to serve the Recorder (${window.location}) via HTTPS or localhost.`);
|
||||||
navigator.serviceWorker.register('sw.bundle.js');
|
navigator.serviceWorker.register('sw.bundle.js' + window.location.search);
|
||||||
if (!navigator.serviceWorker.controller) {
|
if (!navigator.serviceWorker.controller) {
|
||||||
await new Promise<void>(f => {
|
await new Promise<void>(f => {
|
||||||
navigator.serviceWorker.oncontrollerchange = () => f();
|
navigator.serviceWorker.oncontrollerchange = () => f();
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,16 @@ export class ZipTraceModelBackend implements TraceModelBackend {
|
||||||
|
|
||||||
constructor(traceURL: string, progress: Progress) {
|
constructor(traceURL: string, progress: Progress) {
|
||||||
this._traceURL = traceURL;
|
this._traceURL = traceURL;
|
||||||
zipjs.configure({ baseURL: self.location.href } as any);
|
|
||||||
|
const baseURL = new URL(self.location.href);
|
||||||
|
if (baseURL.searchParams.has('testServerPort')) {
|
||||||
|
baseURL.pathname = '/trace/';
|
||||||
|
baseURL.port = baseURL.searchParams.get('testServerPort')!;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = new URL(formatUrl(traceURL), baseURL);
|
||||||
this._zipReader = new zipjs.ZipReader(
|
this._zipReader = new zipjs.ZipReader(
|
||||||
new zipjs.HttpReader(formatUrl(traceURL), { mode: 'cors', preventHeadRequest: true } as any),
|
new zipjs.HttpReader(url, { mode: 'cors', preventHeadRequest: true } as any),
|
||||||
{ useWebWorkers: false });
|
{ useWebWorkers: false });
|
||||||
this._entriesPromise = this._zipReader.getEntries({ onprogress: progress }).then(entries => {
|
this._entriesPromise = this._zipReader.getEntries({ onprogress: progress }).then(entries => {
|
||||||
const map = new Map<string, zip.Entry>();
|
const map = new Map<string, zip.Entry>();
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ export const UIModeView: React.FC<{}> = ({
|
||||||
sidebar={<div className='vbox ui-mode-sidebar'>
|
sidebar={<div className='vbox ui-mode-sidebar'>
|
||||||
<Toolbar noShadow={true} noMinHeight={true}>
|
<Toolbar noShadow={true} noMinHeight={true}>
|
||||||
<img src='playwright-logo.svg' alt='Playwright logo' />
|
<img src='playwright-logo.svg' alt='Playwright logo' />
|
||||||
<div className='section-title'>Claywright</div>
|
<div className='section-title'>Playwright</div>
|
||||||
<ToolbarButton icon='refresh' title='Reload' onClick={() => reloadTests()} disabled={isRunningTest || isLoading}></ToolbarButton>
|
<ToolbarButton icon='refresh' title='Reload' onClick={() => reloadTests()} disabled={isRunningTest || isLoading}></ToolbarButton>
|
||||||
<div style={{ position: 'relative' }}>
|
<div style={{ position: 'relative' }}>
|
||||||
<ToolbarButton icon={'terminal'} title={'Toggle output — ' + (isMac ? '⌃`' : 'Ctrl + `')} toggled={isShowingOutput} onClick={() => { setIsShowingOutput(!isShowingOutput); }} />
|
<ToolbarButton icon={'terminal'} title={'Toggle output — ' + (isMac ? '⌃`' : 'Ctrl + `')} toggled={isShowingOutput} onClick={() => { setIsShowingOutput(!isShowingOutput); }} />
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import { UIModeView } from './ui/uiModeView';
|
||||||
await new Promise(f => setTimeout(f, 1000));
|
await new Promise(f => setTimeout(f, 1000));
|
||||||
if (!navigator.serviceWorker)
|
if (!navigator.serviceWorker)
|
||||||
throw new Error(`Service workers are not supported.\nMake sure to serve the website (${window.location}) via HTTPS or localhost.`);
|
throw new Error(`Service workers are not supported.\nMake sure to serve the website (${window.location}) via HTTPS or localhost.`);
|
||||||
navigator.serviceWorker.register('sw.bundle.js');
|
navigator.serviceWorker.register('sw.bundle.js' + window.location.search);
|
||||||
if (!navigator.serviceWorker.controller) {
|
if (!navigator.serviceWorker.controller) {
|
||||||
await new Promise<void>(f => {
|
await new Promise<void>(f => {
|
||||||
navigator.serviceWorker.oncontrollerchange = () => f();
|
navigator.serviceWorker.oncontrollerchange = () => f();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue