mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 566746 - Create new module FormHistory.jsm with handles asynchronous form history, p=enndeakin,felix, r=mak
This commit is contained in:
parent
639d557288
commit
64c9ed95b4
@ -445,6 +445,7 @@
|
||||
@BINPATH@/components/satchel.manifest
|
||||
@BINPATH@/components/nsFormAutoComplete.js
|
||||
@BINPATH@/components/nsFormHistory.js
|
||||
@BINPATH@/components/FormHistoryStartup.js
|
||||
@BINPATH@/components/nsInputListAutoComplete.js
|
||||
@BINPATH@/components/contentSecurityPolicy.manifest
|
||||
@BINPATH@/components/contentSecurityPolicy.js
|
||||
|
@ -432,6 +432,7 @@
|
||||
@BINPATH@/components/satchel.manifest
|
||||
@BINPATH@/components/nsFormAutoComplete.js
|
||||
@BINPATH@/components/nsFormHistory.js
|
||||
@BINPATH@/components/FormHistoryStartup.js
|
||||
@BINPATH@/components/nsInputListAutoComplete.js
|
||||
@BINPATH@/components/contentSecurityPolicy.manifest
|
||||
@BINPATH@/components/contentSecurityPolicy.js
|
||||
|
@ -343,6 +343,7 @@
|
||||
@BINPATH@/components/satchel.manifest
|
||||
@BINPATH@/components/nsFormAutoComplete.js
|
||||
@BINPATH@/components/nsFormHistory.js
|
||||
@BINPATH@/components/FormHistoryStartup.js
|
||||
@BINPATH@/components/nsInputListAutoComplete.js
|
||||
@BINPATH@/components/contentSecurityPolicy.manifest
|
||||
@BINPATH@/components/contentSecurityPolicy.js
|
||||
|
1044
toolkit/components/satchel/FormHistory.jsm
Normal file
1044
toolkit/components/satchel/FormHistory.jsm
Normal file
File diff suppressed because it is too large
Load Diff
78
toolkit/components/satchel/FormHistoryStartup.js
Normal file
78
toolkit/components/satchel/FormHistoryStartup.js
Normal file
@ -0,0 +1,78 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
|
||||
"resource://gre/modules/FormHistory.jsm");
|
||||
|
||||
function FormHistoryStartup() { }
|
||||
|
||||
FormHistoryStartup.prototype = {
|
||||
classID: Components.ID("{3A0012EB-007F-4BB8-AA81-A07385F77A25}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIFrameMessageListener
|
||||
]),
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "nsPref:changed":
|
||||
FormHistory.updatePrefs();
|
||||
break;
|
||||
case "idle-daily":
|
||||
case "formhistory-expire-now":
|
||||
FormHistory.expireOldEntries();
|
||||
break;
|
||||
case "profile-before-change":
|
||||
FormHistory.shutdown();
|
||||
break;
|
||||
case "profile-after-change":
|
||||
this.init();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
inited: false,
|
||||
|
||||
init: function()
|
||||
{
|
||||
if (this.inited)
|
||||
return;
|
||||
this.inited = true;
|
||||
|
||||
Services.prefs.addObserver("browser.formfill.", this, true);
|
||||
|
||||
// triggers needed service cleanup and db shutdown
|
||||
Services.obs.addObserver(this, "profile-before-change", true);
|
||||
Services.obs.addObserver(this, "formhistory-expire-now", true);
|
||||
|
||||
let messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
messageManager.loadFrameScript("chrome://satchel/content/formSubmitListener.js", true);
|
||||
messageManager.addMessageListener("FormHistory:FormSubmitEntries", this);
|
||||
},
|
||||
|
||||
receiveMessage: function(message) {
|
||||
let entries = message.json;
|
||||
let changes = entries.map(function(entry) {
|
||||
return {
|
||||
op : "bump",
|
||||
fieldname : entry.name,
|
||||
value : entry.value,
|
||||
}
|
||||
});
|
||||
|
||||
FormHistory.update(changes);
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FormHistoryStartup]);
|
@ -25,6 +25,7 @@ CPPSRCS = \
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
nsFormAutoComplete.js \
|
||||
FormHistoryStartup.js \
|
||||
nsInputListAutoComplete.js \
|
||||
satchel.manifest \
|
||||
$(NULL)
|
||||
@ -34,6 +35,7 @@ EXTRA_PP_COMPONENTS = \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_JS_MODULES = \
|
||||
FormHistory.jsm \
|
||||
nsFormAutoCompleteResult.jsm \
|
||||
$(NULL)
|
||||
|
||||
|
@ -4,3 +4,7 @@ component {c11c21b2-71c9-4f87-a0f8-5e13f50495fd} nsFormAutoComplete.js
|
||||
contract @mozilla.org/satchel/form-autocomplete;1 {c11c21b2-71c9-4f87-a0f8-5e13f50495fd}
|
||||
component {bf1e01d0-953e-11df-981c-0800200c9a66} nsInputListAutoComplete.js
|
||||
contract @mozilla.org/satchel/inputlist-autocomplete;1 {bf1e01d0-953e-11df-981c-0800200c9a66}
|
||||
component {3a0012eb-007f-4bb8-aa81-a07385f77a25} FormHistoryStartup.js
|
||||
contract @mozilla.org/satchel/form-history-startup;1 {3a0012eb-007f-4bb8-aa81-a07385f77a25}
|
||||
category profile-after-change formHistoryStartup @mozilla.org/satchel/form-history-startup;1
|
||||
category idle-daily formHistoryStartup @mozilla.org/satchel/form-history-startup;1
|
||||
|
Loading…
Reference in New Issue
Block a user