fix(connection): bump websocket max received message size to 256Mb (#4571)

This is the max message size that DevTools can emit over the DevTools
protocol: https://cs.chromium.org/chromium/src/content/browser/devtools/devtools_http_handler.cc?type=cs&q=kSendBufferSizeForDevTools&sq=package:chromium&g=0&l=83

Test is failing on firefox since Firefox crashes when allocating 100Mb string.

Fix #4543
This commit is contained in:
Andrey Lushnikov 2019-06-14 01:05:09 -07:00 committed by GitHub
parent 5087962682
commit 62733a20d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -25,7 +25,10 @@ class WebSocketTransport {
*/ */
static create(url) { static create(url) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const ws = new WebSocket(url, [], { perMessageDeflate: false }); const ws = new WebSocket(url, [], {
perMessageDeflate: false,
maxPayload: 256 * 1024 * 1024, // 256Mb
});
ws.addEventListener('open', () => resolve(new WebSocketTransport(ws))); ws.addEventListener('open', () => resolve(new WebSocketTransport(ws)));
ws.addEventListener('error', reject); ws.addEventListener('error', reject);
}); });

View File

@ -247,6 +247,10 @@ module.exports.addTests = function({testRunner, expect}) {
}); });
expect(result).toEqual([42]); expect(result).toEqual([42]);
}); });
it_fails_ffox('should transfer 100Mb of data from page to node.js', async({page, server}) => {
const a = await page.evaluate(() => Array(100 * 1024 * 1024 + 1).join('a'));
expect(a.length).toBe(100 * 1024 * 1024);
});
}); });
describe('Page.evaluateOnNewDocument', function() { describe('Page.evaluateOnNewDocument', function() {