~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/js/src/xpconnect/tests/js/old/xpctest_propertybag.js

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
const nsIVariant = Components.interfaces.nsIVariant;
 
3
const nsIProperty = Components.interfaces.nsIProperty;
 
4
 
 
5
const TestVariant = Components.Constructor("@mozilla.org/js/xpc/test/TestVariant;1", 
 
6
                                           "nsITestVariant");
 
7
 
 
8
var tv = new TestVariant;
 
9
 
 
10
var obj = {foo : "fooString", 
 
11
           five : "5", 
 
12
           bar : {}, 
 
13
           6 : "six",
 
14
           fun : function(){},
 
15
           bignum : 1.2345678901234567890,
 
16
           now : new Date().toString() };
 
17
 
 
18
print();
 
19
print(tv.getNamedProperty(obj, "foo"));
 
20
print(tv.getNamedProperty(obj, "five"));
 
21
print(tv.getNamedProperty(obj, "bar"));
 
22
print(tv.getNamedProperty(obj, 6));
 
23
print(tv.getNamedProperty(obj, "fun"));
 
24
print(tv.getNamedProperty(obj, "fun"));
 
25
print(tv.getNamedProperty(obj, "bignum"));
 
26
print(tv.getNamedProperty(obj, "now"));
 
27
print();
 
28
 
 
29
var e = tv.getEnumerator(obj);
 
30
 
 
31
while(e.hasMoreElements()) {
 
32
    var prop = e.getNext().QueryInterface(nsIProperty)
 
33
    print(prop.name+" = "+prop.value);
 
34
}
 
35
 
 
36
print();