summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/search')
-rw-r--r--toolkit/components/search/current/nsSearchService.js6
-rw-r--r--toolkit/components/search/moz.build6
-rw-r--r--toolkit/components/search/orginal/nsSearchService.js20
3 files changed, 22 insertions, 10 deletions
diff --git a/toolkit/components/search/current/nsSearchService.js b/toolkit/components/search/current/nsSearchService.js
index 9f9003516..99e73b50b 100644
--- a/toolkit/components/search/current/nsSearchService.js
+++ b/toolkit/components/search/current/nsSearchService.js
@@ -21,8 +21,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
- "resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SearchStaticData",
"resource://gre/modules/SearchStaticData.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
@@ -3873,21 +3871,17 @@ SearchService.prototype = {
LOG("SearchService.init");
let self = this;
if (!this._initStarted) {
- TelemetryStopwatch.start("SEARCH_SERVICE_INIT_MS");
this._initStarted = true;
Task.spawn(function* task() {
try {
// Complete initialization by calling asynchronous initializer.
yield self._asyncInit();
- TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS");
} catch (ex) {
if (ex.result == Cr.NS_ERROR_ALREADY_INITIALIZED) {
// No need to pursue asynchronous because synchronous fallback was
// called and has finished.
- TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS");
} else {
self._initObservers.reject(ex);
- TelemetryStopwatch.cancel("SEARCH_SERVICE_INIT_MS");
}
}
});
diff --git a/toolkit/components/search/moz.build b/toolkit/components/search/moz.build
index 4cc86ff9e..2accffd00 100644
--- a/toolkit/components/search/moz.build
+++ b/toolkit/components/search/moz.build
@@ -6,10 +6,10 @@
XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
-if CONFIG['MC_PALEMOON']:
- DIRS += ['orginal']
-else:
+if CONFIG['MC_BASILISK'] or CONFIG['HYPE_ICEWEASEL'] or CONFIG['HYPE_ICEDOVE']:
DIRS += ['current']
+else:
+ DIRS += ['orginal']
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Search')
diff --git a/toolkit/components/search/orginal/nsSearchService.js b/toolkit/components/search/orginal/nsSearchService.js
index 56d378b39..8d81e1a27 100644
--- a/toolkit/components/search/orginal/nsSearchService.js
+++ b/toolkit/components/search/orginal/nsSearchService.js
@@ -2237,7 +2237,10 @@ Engine.prototype = {
get lazySerializeTask() {
if (!this._lazySerializeTask) {
let task = function taskCallback() {
- this._serializeToFile();
+ // This check should be done by caller, but it is better to be safe than sorry.
+ if (!this._readOnly && this._file) {
+ this._serializeToFile();
+ }
}.bind(this);
this._lazySerializeTask = new DeferredTask(task, LAZY_SERIALIZE_DELAY);
}
@@ -2245,6 +2248,17 @@ Engine.prototype = {
return this._lazySerializeTask;
},
+ // This API is required by some search engine management extensions, so let's restore it.
+ // Old API was using a timer to do its work, but this can lead us too far. If extension is
+ // rely on such subtle internal details, that extension should be fixed, not browser.
+ _lazySerializeToFile: function SRCH_ENG_lazySerializeToFile() {
+ // This check should be done by caller, but it is better to be safe than sorry.
+ // Besides, we don't have to create a task for r/o or non-file engines.
+ if (!this._readOnly && this._file) {
+ this.lazySerializeTask.arm();
+ }
+ },
+
/**
* Serializes the engine object to file.
*/
@@ -3058,6 +3072,10 @@ SearchService.prototype = {
continue;
}
+ // Write out serialized search engine files when rebuilding cache.
+ // Do it lazily, to: 1) reuse existing API; 2) make browser interface more responsive
+ engine._lazySerializeToFile();
+
let cacheKey = parent.path;
if (!cache.directories[cacheKey]) {
let cacheEntry = {};