|
1 const BinaryInputStream = |
|
2 Components.Constructor("@mozilla.org/binaryinputstream;1", |
|
3 "nsIBinaryInputStream", "setInputStream"); |
|
4 const BinaryOutputStream = |
|
5 Components.Constructor("@mozilla.org/binaryoutputstream;1", |
|
6 "nsIBinaryOutputStream", "setOutputStream"); |
|
7 |
|
8 const Pipe = |
|
9 Components.Constructor("@mozilla.org/pipe;1", "nsIPipe", "init"); |
|
10 |
|
11 const kNestedAboutCID = "{2f277c00-0eaf-4ddb-b936-41326ba48aae}"; |
|
12 |
|
13 function run_test() |
|
14 { |
|
15 var ios = Cc["@mozilla.org/network/io-service;1"].createInstance(Ci.nsIIOService); |
|
16 |
|
17 var baseURI = ios.newURI("http://example.com/", "UTF-8", null); |
|
18 |
|
19 // This depends on the redirector for about:license having the |
|
20 // nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT flag. |
|
21 var aboutLicense = ios.newURI("about:license", "UTF-8", baseURI); |
|
22 |
|
23 var pipe = new Pipe(false, false, 0, 0, null); |
|
24 var output = new BinaryOutputStream(pipe.outputStream); |
|
25 var input = new BinaryInputStream(pipe.inputStream); |
|
26 output.QueryInterface(Ci.nsIObjectOutputStream); |
|
27 input.QueryInterface(Ci.nsIObjectInputStream); |
|
28 |
|
29 output.writeCompoundObject(aboutLicense, Ci.nsIURI, true); |
|
30 var copy = input.readObject(true); |
|
31 copy.QueryInterface(Ci.nsIURI); |
|
32 |
|
33 do_check_eq(copy.asciiSpec, aboutLicense.asciiSpec); |
|
34 do_check_true(copy.equals(aboutLicense)); |
|
35 } |