Commit 78bf550c authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

[NativeFS] Pass in ExecutionContext to Runtime Features checks.

In preparation of making these features origin trial controlled, switch to
the version of RuntimeEnabledFeatures::FooEnabled calls that accepts
a FeatureContext.

Bug: 853326
Change-Id: Ie73d4ee810887068b397ed8fa642b73cac98b83f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095401Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748966}
parent 10a907d2
...@@ -47,6 +47,8 @@ class CORE_EXPORT V8ScriptValueSerializer ...@@ -47,6 +47,8 @@ class CORE_EXPORT V8ScriptValueSerializer
// DataCloneError message will be used. // DataCloneError message will be used.
virtual bool WriteDOMObject(ScriptWrappable*, ExceptionState&); virtual bool WriteDOMObject(ScriptWrappable*, ExceptionState&);
ScriptState* GetScriptState() const { return script_state_; }
void WriteTag(SerializationTag tag) { void WriteTag(SerializationTag tag) {
uint8_t tag_byte = tag; uint8_t tag_byte = tag;
serializer_.WriteRawBytes(&tag_byte, 1); serializer_.WriteRawBytes(&tag_byte, 1);
......
...@@ -302,7 +302,8 @@ CryptoKey* V8ScriptValueDeserializerForModules::ReadCryptoKey() { ...@@ -302,7 +302,8 @@ CryptoKey* V8ScriptValueDeserializerForModules::ReadCryptoKey() {
NativeFileSystemHandle* NativeFileSystemHandle*
V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle( V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle(
SerializationTag tag) { SerializationTag tag) {
if (!RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled()) { if (!RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled(
ExecutionContext::From(GetScriptState()))) {
return nullptr; return nullptr;
} }
......
...@@ -53,13 +53,15 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject( ...@@ -53,13 +53,15 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject(
return true; return true;
} }
if (wrapper_type_info == V8FileSystemFileHandle::GetWrapperTypeInfo() && if (wrapper_type_info == V8FileSystemFileHandle::GetWrapperTypeInfo() &&
RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled()) { RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled(
ExecutionContext::From(GetScriptState()))) {
return WriteNativeFileSystemHandle( return WriteNativeFileSystemHandle(
kNativeFileSystemFileHandleTag, kNativeFileSystemFileHandleTag,
wrappable->ToImpl<NativeFileSystemHandle>()); wrappable->ToImpl<NativeFileSystemHandle>());
} }
if (wrapper_type_info == V8FileSystemDirectoryHandle::GetWrapperTypeInfo() && if (wrapper_type_info == V8FileSystemDirectoryHandle::GetWrapperTypeInfo() &&
RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled()) { RuntimeEnabledFeatures::CloneableNativeFileSystemHandlesEnabled(
ExecutionContext::From(GetScriptState()))) {
return WriteNativeFileSystemHandle( return WriteNativeFileSystemHandle(
kNativeFileSystemDirectoryHandleTag, kNativeFileSystemDirectoryHandleTag,
wrappable->ToImpl<NativeFileSystemHandle>()); wrappable->ToImpl<NativeFileSystemHandle>());
......
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