tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

showSaveFilePicker-manual.https.html (1281B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 <script src="resources/test-helpers.js"></script>
      9 
     10 <script>
     11 
     12  promise_test(async t => {
     13    await window.test_driver.bless(
     14      'show a file picker.<br />Please make a copy of file-system-access/resources/data/testfile.txt in a writable directory and pick that file');
     15    const file = await self.showSaveFilePicker({
     16      multiple: false, types: [
     17        { description: 'Text files', accept: { 'text/plain': ['.txt'] } },
     18      ],
     19    });
     20    assert_true(file instanceof FileSystemHandle);
     21    assert_true(file instanceof FileSystemFileHandle);
     22    assert_equals(file.kind, "file");
     23    assert_equals(file.name, 'testfile.txt');
     24    assert_equals(await (await file.getFile()).text(), '',
     25      'showSaveFilePicker should clear contents of file');
     26 
     27    promise_test(async t => {
     28      assert_equals(await file.queryPermission(), 'granted');
     29      assert_equals(await file.queryPermission({ mode: 'readwrite' }), 'granted');
     30    }, 'showSaveFilePicker returns correct permissions');
     31  }, 'showSaveFilePicker works');
     32 
     33 </script>