Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions
TestJavaProxy Class Reference

Tests that if calls to XPCOM functions return the same object, then the JavaXPCOM interface creates the proper Java proxies. More...

List of all members.

Static Public Member Functions

static void main (String[] args) throws Exception

Detailed Description

Tests that if calls to XPCOM functions return the same object, then the JavaXPCOM interface creates the proper Java proxies.

The XPCOM call to nsISupports supp = entries.getNext() returns an object, for which we create an nsISupports Java proxy. Then, the XPCOM call to supp.queryInterface(nsIFile.NS_IFILE_IID) will return the same object (same address). JavaXPCOM needs to be smart enough to create a new nsIFile proxy, rather than reusing the nsISupports one that was previously created.

Definition at line 54 of file TestJavaProxy.java.


Member Function Documentation

static void TestJavaProxy.main ( String[]  args) throws Exception [inline, static]

Definition at line 55 of file TestJavaProxy.java.

                                                                {
              System.loadLibrary("javaxpcom");

              String mozillaPath = System.getProperty("MOZILLA_FIVE_HOME");
              if (mozillaPath == null) {
                     throw new RuntimeException("MOZILLA_FIVE_HOME system property not set.");
              }

              File localFile = new File(mozillaPath);
              XPCOM.initXPCOM(localFile, null);

              nsILocalFile directory = XPCOM.newLocalFile("/usr", false);
              nsISimpleEnumerator entries = (nsISimpleEnumerator) directory.getDirectoryEntries();
              while (entries.hasMoreElements()) {
                     nsISupports supp = entries.getNext();
                     nsIFile file = (nsIFile) supp.queryInterface(nsIFile.NS_IFILE_IID);
                     System.out.println(file.getPath());
              }

    // cleanup
    directory = null;
    entries = null;

              XPCOM.shutdownXPCOM(null);
       }

Here is the call graph for this function:


The documentation for this class was generated from the following file: