1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 var EXPORTED_SYMBOLS = ["TestBlob"];
9 // we don't have the test harness' utilities in this scope, so we need this
10 // little helper. In the failure case, the exception is propagated to the
11 // caller in the main run_test() function, and the test fails.
13 throw "Failed check: " + text;
19 // throw if anything goes wrong
20 let testContent = "<a id=\"a\"><b id=\"b\">hey!<\/b><\/a>";
21 // should be able to construct a file
22 var f1 = new Blob([testContent], {"type" : "text/xml"});
25 Assert.ok(f1 instanceof Blob, "Should be a DOM Blob");
27 Assert.ok(!(f1 instanceof File), "Should not be a DOM File");
29 Assert.ok(f1.type == "text/xml", "Wrong type");
31 Assert.ok(f1.size == testContent.length, "Wrong content size");
34 Assert.ok(f2.size == 0, "Wrong size");
35 Assert.ok(f2.type == "", "Wrong type");
39 // Needs a valid ctor argument
40 var f2 = new Blob(Date(132131532));
44 Assert.ok(threw, "Passing a random object should fail");