Commit 88a04a8d authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

[FS] Remove legacy native fs API surface.

This deletes a bunch of old code that is no longer needed.

Bug: 1121673
Change-Id: Ie5fccd67aaa989d9011018a14315c5f18c8a452c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376365Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803958}
parent 11ce2723
......@@ -87,10 +87,6 @@ generated_dictionary_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_channel_merger_options.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_channel_splitter_options.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_channel_splitter_options.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_options.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_options.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_options_accepts.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_options_accepts.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_client_query_options.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_client_query_options.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_clipboard_item_options.cc",
......@@ -217,8 +213,6 @@ generated_dictionary_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gamepad_event_init.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_get_notification_options.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_get_notification_options.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_get_system_directory_options.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_get_system_directory_options.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_bind_group_descriptor.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_bind_group_descriptor.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_bind_group_entry.cc",
......@@ -788,8 +782,6 @@ generated_enumeration_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_channel_count_mode.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_channel_interpretation.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_channel_interpretation.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_type.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_type.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_client_lifecycle_state.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_client_lifecycle_state.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_client_lifecycle_state_query.cc",
......@@ -1044,8 +1036,6 @@ generated_enumeration_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_service_worker_update_via_cache.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_error_code.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_error_code.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_system_directory_type.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_system_directory_type.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_task_priority.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_task_priority.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_track_default_type.cc",
......
......@@ -366,8 +366,6 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/mediastream/navigator_user_media.idl",
"//third_party/blink/renderer/modules/mediastream/overconstrained_error.idl",
"//third_party/blink/renderer/modules/mediastream/window_media_stream.idl",
"//third_party/blink/renderer/modules/native_file_system/choose_file_system_entries_options.idl",
"//third_party/blink/renderer/modules/native_file_system/choose_file_system_entries_options_accepts.idl",
"//third_party/blink/renderer/modules/native_file_system/data_transfer_item_native_file_system.idl",
"//third_party/blink/renderer/modules/native_file_system/directory_picker_options.idl",
"//third_party/blink/renderer/modules/native_file_system/file_picker_accept_type.idl",
......@@ -381,7 +379,6 @@ static_idl_files_in_modules = get_path_info(
"//third_party/blink/renderer/modules/native_file_system/file_system_handle_permission_descriptor.idl",
"//third_party/blink/renderer/modules/native_file_system/file_system_remove_options.idl",
"//third_party/blink/renderer/modules/native_file_system/file_system_writable_file_stream.idl",
"//third_party/blink/renderer/modules/native_file_system/get_system_directory_options.idl",
"//third_party/blink/renderer/modules/native_file_system/native_file_system_directory_iterator.idl",
"//third_party/blink/renderer/modules/native_file_system/open_file_picker_options.idl",
"//third_party/blink/renderer/modules/native_file_system/storage_manager_native_file_system.idl",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://wicg.github.io/native-file-system/#enumdef-choosefilesystementriestype
enum ChooseFileSystemEntriesType {
"open-file",
"save-file",
"open-directory",
};
// https://wicg.github.io/native-file-system/#dictdef-choosefilesystementriesoptions
dictionary ChooseFileSystemEntriesOptions {
ChooseFileSystemEntriesType type = "open-file";
boolean multiple = false;
sequence<ChooseFileSystemEntriesOptionsAccepts> accepts;
boolean excludeAcceptAllOption = false;
};
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://github.com/WICG/writable-files/blob/master/EXPLAINER.md
dictionary ChooseFileSystemEntriesOptionsAccepts {
DOMString description;
sequence<DOMString> mimeTypes;
sequence<DOMString> extensions;
};
......@@ -18,20 +18,10 @@
NativeFileSystemDirectoryIterator keys();
NativeFileSystemDirectoryIterator values();
[CallWith=ScriptState, RuntimeEnabled=LegacyNativeFileSystem, ImplementedAs=getFileHandle]
Promise<FileSystemFileHandle> getFile(USVString name, optional FileSystemGetFileOptions options = {});
[CallWith=ScriptState, RuntimeEnabled=LegacyNativeFileSystem, ImplementedAs=getDirectoryHandle]
Promise<FileSystemDirectoryHandle> getDirectory(USVString name, optional FileSystemGetDirectoryOptions options = {});
[CallWith=ScriptState] Promise<FileSystemFileHandle> getFileHandle(USVString name, optional FileSystemGetFileOptions options = {});
[CallWith=ScriptState] Promise<FileSystemDirectoryHandle> getDirectoryHandle(USVString name, optional FileSystemGetDirectoryOptions options = {});
[CallWith=ScriptState, RuntimeEnabled=LegacyNativeFileSystem] object getEntries();
[CallWith=ScriptState] Promise<void> removeEntry(USVString name, optional FileSystemRemoveOptions options = {});
[CallWith=ScriptState, Measure] Promise<sequence<USVString>?> resolve(FileSystemHandle possibleChild);
[CallWith=ScriptState, Measure, RaisesException, RuntimeEnabled=LegacyNativeFileSystem]
static Promise<FileSystemDirectoryHandle> getSystemDirectory(GetSystemDirectoryOptions options);
};
......@@ -19,8 +19,6 @@ enum FileSystemHandleKind {
// Brand checking APIs because javascript makes it otherwise really hard to
// figure out what type an object is when you don't know in which global
// (i.e. iframe) the object was created.
[RuntimeEnabled=LegacyNativeFileSystem] readonly attribute boolean isFile;
[RuntimeEnabled=LegacyNativeFileSystem] readonly attribute boolean isDirectory;
readonly attribute FileSystemHandleKind kind;
readonly attribute USVString name;
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://wicg.github.io/native-file-system/#enumdef-systemdirectorytype
enum SystemDirectoryType {
"sandbox"
};
// https://wicg.github.io/native-file-system/#dictdef-getsystemdirectoryoptions
dictionary GetSystemDirectoryOptions {
required SystemDirectoryType type;
};
......@@ -12,8 +12,6 @@
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/native_file_system/native_file_system_manager.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_choose_file_system_entries_options_accepts.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_file_picker_accept_type.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_open_file_picker_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_save_file_picker_options.h"
......@@ -36,35 +34,6 @@ namespace blink {
namespace {
mojom::blink::ChooseFileSystemEntryType ConvertChooserType(const String& input,
bool multiple) {
if (input == "open-file" || input == "openFile") {
return multiple
? mojom::blink::ChooseFileSystemEntryType::kOpenMultipleFiles
: mojom::blink::ChooseFileSystemEntryType::kOpenFile;
}
if (input == "save-file" || input == "saveFile")
return mojom::blink::ChooseFileSystemEntryType::kSaveFile;
if (input == "open-directory" || input == "openDirectory")
return mojom::blink::ChooseFileSystemEntryType::kOpenDirectory;
NOTREACHED();
return mojom::blink::ChooseFileSystemEntryType::kOpenFile;
}
Vector<mojom::blink::ChooseFileSystemEntryAcceptsOptionPtr> ConvertAccepts(
const HeapVector<Member<ChooseFileSystemEntriesOptionsAccepts>>& accepts) {
Vector<mojom::blink::ChooseFileSystemEntryAcceptsOptionPtr> result;
result.ReserveInitialCapacity(accepts.size());
for (const auto& a : accepts) {
result.emplace_back(
blink::mojom::blink::ChooseFileSystemEntryAcceptsOption::New(
a->hasDescription() ? a->description() : g_empty_string,
a->hasMimeTypes() ? a->mimeTypes() : Vector<String>(),
a->hasExtensions() ? a->extensions() : Vector<String>()));
}
return result;
}
constexpr bool IsHTTPWhitespace(UChar chr) {
return chr == ' ' || chr == '\n' || chr == '\t' || chr == '\r';
}
......@@ -233,29 +202,6 @@ ScriptPromise ShowFilePickerImpl(
} // namespace
// static
ScriptPromise GlobalNativeFileSystem::chooseFileSystemEntries(
ScriptState* script_state,
LocalDOMWindow& window,
const ChooseFileSystemEntriesOptions* options,
ExceptionState& exception_state) {
UseCounter::Count(window, WebFeature::kFileSystemPickerMethod);
VerifyIsAllowedToShowFilePicker(window, exception_state);
if (exception_state.HadException())
return ScriptPromise();
Vector<mojom::blink::ChooseFileSystemEntryAcceptsOptionPtr> accepts;
if (options->hasAccepts())
accepts = ConvertAccepts(options->accepts());
return ShowFilePickerImpl(
script_state, window,
ConvertChooserType(options->type(), options->multiple()),
std::move(accepts), !options->excludeAcceptAllOption(),
options->multiple());
}
// static
ScriptPromise GlobalNativeFileSystem::showOpenFilePicker(
ScriptState* script_state,
......
......@@ -10,7 +10,6 @@
namespace blink {
class ChooseFileSystemEntriesOptions;
class OpenFilePickerOptions;
class SaveFilePickerOptions;
class DirectoryPickerOptions;
......@@ -23,12 +22,6 @@ class GlobalNativeFileSystem {
STATIC_ONLY(GlobalNativeFileSystem);
public:
static ScriptPromise chooseFileSystemEntries(
ScriptState*,
LocalDOMWindow&,
const ChooseFileSystemEntriesOptions*,
ExceptionState&);
static ScriptPromise showOpenFilePicker(ScriptState*,
LocalDOMWindow&,
const OpenFilePickerOptions*,
......
......@@ -11,8 +11,6 @@ modules_idl_files = [
]
modules_dictionary_idl_files = [
"choose_file_system_entries_options.idl",
"choose_file_system_entries_options_accepts.idl",
"directory_picker_options.idl",
"file_picker_accept_type.idl",
"file_picker_options.idl",
......@@ -21,7 +19,6 @@ modules_dictionary_idl_files = [
"file_system_get_file_options.idl",
"file_system_handle_permission_descriptor.idl",
"file_system_remove_options.idl",
"get_system_directory_options.idl",
"open_file_picker_options.idl",
"save_file_picker_options.idl",
"write_params.idl",
......
......@@ -27,10 +27,6 @@
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
namespace {
// The name to use for the root directory of a sandboxed file system.
constexpr const char kSandboxRootDirectoryName[] = "";
} // namespace
using mojom::blink::NativeFileSystemErrorPtr;
......@@ -210,57 +206,6 @@ ScriptPromise NativeFileSystemDirectoryHandle::resolve(
return result;
}
// static
ScriptPromise NativeFileSystemDirectoryHandle::getSystemDirectory(
ScriptState* script_state,
const GetSystemDirectoryOptions* options,
ExceptionState& exception_state) {
ExecutionContext* context = ExecutionContext::From(script_state);
if (!context->GetSecurityOrigin()->CanAccessNativeFileSystem()) {
if (context->IsSandboxed(network::mojom::blink::WebSandboxFlags::kOrigin)) {
exception_state.ThrowSecurityError(
"System directory access is denied because the context is "
"sandboxed and lacks the 'allow-same-origin' flag.");
return ScriptPromise();
} else {
exception_state.ThrowSecurityError("System directory access is denied.");
return ScriptPromise();
}
}
auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
ScriptPromise result = resolver->Promise();
// TODO(mek): Cache mojo::Remote<mojom::blink::NativeFileSystemManager>
// associated with an ExecutionContext, so we don't have to request a new one
// for each operation, and can avoid code duplication between here and other
// uses.
mojo::Remote<mojom::blink::NativeFileSystemManager> manager;
context->GetBrowserInterfaceBroker().GetInterface(
manager.BindNewPipeAndPassReceiver());
auto* raw_manager = manager.get();
raw_manager->GetSandboxedFileSystem(WTF::Bind(
[](ScriptPromiseResolver* resolver,
mojo::Remote<mojom::blink::NativeFileSystemManager>,
NativeFileSystemErrorPtr result,
mojo::PendingRemote<mojom::blink::NativeFileSystemDirectoryHandle>
handle) {
ExecutionContext* context = resolver->GetExecutionContext();
if (!context)
return;
if (result->status != mojom::blink::NativeFileSystemStatus::kOk) {
native_file_system_error::Reject(resolver, *result);
return;
}
resolver->Resolve(MakeGarbageCollected<NativeFileSystemDirectoryHandle>(
context, kSandboxRootDirectoryName, std::move(handle)));
},
WrapPersistent(resolver), std::move(manager)));
return result;
}
mojo::PendingRemote<mojom::blink::NativeFileSystemTransferToken>
NativeFileSystemDirectoryHandle::Transfer() {
mojo::PendingRemote<mojom::blink::NativeFileSystemTransferToken> result;
......
......@@ -14,7 +14,6 @@ namespace blink {
class FileSystemGetDirectoryOptions;
class FileSystemGetFileOptions;
class FileSystemRemoveOptions;
class GetSystemDirectoryOptions;
class NativeFileSystemDirectoryIterator;
class NativeFileSystemDirectoryHandle final : public NativeFileSystemHandle {
......@@ -46,10 +45,6 @@ class NativeFileSystemDirectoryHandle final : public NativeFileSystemHandle {
ScriptPromise resolve(ScriptState*, NativeFileSystemHandle* possible_child);
static ScriptPromise getSystemDirectory(ScriptState*,
const GetSystemDirectoryOptions*,
ExceptionState&);
mojo::PendingRemote<mojom::blink::NativeFileSystemTransferToken> Transfer()
override;
......
......@@ -9,10 +9,6 @@
RuntimeEnabled=NativeFileSystem,
ImplementedAs=GlobalNativeFileSystem
] partial interface Window {
[CallWith=ScriptState, Measure, RaisesException, RuntimeEnabled=LegacyNativeFileSystem]
Promise<(FileSystemHandle or sequence<FileSystemHandle>)>
chooseFileSystemEntries(optional ChooseFileSystemEntriesOptions options = {});
[CallWith=ScriptState, RaisesException, Measure]
Promise<sequence<FileSystemFileHandle>> showOpenFilePicker(
optional OpenFilePickerOptions options = {});
......
......@@ -1055,11 +1055,6 @@
name: "LazyInitializeMediaControls",
// This is enabled by features::kLazyInitializeMediaControls.
},
{
// Used for API surface that will be removed when the Native File System
// API is no longer guarded by an origin trial.
name: "LegacyNativeFileSystem",
},
{
name: "LegacyWindowsDWriteFontFallback",
// Enabled by features::kLegacyWindowsDWriteFontFallback;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment