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 Cu.importGlobalProperties(['Blob', 'File']);
8 // throw if anything goes wrong
9 let testContent = "<a id=\"a\"><b id=\"b\">hey!<\/b><\/a>";
10 // should be able to construct a file
11 var f1 = new Blob([testContent], {"type" : "text/xml"});
14 Assert.ok(f1 instanceof Blob, "Should be a DOM Blob");
16 Assert.ok(!(f1 instanceof File), "Should not be a DOM File");
18 Assert.ok(f1.type == "text/xml", "Wrong type");
20 Assert.ok(f1.size == testContent.length, "Wrong content size");
23 Assert.ok(f2.size == 0, "Wrong size");
24 Assert.ok(f2.type == "", "Wrong type");
28 // Needs a valid ctor argument
29 var f2 = new Blob(Date(132131532));
33 Assert.ok(threw, "Passing a random object should fail");