jsm_url_worker.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. onmessage = function(event) {
  2. if (event.data != 0) {
  3. var worker = new Worker('jsm_url_worker.js');
  4. worker.onmessage = function(event) {
  5. postMessage(event.data);
  6. }
  7. worker.postMessage(event.data - 1);
  8. return;
  9. }
  10. status = false;
  11. try {
  12. if ((URL instanceof Object)) {
  13. status = true;
  14. }
  15. } catch(e) {
  16. }
  17. postMessage({type: 'status', status: status, msg: 'URL object:' + URL});
  18. status = false;
  19. var blob = null;
  20. try {
  21. blob = new Blob([]);
  22. status = true;
  23. } catch(e) {
  24. }
  25. postMessage({type: 'status', status: status, msg: 'Blob:' + blob});
  26. status = false;
  27. var url = null;
  28. try {
  29. url = URL.createObjectURL(blob);
  30. status = true;
  31. } catch(e) {
  32. }
  33. postMessage({type: 'status', status: status, msg: 'Blob URL:' + url});
  34. status = false;
  35. try {
  36. URL.revokeObjectURL(url);
  37. status = true;
  38. } catch(e) {
  39. }
  40. postMessage({type: 'status', status: status, msg: 'Blob Revoke URL'});
  41. status = false;
  42. var url = null;
  43. try {
  44. url = URL.createObjectURL(true);
  45. } catch(e) {
  46. status = true;
  47. }
  48. postMessage({type: 'status', status: status, msg: 'CreateObjectURL should fail if the arg is not a blob'});
  49. status = false;
  50. var url = null;
  51. try {
  52. url = URL.createObjectURL(blob);
  53. status = true;
  54. } catch(e) {
  55. }
  56. postMessage({type: 'status', status: status, msg: 'Blob URL2:' + url});
  57. status = false;
  58. try {
  59. URL.createObjectURL(new Object());
  60. } catch(e) {
  61. status = true;
  62. }
  63. postMessage({type: 'status', status: status, msg: 'Exception wanted' });
  64. postMessage({type: 'url', url: url});
  65. postMessage({type: 'finish' });
  66. }