file_url.jsm 688 B

1234567891011121314151617181920212223
  1. this.EXPORTED_SYMBOLS = ['checkFromJSM'];
  2. this.checkFromJSM = function checkFromJSM(ok, is) {
  3. Components.utils.importGlobalProperties(['URL', 'Blob']);
  4. var url = new URL('http://www.example.com');
  5. is(url.href, "http://www.example.com/", "JSM should have URL");
  6. var url2 = new URL('/foobar', url);
  7. is(url2.href, "http://www.example.com/foobar", "JSM should have URL - based on another URL");
  8. var blob = new Blob(['a']);
  9. var url = URL.createObjectURL(blob);
  10. ok(url, "URL is created!");
  11. var u = new URL(url);
  12. ok(u, "URL created");
  13. is(u.origin, "null", "Url doesn't have an origin if created in a JSM");
  14. URL.revokeObjectURL(url);
  15. ok(true, "URL is revoked");
  16. }