test_filehandle_compat.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!--
  2. Any copyright is dedicated to the Public Domain.
  3. http://creativecommons.org/publicdomain/zero/1.0/
  4. -->
  5. <html>
  6. <head>
  7. <title>File Handle Test</title>
  8. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  10. <script type="text/javascript;version=1.7">
  11. function testSteps()
  12. {
  13. const name = window.location.pathname;
  14. let request = indexedDB.open(name, 1);
  15. request.onerror = errorHandler;
  16. request.onsuccess = grabEventAndContinueHandler;
  17. let event = yield undefined;
  18. let db = event.target.result;
  19. db.onerror = errorHandler;
  20. request = db.mozCreateFileHandle("test.txt");
  21. request.onerror = errorHandler;
  22. request.onsuccess = grabEventAndContinueHandler;
  23. event = yield undefined;
  24. let fileHandle = event.target.result;
  25. fileHandle.onerror = errorHandler;
  26. let lockedFile = fileHandle.open();
  27. ok(lockedFile.fileHandle === fileHandle, "Correct property");
  28. request = lockedFile.getMetadata({ size: true });
  29. ok(request.lockedFile === lockedFile, "Correct property");
  30. request.onerror = errorHandler;
  31. request.onsuccess = grabEventAndContinueHandler;
  32. event = yield undefined;
  33. finishTest();
  34. yield undefined;
  35. }
  36. </script>
  37. <script type="text/javascript;version=1.7" src="helpers.js"></script>
  38. </head>
  39. <body onload="runTest();"></body>
  40. </html>