开发者

Firefox does not remembers data entered into text box which was generatd by my firefox extension

My Firefox extension dynamically adds a username/password fields into every page. The problem 开发者_运维知识库is it does not remember what I enter as it normally do. Why this is happening?


Looking at nsLoginManager.js, forms are normally filled when the DOMContentLoaded event fires (see _fillDocument() call). From what I understand, you insert your elements after that event is already processed so that their values are no longer restored. You could call nsILoginManager.fillForm() explicitly however to restore field values after you changed the form:

Components.classes["@mozilla.org/login-manager;1"]
          .getService(Components.interfaces.nsILoginManager)
          .fillForm(form);

This should be sufficient, from the code it seems that having an id attribute isn't necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