diff --git a/src/document.js b/src/document.js index d9bf52d6f..7c39c5bf2 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/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) { 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}`); } } 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');