Skip to content

Commit ecfafae

Browse files
Remove --no-sandbox and disable sandbox all the time
1 parent 5beeb82 commit ecfafae

File tree

7 files changed

+6
-36
lines changed

7 files changed

+6
-36
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ COPY ./package*.json ./
3232

3333
RUN npm install
3434

35-
# never use the "--no-sandbox" outside of a container!
36-
ENTRYPOINT ["node", "./browser-ui-test-src/index.js", "--no-sandbox"]
35+
ENTRYPOINT ["node", "./browser-ui-test-src/index.js"]
3736
# to be able to pass arguments to index.js
3837
CMD []

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"browser-ui-test": "src/index.js"
1616
},
1717
"scripts": {
18-
"test": "node src/index.js --test-folder tests/full-check/ --failure-folder failures --variable DOC_PATH tests/html_files --no-sandbox",
18+
"test": "node src/index.js --test-folder tests/full-check/ --failure-folder failures --variable DOC_PATH tests/html_files",
1919
"all-test": "node tools/all.js",
2020
"api-test": "node tools/api.js",
2121
"ui-test": "node tools/ui.js",

src/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,7 @@ async function runTests(extras = null) {
782782
}
783783

784784
process.on('browser-ui-test-puppeter-failure', () => {
785-
console.error('ERROR: puppeteer failed when trying to create a new page. Please try again with \
786-
`--no-sandbox`');
785+
console.error('ERROR: puppeteer failed when trying to create a new page.');
787786
process.exit(1);
788787
});
789788

src/options.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ function helper() {
3333
print(' --incognito : Enable incognito mode');
3434
print(' --jobs [N] : Number of parallel jobs, defaults to number of CPUs');
3535
print(' --no-headless : Disable headless mode');
36-
print(' --no-sandbox : Disable the sandbox (use with caution!)');
3736
print(' --pause-on-error [true|false] : Pause execution script until user press ENTER');
3837
print(' --permission [PERMISSION] : Add a permission to enable');
3938
print(' --run-id [id] : Id to be used for failed images extension (\'test\'');
@@ -92,7 +91,6 @@ class Options {
9291
this.showText = false;
9392
this.debug = false;
9493
this.screenshotComparison = false;
95-
this.noSandbox = false;
9694
this.allowFileAccessFromFiles = false;
9795
this.testFiles = [];
9896
this.variables = Object.create(null);
@@ -125,7 +123,6 @@ class Options {
125123
copy.showText = this.showText;
126124
copy.debug = this.debug;
127125
copy.screenshotComparison = this.screenshotComparison;
128-
copy.noSandbox = this.noSandbox;
129126
copy.allowFileAccessFromFiles = this.allowFileAccessFromFiles;
130127
copy.testFiles = JSON.parse(JSON.stringify(this.testFiles));
131128
copy.variables = JSON.parse(JSON.stringify(this.variables));
@@ -194,8 +191,6 @@ class Options {
194191
this.debug = true;
195192
} else if (args[it] === '--enable-screenshot-comparison') {
196193
this.screenshotComparison = true;
197-
} else if (args[it] === '--no-sandbox') {
198-
this.noSandbox = true;
199194
} else if (args[it] === '--allow-file-access-from-files') {
200195
this.allowFileAccessFromFiles = true;
201196
} else if (args[it] === '--incognito') {
@@ -386,7 +381,6 @@ class Options {
386381
validateField('onPageCreatedCallback', 'function');
387382
validateField('failOnJsError', 'boolean');
388383
validateField('failOnRequestError', 'boolean');
389-
validateField('noSandbox', 'boolean');
390384
validateField('allowFileAccessFromFiles', 'boolean');
391385
validateField('screenshotOnFailure', 'boolean');
392386
validateField('nbThreads', 'number');

src/puppeteer-wrapper.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ function buildPuppeteerOptions(options) {
1212
for (let i = 0; i < options.extensions.length; ++i) {
1313
puppeteer_options['args'].push(`--load-extension=${options.extensions[i]}`);
1414
}
15-
if (options.noSandbox === true) {
16-
// Highly unsafe! Only use it when you know what you're doing!
17-
puppeteer_options['args'].push('--no-sandbox');
18-
}
15+
puppeteer_options['args'].push('--no-sandbox');
1916
if (options.allowFileAccessFromFiles === true) {
2017
puppeteer_options['args'].push('--allow-file-access-from-files');
2118
}

tools/exported_items.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,14 @@ const {Assert, plural, print, removeFolder} = require('./utils.js');
99

1010
async function wrapRunTests(options = new Options()) {
1111
options.screenshotComparison = false;
12-
options.noSandbox = true;
1312
return await runTests({'options': options, 'showLogs': false});
1413
}
1514
async function wrapRunTest(testPath, options = new Options()) {
1615
options.screenshotComparison = false;
17-
options.noSandbox = true;
1816
return await runTest(testPath, {'options': options, 'showLogs': false});
1917
}
2018
async function wrapRunTestCode(testName, content, options = new Options()) {
2119
options.screenshotComparison = false;
22-
options.noSandbox = true;
2320
return await runTestCode(testName, content, {'options': options, 'showLogs': false});
2421
}
2522

@@ -305,9 +302,6 @@ async function checkOptions(x) {
305302
await x.assert(options.screenshotComparison, false);
306303
await x.assertTry(() => options.parseArguments(['--enable-screenshot-comparison']), [], true);
307304
await x.assert(options.screenshotComparison, true);
308-
await x.assert(options.noSandbox, false);
309-
await x.assertTry(() => options.parseArguments(['--no-sandbox']), [], true);
310-
await x.assert(options.noSandbox, true);
311305
await x.assert(options.incognito, false);
312306
await x.assertTry(() => options.parseArguments(['--incognito']), [], true);
313307
await x.assert(options.incognito, true);
@@ -451,11 +445,6 @@ async function checkOptions(x) {
451445
await x.assertTry(() => options.validateFields(), [],
452446
'`Options.failOnJsError` field is supposed to be a boolean! (Type is string)');
453447

454-
options = new Options();
455-
options.noSandbox = '';
456-
await x.assertTry(() => options.validateFields(), [],
457-
'`Options.noSandbox` field is supposed to be a boolean! (Type is string)');
458-
459448
options = new Options();
460449
options.failOnRequestError = '';
461450
await x.assertTry(() => options.validateFields(), [],

tools/ui.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ utils.print = function print() {}; // overwriting the print function to avoid th
99
const {runTests, Options} = require('../src/index.js');
1010
const {Assert, plural, print} = require('./utils.js');
1111

12-
async function wrapRunTests(noSandbox, browser, options = new Options()) {
12+
async function wrapRunTests(browser, options = new Options()) {
1313
options.screenshotComparison = false;
14-
options.noSandbox = noSandbox;
1514
const ret = await runTests({
1615
'options': options,
1716
'browser': browser,
@@ -32,7 +31,7 @@ function runAsyncUiTest(x, file, output, tests_queue, browser) {
3231

3332
const callback = x.assertTryUi(
3433
wrapRunTests,
35-
[x.noSandboxEnabled, browser, options],
34+
[browser, options],
3635
output.replaceAll('$CURRENT_DIR', utils.getCurrentDir()),
3736
file,
3837
false,
@@ -75,7 +74,6 @@ async function compareOutput(x) {
7574
process.setMaxListeners(cpuCount);
7675
const tests_queue = [];
7776
const options = new Options();
78-
options.noSandbox = x.noSandboxEnabled;
7977
const browser = await utils.loadPuppeteer(options);
8078

8179
for (const file of filesToTest) {
@@ -149,19 +147,13 @@ if (require.main === module) {
149147
for (const arg of process.argv.slice(2)) {
150148
if (arg === '--bless') {
151149
x.blessEnabled = true;
152-
} else if (arg === '--no-sandbox') {
153-
x.noSandboxEnabled = true;
154150
} else {
155151
x.extraArgs.push(arg);
156152
}
157153
}
158154
if (!x.blessEnabled) {
159155
x.blessEnabled = process.env.npm_config_bless === 'true';
160156
}
161-
if (!x.noSandboxEnabled) {
162-
// The value is `true` if it's enabled.
163-
x.noSandboxEnabled = process.env.npm_config_sandbox === '';
164-
}
165157
checkUi(x).then(nbErrors => {
166158
process.exit(nbErrors !== 0 ? 1 : 0);
167159
});

0 commit comments

Comments
 (0)