summaryrefslogtreecommitdiffstats
path: root/dom/url/tests/file_url.jsm
blob: 6be99f2931d02e159bf424e9010629c7609f0fad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var EXPORTED_SYMBOLS = ["checkFromJSM"];

function checkFromJSM(ok, is) {
  var url = new URL("http://www.example.com");
  is(url.href, "http://www.example.com/", "JSM should have URL");

  var url2 = new URL("/foobar", url);
  is(
    url2.href,
    "http://www.example.com/foobar",
    "JSM should have URL - based on another URL"
  );

  var blob = new Blob(["a"]);
  url = URL.createObjectURL(blob);
  ok(url, "URL is created!");

  var u = new URL(url);
  ok(u, "URL created");
  is(u.origin, "null", "Url doesn't have an origin if created in a JSM");

  URL.revokeObjectURL(url);
  ok(true, "URL is revoked");
}