From 283a7f2f695572e353030ea2539b570727709cd6 Mon Sep 17 00:00:00 2001 From: Arturo GARCIA-VARGAS Date: Thu, 8 Aug 2019 19:23:48 +0100 Subject: [PATCH 1/3] Fix button.type = 'submit' and support button.type = 'reset' - Fix #1190 --- src/dom/forms.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dom/forms.js b/src/dom/forms.js index 3108a85e8..b2c75dfc9 100644 --- a/src/dom/forms.js +++ b/src/dom/forms.js @@ -244,9 +244,19 @@ DOM.HTMLButtonElement.prototype._click = function(event) { if (button.getAttribute('disabled')) return false; + const buttonType = button.getAttribute('type'); + if (buttonType === 'button') + return; + const form = button.form; - if (form) + if (form) { + if (buttonType === 'reset') { + input.form.reset(); + return; + } + return form._dispatchSubmitEvent(button); + } }; DOM.HTMLInputElement.prototype._click = function(event) { From 812b1864293d14530fc7568bbc31b8a7e05f3bad Mon Sep 17 00:00:00 2001 From: Arturo GARCIA-VARGAS Date: Thu, 26 Sep 2019 15:04:42 +0100 Subject: [PATCH 2/3] Remove nodejs-12 "new Buffer" deprecations --- src/document.js | 4 ++-- src/fetch.js | 2 +- src/pipeline.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/document.js b/src/document.js index 523b915db..d668a37be 100644 --- a/src/document.js +++ b/src/document.js @@ -166,8 +166,8 @@ function setupWindow(window, args) { window.FormData = Fetch.FormData; // Base-64 encoding/decoding - window.atob = (string)=> new Buffer(string, 'base64').toString('binary'); - window.btoa = (string)=> new Buffer(string, 'binary').toString('base64'); + window.atob = (string)=> Buffer.from(string, 'base64').toString('binary'); + window.btoa = (string)=> Buffer.from(string, 'binary').toString('base64'); // Constructor for XHLHttpRequest window.XMLHttpRequest = XMLHttpRequest.bind(null, window); diff --git a/src/fetch.js b/src/fetch.js index 75849f1cd..2858e451b 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -294,7 +294,7 @@ class Body { return null; // When Response has no body, we get stream that's no longer readable if (!this._stream.readable) - return new Buffer(''); + return Buffer.from(''); const decompressed = decompressStream(this._stream, this.headers); diff --git a/src/pipeline.js b/src/pipeline.js index bfd076411..c8a669391 100644 --- a/src/pipeline.js +++ b/src/pipeline.js @@ -173,7 +173,7 @@ class Pipeline extends Array { const { username, password } = authenticate; if (username && password) { browser.log(`Authenticating as ${username}:${password}`); - const base64 = new Buffer(`${username}:${password}`).toString('base64'); + const base64 = Buffer.from(`${username}:${password}`).toString('base64'); request.headers.set('authorization', `Basic ${base64}`); } } From dec42a2966ae75e589d3f4ce6caf53671b3bbada Mon Sep 17 00:00:00 2001 From: Arturo GARCIA-VARGAS Date: Sun, 16 Feb 2020 15:37:06 +0000 Subject: [PATCH 3/3] Fix minor issue with test websocket tests --- test/websocket_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/websocket_test.js b/test/websocket_test.js index fed49393f..32a19bd9f 100644 --- a/test/websocket_test.js +++ b/test/websocket_test.js @@ -65,7 +65,7 @@ describe('WebSockets', function() { }); it('should be possible', function() { - browser.assert.text('#ws-url', 'ws://example.com:3004'); + browser.assert.text('#ws-url', 'ws://example.com:3004/'); }); it('should raise open event after connecting', function() { assert.equal(prompts[0], 'open');