michael@0: const BinaryInputStream = michael@0: Components.Constructor("@mozilla.org/binaryinputstream;1", michael@0: "nsIBinaryInputStream", "setInputStream"); michael@0: const BinaryOutputStream = michael@0: Components.Constructor("@mozilla.org/binaryoutputstream;1", michael@0: "nsIBinaryOutputStream", "setOutputStream"); michael@0: michael@0: const Pipe = michael@0: Components.Constructor("@mozilla.org/pipe;1", "nsIPipe", "init"); michael@0: michael@0: const kNestedAboutCID = "{2f277c00-0eaf-4ddb-b936-41326ba48aae}"; michael@0: michael@0: function run_test() michael@0: { michael@0: var ios = Cc["@mozilla.org/network/io-service;1"].createInstance(Ci.nsIIOService); michael@0: michael@0: var baseURI = ios.newURI("http://example.com/", "UTF-8", null); michael@0: michael@0: // This depends on the redirector for about:license having the michael@0: // nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT flag. michael@0: var aboutLicense = ios.newURI("about:license", "UTF-8", baseURI); michael@0: michael@0: var pipe = new Pipe(false, false, 0, 0, null); michael@0: var output = new BinaryOutputStream(pipe.outputStream); michael@0: var input = new BinaryInputStream(pipe.inputStream); michael@0: output.QueryInterface(Ci.nsIObjectOutputStream); michael@0: input.QueryInterface(Ci.nsIObjectInputStream); michael@0: michael@0: output.writeCompoundObject(aboutLicense, Ci.nsIURI, true); michael@0: var copy = input.readObject(true); michael@0: copy.QueryInterface(Ci.nsIURI); michael@0: michael@0: do_check_eq(copy.asciiSpec, aboutLicense.asciiSpec); michael@0: do_check_true(copy.equals(aboutLicense)); michael@0: }