Bug 1798459 - Disable WritableFileStream on the main thread; r=dom-storage-reviewers,jesup

WritableFileStream can be enabled on the main thread only when bug 1798513 gets fixed.

Depends on D161543

Differential Revision: https://phabricator.services.mozilla.com/D161354
This commit is contained in:
Jan Varga 2022-11-08 16:59:24 +00:00
Родитель a070f2c6c9
Коммит 728a3023ec
22 изменённых файлов: 123 добавлений и 96 удалений

Просмотреть файл

@ -431,8 +431,6 @@ void FileSystemWritableFileStream::Seek(uint64_t aPosition,
MOZ_ASSERT(!mClosed);
// submit async seek
// XXX!!! this should be submitted to a TaskQueue instead of sync IO on
// mainthread!
// XXX what happens if we read/write before seek finishes?
// Should we block read/write if an async operation is pending?
// Handle seek before write ('at')
@ -450,8 +448,7 @@ void FileSystemWritableFileStream::Truncate(uint64_t aSize,
RefPtr<Promise> aPromise) {
MOZ_ASSERT(!mClosed);
// XXX!!! this should be submitted to a TaskQueue instead of sync IO on
// mainthread! submit async truncate
// submit async truncate
// XXX what happens if we read/write before seek finishes?
// Should we block read/write if an async operation is pending?
// What if there's an error, and several operations are pending?

Просмотреть файл

@ -9,6 +9,7 @@
#include "FileSystemEntryMetadataArray.h"
#include "fs/FileSystemConstants.h"
#include "mozilla/ResultVariant.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/dom/BlobImpl.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileSystemAccessHandleChild.h"
@ -472,6 +473,13 @@ void FileSystemRequestHandler::GetWritable(RefPtr<FileSystemManager>& aManager,
LOG(("GetWritable %s keep %d", NS_ConvertUTF16toUTF8(aFile.entryName()).get(),
aKeepData));
// XXX This should be removed once bug 1798513 is fixed.
if (NS_IsMainThread() &&
!StaticPrefs::dom_fs_main_thread_writable_file_stream()) {
aError.Throw(NS_ERROR_NOT_IMPLEMENTED);
return;
}
if (aManager->IsShutdown()) {
aError.Throw(NS_ERROR_ILLEGAL_DURING_SHUTDOWN);
return;

Просмотреть файл

@ -85,7 +85,12 @@ TEST_F(TestFileSystemFileHandle, isWritableReturned) {
IgnoredErrorResult rv;
RefPtr<Promise> promise = fileHandle->CreateWritable(options, rv);
// XXX This should be reverted back to check NS_OK once bug 1798513 is fixed.
#if 0
ASSERT_TRUE(rv.ErrorCodeIs(NS_OK));
#else
ASSERT_TRUE(rv.ErrorCodeIs(NS_ERROR_NOT_IMPLEMENTED));
#endif
}
TEST_F(TestFileSystemFileHandle, doesCreateWritableFailOnNullGlobal) {

Просмотреть файл

@ -264,7 +264,13 @@ TEST_F(TestFileSystemRequestHandler, isGetWritableBlockedAfterShutdown) {
mManager, mEntry, /* aKeepData */ false, GetSimplePromise(), error);
ASSERT_TRUE(error.Failed());
// XXX This should be reverted back to check NS_ERROR_ILLEGAL_DURING_SHUTDOWN
// once bug 1798513 is fixed.
#if 0
ASSERT_TRUE(error.ErrorCodeIs(NS_ERROR_ILLEGAL_DURING_SHUTDOWN));
#else
ASSERT_TRUE(error.ErrorCodeIs(NS_ERROR_NOT_IMPLEMENTED));
#endif
}
TEST_F(TestFileSystemRequestHandler, isGetEntriesSuccessful) {

Просмотреть файл

@ -18,5 +18,6 @@ scheme=https
scheme=https
[test_writableFileStream.html]
scheme=https
skip-if = true # This should be enabled once bug 1798513 is fixed.
[test_writableFileStream_worker.html]
scheme=https

Просмотреть файл

@ -11,4 +11,5 @@ head = head.js
[test_fileSystemDirectoryHandle_worker.js]
[test_syncAccessHandle_worker.js]
[test_writableFileStream.js]
skip-if = true # This should be enabled once bug 1798513 is fixed.
[test_writableFileStream_worker.js]

Просмотреть файл

@ -3846,6 +3846,15 @@
value: false
mirror: always
# Whether the WritableFileStream is enabled on the main thread.
# WritableFileStream currently does all IO on the current thread which is okish
# for workers but not for the main thread. The situation will change after bug
# 1798513.
- name: dom.fs.main_thread_writable_file_stream
type: RelaxedAtomicBool
value: false
mirror: always
# LocalStorage data limit as determined by summing up the lengths of all string
# keys and values. This is consistent with the legacy implementation and other
# browser engines. This value should really only ever change in unit testing

Просмотреть файл

@ -1,18 +1,18 @@
[FileSystemBaseHandle-IndexedDB.https.any.html]
[Store handle in IndexedDB and read from pending transaction.]
expected: PASS
expected: FAIL
[Store handle in IndexedDB and read from new transaction.]
expected: PASS
expected: FAIL
[Store handles and blobs in IndexedDB.]
expected: PASS
expected: FAIL
[Store handle in IndexedDB and read using a cursor.]
expected: PASS
expected: FAIL
[Store handle in IndexedDB using inline keys.]
expected: PASS
expected: FAIL
[FileSystemBaseHandle-IndexedDB.https.any.worker.html]

Просмотреть файл

@ -2,4 +2,4 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Send and receive messages using a broadcast channel in an iframe, dedicated worker and service worker.]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,13 +2,13 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Send and receive messages using a message port in a same origin iframe.]
expected: PASS
expected: FAIL
[Send and receive messages using a message port in a sandboxed same origin iframe.]
expected: PASS
expected: FAIL
[Send and receive messages using a message port in a blob iframe.]
expected: PASS
expected: FAIL
[Send and receive messages using a message port in an iframe srcdoc.]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,10 +2,10 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Send and receive messages using a message port in a same origin window.]
expected: PASS
expected: FAIL
[Send and receive messages using a message port in a blob window.]
expected: PASS
expected: FAIL
[Send and receive messages using a message port in a sandboxed same origin window.]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,10 +2,10 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Send and receive messages using a message port in a dedicated worker.]
expected: PASS
expected: FAIL
[Send and receive messages using a message port in a service worker.]
expected: PASS
expected: FAIL
[Send and receive messages using a message port in a shared worker.]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,13 +2,13 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Send and receive messages using a same origin iframe.]
expected: PASS
expected: FAIL
[Send and receive messages using a sandboxed same origin iframe.]
expected: PASS
expected: FAIL
[Send and receive messages using a blob iframe.]
expected: PASS
expected: FAIL
[Send and receive messages using an iframe srcdoc.]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,10 +2,10 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Send and receive messages using a same origin window.]
expected: PASS
expected: FAIL
[Send and receive messages using a blob window.]
expected: PASS
expected: FAIL
[Send and receive messages using a sandboxed same origin window.]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,10 +2,10 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Send and receive messages using a dedicated worker.]
expected: PASS
expected: FAIL
[Send and receive messages using a service worker.]
expected: PASS
expected: FAIL
[Send and receive messages using a shared worker.]
expected: PASS
expected: FAIL

