Merge central to inbound

This commit is contained in:
Marco Bonardo 2012-03-10 11:25:12 +01:00
commit a7e65ba6b6
5 changed files with 86 additions and 35 deletions

View File

@ -144,12 +144,12 @@ nsSVGFE::SetupScalingFilter(nsSVGFilterInstance *aInstance,
return result;
}
float kernelX = aInstance->GetPrimitiveNumber(nsSVGUtils::X,
aKernelUnitLength,
nsSVGNumberPair::eFirst);
float kernelY = aInstance->GetPrimitiveNumber(nsSVGUtils::Y,
aKernelUnitLength,
nsSVGNumberPair::eSecond);
gfxFloat kernelX = aInstance->GetPrimitiveNumber(nsSVGUtils::X,
aKernelUnitLength,
nsSVGNumberPair::eFirst);
gfxFloat kernelY = aInstance->GetPrimitiveNumber(nsSVGUtils::Y,
aKernelUnitLength,
nsSVGNumberPair::eSecond);
if (kernelX <= 0 || kernelY <= 0)
return result;

View File

@ -295,6 +295,16 @@ ServerCollection.prototype = {
return this.insertWBO(new ServerWBO(id, payload, modified));
},
/**
* Removes an object entirely from the collection.
*
* @param id
* (string) ID to remove.
*/
remove: function remove(id) {
delete this._wbos[id];
},
_inResultSet: function(wbo, options) {
return wbo.payload
&& (!options.ids || (options.ids.indexOf(wbo.id) != -1))
@ -544,7 +554,15 @@ function track_collections_helper() {
*/
let SyncServerCallback = {
onCollectionDeleted: function onCollectionDeleted(user, collection) {},
onItemDeleted: function onItemDeleted(user, collection, wboID) {}
onItemDeleted: function onItemDeleted(user, collection, wboID) {},
/**
* Called at the top of every request.
*
* Allows the test to inspect the request. Hooks should be careful not to
* modify or change state of the request or they may impact future processing.
*/
onRequest: function onRequest(request) {},
};
/**
@ -822,6 +840,11 @@ SyncServer.prototype = {
_handleDefault: function _handleDefault(handler, req, resp) {
this._log.debug("SyncServer: Handling request: " + req.method + " " + req.path);
if (this.callback.onRequest) {
this.callback.onRequest(req);
}
let parts = this.pathRE.exec(req.path);
if (!parts) {
this._log.debug("SyncServer: Unexpected request: bad URL " + req.path);

View File

@ -124,7 +124,6 @@ function setUp() {
Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
return generateAndUploadKeys();
}
@ -1601,27 +1600,35 @@ add_test(function test_sync_engine_generic_fail() {
let log = Log4Moz.repository.getLogger("Sync.ErrorHandler");
Svc.Prefs.set("log.appender.file.logOnError", true);
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {
Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog);
do_check_eq(Status.engines["catapult"], undefined);
// Put these checks here, not after sync(), so that we aren't racing the
// log handler... which resets everything just a few lines below!
_("Status.engines: " + JSON.stringify(Status.engines));
do_check_eq(Status.engines["catapult"], ENGINE_UNKNOWN_FAIL);
do_check_eq(Status.service, SYNC_FAILED_PARTIAL);
// Don't wait for reset-file-log until the sync is underway.
// This avoids us catching a delayed notification from an earlier test.
Svc.Obs.add("weave:engine:sync:finish", function onEngineFinish() {
Svc.Obs.remove("weave:engine:sync:finish", onEngineFinish);
// Test Error log was written on SYNC_FAILED_PARTIAL.
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
do_check_eq(logfile.leafName.slice(0, LOG_PREFIX_ERROR.length),
LOG_PREFIX_ERROR);
log.info("Adding reset-file-log observer.");
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {
Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog);
clean();
server.stop(run_next_test);
// Put these checks here, not after sync(), so that we aren't racing the
// log handler... which resets everything just a few lines below!
_("Status.engines: " + JSON.stringify(Status.engines));
do_check_eq(Status.engines["catapult"], ENGINE_UNKNOWN_FAIL);
do_check_eq(Status.service, SYNC_FAILED_PARTIAL);
// Test Error log was written on SYNC_FAILED_PARTIAL.
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
do_check_eq(logfile.leafName.slice(0, LOG_PREFIX_ERROR.length),
LOG_PREFIX_ERROR);
clean();
server.stop(run_next_test);
});
});
do_check_eq(Status.engines["catapult"], undefined);
do_check_true(setUp());
Service.sync();
});

View File

@ -67,9 +67,11 @@ function server_report(request, response) {
}
// Hook for test code.
let hooks = {
onGET: function onGET(request) {}
let hooks = {};
function initHooks() {
hooks.onGET = function onGET(request) {};
}
initHooks();
function ServerChannel() {
this.data = "";
@ -271,11 +273,19 @@ add_test(function test_firstMsgMaxTries() {
// For the purpose of the tests, the poll interval is 50ms and
// we're polling up to 5 times for the first exchange (as
// opposed to 2 times for most of the other exchanges). So let's
// pretend it took 150ms to enter the PIN on the sender.
_("Received PIN " + pin + ". Waiting 150ms before entering it into sender...");
// pretend it took 150ms to enter the PIN on the sender, which should
// require 3 polls.
// Rather than using an imprecise timer, we hook into the channel's
// GET handler to know how long to wait.
_("Received PIN " + pin + ". Waiting for three polls before entering it into sender...");
this.cid = pin.slice(JPAKE_LENGTH_SECRET);
Utils.namedTimer(function() { snd.pairWithPIN(pin, false); },
150, this, "_sendTimer");
let count = 0;
hooks.onGET = function onGET(request) {
if (++count == 3) {
_("Third GET. Triggering pair.");
Utils.nextTick(function() { snd.pairWithPIN(pin, false); });
}
};
},
onPairingStart: function onPairingStart(pin) {},
onComplete: function onComplete(data) {
@ -283,12 +293,15 @@ add_test(function test_firstMsgMaxTries() {
// Ensure channel was cleared, no error report.
do_check_eq(channels[this.cid].data, undefined);
do_check_eq(error_report, undefined);
// Clean up.
initHooks();
run_next_test();
}
});
rec.receiveNoPIN();
});
add_test(function test_lastMsgMaxTries() {
_("Test that receiver can wait longer for the last message.");
@ -329,7 +342,7 @@ add_test(function test_lastMsgMaxTries() {
do_check_eq(error_report, undefined);
// Clean up.
hooks.onGET = function onGET(request) {};
initHooks();
run_next_test();
}
});
@ -420,14 +433,22 @@ add_test(function test_abort_sender() {
// Ensure channel was cleared, no error report.
do_check_eq(channels[this.cid].data, undefined);
do_check_eq(error_report, undefined);
initHooks();
run_next_test();
},
displayPIN: function displayPIN(pin) {
_("Received PIN " + pin + ". Entering it in the other computer...");
this.cid = pin.slice(JPAKE_LENGTH_SECRET);
Utils.nextTick(function() { snd.pairWithPIN(pin, false); });
Utils.namedTimer(function() { snd.abort(); },
POLLINTERVAL, this, "_abortTimer");
// Abort after the first poll.
let count = 0;
hooks.onGET = function onGET(request) {
if (++count >= 1) {
_("First GET. Aborting.");
Utils.nextTick(function() { snd.abort(); });
}
};
},
onPairingStart: function onPairingStart(pin) {}
});

View File

@ -3,7 +3,7 @@
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY resetProfile.dialog.title "Reset &brandShortName;">
<!ENTITY resetProfile.dialog.description "Are you sure you want to reset Firefox to its initial state?">
<!ENTITY resetProfile.dialog.description "Are you sure you want to reset &brandShortName; to its initial state?">
<!ENTITY resetProfile.dialog.items.label "The following will be preserved:">
<!ENTITY resetProfile.dialog.footer.label "&brandShortName; will restart and everything else will be removed.">
<!ENTITY resetProfile.dialog.button.label "Reset &brandShortName;">