mozilla-backout-677092.patch
branchfirefox18
changeset 604 127a01719356
parent 603 cfcae96df099
child 607 dfcb6d8fcf5a
child 608 ec1d401e061d
equal deleted inserted replaced
603:cfcae96df099 604:127a01719356
     1 # HG changeset patch
       
     2 # Parent 297b3a7802b2488cca8f2e6febc77e9dbf7f16e0
       
     3 # User Wolfgang Rosenauer <wr@rosenauer.org>
       
     4 Bug 818468 - Langpacks bundled in distribution/extensions are registered but disabled even if shown enabled
       
     5 (backing out Bug 677092 - Make language packs restartless by default)
       
     6 
       
     7 diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm
       
     8 --- a/toolkit/mozapps/extensions/XPIProvider.jsm
       
     9 +++ b/toolkit/mozapps/extensions/XPIProvider.jsm
       
    10 @@ -757,18 +757,18 @@ function loadManifestFromRDF(aUri, aStre
       
    11      if (addon.optionsType &&
       
    12          addon.optionsType != AddonManager.OPTIONS_TYPE_DIALOG &&
       
    13          addon.optionsType != AddonManager.OPTIONS_TYPE_INLINE &&
       
    14          addon.optionsType != AddonManager.OPTIONS_TYPE_TAB) {
       
    15        throw new Error("Install manifest specifies unknown type: " + addon.optionsType);
       
    16      }
       
    17    }
       
    18    else {
       
    19 -    // spell check dictionaries and language packs never require a restart
       
    20 -    if (addon.type == "dictionary" || addon.type == "locale")
       
    21 +    // spell check dictionaries never require a restart
       
    22 +    if (addon.type == "dictionary")
       
    23        addon.bootstrap = true;
       
    24  
       
    25      // Only extensions are allowed to provide an optionsURL, optionsType or aboutURL. For
       
    26      // all other types they are silently ignored
       
    27      addon.optionsURL = null;
       
    28      addon.optionsType = null;
       
    29      addon.aboutURL = null;
       
    30  
       
    31 @@ -3712,21 +3712,16 @@ var XPIProvider = {
       
    32      // Never call any bootstrap methods in safe mode
       
    33      if (Services.appinfo.inSafeMode)
       
    34        return;
       
    35  
       
    36      if (aMethod == "startup")
       
    37        Components.manager.addBootstrappedManifestLocation(aFile);
       
    38  
       
    39      try {
       
    40 -      // Don't call bootstrap.js methods for language packs,
       
    41 -      // they only contain chrome.
       
    42 -      if (aType == "locale")
       
    43 -         return;
       
    44 -
       
    45        // Load the scope if it hasn't already been loaded
       
    46        if (!(aId in this.bootstrapScopes))
       
    47          this.loadBootstrapScope(aId, aFile, aVersion, aType);
       
    48  
       
    49        if (!(aMethod in this.bootstrapScopes[aId])) {
       
    50          WARN("Add-on " + aId + " is missing bootstrap method " + aMethod);
       
    51          return;
       
    52        }
       
    53 diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js b/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
       
    54 --- a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
       
    55 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
       
    56 @@ -4,19 +4,16 @@
       
    57  
       
    58  // This verifies that bootstrappable add-ons can be used without restarts.
       
    59  Components.utils.import("resource://gre/modules/Services.jsm");
       
    60  
       
    61  // Enable loading extensions from the user scopes
       
    62  Services.prefs.setIntPref("extensions.enabledScopes",
       
    63                            AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_USER);
       
    64  
       
    65 -// The test extension uses an insecure update url.
       
    66 -Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
       
    67 -
       
    68  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
       
    69  
       
    70  const profileDir = gProfD.clone();
       
    71  profileDir.append("extensions");
       
    72  const userExtDir = gProfD.clone();
       
    73  userExtDir.append("extensions2");
       
    74  userExtDir.append(gAppInfo.ID);
       
    75  registerDirectory("XREUSysExt", userExtDir.parent);
       
    76 @@ -98,17 +95,16 @@ var HunspellEngine = {
       
    77    }
       
    78  };
       
    79  
       
    80  function run_test() {
       
    81    do_test_pending();
       
    82  
       
    83    // Create and configure the HTTP server.
       
    84    testserver = new HttpServer();
       
    85 -  testserver.registerDirectory("/data/", do_get_file("data"));
       
    86    testserver.registerDirectory("/addons/", do_get_file("addons"));
       
    87    testserver.start(4444);
       
    88  
       
    89    startupManager();
       
    90  
       
    91    run_test_1();
       
    92  }
       
    93  
       
    94 @@ -563,17 +559,17 @@ function check_test_23() {
       
    95        AddonManager.getAddonsWithOperationsByTypes(null, function(list) {
       
    96          do_check_eq(list.length, 0);
       
    97  
       
    98          restartManager();
       
    99          AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) {
       
   100            b1.uninstall();
       
   101            restartManager();
       
   102  
       
   103 -          run_test_25();
       
   104 +          testserver.stop(run_test_25);
       
   105          });
       
   106        });
       
   107      });
       
   108    });
       
   109  }
       
   110  
       
   111  // Tests that updating from a bootstrappable add-on to a normal add-on calls
       
   112  // the uninstall method
       
   113 @@ -631,160 +627,15 @@ function run_test_26() {
       
   114  
       
   115        AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) {
       
   116          do_check_neq(b1, null);
       
   117          do_check_eq(b1.version, "1.0");
       
   118          do_check_true(b1.isActive);
       
   119          do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
       
   120  
       
   121          HunspellEngine.deactivate();
       
   122 -        b1.uninstall();
       
   123 -        restartManager();
       
   124 -        run_test_27();
       
   125 +
       
   126 +        do_test_finished();
       
   127        });
       
   128      });
       
   129    });
       
   130  }
       
   131  
       
   132 -// Tests that an update check from a normal add-on to a bootstrappable add-on works
       
   133 -function run_test_27() {
       
   134 -  writeInstallRDFForExtension({
       
   135 -    id: "ab-CD@dictionaries.addons.mozilla.org",
       
   136 -    version: "1.0",
       
   137 -    updateURL: "http://localhost:4444/data/test_dictionary.rdf",
       
   138 -    targetApplications: [{
       
   139 -      id: "xpcshell@tests.mozilla.org",
       
   140 -      minVersion: "1",
       
   141 -      maxVersion: "1"
       
   142 -    }],
       
   143 -    name: "Test Dictionary",
       
   144 -  }, profileDir);
       
   145 -  restartManager();
       
   146 -
       
   147 -  prepare_test({
       
   148 -    "ab-CD@dictionaries.addons.mozilla.org": [
       
   149 -      "onInstalling"
       
   150 -    ]
       
   151 -  }, [
       
   152 -    "onNewInstall",
       
   153 -    "onDownloadStarted",
       
   154 -    "onDownloadEnded",
       
   155 -    "onInstallStarted",
       
   156 -    "onInstallEnded"
       
   157 -  ], check_test_27);
       
   158 -
       
   159 -  AddonManagerPrivate.backgroundUpdateCheck();
       
   160 -}
       
   161 -
       
   162 -function check_test_27(install) {
       
   163 -  do_check_eq(install.existingAddon.pendingUpgrade.install, install);
       
   164 -
       
   165 -  restartManager();
       
   166 -  AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) {
       
   167 -    do_check_neq(b1, null);
       
   168 -    do_check_eq(b1.version, "2.0");
       
   169 -    do_check_eq(b1.type, "dictionary");
       
   170 -    b1.uninstall();
       
   171 -    restartManager();
       
   172 -
       
   173 -    run_test_28();
       
   174 -  });
       
   175 -}
       
   176 -
       
   177 -// Tests that an update check from a bootstrappable add-on to a normal add-on works
       
   178 -function run_test_28() {
       
   179 -  writeInstallRDFForExtension({
       
   180 -    id: "ef@dictionaries.addons.mozilla.org",
       
   181 -    version: "1.0",
       
   182 -    type: "64",
       
   183 -    updateURL: "http://localhost:4444/data/test_dictionary.rdf",
       
   184 -    targetApplications: [{
       
   185 -      id: "xpcshell@tests.mozilla.org",
       
   186 -      minVersion: "1",
       
   187 -      maxVersion: "1"
       
   188 -    }],
       
   189 -    name: "Test Dictionary ef",
       
   190 -  }, profileDir);
       
   191 -  restartManager();
       
   192 -
       
   193 -  prepare_test({
       
   194 -    "ef@dictionaries.addons.mozilla.org": [
       
   195 -      "onInstalling"
       
   196 -    ]
       
   197 -  }, [
       
   198 -    "onNewInstall",
       
   199 -    "onDownloadStarted",
       
   200 -    "onDownloadEnded",
       
   201 -    "onInstallStarted",
       
   202 -    "onInstallEnded"
       
   203 -  ], check_test_28);
       
   204 -
       
   205 -  AddonManagerPrivate.backgroundUpdateCheck();
       
   206 -}
       
   207 -
       
   208 -function check_test_28(install) {
       
   209 -  do_check_eq(install.existingAddon.pendingUpgrade.install, install);
       
   210 -
       
   211 -  restartManager();
       
   212 -  AddonManager.getAddonByID("ef@dictionaries.addons.mozilla.org", function(b2) {
       
   213 -    do_check_neq(b2, null);
       
   214 -    do_check_eq(b2.version, "2.0");
       
   215 -    do_check_eq(b2.type, "extension");
       
   216 -    b2.uninstall();
       
   217 -    restartManager();
       
   218 -
       
   219 -    run_test_29();
       
   220 -  });
       
   221 -}
       
   222 -
       
   223 -// Tests that an update check from a bootstrappable add-on to a bootstrappable add-on works
       
   224 -function run_test_29() {
       
   225 -  writeInstallRDFForExtension({
       
   226 -    id: "gh@dictionaries.addons.mozilla.org",
       
   227 -    version: "1.0",
       
   228 -    type: "64",
       
   229 -    updateURL: "http://localhost:4444/data/test_dictionary.rdf",
       
   230 -    targetApplications: [{
       
   231 -      id: "xpcshell@tests.mozilla.org",
       
   232 -      minVersion: "1",
       
   233 -      maxVersion: "1"
       
   234 -    }],
       
   235 -    name: "Test Dictionary gh",
       
   236 -  }, profileDir);
       
   237 -  restartManager();
       
   238 -
       
   239 -  prepare_test({
       
   240 -    "gh@dictionaries.addons.mozilla.org": [
       
   241 -      ["onInstalling", false /* = no restart */],
       
   242 -      ["onInstalled", false]
       
   243 -    ]
       
   244 -  }, [
       
   245 -    "onNewInstall",
       
   246 -    "onDownloadStarted",
       
   247 -    "onDownloadEnded",
       
   248 -    "onInstallStarted",
       
   249 -    "onInstallEnded"
       
   250 -  ], check_test_29);
       
   251 -
       
   252 -  AddonManagerPrivate.backgroundUpdateCheck();
       
   253 -}
       
   254 -
       
   255 -function check_test_29(install) {
       
   256 -  AddonManager.getAddonByID("gh@dictionaries.addons.mozilla.org", function(b2) {
       
   257 -    do_check_neq(b2, null);
       
   258 -    do_check_eq(b2.version, "2.0");
       
   259 -    do_check_eq(b2.type, "dictionary");
       
   260 -
       
   261 -    prepare_test({
       
   262 -      "gh@dictionaries.addons.mozilla.org": [
       
   263 -        ["onUninstalling", false],
       
   264 -        ["onUninstalled", false],
       
   265 -      ]
       
   266 -    }, [
       
   267 -    ], finish_test_29);
       
   268 -
       
   269 -    b2.uninstall();
       
   270 -  });
       
   271 -}
       
   272 -
       
   273 -function finish_test_29() {
       
   274 -  testserver.stop(do_test_finished);
       
   275 -}
       
   276 diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
       
   277 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
       
   278 +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
       
   279 @@ -136,17 +136,16 @@ fail-if = os == "android"
       
   280  [test_cacheflush.js]
       
   281  [test_checkcompatibility.js]
       
   282  [test_ChromeManifestParser.js]
       
   283  [test_compatoverrides.js]
       
   284  [test_corrupt.js]
       
   285  [test_corrupt_strictcompat.js]
       
   286  [test_db_sanity.js]
       
   287  [test_dictionary.js]
       
   288 -[test_langpack.js]
       
   289  [test_disable.js]
       
   290  [test_distribution.js]
       
   291  [test_dss.js]
       
   292  # Bug 676992: test consistently fails on Android
       
   293  fail-if = os == "android"
       
   294  [test_duplicateplugins.js]
       
   295  # Bug 676992: test consistently hangs on Android
       
   296  skip-if = os == "android"