Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2012-02-22 01:28:34 +00:00
commit be847bb9bd
54 changed files with 621 additions and 203 deletions

View File

@ -195,7 +195,7 @@
oncommand="gSyncSetup.onServerCommand()" oncommand="gSyncSetup.onServerCommand()"
oninput="gSyncSetup.onServerInput()"> oninput="gSyncSetup.onServerInput()">
<menupopup> <menupopup>
<menuitem label="&serverType.main.label;" <menuitem label="&serverType.default.label;"
value="main"/> value="main"/>
<menuitem label="&serverType.custom2.label;" <menuitem label="&serverType.custom2.label;"
value="custom"/> value="custom"/>
@ -335,7 +335,7 @@
oncommand="gSyncSetup.onExistingServerCommand()" oncommand="gSyncSetup.onExistingServerCommand()"
oninput="gSyncSetup.onExistingServerInput()"> oninput="gSyncSetup.onExistingServerInput()">
<menupopup> <menupopup>
<menuitem label="&serverType.main.label;" <menuitem label="&serverType.default.label;"
value="main"/> value="main"/>
<menuitem label="&serverType.custom2.label;" <menuitem label="&serverType.custom2.label;"
value="custom"/> value="custom"/>

View File

@ -64,7 +64,7 @@ function test() {
let testState = { let testState = {
windows: [ windows: [
{ tabs: [{ entries: [{ url: "http://example.com/" }] }], selected: 1 }, { tabs: [{ entries: [{ url: "http://example.com/" }] }], selected: 1 },
{ tabs: [{ entries: [{ url: "about:robots" }] }], selected: 1 }, { tabs: [{ entries: [{ url: "about:mozilla" }] }], selected: 1 },
], ],
// make sure the first window is focused, otherwise when restoring the // make sure the first window is focused, otherwise when restoring the
// old state, the first window is closed and the test harness gets unloaded // old state, the first window is closed and the test harness gets unloaded

View File

@ -12,7 +12,7 @@
<!-- New Account AND Existing Account --> <!-- New Account AND Existing Account -->
<!ENTITY server.label "Server"> <!ENTITY server.label "Server">
<!ENTITY serverType.main.label "&syncBrand.fullName.label; Server"> <!ENTITY serverType.default.label "Default: Mozilla &syncBrand.fullName.label; server">
<!ENTITY serverType.custom2.label "Use a custom server…"> <!ENTITY serverType.custom2.label "Use a custom server…">
<!ENTITY signIn.account2.label "Account"> <!ENTITY signIn.account2.label "Account">
<!ENTITY signIn.account2.accesskey "A"> <!ENTITY signIn.account2.accesskey "A">

View File

@ -1760,6 +1760,10 @@ main(int argc, char **argv, char **envp)
setbuf(stdout, 0); setbuf(stdout, 0);
#endif #endif
#ifdef XRE_HAS_DLL_BLOCKLIST
XRE_SetupDllBlocklist();
#endif
gErrFile = stderr; gErrFile = stderr;
gOutFile = stdout; gOutFile = stdout;
gInFile = stdin; gInFile = stdin;

View File

@ -47,6 +47,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.BatteryManager; import android.os.BatteryManager;
import android.os.Build;
import android.os.SystemClock; import android.os.SystemClock;
public class GeckoBatteryManager public class GeckoBatteryManager
@ -77,7 +78,14 @@ public class GeckoBatteryManager
boolean previousCharging = isCharging(); boolean previousCharging = isCharging();
double previousLevel = getLevel(); double previousLevel = getLevel();
if (intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, false)) { // NOTE: it might not be common (in 2012) but technically, Android can run
// on a device that has no battery so we want to make sure it's not the case
// before bothering checking for battery state.
// However, the Galaxy Nexus phone advertizes itself as battery-less which
// force us to special-case the logic.
// See the Google bug: https://code.google.com/p/android/issues/detail?id=22035
if (intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, false) ||
Build.MODEL.equals("Galaxy Nexus")) {
int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
if (plugged == -1) { if (plugged == -1) {
sCharging = kDefaultCharging; sCharging = kDefaultCharging;
@ -140,7 +148,7 @@ public class GeckoBatteryManager
} else { } else {
sLevel = kDefaultLevel; sLevel = kDefaultLevel;
sCharging = kDefaultCharging; sCharging = kDefaultCharging;
sRemainingTime = kDefaultRemainingTime; sRemainingTime = 0;
} }
/* /*

View File

@ -45,7 +45,7 @@ Phase("phase04", [
// Now we disable the add-on // Now we disable the add-on
Phase("phase05", [ Phase("phase05", [
[Sync], [EnsureTracking],
[Addons.setEnabled, [id], STATE_DISABLED], [Addons.setEnabled, [id], STATE_DISABLED],
[Sync] [Sync]
]); ]);
@ -62,6 +62,7 @@ Phase("phase08", [
// Now we re-enable it again. // Now we re-enable it again.
Phase("phase09", [ Phase("phase09", [
[EnsureTracking],
[Addons.setEnabled, [id], STATE_ENABLED], [Addons.setEnabled, [id], STATE_ENABLED],
[Sync] [Sync]
]); ]);
@ -77,7 +78,9 @@ Phase("phase12", [
]); ]);
// And we uninstall it // And we uninstall it
Phase("phase13", [ Phase("phase13", [
[EnsureTracking],
[Addons.verify, [id], STATE_ENABLED], [Addons.verify, [id], STATE_ENABLED],
[Addons.uninstall, [id]], [Addons.uninstall, [id]],
[Sync] [Sync]

View File

@ -33,6 +33,7 @@ Phase("phase02", [
// Now disable and see that is is synced. // Now disable and see that is is synced.
Phase("phase03", [ Phase("phase03", [
[EnsureTracking],
[Addons.setEnabled, [id], STATE_DISABLED], [Addons.setEnabled, [id], STATE_DISABLED],
[Addons.verify, [id], STATE_DISABLED], [Addons.verify, [id], STATE_DISABLED],
[Sync] [Sync]
@ -44,6 +45,7 @@ Phase("phase04", [
// Enable and see it is synced. // Enable and see it is synced.
Phase("phase05", [ Phase("phase05", [
[EnsureTracking],
[Addons.setEnabled, [id], STATE_ENABLED], [Addons.setEnabled, [id], STATE_ENABLED],
[Addons.verify, [id], STATE_ENABLED], [Addons.verify, [id], STATE_ENABLED],
[Sync] [Sync]
@ -55,6 +57,7 @@ Phase("phase06", [
// Uninstall and see it is synced. // Uninstall and see it is synced.
Phase("phase07", [ Phase("phase07", [
[EnsureTracking],
[Addons.verify, [id], STATE_ENABLED], [Addons.verify, [id], STATE_ENABLED],
[Addons.uninstall, [id]], [Addons.uninstall, [id]],
[Addons.verifyNot, [id]], [Addons.verifyNot, [id]],

View File

@ -93,7 +93,8 @@ function serverForFoo(engine) {
add_test(function test_processIncoming_error_orderChildren() { add_test(function test_processIncoming_error_orderChildren() {
_("Ensure that _orderChildren() is called even when _processIncoming() throws an error."); _("Ensure that _orderChildren() is called even when _processIncoming() throws an error.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let engine = new BookmarksEngine(); let engine = new BookmarksEngine();
@ -166,8 +167,8 @@ add_test(function test_restorePromptsReupload() {
_("Ensure that restoring from a backup will reupload all records."); _("Ensure that restoring from a backup will reupload all records.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
let engine = new BookmarksEngine(); let engine = new BookmarksEngine();
let store = engine._store; let store = engine._store;
@ -334,8 +335,8 @@ add_test(function test_mismatched_types() {
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
let engine = new BookmarksEngine(); let engine = new BookmarksEngine();
let store = engine._store; let store = engine._store;
@ -377,7 +378,8 @@ add_test(function test_bookmark_guidMap_fail() {
_("Ensure that failures building the GUID map cause early death."); _("Ensure that failures building the GUID map cause early death.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let engine = new BookmarksEngine(); let engine = new BookmarksEngine();
let store = engine._store; let store = engine._store;

View File

@ -107,8 +107,8 @@ add_test(function test_annotation_uploaded() {
_("Sync record to the server."); _("Sync record to the server.");
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
let server = serverForFoo(engine); let server = serverForFoo(engine);
let collection = server.user("foo").collection("bookmarks"); let collection = server.user("foo").collection("bookmarks");
@ -193,8 +193,8 @@ add_test(function test_smart_bookmarks_duped() {
_("Prepare sync."); _("Prepare sync.");
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
let server = serverForFoo(engine); let server = serverForFoo(engine);
let collection = server.user("foo").collection("bookmarks"); let collection = server.user("foo").collection("bookmarks");

View File

@ -54,8 +54,8 @@ add_test(function test_bad_hmac() {
try { try {
let passphrase = "abcdeabcdeabcdeabcdeabcdea"; let passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
Service.login("foo", "ilovejane", passphrase); Service.login("foo", "ilovejane", passphrase);
generateNewKeys(); generateNewKeys();
@ -164,7 +164,9 @@ add_test(function test_properties() {
add_test(function test_sync() { add_test(function test_sync() {
_("Ensure that Clients engine uploads a new client record once a week."); _("Ensure that Clients engine uploads a new client record once a week.");
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
generateNewKeys(); generateNewKeys();
@ -402,7 +404,9 @@ add_test(function test_process_incoming_commands() {
add_test(function test_command_sync() { add_test(function test_command_sync() {
_("Ensure that commands are synced across clients."); _("Ensure that commands are synced across clients.");
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Clients._store.wipe(); Clients._store.wipe();

View File

@ -19,8 +19,8 @@ add_test(function test_missing_crypto_collection() {
}; };
} }
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "a-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa"; Service.passphrase = "a-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa";

View File

@ -55,8 +55,8 @@ add_test(function test_locally_changed_keys() {
Weave.Service.password = "ilovejane"; Weave.Service.password = "ilovejane";
Weave.Service.passphrase = passphrase; Weave.Service.passphrase = passphrase;
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
Engines.register(HistoryEngine); Engines.register(HistoryEngine);
Weave.Service._registerEngines(); Weave.Service._registerEngines();

View File

@ -4,7 +4,8 @@ Cu.import("resource://services-sync/util.js");
add_test(function test_processIncoming_abort() { add_test(function test_processIncoming_abort() {
_("An abort exception, raised in applyIncoming, will abort _processIncoming."); _("An abort exception, raised in applyIncoming, will abort _processIncoming.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
generateNewKeys(); generateNewKeys();

View File

@ -9,6 +9,7 @@ Cu.import("resource://services-sync/status.js");
Svc.DefaultPrefs.set("registerEngines", ""); Svc.DefaultPrefs.set("registerEngines", "");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
const TEST_MAINTENANCE_URL = "http://localhost:8080/maintenance/";
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true); const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
const LOG_PREFIX_SUCCESS = "success-"; const LOG_PREFIX_SUCCESS = "success-";
const LOG_PREFIX_ERROR = "error-"; const LOG_PREFIX_ERROR = "error-";
@ -120,8 +121,10 @@ function setUp() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
return generateAndUploadKeys(); return generateAndUploadKeys();
} }
@ -219,7 +222,8 @@ add_test(function test_shouldReportError() {
// Give ourselves a clusterURL so that the temporary 401 no-error situation // Give ourselves a clusterURL so that the temporary 401 no-error situation
// doesn't come into play. // doesn't come into play.
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
// Test dontIgnoreErrors, non-network, non-prolonged, login error reported // Test dontIgnoreErrors, non-network, non-prolonged, login error reported
Status.resetSync(); Status.resetSync();
@ -510,7 +514,8 @@ add_test(function test_login_syncAndReportErrors_network_error() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
Svc.Obs.add("weave:ui:login:error", function onSyncError() { Svc.Obs.add("weave:ui:login:error", function onSyncError() {
Svc.Obs.remove("weave:ui:login:error", onSyncError); Svc.Obs.remove("weave:ui:login:error", onSyncError);
@ -548,7 +553,8 @@ add_test(function test_login_syncAndReportErrors_prolonged_network_error() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
Svc.Obs.add("weave:ui:login:error", function onSyncError() { Svc.Obs.add("weave:ui:login:error", function onSyncError() {
Svc.Obs.remove("weave:ui:login:error", onSyncError); Svc.Obs.remove("weave:ui:login:error", onSyncError);
@ -627,7 +633,8 @@ add_test(function test_login_prolonged_network_error() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
Svc.Obs.add("weave:ui:login:error", function onSyncError() { Svc.Obs.add("weave:ui:login:error", function onSyncError() {
Svc.Obs.remove("weave:ui:login:error", onSyncError); Svc.Obs.remove("weave:ui:login:error", onSyncError);
@ -704,7 +711,8 @@ add_test(function test_login_network_error() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
// Test network errors are not reported. // Test network errors are not reported.
Svc.Obs.add("weave:ui:clear-error", function onClearError() { Svc.Obs.add("weave:ui:clear-error", function onClearError() {
@ -777,7 +785,8 @@ add_test(function test_info_collections_login_server_maintenance_error() {
setUp(); setUp();
Service.username = "broken.info"; Service.username = "broken.info";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -816,7 +825,8 @@ add_test(function test_meta_global_login_server_maintenance_error() {
setUp(); setUp();
Service.username = "broken.meta"; Service.username = "broken.meta";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -855,7 +865,8 @@ add_test(function test_crypto_keys_login_server_maintenance_error() {
setUp(); setUp();
Service.username = "broken.keys"; Service.username = "broken.keys";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
// Force re-download of keys // Force re-download of keys
CollectionKeys.clear(); CollectionKeys.clear();
@ -922,7 +933,8 @@ add_test(function test_info_collections_login_prolonged_server_maintenance_error
setUp(); setUp();
Service.username = "broken.info"; Service.username = "broken.info";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -954,7 +966,8 @@ add_test(function test_meta_global_login_prolonged_server_maintenance_error(){
setUp(); setUp();
Service.username = "broken.meta"; Service.username = "broken.meta";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -986,7 +999,8 @@ add_test(function test_download_crypto_keys_login_prolonged_server_maintenance_e
setUp(); setUp();
Service.username = "broken.keys"; Service.username = "broken.keys";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
// Force re-download of keys // Force re-download of keys
CollectionKeys.clear(); CollectionKeys.clear();
@ -1022,7 +1036,8 @@ add_test(function test_upload_crypto_keys_login_prolonged_server_maintenance_err
Service.username = "broken.keys"; Service.username = "broken.keys";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1057,7 +1072,8 @@ add_test(function test_wipeServer_login_prolonged_server_maintenance_error(){
Service.username = "broken.wipe"; Service.username = "broken.wipe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1091,7 +1107,8 @@ add_test(function test_wipeRemote_prolonged_server_maintenance_error(){
Service.username = "broken.wipe"; Service.username = "broken.wipe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
generateAndUploadKeys(); generateAndUploadKeys();
let engine = Engines.get("catapult"); let engine = Engines.get("catapult");
@ -1158,7 +1175,8 @@ add_test(function test_info_collections_login_syncAndReportErrors_server_mainten
setUp(); setUp();
Service.username = "broken.info"; Service.username = "broken.info";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1191,7 +1209,8 @@ add_test(function test_meta_global_login_syncAndReportErrors_server_maintenance_
setUp(); setUp();
Service.username = "broken.meta"; Service.username = "broken.meta";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1224,7 +1243,8 @@ add_test(function test_download_crypto_keys_login_syncAndReportErrors_server_mai
setUp(); setUp();
Service.username = "broken.keys"; Service.username = "broken.keys";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
// Force re-download of keys // Force re-download of keys
CollectionKeys.clear(); CollectionKeys.clear();
@ -1261,7 +1281,8 @@ add_test(function test_upload_crypto_keys_login_syncAndReportErrors_server_maint
Service.username = "broken.keys"; Service.username = "broken.keys";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1296,7 +1317,8 @@ add_test(function test_wipeServer_login_syncAndReportErrors_server_maintenance_e
Service.username = "broken.wipe"; Service.username = "broken.wipe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1330,7 +1352,8 @@ add_test(function test_wipeRemote_syncAndReportErrors_server_maintenance_error()
Service.username = "broken.wipe"; Service.username = "broken.wipe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
generateAndUploadKeys(); generateAndUploadKeys();
let engine = Engines.get("catapult"); let engine = Engines.get("catapult");
@ -1397,7 +1420,8 @@ add_test(function test_info_collections_login_syncAndReportErrors_prolonged_serv
setUp(); setUp();
Service.username = "broken.info"; Service.username = "broken.info";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1430,7 +1454,8 @@ add_test(function test_meta_global_login_syncAndReportErrors_prolonged_server_ma
setUp(); setUp();
Service.username = "broken.meta"; Service.username = "broken.meta";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1463,7 +1488,8 @@ add_test(function test_download_crypto_keys_login_syncAndReportErrors_prolonged_
setUp(); setUp();
Service.username = "broken.keys"; Service.username = "broken.keys";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
// Force re-download of keys // Force re-download of keys
CollectionKeys.clear(); CollectionKeys.clear();
@ -1500,7 +1526,8 @@ add_test(function test_upload_crypto_keys_login_syncAndReportErrors_prolonged_se
Service.username = "broken.keys"; Service.username = "broken.keys";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
@ -1535,7 +1562,8 @@ add_test(function test_wipeServer_login_syncAndReportErrors_prolonged_server_mai
Service.username = "broken.wipe"; Service.username = "broken.wipe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/maintenance/"; Service.serverURL = TEST_MAINTENANCE_URL;
Service.clusterURL = TEST_MAINTENANCE_URL;
let backoffInterval; let backoffInterval;
Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) { Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {

View File

@ -51,7 +51,8 @@ function setUp() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "aabcdeabcdeabcdeabcdeabcde"; Service.passphrase = "aabcdeabcdeabcdeabcdeabcde";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
new FakeCryptoService(); new FakeCryptoService();
} }

View File

@ -12,7 +12,8 @@ add_test(function test_processIncoming_mobile_history_batched() {
let FAKE_DOWNLOAD_LIMIT = 100; let FAKE_DOWNLOAD_LIMIT = 100;
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Svc.Prefs.set("client.type", "mobile"); Svc.Prefs.set("client.type", "mobile");
PlacesUtils.history.removeAllPages(); PlacesUtils.history.removeAllPages();

View File

@ -18,8 +18,8 @@ function shared_setup() {
hmacErrorCount = 0; hmacErrorCount = 0;
// Do not instantiate SyncTestingInfrastructure; we need real crypto. // Do not instantiate SyncTestingInfrastructure; we need real crypto.
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
Service.username = "foo"; Service.username = "foo";
Service.password = "foo"; Service.password = "foo";
Service.passphrase = "aabcdeabcdeabcdeabcdeabcde"; Service.passphrase = "aabcdeabcdeabcdeabcdeabcde";

View File

@ -35,7 +35,8 @@ function setUp() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
generateNewKeys(); generateNewKeys();
let serverKeys = CollectionKeys.asWBO("crypto", "keys"); let serverKeys = CollectionKeys.asWBO("crypto", "keys");

View File

@ -166,7 +166,7 @@ const DATA = {"msg": "eggstreamly sekrit"};
const POLLINTERVAL = 50; const POLLINTERVAL = 50;
function run_test() { function run_test() {
Svc.Prefs.set("jpake.serverURL", "http://localhost:8080/"); Svc.Prefs.set("jpake.serverURL", TEST_SERVER_URL);
Svc.Prefs.set("jpake.pollInterval", POLLINTERVAL); Svc.Prefs.set("jpake.pollInterval", POLLINTERVAL);
Svc.Prefs.set("jpake.maxTries", 2); Svc.Prefs.set("jpake.maxTries", 2);
Svc.Prefs.set("jpake.firstMsgMaxTries", 5); Svc.Prefs.set("jpake.firstMsgMaxTries", 5);

View File

@ -76,8 +76,8 @@ function prepareServer() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
do_check_eq(Service.userAPI, "http://localhost:8080/user/1.0/"); do_check_eq(Service.userAPI, "http://localhost:8080/user/1.0/");
let server = new SyncServer(); let server = new SyncServer();

View File

@ -4,6 +4,9 @@ Cu.import("resource://services-sync/log4moz.js");
Cu.import("resource://services-sync/resource.js"); Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
const RES_UPLOAD_URL = "http://localhost:8080/upload";
const RES_HEADERS_URL = "http://localhost:8080/headers";
let logger; let logger;
let fetched = false; let fetched = false;
@ -322,7 +325,7 @@ add_test(function test_get_404() {
add_test(function test_put_string() { add_test(function test_put_string() {
_("PUT to a resource (string)"); _("PUT to a resource (string)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.put(JSON.stringify(sample_data), function(error, content) { res_upload.put(JSON.stringify(sample_data), function(error, content) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(content, "Valid data upload via PUT"); do_check_eq(content, "Valid data upload via PUT");
@ -334,7 +337,7 @@ add_test(function test_put_string() {
add_test(function test_put_object() { add_test(function test_put_object() {
_("PUT to a resource (object)"); _("PUT to a resource (object)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.put(sample_data, function (error, content) { res_upload.put(sample_data, function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(content, "Valid data upload via PUT"); do_check_eq(content, "Valid data upload via PUT");
@ -346,7 +349,7 @@ add_test(function test_put_object() {
add_test(function test_put_data_string() { add_test(function test_put_data_string() {
_("PUT without data arg (uses resource.data) (string)"); _("PUT without data arg (uses resource.data) (string)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.data = JSON.stringify(sample_data); res_upload.data = JSON.stringify(sample_data);
res_upload.put(function (error, content) { res_upload.put(function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
@ -359,7 +362,7 @@ add_test(function test_put_data_string() {
add_test(function test_put_data_object() { add_test(function test_put_data_object() {
_("PUT without data arg (uses resource.data) (object)"); _("PUT without data arg (uses resource.data) (object)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.data = sample_data; res_upload.data = sample_data;
res_upload.put(function (error, content) { res_upload.put(function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
@ -372,7 +375,7 @@ add_test(function test_put_data_object() {
add_test(function test_post_string() { add_test(function test_post_string() {
_("POST to a resource (string)"); _("POST to a resource (string)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.post(JSON.stringify(sample_data), function (error, content) { res_upload.post(JSON.stringify(sample_data), function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(content, "Valid data upload via POST"); do_check_eq(content, "Valid data upload via POST");
@ -384,7 +387,7 @@ add_test(function test_post_string() {
add_test(function test_post_object() { add_test(function test_post_object() {
_("POST to a resource (object)"); _("POST to a resource (object)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.post(sample_data, function (error, content) { res_upload.post(sample_data, function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(content, "Valid data upload via POST"); do_check_eq(content, "Valid data upload via POST");
@ -396,7 +399,7 @@ add_test(function test_post_object() {
add_test(function test_post_data_string() { add_test(function test_post_data_string() {
_("POST without data arg (uses resource.data) (string)"); _("POST without data arg (uses resource.data) (string)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.data = JSON.stringify(sample_data); res_upload.data = JSON.stringify(sample_data);
res_upload.post(function (error, content) { res_upload.post(function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
@ -409,7 +412,7 @@ add_test(function test_post_data_string() {
add_test(function test_post_data_object() { add_test(function test_post_data_object() {
_("POST without data arg (uses resource.data) (object)"); _("POST without data arg (uses resource.data) (object)");
let res_upload = new AsyncResource("http://localhost:8080/upload"); let res_upload = new AsyncResource(RES_UPLOAD_URL);
res_upload.data = sample_data; res_upload.data = sample_data;
res_upload.post(function (error, content) { res_upload.post(function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
@ -458,7 +461,7 @@ add_test(function test_weave_timestamp() {
add_test(function test_get_no_headers() { add_test(function test_get_no_headers() {
_("GET: no special request headers"); _("GET: no special request headers");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.get(function (error, content) { res_headers.get(function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(content, '{}'); do_check_eq(content, '{}');
@ -468,7 +471,7 @@ add_test(function test_get_no_headers() {
add_test(function test_put_default_content_type() { add_test(function test_put_default_content_type() {
_("PUT: Content-Type defaults to text/plain"); _("PUT: Content-Type defaults to text/plain");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.put('data', function (error, content) { res_headers.put('data', function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(content, JSON.stringify({"content-type": "text/plain"})); do_check_eq(content, JSON.stringify({"content-type": "text/plain"}));
@ -478,7 +481,7 @@ add_test(function test_put_default_content_type() {
add_test(function test_post_default_content_type() { add_test(function test_post_default_content_type() {
_("POST: Content-Type defaults to text/plain"); _("POST: Content-Type defaults to text/plain");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.post('data', function (error, content) { res_headers.post('data', function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(content, JSON.stringify({"content-type": "text/plain"})); do_check_eq(content, JSON.stringify({"content-type": "text/plain"}));
@ -488,7 +491,7 @@ add_test(function test_post_default_content_type() {
add_test(function test_setHeader() { add_test(function test_setHeader() {
_("setHeader(): setting simple header"); _("setHeader(): setting simple header");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.setHeader('X-What-Is-Weave', 'awesome'); res_headers.setHeader('X-What-Is-Weave', 'awesome');
do_check_eq(res_headers.headers['x-what-is-weave'], 'awesome'); do_check_eq(res_headers.headers['x-what-is-weave'], 'awesome');
res_headers.get(function (error, content) { res_headers.get(function (error, content) {
@ -500,7 +503,7 @@ add_test(function test_setHeader() {
add_test(function test_setHeader_overwrite() { add_test(function test_setHeader_overwrite() {
_("setHeader(): setting multiple headers, overwriting existing header"); _("setHeader(): setting multiple headers, overwriting existing header");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.setHeader('X-WHAT-is-Weave', 'more awesomer'); res_headers.setHeader('X-WHAT-is-Weave', 'more awesomer');
res_headers.setHeader('X-Another-Header', 'hello world'); res_headers.setHeader('X-Another-Header', 'hello world');
do_check_eq(res_headers.headers['x-what-is-weave'], 'more awesomer'); do_check_eq(res_headers.headers['x-what-is-weave'], 'more awesomer');
@ -516,7 +519,7 @@ add_test(function test_setHeader_overwrite() {
add_test(function test_headers_object() { add_test(function test_headers_object() {
_("Setting headers object"); _("Setting headers object");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.headers = {}; res_headers.headers = {};
res_headers.get(function (error, content) { res_headers.get(function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);
@ -527,7 +530,7 @@ add_test(function test_headers_object() {
add_test(function test_put_override_content_type() { add_test(function test_put_override_content_type() {
_("PUT: override default Content-Type"); _("PUT: override default Content-Type");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.setHeader('Content-Type', 'application/foobar'); res_headers.setHeader('Content-Type', 'application/foobar');
do_check_eq(res_headers.headers['content-type'], 'application/foobar'); do_check_eq(res_headers.headers['content-type'], 'application/foobar');
res_headers.put('data', function (error, content) { res_headers.put('data', function (error, content) {
@ -539,7 +542,7 @@ add_test(function test_put_override_content_type() {
add_test(function test_post_override_content_type() { add_test(function test_post_override_content_type() {
_("POST: override default Content-Type"); _("POST: override default Content-Type");
let res_headers = new AsyncResource("http://localhost:8080/headers"); let res_headers = new AsyncResource(RES_HEADERS_URL);
res_headers.setHeader('Content-Type', 'application/foobar'); res_headers.setHeader('Content-Type', 'application/foobar');
res_headers.post('data', function (error, content) { res_headers.post('data', function (error, content) {
do_check_eq(error, null); do_check_eq(error, null);

View File

@ -2,6 +2,8 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/resource.js"); Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
const TEST_GET_URL = "http://localhost:8080/1.1/johndoe/storage/meta/global";
function test_resource_user_agent() { function test_resource_user_agent() {
let meta_global = new ServerWBO('global'); let meta_global = new ServerWBO('global');
@ -23,8 +25,8 @@ function test_resource_user_agent() {
"/1.1/johndoe/storage/meta/global": uaHandler(meta_global.handler()), "/1.1/johndoe/storage/meta/global": uaHandler(meta_global.handler()),
}); });
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
Weave.Service.username = "johndoe"; Weave.Service.username = "johndoe";
Weave.Service.password = "ilovejane"; Weave.Service.password = "ilovejane";
@ -43,7 +45,7 @@ function test_resource_user_agent() {
function test_desktop_post(next) { function test_desktop_post(next) {
_("Testing direct Resource POST."); _("Testing direct Resource POST.");
let r = new AsyncResource("http://localhost:8080/1.1/johndoe/storage/meta/global"); let r = new AsyncResource(TEST_GET_URL);
r.post("foo=bar", function (error, content) { r.post("foo=bar", function (error, content) {
_("User-Agent: " + ua); _("User-Agent: " + ua);
do_check_eq(ua, expectedUA + ".desktop"); do_check_eq(ua, expectedUA + ".desktop");
@ -55,7 +57,7 @@ function test_resource_user_agent() {
function test_desktop_get(next) { function test_desktop_get(next) {
_("Testing async."); _("Testing async.");
Svc.Prefs.set("client.type", "desktop"); Svc.Prefs.set("client.type", "desktop");
let r = new AsyncResource("http://localhost:8080/1.1/johndoe/storage/meta/global"); let r = new AsyncResource(TEST_GET_URL);
r.get(function(error, content) { r.get(function(error, content) {
_("User-Agent: " + ua); _("User-Agent: " + ua);
do_check_eq(ua, expectedUA + ".desktop"); do_check_eq(ua, expectedUA + ".desktop");
@ -67,7 +69,7 @@ function test_resource_user_agent() {
function test_mobile_get(next) { function test_mobile_get(next) {
_("Testing mobile."); _("Testing mobile.");
Svc.Prefs.set("client.type", "mobile"); Svc.Prefs.set("client.type", "mobile");
let r = new AsyncResource("http://localhost:8080/1.1/johndoe/storage/meta/global"); let r = new AsyncResource(TEST_GET_URL);
r.get(function (error, content) { r.get(function (error, content) {
_("User-Agent: " + ua); _("User-Agent: " + ua);
do_check_eq(ua, expectedUA + ".mobile"); do_check_eq(ua, expectedUA + ".mobile");

View File

@ -5,6 +5,8 @@ Cu.import("resource://services-sync/rest.js");
Cu.import("resource://services-sync/log4moz.js"); Cu.import("resource://services-sync/log4moz.js");
Cu.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm");
const TEST_RESOURCE_URL = TEST_SERVER_URL + "resource";
function run_test() { function run_test() {
Log4Moz.repository.getLogger("Sync.RESTRequest").level = Log4Moz.Level.Trace; Log4Moz.repository.getLogger("Sync.RESTRequest").level = Log4Moz.Level.Trace;
initTestLogging(); initTestLogging();
@ -89,7 +91,7 @@ add_test(function test_simple_get() {
let handler = httpd_handler(200, "OK", "Huzzah!"); let handler = httpd_handler(200, "OK", "Huzzah!");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let uri = "http://localhost:8080/resource"; let uri = TEST_RESOURCE_URL;
let request = new RESTRequest(uri).get(function (error) { let request = new RESTRequest(uri).get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
@ -111,7 +113,7 @@ add_test(function test_get() {
let handler = httpd_handler(200, "OK", "Huzzah!"); let handler = httpd_handler(200, "OK", "Huzzah!");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
do_check_eq(request.status, request.NOT_SENT); do_check_eq(request.status, request.NOT_SENT);
request.onProgress = request.onComplete = function () { request.onProgress = request.onComplete = function () {
@ -160,7 +162,7 @@ add_test(function test_put() {
let handler = httpd_handler(200, "OK", "Got it!"); let handler = httpd_handler(200, "OK", "Got it!");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
do_check_eq(request.status, request.NOT_SENT); do_check_eq(request.status, request.NOT_SENT);
request.onProgress = request.onComplete = function () { request.onProgress = request.onComplete = function () {
@ -209,7 +211,7 @@ add_test(function test_post() {
let handler = httpd_handler(200, "OK", "Got it!"); let handler = httpd_handler(200, "OK", "Got it!");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
do_check_eq(request.status, request.NOT_SENT); do_check_eq(request.status, request.NOT_SENT);
request.onProgress = request.onComplete = function () { request.onProgress = request.onComplete = function () {
@ -258,7 +260,7 @@ add_test(function test_delete() {
let handler = httpd_handler(200, "OK", "Got it!"); let handler = httpd_handler(200, "OK", "Got it!");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
do_check_eq(request.status, request.NOT_SENT); do_check_eq(request.status, request.NOT_SENT);
request.onProgress = request.onComplete = function () { request.onProgress = request.onComplete = function () {
@ -304,7 +306,7 @@ add_test(function test_get_404() {
let handler = httpd_handler(404, "Not Found", "Cannae find it!"); let handler = httpd_handler(404, "Not Found", "Cannae find it!");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
@ -330,7 +332,7 @@ add_test(function test_put_json() {
injson: "format", injson: "format",
number: 42 number: 42
}; };
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.put(sample_data, function (error) { request.put(sample_data, function (error) {
do_check_eq(error, null); do_check_eq(error, null);
@ -360,7 +362,7 @@ add_test(function test_post_json() {
injson: "format", injson: "format",
number: 42 number: 42
}; };
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.post(sample_data, function (error) { request.post(sample_data, function (error) {
do_check_eq(error, null); do_check_eq(error, null);
@ -384,7 +386,7 @@ add_test(function test_put_override_content_type() {
let handler = httpd_handler(200, "OK"); let handler = httpd_handler(200, "OK");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.setHeader("Content-Type", "application/lolcat"); request.setHeader("Content-Type", "application/lolcat");
request.put("O HAI!!1!", function (error) { request.put("O HAI!!1!", function (error) {
do_check_eq(error, null); do_check_eq(error, null);
@ -409,7 +411,7 @@ add_test(function test_post_override_content_type() {
let handler = httpd_handler(200, "OK"); let handler = httpd_handler(200, "OK");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.setHeader("Content-Type", "application/lolcat"); request.setHeader("Content-Type", "application/lolcat");
request.post("O HAI!!1!", function (error) { request.post("O HAI!!1!", function (error) {
do_check_eq(error, null); do_check_eq(error, null);
@ -439,7 +441,7 @@ add_test(function test_get_no_headers() {
"connection", "pragma", "cache-control", "connection", "pragma", "cache-control",
"content-length"]; "content-length"];
new RESTRequest("http://localhost:8080/resource").get(function (error) { new RESTRequest(TEST_RESOURCE_URL).get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -465,7 +467,7 @@ add_test(function test_changing_uri() {
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/the-wrong-resource"); let request = new RESTRequest("http://localhost:8080/the-wrong-resource");
request.uri = Utils.makeURI("http://localhost:8080/resource"); request.uri = Utils.makeURI(TEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -480,7 +482,7 @@ add_test(function test_request_setHeader() {
let handler = httpd_handler(200, "OK"); let handler = httpd_handler(200, "OK");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.setHeader("X-What-Is-Weave", "awesome"); request.setHeader("X-What-Is-Weave", "awesome");
request.setHeader("X-WHAT-is-Weave", "more awesomer"); request.setHeader("X-WHAT-is-Weave", "more awesomer");
@ -509,7 +511,7 @@ add_test(function test_response_headers() {
response.setStatusLine(request.httpVersion, 200, "OK"); response.setStatusLine(request.httpVersion, 200, "OK");
} }
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
@ -529,7 +531,7 @@ add_test(function test_response_headers() {
* (e.g. NS_ERROR_CONNECTION_REFUSED). * (e.g. NS_ERROR_CONNECTION_REFUSED).
*/ */
add_test(function test_connection_refused() { add_test(function test_connection_refused() {
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.onProgress = function onProgress() { request.onProgress = function onProgress() {
do_throw("Shouldn't have called request.onProgress()!"); do_throw("Shouldn't have called request.onProgress()!");
}; };
@ -551,7 +553,7 @@ add_test(function test_abort() {
} }
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
// Aborting a request that hasn't been sent yet is pointless and will throw. // Aborting a request that hasn't been sent yet is pointless and will throw.
do_check_throws(function () { do_check_throws(function () {
@ -591,7 +593,7 @@ add_test(function test_timeout() {
}; };
server.start(8080); server.start(8080);
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.timeout = 0.1; // 100 milliseconds request.timeout = 0.1; // 100 milliseconds
request.get(function (error) { request.get(function (error) {
do_check_eq(error.result, Cr.NS_ERROR_NET_TIMEOUT); do_check_eq(error.result, Cr.NS_ERROR_NET_TIMEOUT);
@ -609,7 +611,7 @@ add_test(function test_exception_in_onProgress() {
let handler = httpd_handler(200, "OK", "Foobar"); let handler = httpd_handler(200, "OK", "Foobar");
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new RESTRequest("http://localhost:8080/resource"); let request = new RESTRequest(TEST_RESOURCE_URL);
request.onProgress = function onProgress() { request.onProgress = function onProgress() {
it.does.not.exist(); it.does.not.exist();
}; };

View File

@ -46,7 +46,8 @@ function setUp() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "sekrit"; Service.passphrase = "sekrit";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
new FakeCryptoService(); new FakeCryptoService();
} }

View File

@ -26,7 +26,8 @@ add_test(function test_change_password() {
} }
try { try {
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = TEST_CLUSTER_URL;
Weave.Service.username = "johndoe"; Weave.Service.username = "johndoe";
Weave.Service.password = "ilovejane"; Weave.Service.password = "ilovejane";

View File

@ -12,7 +12,7 @@ function run_test() {
"/user/1.0/vuuf3eqgloxpxmzph27f5a6ve7gzlrms": httpd_handler(200, "OK", "1") "/user/1.0/vuuf3eqgloxpxmzph27f5a6ve7gzlrms": httpd_handler(200, "OK", "1")
}); });
try { try {
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
_("A 404 will be recorded as 'generic-server-error'"); _("A 404 will be recorded as 'generic-server-error'");
do_check_eq(Service.checkAccount("jimdoe"), "generic-server-error"); do_check_eq(Service.checkAccount("jimdoe"), "generic-server-error");

View File

@ -15,7 +15,7 @@ function test_findCluster() {
_("Test Service._findCluster()"); _("Test Service._findCluster()");
let server; let server;
try { try {
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.username = "johndoe"; Service.username = "johndoe";
_("_findCluster() throws on network errors (e.g. connection refused)."); _("_findCluster() throws on network errors (e.g. connection refused).");
@ -73,7 +73,7 @@ function test_setCluster() {
"/user/1.0/jimdoe/node/weave": httpd_handler(200, "OK", "null") "/user/1.0/jimdoe/node/weave": httpd_handler(200, "OK", "null")
}); });
try { try {
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.username = "johndoe"; Service.username = "johndoe";
_("Check initial state."); _("Check initial state.");
@ -105,7 +105,7 @@ function test_updateCluster() {
"/user/1.0/janedoe/node/weave": httpd_handler(200, "OK", "http://weave.cluster.url/") "/user/1.0/janedoe/node/weave": httpd_handler(200, "OK", "http://weave.cluster.url/")
}); });
try { try {
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.username = "johndoe"; Service.username = "johndoe";
_("Check initial state."); _("Check initial state.");

View File

@ -26,7 +26,7 @@ function run_test() {
"/user/1.0/vz6fhecgw5t3sgx3a4cektoiokyczkqd": send(500, "Server Error", "Server Error") "/user/1.0/vz6fhecgw5t3sgx3a4cektoiokyczkqd": send(500, "Server Error", "Server Error")
}); });
try { try {
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
_("Create an account."); _("Create an account.");
let res = Service.createAccount("john@doe.com", "mysecretpw", let res = Service.createAccount("john@doe.com", "mysecretpw",

View File

@ -63,8 +63,8 @@ add_test(function v4_upgrade() {
Status.resetSync(); Status.resetSync();
_("Logging in."); _("Logging in.");
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
Weave.Service.login("johndoe", "ilovejane", passphrase); Weave.Service.login("johndoe", "ilovejane", passphrase);
do_check_true(Weave.Service.isLoggedIn); do_check_true(Weave.Service.isLoggedIn);
@ -99,8 +99,8 @@ add_test(function v4_upgrade() {
_("Syncing afresh..."); _("Syncing afresh...");
Weave.Service.logout(); Weave.Service.logout();
CollectionKeys.clear(); CollectionKeys.clear();
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
meta_global.payload = JSON.stringify({"syncID": "foooooooooooooobbbbbbbbbbbb", meta_global.payload = JSON.stringify({"syncID": "foooooooooooooobbbbbbbbbbbb",
"storageVersion": STORAGE_VERSION}); "storageVersion": STORAGE_VERSION});
collections.meta = Date.now() / 1000; collections.meta = Date.now() / 1000;
@ -239,8 +239,8 @@ add_test(function v5_upgrade() {
Weave.Service.password = "ilovejane"; Weave.Service.password = "ilovejane";
Weave.Service.passphrase = passphrase; Weave.Service.passphrase = passphrase;
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
// //
// Test an upgrade where the contents of the server would cause us to error // Test an upgrade where the contents of the server would cause us to error

View File

@ -13,7 +13,8 @@ let collections = {steam: 65.11328,
function run_test() { function run_test() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
Log4Moz.repository.getLogger("Sync.Service").level = Log4Moz.Level.Trace; Log4Moz.repository.getLogger("Sync.Service").level = Log4Moz.Level.Trace;
Log4Moz.repository.getLogger("Sync.StorageRequest").level = Log4Moz.Level.Trace; Log4Moz.repository.getLogger("Sync.StorageRequest").level = Log4Moz.Level.Trace;

View File

@ -39,8 +39,8 @@ add_test(function test_offline() {
}); });
function setup() { function setup() {
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
let janeHelper = track_collections_helper(); let janeHelper = track_collections_helper();
let janeU = janeHelper.with_updated_collection; let janeU = janeHelper.with_updated_collection;

View File

@ -65,7 +65,7 @@ function run_test() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = JAPANESE; Service.password = JAPANESE;
Service.passphrase = "cantentsveryrelevantabbbb"; Service.passphrase = "cantentsveryrelevantabbbb";
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
try { try {
_("Try to log in with the password."); _("Try to log in with the password.");

View File

@ -71,7 +71,9 @@ add_test(function test_removeClientData() {
Service.startOver(); Service.startOver();
do_check_false(engine.removed); do_check_false(engine.removed);
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
do_check_false(engine.removed); do_check_false(engine.removed);
Service.startOver(); Service.startOver();
do_check_true(engine.removed); do_check_true(engine.removed);

View File

@ -32,8 +32,8 @@ function run_test() {
try { try {
_("Set up test fixtures."); _("Set up test fixtures.");
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
Weave.Service.username = "johndoe"; Weave.Service.username = "johndoe";
Weave.Service.password = "ilovejane"; Weave.Service.password = "ilovejane";
Weave.Service.passphrase = "foo"; Weave.Service.passphrase = "foo";

View File

@ -61,8 +61,8 @@ function run_test() {
try { try {
_("Log in."); _("Log in.");
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
_("Checking Status.sync with no credentials."); _("Checking Status.sync with no credentials.");
Weave.Service.verifyAndFetchSymmetricKeys(); Weave.Service.verifyAndFetchSymmetricKeys();
@ -77,8 +77,8 @@ function run_test() {
let syncKey = Weave.Service.passphrase; let syncKey = Weave.Service.passphrase;
Weave.Service.startOver(); Weave.Service.startOver();
Weave.Service.serverURL = "http://localhost:8080/"; Weave.Service.serverURL = TEST_SERVER_URL;
Weave.Service.clusterURL = "http://localhost:8080/"; Weave.Service.clusterURL = TEST_CLUSTER_URL;
Weave.Service.login("johndoe", "ilovejane", syncKey); Weave.Service.login("johndoe", "ilovejane", syncKey);
do_check_true(Weave.Service.isLoggedIn); do_check_true(Weave.Service.isLoggedIn);

View File

@ -69,7 +69,8 @@ function setUp() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
// So that we can poke at meta/global. // So that we can poke at meta/global.
new FakeCryptoService(); new FakeCryptoService();

View File

@ -44,7 +44,7 @@ function run_test() {
}); });
try { try {
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
_("Force the initial state."); _("Force the initial state.");
Status.service = STATUS_OK; Status.service = STATUS_OK;

View File

@ -29,7 +29,8 @@ FakeCollection.prototype = {
function setUpTestFixtures() { function setUpTestFixtures() {
let cryptoService = new FakeCryptoService(); let cryptoService = new FakeCryptoService();
Service.clusterURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = TEST_CLUSTER_URL;
Service.username = "johndoe"; Service.username = "johndoe";
Service.passphrase = "aabcdeabcdeabcdeabcdeabcde"; Service.passphrase = "aabcdeabcdeabcdeabcdeabcde";
} }

View File

@ -158,7 +158,8 @@ function test_resetClient() {
function test_wipeServer() { function test_wipeServer() {
_("SyncEngine.wipeServer deletes server data and resets the client."); _("SyncEngine.wipeServer deletes server data and resets the client.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
let engine = makeSteamEngine(); let engine = makeSteamEngine();
const PAYLOAD = 42; const PAYLOAD = 42;

View File

@ -29,8 +29,8 @@ function createServerAndConfigureClient() {
}; };
const USER = "foo"; const USER = "foo";
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("serverURL", TEST_SERVER_URL); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", USER); Svc.Prefs.set("username", USER);
let server = new SyncServer(); let server = new SyncServer();
@ -65,7 +65,8 @@ add_test(function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() {
_("SyncEngine._syncStartup resets sync and wipes server data if there's no or an outdated global record"); _("SyncEngine._syncStartup resets sync and wipes server data if there's no or an outdated global record");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
// Some server side data that's going to be wiped // Some server side data that's going to be wiped
@ -118,7 +119,8 @@ add_test(function test_syncStartup_serverHasNewerVersion() {
_("SyncEngine._syncStartup "); _("SyncEngine._syncStartup ");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let global = new ServerWBO('global', {engines: {rotary: {version: 23456}}}); let global = new ServerWBO('global', {engines: {rotary: {version: 23456}}});
let server = httpd_setup({ let server = httpd_setup({
@ -148,7 +150,8 @@ add_test(function test_syncStartup_syncIDMismatchResetsClient() {
_("SyncEngine._syncStartup resets sync if syncIDs don't match"); _("SyncEngine._syncStartup resets sync if syncIDs don't match");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let server = sync_httpd_setup({}); let server = sync_httpd_setup({});
@ -185,7 +188,8 @@ add_test(function test_processIncoming_emptyServer() {
_("SyncEngine._processIncoming working with an empty server backend"); _("SyncEngine._processIncoming working with an empty server backend");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
@ -210,7 +214,8 @@ add_test(function test_processIncoming_createFromServer() {
_("SyncEngine._processIncoming creates new records from server data"); _("SyncEngine._processIncoming creates new records from server data");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
generateNewKeys(); generateNewKeys();
@ -271,7 +276,8 @@ add_test(function test_processIncoming_reconcile() {
_("SyncEngine._processIncoming updates local records"); _("SyncEngine._processIncoming updates local records");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
@ -590,7 +596,8 @@ add_test(function test_processIncoming_mobile_batchSize() {
_("SyncEngine._processIncoming doesn't fetch everything at once on mobile clients"); _("SyncEngine._processIncoming doesn't fetch everything at once on mobile clients");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Svc.Prefs.set("client.type", "mobile"); Svc.Prefs.set("client.type", "mobile");
@ -659,7 +666,8 @@ add_test(function test_processIncoming_mobile_batchSize() {
add_test(function test_processIncoming_store_toFetch() { add_test(function test_processIncoming_store_toFetch() {
_("If processIncoming fails in the middle of a batch on mobile, state is saved in toFetch and lastSync."); _("If processIncoming fails in the middle of a batch on mobile, state is saved in toFetch and lastSync.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Svc.Prefs.set("client.type", "mobile"); Svc.Prefs.set("client.type", "mobile");
@ -726,7 +734,8 @@ add_test(function test_processIncoming_store_toFetch() {
add_test(function test_processIncoming_resume_toFetch() { add_test(function test_processIncoming_resume_toFetch() {
_("toFetch and previousFailed items left over from previous syncs are fetched on the next sync, along with new items."); _("toFetch and previousFailed items left over from previous syncs are fetched on the next sync, along with new items.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
const LASTSYNC = Date.now() / 1000; const LASTSYNC = Date.now() / 1000;
@ -794,7 +803,8 @@ add_test(function test_processIncoming_resume_toFetch() {
add_test(function test_processIncoming_applyIncomingBatchSize_smaller() { add_test(function test_processIncoming_applyIncomingBatchSize_smaller() {
_("Ensure that a number of incoming items less than applyIncomingBatchSize is still applied."); _("Ensure that a number of incoming items less than applyIncomingBatchSize is still applied.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
// Engine that doesn't like the first and last record it's given. // Engine that doesn't like the first and last record it's given.
@ -848,7 +858,7 @@ add_test(function test_processIncoming_applyIncomingBatchSize_smaller() {
add_test(function test_processIncoming_applyIncomingBatchSize_multiple() { add_test(function test_processIncoming_applyIncomingBatchSize_multiple() {
_("Ensure that incoming items are applied according to applyIncomingBatchSize."); _("Ensure that incoming items are applied according to applyIncomingBatchSize.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
const APPLY_BATCH_SIZE = 10; const APPLY_BATCH_SIZE = 10;
@ -900,7 +910,8 @@ add_test(function test_processIncoming_applyIncomingBatchSize_multiple() {
add_test(function test_processIncoming_notify_count() { add_test(function test_processIncoming_notify_count() {
_("Ensure that failed records are reported only once."); _("Ensure that failed records are reported only once.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
const APPLY_BATCH_SIZE = 5; const APPLY_BATCH_SIZE = 5;
@ -986,7 +997,8 @@ add_test(function test_processIncoming_notify_count() {
add_test(function test_processIncoming_previousFailed() { add_test(function test_processIncoming_previousFailed() {
_("Ensure that failed records are retried."); _("Ensure that failed records are retried.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
Svc.Prefs.set("client.type", "mobile"); Svc.Prefs.set("client.type", "mobile");
@ -1071,7 +1083,8 @@ add_test(function test_processIncoming_previousFailed() {
add_test(function test_processIncoming_failed_records() { add_test(function test_processIncoming_failed_records() {
_("Ensure that failed records from _reconcile and applyIncomingBatch are refetched."); _("Ensure that failed records from _reconcile and applyIncomingBatch are refetched.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
// Let's create three and a bit batches worth of server side records. // Let's create three and a bit batches worth of server side records.
@ -1205,7 +1218,8 @@ add_test(function test_processIncoming_decrypt_failed() {
_("Ensure that records failing to decrypt are either replaced or refetched."); _("Ensure that records failing to decrypt are either replaced or refetched.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
// Some good and some bogus records. One doesn't contain valid JSON, // Some good and some bogus records. One doesn't contain valid JSON,
@ -1282,7 +1296,8 @@ add_test(function test_uploadOutgoing_toEmptyServer() {
_("SyncEngine._uploadOutgoing uploads new records to server"); _("SyncEngine._uploadOutgoing uploads new records to server");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
collection._wbos.flying = new ServerWBO('flying'); collection._wbos.flying = new ServerWBO('flying');
@ -1340,7 +1355,8 @@ add_test(function test_uploadOutgoing_failed() {
_("SyncEngine._uploadOutgoing doesn't clear the tracker of objects that failed to upload."); _("SyncEngine._uploadOutgoing doesn't clear the tracker of objects that failed to upload.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
// We only define the "flying" WBO on the server, not the "scotsman" // We only define the "flying" WBO on the server, not the "scotsman"
@ -1402,7 +1418,8 @@ add_test(function test_uploadOutgoing_MAX_UPLOAD_RECORDS() {
_("SyncEngine._uploadOutgoing uploads in batches of MAX_UPLOAD_RECORDS"); _("SyncEngine._uploadOutgoing uploads in batches of MAX_UPLOAD_RECORDS");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
@ -1473,7 +1490,8 @@ add_test(function test_syncFinish_deleteByIds() {
_("SyncEngine._syncFinish deletes server records slated for deletion (list of record IDs)."); _("SyncEngine._syncFinish deletes server records slated for deletion (list of record IDs).");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
collection._wbos.flying = new ServerWBO( collection._wbos.flying = new ServerWBO(
@ -1514,7 +1532,8 @@ add_test(function test_syncFinish_deleteLotsInBatches() {
_("SyncEngine._syncFinish deletes server records in batches of 100 (list of record IDs)."); _("SyncEngine._syncFinish deletes server records in batches of 100 (list of record IDs).");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
@ -1585,7 +1604,8 @@ add_test(function test_sync_partialUpload() {
_("SyncEngine.sync() keeps changedIDs that couldn't be uploaded."); _("SyncEngine.sync() keeps changedIDs that couldn't be uploaded.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
let collection = new ServerCollection(); let collection = new ServerCollection();
@ -1658,7 +1678,8 @@ add_test(function test_sync_partialUpload() {
add_test(function test_canDecrypt_noCryptoKeys() { add_test(function test_canDecrypt_noCryptoKeys() {
_("SyncEngine.canDecrypt returns false if the engine fails to decrypt items on the server, e.g. due to a missing crypto key collection."); _("SyncEngine.canDecrypt returns false if the engine fails to decrypt items on the server, e.g. due to a missing crypto key collection.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
// Wipe CollectionKeys so we can test the desired scenario. // Wipe CollectionKeys so we can test the desired scenario.
@ -1686,7 +1707,8 @@ add_test(function test_canDecrypt_noCryptoKeys() {
add_test(function test_canDecrypt_true() { add_test(function test_canDecrypt_true() {
_("SyncEngine.canDecrypt returns true if the engine can decrypt the items on the server."); _("SyncEngine.canDecrypt returns true if the engine can decrypt the items on the server.");
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
// Set up CollectionKeys, as service.js does. // Set up CollectionKeys, as service.js does.
@ -1714,7 +1736,8 @@ add_test(function test_canDecrypt_true() {
add_test(function test_syncapplied_observer() { add_test(function test_syncapplied_observer() {
let syncTesting = new SyncTestingInfrastructure(); let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/"); Svc.Prefs.set("serverURL", TEST_SERVER_URL);
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
Svc.Prefs.set("username", "foo"); Svc.Prefs.set("username", "foo");
const NUMBER_OF_RECORDS = 10; const NUMBER_OF_RECORDS = 10;

View File

@ -52,7 +52,7 @@ function setUp() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
generateNewKeys(); generateNewKeys();
let serverKeys = CollectionKeys.asWBO("crypto", "keys"); let serverKeys = CollectionKeys.asWBO("crypto", "keys");
@ -667,7 +667,7 @@ add_test(function test_no_sync_node() {
let server = sync_httpd_setup(); let server = sync_httpd_setup();
setUp(); setUp();
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.sync(); Service.sync();
do_check_eq(Status.sync, NO_SYNC_NODE_FOUND); do_check_eq(Status.sync, NO_SYNC_NODE_FOUND);
@ -852,8 +852,8 @@ add_test(function test_loginError_recoverable_reschedules() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
Service.persistLogin(); Service.persistLogin();
Status.resetSync(); // reset Status.login Status.resetSync(); // reset Status.login
@ -896,8 +896,8 @@ add_test(function test_loginError_fatal_clearsTriggers() {
Service.username = "johndoe"; Service.username = "johndoe";
Service.password = "ilovejane"; Service.password = "ilovejane";
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea"; Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
Service.serverURL = "http://localhost:8080/"; Service.serverURL = TEST_SERVER_URL;
Service.clusterURL = "http://localhost:8080/"; Service.clusterURL = TEST_CLUSTER_URL;
Service.persistLogin(); Service.persistLogin();
Status.resetSync(); // reset Status.login Status.resetSync(); // reset Status.login

View File

@ -7,6 +7,8 @@ Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/log4moz.js"); Cu.import("resource://services-sync/log4moz.js");
const STORAGE_REQUEST_RESOURCE_URL = TEST_SERVER_URL + "resource";
function run_test() { function run_test() {
Log4Moz.repository.getLogger("Sync.RESTRequest").level = Log4Moz.Level.Trace; Log4Moz.repository.getLogger("Sync.RESTRequest").level = Log4Moz.Level.Trace;
initTestLogging(); initTestLogging();
@ -22,7 +24,7 @@ add_test(function test_user_agent_desktop() {
" FxSync/" + WEAVE_VERSION + "." + " FxSync/" + WEAVE_VERSION + "." +
Services.appinfo.appBuildID + ".desktop"; Services.appinfo.appBuildID + ".desktop";
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
request.onComplete = function onComplete(error) { request.onComplete = function onComplete(error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -41,7 +43,7 @@ add_test(function test_user_agent_mobile() {
" FxSync/" + WEAVE_VERSION + "." + " FxSync/" + WEAVE_VERSION + "." +
Services.appinfo.appBuildID + ".mobile"; Services.appinfo.appBuildID + ".mobile";
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -59,7 +61,7 @@ add_test(function test_auth() {
id.password = "ilovejane"; id.password = "ilovejane";
ID.set("WeaveID", id); ID.set("WeaveID", id);
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -82,7 +84,7 @@ add_test(function test_weave_timestamp() {
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
do_check_eq(SyncStorageRequest.serverTime, undefined); do_check_eq(SyncStorageRequest.serverTime, undefined);
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -108,7 +110,7 @@ add_test(function test_weave_backoff() {
backoffInterval = subject; backoffInterval = subject;
}); });
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -133,7 +135,7 @@ add_test(function test_weave_quota_notice() {
quotaValue = subject; quotaValue = subject;
}); });
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 200); do_check_eq(this.response.status, 200);
@ -158,7 +160,7 @@ add_test(function test_weave_quota_error() {
} }
Svc.Obs.add("weave:service:quota:remaining", onQuota); Svc.Obs.add("weave:service:quota:remaining", onQuota);
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
request.get(function (error) { request.get(function (error) {
do_check_eq(error, null); do_check_eq(error, null);
do_check_eq(this.response.status, 400); do_check_eq(this.response.status, 400);
@ -177,7 +179,7 @@ add_test(function test_abort() {
} }
let server = httpd_setup({"/resource": handler}); let server = httpd_setup({"/resource": handler});
let request = new SyncStorageRequest("http://localhost:8080/resource"); let request = new SyncStorageRequest(STORAGE_REQUEST_RESOURCE_URL);
// Aborting a request that hasn't been sent yet is pointless and will throw. // Aborting a request that hasn't been sent yet is pointless and will throw.
do_check_throws(function () { do_check_throws(function () {

View File

@ -93,6 +93,7 @@ const SYNC_START_OVER = "start-over";
let TPS = let TPS =
{ {
_waitingForSync: false, _waitingForSync: false,
_isTracking: false,
_test: null, _test: null,
_currentAction: -1, _currentAction: -1,
_currentPhase: -1, _currentPhase: -1,
@ -148,6 +149,15 @@ let TPS =
}, 1000, this, "postsync"); }, 1000, this, "postsync");
} }
break; break;
case "weave:engine:start-tracking":
this._isTracking = true;
break;
case "weave:engine:stop-tracking":
this._isTracking = false;
break;
case "sessionstore-windows-restored": case "sessionstore-windows-restored":
Utils.nextTick(this.RunNextTestAction, this); Utils.nextTick(this.RunNextTestAction, this);
break; break;
@ -533,7 +543,31 @@ let TPS =
return; return;
} }
// setup observers // Wait for Sync service to become ready.
if (!Weave.Status.ready) {
this.waitForEvent("weave:service:ready");
}
// Always give Sync an extra tick to initialize. If we waited for the
// service:ready event, this is required to ensure all handlers have
// executed.
Utils.nextTick(this._executeTestPhase.bind(this, file, phase, settings));
} catch(e) {
this.DumpError("Exception caught: " + Utils.exceptionStr(e));
return;
}
},
/**
* Executes a single test phase.
*
* This is called by RunTestPhase() after the environment is validated.
*/
_executeTestPhase: function _executeTestPhase(file, phase, settings) {
try {
// TODO Unregister observers on unload (bug 721283).
Services.obs.addObserver(this, "weave:engine:start-tracking", true);
Services.obs.addObserver(this, "weave:engine:stop-tracking", true);
Services.obs.addObserver(this, "weave:service:sync:finish", true); Services.obs.addObserver(this, "weave:service:sync:finish", true);
Services.obs.addObserver(this, "weave:service:sync:error", true); Services.obs.addObserver(this, "weave:service:sync:error", true);
Services.obs.addObserver(this, "sessionstore-windows-restored", true); Services.obs.addObserver(this, "sessionstore-windows-restored", true);
@ -669,6 +703,41 @@ let TPS =
Logger.logInfo("set privateBrowsingEnabled: " + options); Logger.logInfo("set privateBrowsingEnabled: " + options);
}, },
/**
* Synchronously wait for the named event to be observed.
*
* When the event is observed, the function will wait an extra tick before
* returning.
*
* @param name
* String event to wait for.
*/
waitForEvent:function waitForEvent(name) {
Logger.logInfo("Waiting for " + name + "...");
let cb = Async.makeSpinningCallback();
Svc.Obs.add(name, cb);
cb.wait();
Svc.Obs.remove(name, cb);
Logger.logInfo(name + " observed!");
let cb = Async.makeSpinningCallback();
Utils.nextTick(cb);
cb.wait();
},
/**
* Waits for Sync to start tracking before returning.
*/
waitForTracking: function waitForTracking() {
if (!this._isTracking) {
this.waitForEvent("weave:engine:start-tracking");
}
let cb = Async.makeSyncCallback();
Utils.nextTick(cb);
Async.waitForSyncCallback(cb);
},
/** /**
* Reset the client and server to an empty/pure state. * Reset the client and server to an empty/pure state.
* *
@ -689,6 +758,8 @@ let TPS =
Service.wipeServer(); Service.wipeServer();
Service.resetClient(); Service.resetClient();
Service.login(); Service.login();
this.waitForTracking();
}, },
Login: function Login(force) { Login: function Login(force) {
@ -734,6 +805,8 @@ let TPS =
Logger.AssertEqual(Weave.Status.service, Weave.STATUS_OK, "Weave status not OK"); Logger.AssertEqual(Weave.Status.service, Weave.STATUS_OK, "Weave status not OK");
Weave.Svc.Obs.notify("weave:service:setup-complete"); Weave.Svc.Obs.notify("weave:service:setup-complete");
this._loggedIn = true; this._loggedIn = true;
this.waitForTracking();
}, },
Sync: function TPS__Sync(options) { Sync: function TPS__Sync(options) {
@ -767,6 +840,14 @@ let TPS =
this.Login(); this.Login();
Weave.Service.wipeServer(); Weave.Service.wipeServer();
}, },
/**
* Action which ensures changes are being tracked before returning.
*/
EnsureTracking: function EnsureTracking() {
this.Login(false);
this.waitForTracking();
}
}; };
var Addons = { var Addons = {

View File

@ -50,6 +50,7 @@
#endif #endif
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "prlog.h" #include "prlog.h"
@ -151,12 +152,76 @@ static DllBlockInfo sWindowsDllBlocklist[] = {
// define this for very verbose dll load debug spew // define this for very verbose dll load debug spew
#undef DEBUG_very_verbose #undef DEBUG_very_verbose
extern bool gInXPCOMLoadOnMainThread;
namespace { namespace {
typedef NTSTATUS (NTAPI *LdrLoadDll_func) (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle); typedef NTSTATUS (NTAPI *LdrLoadDll_func) (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle);
static LdrLoadDll_func stub_LdrLoadDll = 0; static LdrLoadDll_func stub_LdrLoadDll = 0;
template <class T>
struct RVAMap {
RVAMap(HANDLE map, DWORD offset) {
SYSTEM_INFO info;
GetSystemInfo(&info);
DWORD alignedOffset = (offset / info.dwAllocationGranularity) *
info.dwAllocationGranularity;
NS_ASSERTION(offset - alignedOffset < info.dwAllocationGranularity, "Wtf");
void* mRealView = ::MapViewOfFile(map, FILE_MAP_READ, 0, alignedOffset,
sizeof(T) + (offset - alignedOffset));
mMappedView = reinterpret_cast<T*>((char*)mRealView + (offset - alignedOffset));
}
~RVAMap() {
if (mRealView) {
::UnmapViewOfFile(mRealView);
}
}
operator const T*() const { return mMappedView; }
const T* operator->() const { return mMappedView; }
private:
const T* mMappedView;
void* mRealView;
};
bool
CheckASLR(const wchar_t* path)
{
bool retval = false;
HANDLE file = ::CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
if (file != INVALID_HANDLE_VALUE) {
HANDLE map = ::CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
if (map) {
RVAMap<IMAGE_DOS_HEADER> peHeader(map, 0);
if (peHeader) {
RVAMap<IMAGE_NT_HEADERS> ntHeader(map, peHeader->e_lfanew);
if (ntHeader) {
// If the DLL has no code, permit it regardless of ASLR status.
if (ntHeader->OptionalHeader.SizeOfCode == 0) {
retval = true;
}
// Check to see if the DLL supports ASLR
else if ((ntHeader->OptionalHeader.DllCharacteristics &
IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) != 0) {
retval = true;
}
}
}
::CloseHandle(map);
}
::CloseHandle(file);
}
return retval;
}
/** /**
* Some versions of Windows call LoadLibraryEx to get the version information * Some versions of Windows call LoadLibraryEx to get the version information
* for a DLL, which causes our patched LdrLoadDll implementation to re-enter * for a DLL, which causes our patched LdrLoadDll implementation to re-enter
@ -225,6 +290,29 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam
int len = moduleFileName->Length / 2; int len = moduleFileName->Length / 2;
wchar_t *fname = moduleFileName->Buffer; wchar_t *fname = moduleFileName->Buffer;
// In Windows 8, the first parameter seems to be used for more than just the
// path name. For example, its numerical value can be 1. Passing a non-valid
// pointer to SearchPathW will cause a crash, so we need to check to see if we
// are handed a valid pointer, and otherwise just pass NULL to SearchPathW.
PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? NULL : filePath;
// figure out the length of the string that we need
DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, NULL, NULL);
if (pathlen == 0) {
// uh, we couldn't find the DLL at all, so...
printf_stderr("LdrLoadDll: Blocking load of '%s' (SearchPathW didn't find it?)\n", dllName);
return STATUS_DLL_NOT_FOUND;
}
nsAutoArrayPtr<wchar_t> full_fname(new wchar_t[pathlen+1]);
if (!full_fname) {
// couldn't allocate memory?
return STATUS_DLL_NOT_FOUND;
}
// now actually grab it
SearchPathW(sanitizedFilePath, fname, L".dll", pathlen+1, full_fname, NULL);
// The filename isn't guaranteed to be null terminated, but in practice // The filename isn't guaranteed to be null terminated, but in practice
// it always will be; ensure that this is so, and bail if not. // it always will be; ensure that this is so, and bail if not.
// This is done instead of the more robust approach because of bug 527122, // This is done instead of the more robust approach because of bug 527122,
@ -305,29 +393,6 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam
goto continue_loading; goto continue_loading;
} }
// In Windows 8, the first parameter seems to be used for more than just the
// path name. For example, its numerical value can be 1. Passing a non-valid
// pointer to SearchPathW will cause a crash, so we need to check to see if we
// are handed a valid pointer, and otherwise just pass NULL to SearchPathW.
PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? NULL : filePath;
// figure out the length of the string that we need
DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, NULL, NULL);
if (pathlen == 0) {
// uh, we couldn't find the DLL at all, so...
printf_stderr("LdrLoadDll: Blocking load of '%s' (SearchPathW didn't find it?)\n", dllName);
return STATUS_DLL_NOT_FOUND;
}
wchar_t *full_fname = (wchar_t*) malloc(sizeof(wchar_t)*(pathlen+1));
if (!full_fname) {
// couldn't allocate memory?
return STATUS_DLL_NOT_FOUND;
}
// now actually grab it
SearchPathW(sanitizedFilePath, fname, L".dll", pathlen+1, full_fname, NULL);
DWORD zero; DWORD zero;
DWORD infoSize = GetFileVersionInfoSizeW(full_fname, &zero); DWORD infoSize = GetFileVersionInfoSizeW(full_fname, &zero);
@ -351,8 +416,6 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam
load_ok = true; load_ok = true;
} }
} }
free(full_fname);
} }
if (!load_ok) { if (!load_ok) {
@ -368,6 +431,14 @@ continue_loading:
NS_SetHasLoadedNewDLLs(); NS_SetHasLoadedNewDLLs();
if (gInXPCOMLoadOnMainThread && NS_IsMainThread()) {
// Check to ensure that the DLL has ASLR.
if (!CheckASLR(full_fname)) {
printf_stderr("LdrLoadDll: Blocking load of '%s'. XPCOM components must support ASLR.\n", dllName);
return STATUS_DLL_NOT_FOUND;
}
}
return stub_LdrLoadDll(filePath, flags, moduleFileName, handle); return stub_LdrLoadDll(filePath, flags, moduleFileName, handle);
} }

View File

@ -450,7 +450,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) { if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
// Blacklist all ATI cards on OSX, except for // Blacklist all ATI cards on OSX, except for
// 0x6760 and 0x9488 // 0x6760 and 0x9488
if (mAdapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorATI) && if (mAdapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
(mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") || (mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") ||
mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) { mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) {
*aStatus = nsIGfxInfo::FEATURE_NO_INFO; *aStatus = nsIGfxInfo::FEATURE_NO_INFO;

View File

@ -963,10 +963,10 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
if (adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorIntel) && if (!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorIntel), nsCaseInsensitiveStringComparator()) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) && !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorAMD) && !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorAMD), nsCaseInsensitiveStringComparator()) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorATI) && !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) &&
// FIXME - these special hex values are currently used in xpcshell tests introduced by // FIXME - these special hex values are currently used in xpcshell tests introduced by
// bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting // bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
// intel/ati/nvidia. // intel/ati/nvidia.
@ -988,7 +988,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
// whitelist them, actually we do know that this combination of device and driver version // whitelist them, actually we do know that this combination of device and driver version
// works well. // works well.
if (mWindowsVersion == gfxWindowsPlatform::kWindowsXP && if (mWindowsVersion == gfxWindowsPlatform::kWindowsXP &&
adapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) && adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) &&
adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400 adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400
driverVersion == V(6,14,11,7756)) driverVersion == V(6,14,11,7756))
{ {

View File

@ -47,6 +47,7 @@
#include "nsCOMArray.h" #include "nsCOMArray.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsString.h" #include "nsString.h"
#include "nsUnicharUtils.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/Observer.h" #include "mozilla/Observer.h"
#include "nsIObserver.h" #include "nsIObserver.h"
@ -643,15 +644,15 @@ GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
continue; continue;
} }
if (info[i].mAdapterVendor != GfxDriverInfo::GetDeviceVendor(VendorAll) && if (!info[i].mAdapterVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator()) &&
info[i].mAdapterVendor != adapterVendorID) { !info[i].mAdapterVendor.Equals(adapterVendorID, nsCaseInsensitiveStringComparator())) {
continue; continue;
} }
if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) { if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) {
bool deviceMatches = false; bool deviceMatches = false;
for (PRUint32 j = 0; j < info[i].mDevices->Length(); j++) { for (PRUint32 j = 0; j < info[i].mDevices->Length(); j++) {
if ((*info[i].mDevices)[j] == adapterDeviceID) { if ((*info[i].mDevices)[j].Equals(adapterDeviceID, nsCaseInsensitiveStringComparator())) {
deviceMatches = true; deviceMatches = true;
break; break;
} }

View File

@ -87,6 +87,8 @@ using namespace mozilla;
static PRLogModuleInfo *nsNativeModuleLoaderLog = static PRLogModuleInfo *nsNativeModuleLoaderLog =
PR_NewLogModule("nsNativeModuleLoader"); PR_NewLogModule("nsNativeModuleLoader");
bool gInXPCOMLoadOnMainThread = false;
#define LOG(level, args) PR_LOG(nsNativeModuleLoaderLog, level, args) #define LOG(level, args) PR_LOG(nsNativeModuleLoaderLog, level, args)
NS_IMPL_QUERY_INTERFACE1(nsNativeModuleLoader, NS_IMPL_QUERY_INTERFACE1(nsNativeModuleLoader,
@ -167,7 +169,9 @@ nsNativeModuleLoader::LoadModule(FileLocation &aFile)
// We haven't loaded this module before // We haven't loaded this module before
gInXPCOMLoadOnMainThread = true;
rv = file->Load(&data.library); rv = file->Load(&data.library);
gInXPCOMLoadOnMainThread = false;
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
char errorMsg[1024] = "<unknown; can't get error from NSPR>"; char errorMsg[1024] = "<unknown; can't get error from NSPR>";

View File

@ -45,7 +45,12 @@ include $(DEPTH)/config/autoconf.mk
MODULE = xpcom MODULE = xpcom
DIRS = external component bug656331_component DIRS = \
external \
component \
bug656331_component \
component_no_aslr \
$(NULL)
ifeq ($(OS_ARCH),WINNT) ifeq ($(OS_ARCH),WINNT)
DIRS += windows DIRS += windows

View File

@ -0,0 +1,81 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Benjamin Smedberg <benjamin@smedbergs.us>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = testcompnoaslr
IS_COMPONENT = 1
CPPSRCS = TestComponent.cpp
NO_DIST_INSTALL = 1
FORCE_SHARED_LIB = 1
include $(topsrcdir)/config/config.mk
MANIFEST_FILE = testcompnoaslr.manifest
EXTRA_DSO_LDOPTS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(XPCOM_FROZEN_LDOPTS) \
$(NSPR_LIBS) \
$(NULL)
# Need to link with CoreFoundation on Mac
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
EXTRA_DSO_LDOPTS += \
$(TK_LIBS) \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
LDFLAGS := $(filter-out -DYNAMICBASE,$(LDFLAGS)) -DYNAMICBASE:NO
DEFINES += -DLIBRARY_FILENAME="$(SHARED_LIBRARY)"
unittestlocation = xpcom/tests/unit
libs:: $(SHARED_LIBRARY)
$(INSTALL) $^ $(testxpcobjdir)/$(unittestlocation)
libs:: $(MANIFEST_FILE)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $(testxpcobjdir)/$(unittestlocation)/$(<F)

View File

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Suresh Duddu <dp@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/ModuleUtils.h"
#define NS_TESTING_CID \
{ 0x335fb596, 0xe52d, 0x418f, \
{ 0xb0, 0x1c, 0x1b, 0xf1, 0x6c, 0xe5, 0xe7, 0xe4 } }
NS_DEFINE_NAMED_CID(NS_TESTING_CID);
static nsresult
DummyConstructorFunc(nsISupports* aOuter, const nsIID& aIID, void** aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
static const mozilla::Module::CIDEntry kTestCIDs[] = {
{ &kNS_TESTING_CID, false, NULL, DummyConstructorFunc },
{ NULL }
};
static const mozilla::Module kTestModule = {
mozilla::Module::kVersion,
kTestCIDs
};
NSMODULE_DEFN(dummy) = &kTestModule;

View File

@ -0,0 +1,2 @@
#filter substitution
binary-component @LIBRARY_FILENAME@

View File

@ -0,0 +1,10 @@
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const Cc = Components.classes;
const Ci = Components.interfaces;
function run_test() {
let manifest = do_get_file('testcompwithaslr.manifest');
Components.manager.autoRegister(manifest);
do_check_false("{335fb596-e52d-418f-b01c-1bf16ce5e7e4}" in Components.classesByID);
}

View File

@ -42,3 +42,5 @@ fail-if = os == "android"
# Bug 676998: test fails consistently on Android # Bug 676998: test fails consistently on Android
fail-if = os == "android" fail-if = os == "android"
[test_versioncomparator.js] [test_versioncomparator.js]
[test_comp_no_aslr.js]
fail-if = os != "win"