Hello!
I tried out signed scripts today, and have some problems. Firstly, I 
have created a HTML file (see below) which does 
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect").
Then I put it in the directory "pref" and called this command:
  ./signtool  -k"biesi" -Z"pref.jar"  pref
(my cert is nicknamed biesi)

There were apparently no errors, and "unzip -l pref.jar" shows these files:
       730  06-07-02 15:35   test.html
       241  06-07-02 15:35   META-INF/manifest.mf
       349  06-07-02 15:35   META-INF/zigbert.sf
      3375  06-07-02 15:35   META-INF/zigbert.rsa

However, if I put pref.jar on my server and connect to it like:
jar:http://server/~chb/pref.jar!/test.html
I get undefined in the textfield, and an error message in JS Console 
("Error: uncaught exception: enablePrivilege not granted"). I did not 
get a dialog asking for the requested privileges.


Did I do something wrong?


Here's the test.html file:
----------------------start of html
<html>
        <head>
                <title>Pref Test</title>
                <script type="application/x-javascript">
                        
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                        const prefService = 
Components.classes["@mozilla.org/preferences-service;1"].createInstance(Components.interfaces.nsIPrefService);
                        const prefBranch = prefService.getBranch(null);
                        var timebombVal;
                        try {
                                timebombVal = 
prefBranch.getCharPref("timebomb.first_launch_time");
                        }
                        catch (ex) {
                                alert(ex);
                        }
                        function setVal() {
                                document.prefs.timebomb.value = timebombVal;
                        }
                        
                </script>
        </head>
        <body onload="setVal();">
                <form name="prefs" id="prefs" onsubmit="return false;">
                        <input name="timebomb">
                </form>
        </body>
</html>
-------------------end of HTML


Reply via email to