Fix some problems related to dynamic enabling/disabling of form autocomplete: make autocomplete ignore all key navigation if the input is disabled, also, instead of trying to keep autocomplete state in sync on every browser instance, just set the disabled state on the global form fill controller. Bug 249610, r=blake.

This commit is contained in:
bryner@brianryner.com 2007-08-21 21:59:32 -07:00
parent fc6fe23a64
commit 124b58877d

View File

@ -809,12 +809,6 @@
b.setAttribute("tooltip", this.getAttribute("contenttooltip")); b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup")); b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
// To avoid unnecessary string compares on pageload in <browser>, only set the
// autocomplete attribute if autocomplete is actually enabled, so we can
// just test with |hasAttribute| in <browser>'s load handler.
if (this.getAttribute("autocompleteenabled") == "true")
b.setAttribute("autocompleteenabled", "true");
this.mPanelContainer.appendChild(b); this.mPanelContainer.appendChild(b);
b.addEventListener("DOMTitleChanged", this.onTitleChanged, false); b.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
@ -1268,9 +1262,6 @@
var browsers = this.mPanelContainer.childNodes; var browsers = this.mPanelContainer.childNodes;
for (var i = 0; i < browsers.length; ++i) { for (var i = 0; i < browsers.length; ++i) {
var cb = browsers[i]; var cb = browsers[i];
// We can do stuff like this here because we aren't called on every
// page load, like <browser>'s |attachFormFill| method is.
cb.setAttribute("autocompleteenabled", "true");
cb.attachFormFill(); cb.attachFormFill();
} }
]]></body> ]]></body>
@ -1281,7 +1272,6 @@
var browsers = this.mPanelContainer.childNodes; var browsers = this.mPanelContainer.childNodes;
for (var i = 0; i < browsers.length; ++i) { for (var i = 0; i < browsers.length; ++i) {
var cb = browsers[i]; var cb = browsers[i];
cb.removeAttribute("autocompleteenabled");
cb.detachFormFill(); cb.detachFormFill();
} }
]]></body> ]]></body>