Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=422537 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for bug 422537</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 10 | </head> |
michael@0 | 11 | |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=422537">Mozilla Bug 422537</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content" style="display: none"> |
michael@0 | 16 | |
michael@0 | 17 | </div> |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script class="testbody" type="text/javascript"> |
michael@0 | 20 | |
michael@0 | 21 | /** Test for Bug 422537 **/ |
michael@0 | 22 | var isupports_string = SpecialPowers.Cc["@mozilla.org/supports-string;1"] |
michael@0 | 23 | .createInstance(SpecialPowers.Ci.nsISupportsString); |
michael@0 | 24 | isupports_string.data = "foo"; |
michael@0 | 25 | |
michael@0 | 26 | const url = "http://mochi.test:8888"; |
michael@0 | 27 | var body = [ |
michael@0 | 28 | document, |
michael@0 | 29 | "foo", |
michael@0 | 30 | isupports_string |
michael@0 | 31 | ]; |
michael@0 | 32 | |
michael@0 | 33 | for (var i of body) { |
michael@0 | 34 | var xhr = new XMLHttpRequest(); |
michael@0 | 35 | xhr.open("POST", url, true); |
michael@0 | 36 | if (i == isupports_string) |
michael@0 | 37 | SpecialPowers.wrap(xhr).send(i); |
michael@0 | 38 | else |
michael@0 | 39 | xhr.send(i); |
michael@0 | 40 | var chan = SpecialPowers.wrap(xhr).channel; |
michael@0 | 41 | if (!SpecialPowers.call_Instanceof(chan, SpecialPowers.Ci.nsIUploadChannel)) |
michael@0 | 42 | throw "Must be an upload channel"; |
michael@0 | 43 | var stream = chan.uploadStream; |
michael@0 | 44 | if (!stream || !SpecialPowers.call_Instanceof(stream, SpecialPowers.Ci.nsISeekableStream)) |
michael@0 | 45 | throw "Stream must be seekable"; |
michael@0 | 46 | // the following is a no-op, but should not throw an exception |
michael@0 | 47 | stream.seek(SpecialPowers.Ci.nsISeekableStream.NS_SEEK_CUR, 0); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | ok(true, "xhr is seekable"); |
michael@0 | 51 | |
michael@0 | 52 | </script> |
michael@0 | 53 | </pre> |
michael@0 | 54 | </body> |
michael@0 | 55 | </html> |