Permalink
Browse files

Bug 854465: Use in-XPI modules if a preference is set.

  • Loading branch information...
1 parent 81dbd8f commit 78030fe8bb532448333c29f084f773981ee52d80 @Mossop committed Mar 25, 2013
Showing with 13 additions and 3 deletions.
  1. +13 −3 app-extension/bootstrap.js
View
@@ -20,7 +20,8 @@ const systemPrincipal = CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')();
const scriptLoader = Cc['@mozilla.org/moz/jssubscript-loader;1'].
getService(Ci.mozIJSSubScriptLoader);
const prefService = Cc['@mozilla.org/preferences-service;1'].
- getService(Ci.nsIPrefService);
+ getService(Ci.nsIPrefService).
+ QueryInterface(Ci.nsIPrefBranch);
const appInfo = Cc["@mozilla.org/xre/app-info;1"].
getService(Ci.nsIXULAppInfo);
const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
@@ -127,12 +128,21 @@ function startup(data, reasonCode) {
if (name == 'addon-sdk')
paths['tests/'] = prefixURI + name + '/tests/';
+ let useBundledSDK = options['force-use-bundled-sdk'];
+ if (!useBundledSDK) {
+ try {
+ useBundledSDK = prefService.getBoolPref("extensions.addon-sdk.useBundledSDK");
+ }
+ catch (e) {
+ // Pref doesn't exist, allow using Firefox shipped SDK
+ }
+ }
+
// Starting with Firefox 21.0a1, we start using modules shipped into firefox
// Still allow using modules from the xpi if the manifest tell us to do so.
// And only try to look for sdk modules in xpi if the xpi actually ship them
if (options['is-sdk-bundled'] &&
- (vc.compare(appInfo.version, '21.0a1') < 0 ||
- options['force-use-bundled-sdk'])) {
+ (vc.compare(appInfo.version, '21.0a1') < 0 || useBundledSDK)) {
// Maps sdk module folders to their resource folder
paths[''] = prefixURI + 'addon-sdk/lib/';
// test.js is usually found in root commonjs or SDK_ROOT/lib/ folder,

0 comments on commit 78030fe

Please sign in to comment.