mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 724805 - Bug 723126 broke PlacesDBUtils add-ons compatibility.
r=dietrich
This commit is contained in:
parent
fbdf8f5998
commit
ccfb935009
@ -298,7 +298,7 @@ let PlacesDBUtils = {
|
||||
let tasks = new Tasks(aTasks);
|
||||
tasks.log("> Coherence check");
|
||||
|
||||
let stmts = this._getBoundCoherenceStatements();
|
||||
let stmts = PlacesDBUtils._getBoundCoherenceStatements();
|
||||
DBConn.executeAsync(stmts, stmts.length, {
|
||||
handleError: PlacesDBUtils._handleError,
|
||||
handleResult: function () {},
|
||||
@ -1016,6 +1016,22 @@ let PlacesDBUtils = {
|
||||
PlacesDBUtils._executeTasks(tasks);
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs a list of tasks, notifying log messages to the callback.
|
||||
*
|
||||
* @param aTasks
|
||||
* Array of tasks to be executed, in form of pointers to methods in
|
||||
* this module.
|
||||
* @param [optional] aCallback
|
||||
* Callback to be invoked when done. It will receive an array of
|
||||
* log messages. If not specified the log will be printed to the
|
||||
* Error Console.
|
||||
*/
|
||||
runTasks: function PDBU_runTasks(aTasks, aCallback) {
|
||||
let tasks = new Tasks(aTasks);
|
||||
tasks.callback = aCallback;
|
||||
PlacesDBUtils._executeTasks(tasks);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1030,7 +1046,10 @@ function Tasks(aTasks)
|
||||
if (Array.isArray(aTasks)) {
|
||||
this._list = aTasks.slice(0, aTasks.length);
|
||||
}
|
||||
else if (typeof(aTasks) == "object" && aTasks instanceof Tasks) {
|
||||
// This supports passing in a Tasks-like object, with a "list" property,
|
||||
// for compatibility reasons.
|
||||
else if (typeof(aTasks) == "object" &&
|
||||
(Tasks instanceof Tasks || "list" in aTasks)) {
|
||||
this._list = aTasks.list;
|
||||
this._log = aTasks.messages;
|
||||
this.callback = aTasks.callback;
|
||||
|
@ -0,0 +1,46 @@
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* Test preventive maintenance runTasks.
|
||||
*/
|
||||
|
||||
// Include PlacesDBUtils module.
|
||||
Components.utils.import("resource://gre/modules/PlacesDBUtils.jsm");
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
PlacesDBUtils.runTasks([PlacesDBUtils.reindex], function(aLog) {
|
||||
let sections = [];
|
||||
let positives = [];
|
||||
let negatives = [];
|
||||
let infos = [];
|
||||
|
||||
aLog.forEach(function (aMsg) {
|
||||
print (aMsg);
|
||||
switch (aMsg.substr(0, 1)) {
|
||||
case "+":
|
||||
positives.push(aMsg);
|
||||
break;
|
||||
case "-":
|
||||
negatives.push(aMsg);
|
||||
break;
|
||||
case ">":
|
||||
sections.push(aMsg);
|
||||
break;
|
||||
default:
|
||||
infos.push(aMsg);
|
||||
}
|
||||
});
|
||||
|
||||
print("Check that we have run all sections.");
|
||||
do_check_eq(sections.length, 1);
|
||||
print("Check that we have no negatives.");
|
||||
do_check_false(!!negatives.length);
|
||||
print("Check that we have positives.");
|
||||
do_check_true(!!positives.length);
|
||||
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
@ -112,6 +112,7 @@ skip-if = os == "android"
|
||||
# Bug 676989: test hangs consistently on Android
|
||||
skip-if = os == "android"
|
||||
[test_preventive_maintenance_console.js]
|
||||
[test_preventive_maintenance_runTasks.js]
|
||||
[test_removeVisitsByTimeframe.js]
|
||||
# Bug 676989: test hangs consistently on Android
|
||||
skip-if = os == "android"
|
||||
|
Loading…
Reference in New Issue
Block a user