Changeset 2e702e


Ignore:
Timestamp:
Jul 6, 2011, 1:37:03 PM (9 years ago)
Author:
rene <rene@…>
Branches:
ng_0.8, ng_0.9
Children:
d1603d
Parents:
e832ce
Message:

extension-check now asynchronous, therefore check on startup

Location:
chrome/content/v_identity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_helper.js

    re832ce r2e702e  
    5353
    5454    extensionActive : function (extensionID) {
    55         // seamonkey has no extension-manager, return false in this case
    56         if (("nsIExtensionManager" in Components.interfaces) && ("@mozilla.org/extensions/manager;1" in Components.classes)) {
    57             var em = Components.classes["@mozilla.org/extensions/manager;1"]
    58                 .getService(Components.interfaces.nsIExtensionManager);
    59             var rdfS = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
    60             var source = rdfS.GetResource("urn:mozilla:item:"+extensionID);
    61            
    62             var item = em.getItemForID(extensionID);
    63             if (!item || !item.installLocationKey) return false;
    64 
    65             var disabledResource = rdfS.GetResource("http://www.mozilla.org/2004/em-rdf#disabled");
    66             var isDisabledResource = rdfS.GetResource("http://www.mozilla.org/2004/em-rdf#isDisabled");
    67             var disabled = em.datasource.GetTarget(source, disabledResource, true);
    68             if (!disabled) disabled = em.datasource.GetTarget(source, isDisabledResource, true);
    69 
    70             try {
    71                 disabled=disabled.QueryInterface(Components.interfaces.nsIRDFLiteral);
    72                 if (disabled.Value=="true") return false;
    73             } catch (e) { }
    74             return true;
    75         }
    76         else return false;
     55    // new AddonManager uses asynchronous calls, therefore status is pre-stored in vI_upgradeOverlay.js
     56        try {
     57            var prefroot = Components.classes["@mozilla.org/preferences-service;1"]
     58            .getService(Components.interfaces.nsIPrefService)
     59            .getBranch(null);
     60            return prefroot.getBoolPref("extensions.virtualIdentity." + extensionID)
     61        } catch(e) { return false };
    7762    }
    7863}
  • chrome/content/v_identity/vI_upgradeOverlay.js

    re832ce r2e702e  
    2525var vI_upgradeOverlay = {
    2626    init: function() {
    27         var rdfDatasource = new vI_rdfDatasource("virtualIdentity.rdf", true);
     27        var rdfDatasource = new vI_rdfDatasource("virtualIdentity.rdf", true);
    2828        if (rdfDatasource.extUpgradeRequired()) {
    2929            if (!vI_upgrade.quick_upgrade(rdfDatasource.getCurrentExtFileVersion()))
     
    4242            .getService(Components.interfaces.nsIPrefService)
    4343            .getBranch(null);
     44       
     45        Components.utils.import("resource://gre/modules/AddonManager.jsm"); 
     46
     47        const switch_signature_ID="{2ab1b709-ba03-4361-abf9-c50b964ff75d}"     
     48        prefroot.setBoolPref("extensions.virtualIdentity." + switch_signature_ID, false)
     49        AddonManager.getAddonByID(switch_signature_ID, function(addon) {
     50            prefroot.setBoolPref("extensions.virtualIdentity." + switch_signature_ID, addon.userDisabled || addon.appDisabled ? false : true)
     51        });
     52       
     53        const enigmail_ID="{847b3a00-7ab1-11d4-8f02-006008948af5}"
     54        prefroot.setBoolPref("extensions.virtualIdentity." + enigmail_ID, false)
     55        AddonManager.getAddonByID(enigmail_ID, function(addon) {
     56            prefroot.setBoolPref("extensions.virtualIdentity." + enigmail_ID, addon.userDisabled || addon.appDisabled ? false : true)
     57        });
     58       
     59       
    4460        if (prefroot.getBoolPref("extensions.virtualIdentity.error_console")) {
    4561            document.getElementById("vIErrorBoxSplitter").removeAttribute("hidden");
Note: See TracChangeset for help on using the changeset viewer.