I'm trying to access the 'Components' object via a <script> block in an 
XUL file.  I get the following error in the Javascript console:

Error: uncaught exception: Permission denied to get property 
UnknownClass.classes

Any ideas?  Thanks, in advance.

- Max Requenes


Here is the code in the XUL file.  It's based on the samples in the XUL 
tutorial:



<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window
     id="findfile-window"
     title="GUI Test"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
     onload="setView();">

<script type="application/x-javascript">
<![CDATA[

/* I don't know if the following line is needed -- desperation */
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

var outlinerView = {
     rowCount : 10000,
     setOutliner : function(outliner){},
     getCellText : function(row,column){
       if (column=="namecol") return "Row "+row;
       else return "February 18";
     },
     getRowProperties : function(row,prop){},
     getColumnProperties : function(column,columnElement,prop){},
     getCellProperties : function(row,column,props){
         if ((row %4) == 0){
             /* var aserv = 
Components.classes["@mozilla.org/atom-service;1"].
                 createInstance(Components.interfaces.nsIAtomService);
             props.AppendElement(aserv.getAtom("makeItBlue")); */

         }
     },
     isContainer : function(row) { return false; },
     isSeparator : function(row) { return false; }
    };

function setView()
{
document.getElementById('my-outliner').outlinerBoxObject.view=outlinerView;
}
]]>
</script>

<box orient="vertical" flex="1">
<box orient="horizontal" flex="1">
<grid flex="1">
   <columns>
       <column flex="2"/>
       <column flex="1"/>
   </columns>
   <rows>
       <row>
         <button label="Rabbit"/>
         <button label="Elephant"/>
       </row>
       <row>
         <button label="Koala"/>
         <button label="Gorilla"/>
       </row>
   </rows>
</grid>
</box>
<box orient="horizontal" flex="2">
<outliner id="my-outliner" flex="1">
<outlinercol id="namecol" label="Name" flex="1"/>
<outlinercol id="datecol" label="Date" flex="1"/>
<outlinerbody flex="1"/>
</outliner>
</box>
</box>
</window>


Reply via email to