Просмотреть файл

@ -8,10 +8,10 @@
expected: PASS
[getFileHandle(create=false) returns existing files]
expected: PASS
expected: FAIL
[getFileHandle(create=true) returns existing files without erasing]
expected: PASS
expected: FAIL
[getFileHandle(create=false) when a directory already exists with the same name]
expected: PASS

Просмотреть файл

@ -24,19 +24,19 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[returning early from an iteration doesn't crash]
expected: PASS
expected: FAIL
[@@asyncIterator: full iteration works]
expected: PASS
expected: FAIL
[entries: full iteration works]
expected: PASS
expected: FAIL
[values: full iteration works]
expected: PASS
expected: FAIL
[keys: full iteration works]
expected: PASS
expected: FAIL
[iteration while iterator gets garbage collected]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,19 +2,19 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[removeEntry() to remove a file]
expected: PASS
expected: FAIL
[removeEntry() on an already removed file should fail]
expected: PASS
expected: FAIL
[removeEntry() to remove an empty directory]
expected: PASS
expected: FAIL
[removeEntry() on a non-empty directory should fail]
expected: PASS
[removeEntry() on a directory recursively should delete all sub-items]
expected: PASS
expected: FAIL
[removeEntry() with empty name should fail]
expected: PASS
@ -29,7 +29,7 @@
expected: PASS
[removeEntry() while the file has an open writable fails]
expected: PASS
expected: FAIL
[FileSystemDirectoryHandle-removeEntry.https.any.worker.html]

Просмотреть файл

@ -12,7 +12,7 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[getFile() provides a file that can be sliced]
expected: PASS
expected: FAIL
[getFile() returns last modified time]
expected: PASS
expected: FAIL

Просмотреть файл

@ -69,25 +69,25 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[move(name) to rename a file]
expected: PASS
expected: FAIL
[move(name) to rename a file the same name]
expected: PASS
expected: FAIL
[move("") to rename a file fails]
expected: PASS
expected: FAIL
[get a handle to a moved file]
expected: PASS
expected: FAIL
[move(name) can be called multiple times]
expected: PASS
expected: FAIL
[move(name) with a name with a trailing period should fail]
expected: FAIL
[move(name) with a name with invalid characters should fail]
expected: PASS
expected: FAIL
[move(name) while the file has an open writable fails]
expected: FAIL
@ -96,37 +96,37 @@
expected: FAIL
[move(dir, name) to rename a file]
expected: PASS
expected: FAIL
[move(dir, name) to rename a file the same name]
expected: FAIL
[move(dir) to move a file to a new directory]
expected: PASS
expected: FAIL
[move(dir, name) to move a file to a new directory]
expected: PASS
expected: FAIL
[move(dir) can be called multiple times]
expected: PASS
expected: FAIL
[move(dir, name) can be called multiple times]
expected: PASS
expected: FAIL
[move(dir, name) with a name with invalid characters should fail]
expected: PASS
expected: FAIL
[move(dir) while the file has an open writable fails]
expected: PASS
expected: FAIL
[move(dir, name) while the file has an open writable fails]
expected: PASS
expected: FAIL
[move(dir) while the destination file has an open writable fails]
expected: PASS
expected: FAIL
[move(dir, name) while the destination file has an open writable fails]
expected: PASS
expected: FAIL
[move(dir, "") to move a file to a new directory fails]
expected: PASS
expected: FAIL

Просмотреть файл

@ -2,55 +2,55 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[write() with an empty blob to an empty file]
expected: PASS
expected: FAIL
[write() a blob to an empty file]
expected: PASS
expected: FAIL
[write() with WriteParams without position to an empty file]
expected: PASS
expected: FAIL
[write() a string to an empty file with zero offset]
expected: PASS
expected: FAIL
[write() a blob to an empty file with zero offset]
expected: PASS
expected: FAIL
[write() called consecutively appends]
expected: PASS
expected: FAIL
[write() WriteParams without position and string appends]
expected: PASS
expected: FAIL
[write() WriteParams without position and blob appends]
expected: PASS
expected: FAIL
[write() called with a string and a valid offset]
expected: PASS
expected: FAIL
[write() called with a blob and a valid offset]
expected: PASS
expected: FAIL
[write() called with an offset beyond the end of the file]
expected: PASS
expected: FAIL
[write() with an empty string to an empty file]
expected: PASS
expected: FAIL
[write() with a valid utf-8 string]
expected: PASS
expected: FAIL
[write() with a string with unix line ending preserved]
expected: PASS
expected: FAIL
[write() with a string with windows line ending preserved]
expected: PASS
expected: FAIL
[write() with an empty array buffer to an empty file]
expected: PASS
expected: FAIL
[write() with a valid typed array buffer]
expected: PASS
expected: FAIL
[atomic writes: close() fails when parent directory is removed]
expected: FAIL
@ -59,37 +59,37 @@
expected: FAIL
[atomic writes: write() after close() fails]
expected: PASS
expected: FAIL
[atomic writes: truncate() after close() fails]
expected: PASS
expected: FAIL
[atomic writes: close() after close() fails]
expected: PASS
expected: FAIL
[atomic writes: only one close() operation may succeed]
expected: PASS
expected: FAIL
[atomic writes: writable file stream persists file on close, even if file is removed]
expected: FAIL
[getWriter() can be used]
expected: PASS
expected: FAIL
[WriteParams: truncate missing size param]
expected: PASS
expected: FAIL
[WriteParams: write missing data param]
expected: PASS
expected: FAIL
[WriteParams: seek missing position param]
expected: PASS
expected: FAIL
[write() with an invalid blob to an empty file should reject]
expected: PASS
expected: FAIL
[WriteParams: write null data param]
expected: PASS
expected: FAIL
[FileSystemWritableFileStream-write.https.any.worker.html]

Просмотреть файл

@ -2,13 +2,13 @@
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[truncate() to shrink a file]
expected: PASS
expected: FAIL
[truncate() to grow a file]
expected: PASS
expected: FAIL
[createWritable() fails when parent directory is removed]
expected: PASS
expected: FAIL
[write() fails when parent directory is removed]
expected: FAIL
@ -17,19 +17,19 @@
expected: FAIL
[createWritable({keepExistingData: true}): atomic writable file stream initialized with source contents]
expected: PASS
expected: FAIL
[createWritable({keepExistingData: false}): atomic writable file stream initialized with empty file]
expected: FAIL
[cursor position: truncate size > offset]
expected: PASS
expected: FAIL
[cursor position: truncate size < offset]
expected: PASS
expected: FAIL
[commands are queued, stream is unlocked after each operation]
expected: PASS
expected: FAIL
[FileSystemWritableFileStream.https.any.worker.html]