Changeset 277881 in webkit
- Timestamp:
- May 21, 2021, 1:20:07 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/FileSystem.h (modified) (1 diff)
-
WTF/wtf/cocoa/FileSystemCocoa.mm (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r277880 r277881 1 2021-05-21 Chris Dumez <cdumez@apple.com> 2 3 [Cocoa] Unable to upload files that are stored in the cloud (without a local copy) 4 https://bugs.webkit.org/show_bug.cgi?id=226090 5 <rdar://77775887> 6 7 Reviewed by Darin Adler. 8 9 Add FileSystem API to allow/disallow the materializing of dataless files stored 10 in the cloud, at process or thread level. 11 12 * wtf/FileSystem.h: 13 * wtf/cocoa/FileSystemCocoa.mm: 14 (WTF::FileSystemImpl::toIOPolicyScope): 15 (WTF::FileSystemImpl::setAllowsMaterializingDatalessFiles): 16 (WTF::FileSystemImpl::allowsMaterializingDatalessFiles): 17 1 18 2021-05-21 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WTF/wtf/FileSystem.h
r277535 r277881 197 197 #if PLATFORM(COCOA) 198 198 WTF_EXPORT_PRIVATE NSString *createTemporaryDirectory(NSString *directoryPrefix); 199 200 // Allow reading cloud files with no local copy. 201 enum class PolicyScope : uint8_t { Process, Thread }; 202 WTF_EXPORT_PRIVATE bool setAllowsMaterializingDatalessFiles(bool, PolicyScope); 203 WTF_EXPORT_PRIVATE Optional<bool> allowsMaterializingDatalessFiles(PolicyScope); 199 204 #endif 200 205 -
trunk/Source/WTF/wtf/cocoa/FileSystemCocoa.mm
r277498 r277881 151 151 } 152 152 153 static int toIOPolicyScope(PolicyScope scope) 154 { 155 switch (scope) { 156 case PolicyScope::Process: 157 return IOPOL_SCOPE_PROCESS; 158 case PolicyScope::Thread: 159 return IOPOL_SCOPE_THREAD; 160 } 161 } 162 163 bool setAllowsMaterializingDatalessFiles(bool allow, PolicyScope scope) 164 { 165 if (setiopolicy_np(IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES, toIOPolicyScope(scope), allow ? IOPOL_MATERIALIZE_DATALESS_FILES_ON : IOPOL_MATERIALIZE_DATALESS_FILES_OFF) == -1) { 166 LOG_ERROR("FileSystem::setAllowsMaterializingDatalessFiles(%d): setiopolicy_np call failed, errno: %d", allow, errno); 167 return false; 168 } 169 return true; 170 } 171 172 Optional<bool> allowsMaterializingDatalessFiles(PolicyScope scope) 173 { 174 int ret = getiopolicy_np(IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES, toIOPolicyScope(scope)); 175 if (ret == IOPOL_MATERIALIZE_DATALESS_FILES_ON) 176 return true; 177 if (ret == IOPOL_MATERIALIZE_DATALESS_FILES_OFF) 178 return false; 179 LOG_ERROR("FileSystem::allowsMaterializingDatalessFiles(): getiopolicy_np call failed, errno: %d", errno); 180 return WTF::nullopt; 181 } 182 153 183 #if PLATFORM(IOS_FAMILY) 154 184 bool isSafeToUseMemoryMapForPath(const String& path) -
trunk/Source/WebKit/ChangeLog
r277879 r277881 1 2021-05-21 Chris Dumez <cdumez@apple.com> 2 3 [Cocoa] Unable to upload files that are stored in the cloud (without a local copy) 4 https://bugs.webkit.org/show_bug.cgi?id=226090 5 <rdar://77775887> 6 7 Reviewed by Darin Adler. 8 9 Allow the network process to load / read dataless files stored in the cloud by allowing 10 the process to materialize such files. I initially only allowed the AsyncFileStream 11 thread to materialize the dataless files and this was enough to make the file upload 12 use cases work. However, I noticed that drag and dropping such file in the Safari URL 13 bar would fail loading, which I think is bad user experience. As a result, I have 14 decided to allow the materializing at network process level. 15 16 I have verified manually that I can now upload such dataless files via either file 17 picker or drag and drop (used https://blueimp.github.io/jQuery-File-Upload/). I have 18 also verified that drag and dropping such a file in the Safari URL bar successfuly 19 loads that file. 20 21 * NetworkProcess/cocoa/NetworkProcessCocoa.mm: 22 (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): 23 1 24 2021-05-21 Brent Fulgham <bfulgham@apple.com> 2 25 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
r275013 r277881 46 46 #import <wtf/BlockPtr.h> 47 47 #import <wtf/CallbackAggregator.h> 48 #import <wtf/FileSystem.h> 48 49 #import <wtf/ProcessPrivilege.h> 49 50 #import <wtf/RetainPtr.h> … … 90 91 setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier); 91 92 #endif 93 94 // Allow the network process to materialize files stored in the cloud so that loading/reading such files actually succeeds. 95 FileSystem::setAllowsMaterializingDatalessFiles(true, FileSystem::PolicyScope::Process); 92 96 93 97 // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel().
Note:
See TracChangeset
for help on using the changeset viewer.