toolkit/mozapps/extensions/test/xpcshell/test_bug753900.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug753900.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,86 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.6 + */
     1.7 +
     1.8 +// This verifies that strange characters in an add-on version don't break the
     1.9 +// crash annotation.
    1.10 +
    1.11 +var addon1 = {
    1.12 +  id: "addon1@tests.mozilla.org",
    1.13 +  version: "1,0",
    1.14 +  name: "Test 1",
    1.15 +  targetApplications: [{
    1.16 +    id: "xpcshell@tests.mozilla.org",
    1.17 +    minVersion: "1",
    1.18 +    maxVersion: "1"
    1.19 +  }]
    1.20 +};
    1.21 +
    1.22 +var addon2 = {
    1.23 +  id: "addon2@tests.mozilla.org",
    1.24 +  version: "1:0",
    1.25 +  name: "Test 2",
    1.26 +  targetApplications: [{
    1.27 +    id: "xpcshell@tests.mozilla.org",
    1.28 +    minVersion: "1",
    1.29 +    maxVersion: "1"
    1.30 +  }]
    1.31 +};
    1.32 +
    1.33 +var addon3 = {
    1.34 +  id: "addon3@tests.mozilla.org",
    1.35 +  version: "1,0",
    1.36 +  name: "Test 3",
    1.37 +  bootstrap: true,
    1.38 +  targetApplications: [{
    1.39 +    id: "xpcshell@tests.mozilla.org",
    1.40 +    minVersion: "1",
    1.41 +    maxVersion: "1"
    1.42 +  }]
    1.43 +};
    1.44 +
    1.45 +var addon4 = {
    1.46 +  id: "addon4@tests.mozilla.org",
    1.47 +  version: "1:0",
    1.48 +  name: "Test 4",
    1.49 +  bootstrap: true,
    1.50 +  targetApplications: [{
    1.51 +    id: "xpcshell@tests.mozilla.org",
    1.52 +    minVersion: "1",
    1.53 +    maxVersion: "1"
    1.54 +  }]
    1.55 +};
    1.56 +
    1.57 +createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
    1.58 +
    1.59 +const profileDir = gProfD.clone();
    1.60 +profileDir.append("extensions");
    1.61 +
    1.62 +function run_test() {
    1.63 +  do_test_pending();
    1.64 +
    1.65 +  writeInstallRDFForExtension(addon1, profileDir);
    1.66 +  writeInstallRDFForExtension(addon2, profileDir);
    1.67 +  writeInstallRDFForExtension(addon3, profileDir);
    1.68 +  writeInstallRDFForExtension(addon4, profileDir);
    1.69 +
    1.70 +  startupManager();
    1.71 +
    1.72 +  AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
    1.73 +                               "addon2@tests.mozilla.org",
    1.74 +                               "addon3@tests.mozilla.org",
    1.75 +                               "addon4@tests.mozilla.org"],
    1.76 +                               function([a1, a2, a3, a4]) {
    1.77 +
    1.78 +    do_check_neq(a1, null);
    1.79 +    do_check_in_crash_annotation(addon1.id, addon1.version);
    1.80 +    do_check_neq(a2, null);
    1.81 +    do_check_in_crash_annotation(addon2.id, addon2.version);
    1.82 +    do_check_neq(a3, null);
    1.83 +    do_check_in_crash_annotation(addon3.id, addon3.version);
    1.84 +    do_check_neq(a4, null);
    1.85 +    do_check_in_crash_annotation(addon4.id, addon4.version);
    1.86 +
    1.87 +    do_execute_soon(do_test_finished);
    1.88 +  });
    1.89 +}

mercurial