fix(pipe): handle 'error' events on pipes to avoid crashing (#4705)

Fix #4374
This commit is contained in:
Andrey Lushnikov 2019-07-15 17:53:27 -07:00 committed by GitHub
parent c9977c8004
commit f8616ed54b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const {helper} = require('./helper');
const {helper, debugError} = require('./helper');
/**
* @implements {!Puppeteer.ConnectionTransport}
@ -31,7 +31,9 @@ class PipeTransport {
helper.addEventListener(pipeRead, 'close', () => {
if (this.onclose)
this.onclose.call(null);
})
}),
helper.addEventListener(pipeRead, 'error', debugError),
helper.addEventListener(pipeWrite, 'error', debugError),
];
this.onmessage = null;
this.onclose = null;