From 62733a20d726f2687e00fc42f3051e7767051755 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Fri, 14 Jun 2019 01:05:09 -0700 Subject: [PATCH] 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 --- lib/WebSocketTransport.js | 5 ++++- test/evaluation.spec.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/WebSocketTransport.js b/lib/WebSocketTransport.js index 492beb62..7bf5a0a9 100644 --- a/lib/WebSocketTransport.js +++ b/lib/WebSocketTransport.js @@ -25,7 +25,10 @@ class WebSocketTransport { */ static create(url) { 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('error', reject); }); diff --git a/test/evaluation.spec.js b/test/evaluation.spec.js index 23b3b18f..ee3988dc 100644 --- a/test/evaluation.spec.js +++ b/test/evaluation.spec.js @@ -247,6 +247,10 @@ module.exports.addTests = function({testRunner, expect}) { }); 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() {