security/manager/pki/resources/content/protectedAuth.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/manager/pki/resources/content/protectedAuth.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +function onLoad()
     1.9 +{
    1.10 +    protectedAuthThread = window.arguments[0].QueryInterface(Components.interfaces.nsIProtectedAuthThread);
    1.11 +
    1.12 +    if (!protectedAuthThread) 
    1.13 +    {
    1.14 +        window.close();
    1.15 +        return;
    1.16 +    }
    1.17 +
    1.18 +    try
    1.19 +    {
    1.20 +        var tokenName = protectedAuthThread.getTokenName();
    1.21 +
    1.22 +        var tag = document.getElementById("tokenName");
    1.23 +        tag.setAttribute("value",tokenName);
    1.24 +
    1.25 +        setCursor("wait");
    1.26 +  
    1.27 +        var obs = {
    1.28 +          observe : function protectedAuthListenerObserve(subject, topic, data) {
    1.29 +            if (topic == "operation-completed")
    1.30 +              window.close();
    1.31 +          }
    1.32 +        };
    1.33 +        
    1.34 +        protectedAuthThread.login(obs);
    1.35 +
    1.36 +    } catch (exception)
    1.37 +    {
    1.38 +        window.close();
    1.39 +        return;
    1.40 +    }
    1.41 +}
    1.42 +
    1.43 +function onClose()
    1.44 +{
    1.45 +    setCursor("default");
    1.46 +}

mercurial