fix(core): update
This commit is contained in:
@ -5,9 +5,7 @@ export class IncognitoBrowser {
|
||||
public status: 'started' | 'stopped' = 'stopped';
|
||||
public browser: plugins.puppeteer.Browser;
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* starts the IncognitoBrowser
|
||||
@ -15,14 +13,14 @@ export class IncognitoBrowser {
|
||||
public async start() {
|
||||
this.status = 'started';
|
||||
this.browser = await getEnvAwareBrowserInstance();
|
||||
this.browser.addListener('disconnected', async eventArg => {
|
||||
this.browser.addListener('disconnected', async (eventArg) => {
|
||||
try {
|
||||
this.browser.removeAllListeners();
|
||||
} catch(err) {}
|
||||
} catch (err) {}
|
||||
if (this.status === 'started') {
|
||||
this.browser = await getEnvAwareBrowserInstance();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,4 +37,4 @@ export class IncognitoBrowser {
|
||||
throw new Error('you need to start the IncognitoBrowser instance first');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,13 @@ export const getEnvAwareBrowserInstance = async (
|
||||
const smartenv = new plugins.smartenv.Smartenv();
|
||||
const options: IEnvAwareOptions = {
|
||||
...{
|
||||
forceNoSandbox: false
|
||||
forceNoSandbox: false,
|
||||
},
|
||||
...optionsArg
|
||||
...optionsArg,
|
||||
};
|
||||
|
||||
let chromeArgs: string[] = [];
|
||||
if ((process.env.CI || options.forceNoSandbox || plugins.os.userInfo().username === 'root')) {
|
||||
if (process.env.CI || options.forceNoSandbox || plugins.os.userInfo().username === 'root') {
|
||||
chromeArgs = chromeArgs.concat(['--no-sandbox', '--disable-setuid-sandbox']);
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ export const getEnvAwareBrowserInstance = async (
|
||||
console.log('launching puppeteer bundled chrome with arguments:');
|
||||
console.log(chromeArgs);
|
||||
headlessBrowser = await plugins.puppeteer.launch({
|
||||
args: chromeArgs
|
||||
args: chromeArgs,
|
||||
});
|
||||
|
||||
return headlessBrowser;
|
||||
|
@ -1,9 +1,7 @@
|
||||
// node native scope
|
||||
import * as os from 'os';
|
||||
|
||||
export {
|
||||
os
|
||||
};
|
||||
export { os };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
|
Reference in New Issue
Block a user