From d42eaceadea4b36f4eb7a8ba0e97aef8f5cd06d0 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Mon, 9 Jan 2023 20:43:44 +0000 Subject: [PATCH] Bug 1785123: Enable Origin Private File System (OPFS) by default on Nightly r=dom-storage-reviewers,asuth,jari,jstutte,janv,dom-worker-reviewers Intent to prototype sent to dev-platform on Aug 19, 2022: https://groups.google.com/a/mozilla.org/g/dev-platform/c/gc4BxcgkN7E Intent to ship sent to dev-platform on Nov 10, 2022: https://groups.google.com/a/mozilla.org/g/dev-platform/c/dsRxP4liTek Differential Revision: https://phabricator.services.mozilla.com/D154818 --- .../test/gtest/api/TestFileSystemDirectoryHandle.cpp | 8 ++++++++ dom/fs/test/gtest/api/TestFileSystemFileHandle.cpp | 8 ++++++++ dom/fs/test/gtest/api/TestFileSystemHandle.cpp | 8 ++++++++ .../child/TestFileSystemBackgroundRequestHandler.cpp | 10 ++++++++++ .../test/test_serviceworker_interfaces.js | 8 ++++++++ dom/tests/mochitest/general/test_interfaces.js | 8 ++++++++ dom/workers/test/test_worker_interfaces.js | 10 ++++++++++ modules/libpref/init/StaticPrefList.yaml | 2 +- 8 files changed, 61 insertions(+), 1 deletion(-) diff --git a/dom/fs/test/gtest/api/TestFileSystemDirectoryHandle.cpp b/dom/fs/test/gtest/api/TestFileSystemDirectoryHandle.cpp index 0e9af2d66a2d..9114f3bb338f 100644 --- a/dom/fs/test/gtest/api/TestFileSystemDirectoryHandle.cpp +++ b/dom/fs/test/gtest/api/TestFileSystemDirectoryHandle.cpp @@ -22,6 +22,11 @@ namespace mozilla::dom::fs::test { class TestFileSystemDirectoryHandle : public ::testing::Test { protected: void SetUp() override { + // TODO: Fix the test to not depend on CreateFileSystemManagerParent + // failure because of the pref set to false. + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", false); + mRequestHandler = MakeUnique(); mMetadata = FileSystemEntryMetadata("dir"_ns, u"Directory"_ns, /* directory */ true); @@ -30,6 +35,9 @@ class TestFileSystemDirectoryHandle : public ::testing::Test { } void TearDown() override { + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", true); + if (!mManager->IsShutdown()) { mManager->Shutdown(); } diff --git a/dom/fs/test/gtest/api/TestFileSystemFileHandle.cpp b/dom/fs/test/gtest/api/TestFileSystemFileHandle.cpp index 75c52ea8e29d..615d907f48fb 100644 --- a/dom/fs/test/gtest/api/TestFileSystemFileHandle.cpp +++ b/dom/fs/test/gtest/api/TestFileSystemFileHandle.cpp @@ -22,6 +22,11 @@ namespace mozilla::dom::fs::test { class TestFileSystemFileHandle : public ::testing::Test { protected: void SetUp() override { + // TODO: Fix the test to not depend on CreateFileSystemManagerParent + // failure because of the pref set to false. + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", false); + mRequestHandler = MakeUnique(); mMetadata = FileSystemEntryMetadata("file"_ns, u"File"_ns, /* directory */ false); @@ -29,6 +34,9 @@ class TestFileSystemFileHandle : public ::testing::Test { } void TearDown() override { + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", true); + if (!mManager->IsShutdown()) { mManager->Shutdown(); } diff --git a/dom/fs/test/gtest/api/TestFileSystemHandle.cpp b/dom/fs/test/gtest/api/TestFileSystemHandle.cpp index 16a8c92163c8..19cdc98a84ee 100644 --- a/dom/fs/test/gtest/api/TestFileSystemHandle.cpp +++ b/dom/fs/test/gtest/api/TestFileSystemHandle.cpp @@ -20,6 +20,11 @@ namespace mozilla::dom::fs::test { class TestFileSystemHandle : public ::testing::Test { protected: void SetUp() override { + // TODO: Fix the test to not depend on CreateFileSystemManagerParent + // failure because of the pref set to false. + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", false); + mDirMetadata = FileSystemEntryMetadata("dir"_ns, u"Directory"_ns, /* directory */ true); mFileMetadata = @@ -28,6 +33,9 @@ class TestFileSystemHandle : public ::testing::Test { } void TearDown() override { + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", true); + if (!mManager->IsShutdown()) { mManager->Shutdown(); } diff --git a/dom/fs/test/gtest/child/TestFileSystemBackgroundRequestHandler.cpp b/dom/fs/test/gtest/child/TestFileSystemBackgroundRequestHandler.cpp index 4039145350c7..48d63cfc3633 100644 --- a/dom/fs/test/gtest/child/TestFileSystemBackgroundRequestHandler.cpp +++ b/dom/fs/test/gtest/child/TestFileSystemBackgroundRequestHandler.cpp @@ -18,9 +18,19 @@ namespace mozilla::dom::fs::test { class TestFileSystemBackgroundRequestHandler : public ::testing::Test { protected: void SetUp() override { + // TODO: Fix the test to not depend on CreateFileSystemManagerParent + // failure because of the pref set to false. + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", false); + mFileSystemManagerChild = MakeAndAddRef(); } + void TearDown() override { + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); + prefs->SetBoolPref("dom.fs.enabled", true); + } + RefPtr GetFileSystemBackgroundRequestHandler() { return MakeRefPtr( diff --git a/dom/serviceworkers/test/test_serviceworker_interfaces.js b/dom/serviceworkers/test/test_serviceworker_interfaces.js index 33c0f127b5a9..379b3faec9ba 100644 --- a/dom/serviceworkers/test/test_serviceworker_interfaces.js +++ b/dom/serviceworkers/test/test_serviceworker_interfaces.js @@ -189,6 +189,14 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! "FileReader", // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemDirectoryHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemFileHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemWritableFileStream", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! "FontFace", // IMPORTANT: Do not change this list without review from a DOM peer! "FontFaceSet", diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index 76c5f14ba8ee..1fff59aee4c1 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -417,12 +417,20 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FileSystemDirectoryEntry", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemDirectoryHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FileSystemDirectoryReader", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FileSystemEntry", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FileSystemFileEntry", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemFileHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemWritableFileStream", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FocusEvent", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FormData", insecureContext: true }, diff --git a/dom/workers/test/test_worker_interfaces.js b/dom/workers/test/test_worker_interfaces.js index d4d8c2bf25da..0a021646706d 100644 --- a/dom/workers/test/test_worker_interfaces.js +++ b/dom/workers/test/test_worker_interfaces.js @@ -194,6 +194,16 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FileReaderSync", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemDirectoryHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemFileHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemSyncAccessHandle", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "FileSystemWritableFileStream", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FontFace", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "FontFaceSet", insecureContext: true }, diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index c524095e3397..53fd86e785c3 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -3888,7 +3888,7 @@ # Whether the File System API is enabled - name: dom.fs.enabled type: RelaxedAtomicBool - value: false + value: @IS_NIGHTLY_BUILD@ mirror: always # Whether the WritableFileStream is enabled or disabled.