content/base/test/unit/test_xhr_standalone.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/unit/test_xhr_standalone.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,21 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.6 + */
     1.7 +
     1.8 +// Test setting .responseType and .withCredentials is allowed
     1.9 +// in non-window non-Worker context
    1.10 +
    1.11 +function run_test()
    1.12 +{
    1.13 +    var xhr = Components.classes['@mozilla.org/xmlextras/xmlhttprequest;1'].
    1.14 +          createInstance(Components.interfaces.nsIXMLHttpRequest);
    1.15 +    xhr.open('GET', 'data:,', false);
    1.16 +    var exceptionThrown = false;
    1.17 +    try {
    1.18 +        xhr.responseType = '';
    1.19 +        xhr.withCredentials = false;
    1.20 +    } catch (e) {
    1.21 +        exceptionThrown = true;
    1.22 +    }
    1.23 +    do_check_eq(false, exceptionThrown);
    1.24 +}

mercurial