open-consul/ui-v2/app/components/auth-form/index.js
John Cowen 85540ca829 ui: Blink/Webkit input[type=password] workaround (#7929)
It seems that blink/webkit browsers at least will leak memory when using
input[type=password] inputs. This only affects us during testing as we
'refresh' the ember app ~1000 times without actually refreshing
the browser. This means references to these HTML input elements mount
up now that every single page/test has an input[password] on it.

Following this change our memory usage during testing seems to have
reduced by as much as 75%.

During normal usage the single password element is only added to the
page once per login/logout.
2020-06-03 16:46:43 +00:00

30 lines
792 B
JavaScript

import Component from '@ember/component';
import { computed } from '@ember/object';
import Ember from 'ember';
import chart from './chart.xstate';
export default Component.extend({
tagName: '',
onsubmit: function(e) {},
onchange: function(e) {},
// Blink/Webkit based seem to leak password inputs
// this will only occur during acceptance testing so
// turn them into text inputs during acceptance testing
inputType: computed(function() {
return Ember.testing ? 'text' : 'password';
}),
init: function() {
this._super(...arguments);
this.chart = chart;
},
actions: {
hasValue: function(context, event, meta) {
return this.value !== '' && typeof this.value !== 'undefined';
},
focus: function() {
this.input.focus();
},
},
});