Revision 28d63f19babbd14a18a0219acf21362fc5d52dbc authored by Henrik Skupin on 28 March 2018, 18:49:31 UTC, committed by moz-wptsync-bot on 28 March 2018, 18:49:31 UTC
To retrieve links via "link text" or "partial link text" the rendered
content of the element has to be used. This can be the case for CSS
transformations like "uppercase".
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1381519
gecko-commit: 3e204686f1b10441f48435890241dff6706d04dd
gecko-integration-branch: central
gecko-reviewers: ato
1 parent f5b48cf
Raw File
getRandomValues.any.js
// Step 1.
test(function() {
    assert_throws("TypeMismatchError", function() {
        self.crypto.getRandomValues(new Float32Array(6))
    }, "Float32Array")
    assert_throws("TypeMismatchError", function() {
        self.crypto.getRandomValues(new Float64Array(6))
    }, "Float64Array")

    assert_throws("TypeMismatchError", function() {
        self.crypto.getRandomValues(new Float32Array(65537))
    }, "Float32Array (too long)")
    assert_throws("TypeMismatchError", function() {
        self.crypto.getRandomValues(new Float64Array(65537))
    }, "Float64Array (too long)")
}, "Float arrays")

var arrays = {
    'Int8Array': Int8Array,
    'Int16Array': Int16Array,
    'Int32Array': Int32Array,
    'Uint8Array': Uint8Array,
    'Uint8ClampedArray': Uint8ClampedArray,
    'Uint16Array': Uint16Array,
    'Uint32Array': Uint32Array,
};

test(function() {
    for (var array in arrays) {
        assert_equals(self.crypto.getRandomValues(new arrays[array](8)).constructor,
                      arrays[array], "crypto.getRandomValues(new " + array + "(8))")
    }
}, "Integer array")

test(function() {
    for (var array in arrays) {
        var maxlength = 65536 / (arrays[array].BYTES_PER_ELEMENT);
        assert_throws("QuotaExceededError", function() {
            self.crypto.getRandomValues(new arrays[array](maxlength + 1))
        }, "crypto.getRandomValues length over 65536")
    }
}, "Large length")

test(function() {
    for (var array in arrays) {
        assert_true(self.crypto.getRandomValues(new arrays[array](0)).length == 0)
    }
}, "Null arrays")
back to top