⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 263830 in webkit


Ignore:
Timestamp:
Jul 1, 2020, 8:08:57 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Allow the File object to be created with a replacement file
​https://bugs.webkit.org/show_bug.cgi?id=213825

Patch by Said Abou-Hallawa <​sabouhallawa@apple.com> on 2020-07-01
Reviewed by Darin Adler.

Source/WebCore:

Working towards webkit.org/b/213347, it needs to be possible to create
the File object with an optional replacement file. Only the registered
BlobDataFileReference will be created with both the original file path
and the replacement file path. So it can delete the replacement file when
it is destroyed. Otherwise BlobDataFileReference will be created with the
replacement file path.

It is important to create the File object with the replacement file because
it needs to get the meta-data and the bytes of the replacement file not
the original file.

  • fileapi/File.cpp:

(WebCore::File::create):

  • fileapi/File.h:
  • fileapi/ThreadableBlobRegistry.cpp:

(WebCore::ThreadableBlobRegistry::registerFileBlobURL):

  • fileapi/ThreadableBlobRegistry.h:
  • html/DirectoryFileListCreator.cpp:

(WebCore::createFileList):

  • html/FileInputType.cpp:

(WebCore::FileInputType::filesFromFormControlState):
When the Files are created from a FormControlState, they will be created
without replacement files since they might have been deleted.

(WebCore::FileInputType::filesChosen):
(WebCore::FileInputType::receiveDroppedFiles):

  • platform/FileChooser.cpp:

(WebCore::FileChooser::chooseFiles):
(WebCore::FileChooser::chooseMediaFiles):

  • platform/FileChooser.h:

(WebCore::FileChooserFileInfo::isolatedCopy const):
(WebCore::FileChooser::chooseFiles):
(WebCore::FileChooserFileInfo::FileChooserFileInfo): Deleted.

  • platform/network/BlobDataFileReference.cpp:

(WebCore::BlobDataFileReference::BlobDataFileReference):
(WebCore::BlobDataFileReference::~BlobDataFileReference):
(WebCore::BlobDataFileReference::path):
(WebCore::BlobDataFileReference::startTrackingModifications):

  • platform/network/BlobDataFileReference.h:
  • platform/network/BlobRegistry.h:

Source/WebKit:

The UIProcess passes a list of strings which represents the replacement
paths along with a list to the original paths to the WebProcess. The
WebProcess passes these two list to FileChooser which creates the File
objects and register the Blobs.

The WebProcess registers the Blobs in the NetworkProcess which creates
BlobDataFileReference objects with both the original path and the
replacement path.

The WebProcess unregisters the Blobs from the NetworkProcess which deletes
the corresponding BlobDataFileReference from its registry. Upon destroying
the BlobDataFileReference, the replacement file should be deleted.

  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):

  • NetworkProcess/NetworkConnectionToWebProcess.h:
  • NetworkProcess/NetworkConnectionToWebProcess.messages.in:
  • NetworkProcess/NetworkProcessPlatformStrategies.cpp:

(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):

  • Shared/BlobDataFileReferenceWithSandboxExtension.cpp:

(WebKit::BlobDataFileReferenceWithSandboxExtension::BlobDataFileReferenceWithSandboxExtension):

  • Shared/BlobDataFileReferenceWithSandboxExtension.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didChooseFilesForOpenPanel):

  • WebProcess/FileAPI/BlobRegistryProxy.cpp:

(WebKit::BlobRegistryProxy::registerFileBlobURL):

  • WebProcess/FileAPI/BlobRegistryProxy.h:
  • WebProcess/WebPage/WebOpenPanelResultListener.cpp:

(WebKit::WebOpenPanelResultListener::didChooseFiles):

  • WebProcess/WebPage/WebOpenPanelResultListener.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::didChooseFilesForOpenPanel):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:

Source/WebKitLegacy/mac:

  • WebCoreSupport/WebPlatformStrategies.mm:

Source/WebKitLegacy/win:

  • WebCoreSupport/WebPlatformStrategies.cpp:
Location:
trunk/Source
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r263829 r263830  
     12020-07-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Allow the File object to be created with a replacement file
     4        https://bugs.webkit.org/show_bug.cgi?id=213825
     5
     6        Reviewed by Darin Adler.
     7
     8        Working towards webkit.org/b/213347, it needs to be possible to create
     9        the File object with an optional replacement file. Only the registered
     10        BlobDataFileReference will be created with both the original file path
     11        and the replacement file path. So it can delete the replacement file when
     12        it is destroyed. Otherwise BlobDataFileReference will be created with the
     13        replacement file path.
     14
     15        It is important to create the File object with the replacement file because
     16        it needs to get the meta-data and the bytes of the replacement file not
     17        the original file.
     18
     19        * fileapi/File.cpp:
     20        (WebCore::File::create):
     21        * fileapi/File.h:
     22        * fileapi/ThreadableBlobRegistry.cpp:
     23        (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
     24        * fileapi/ThreadableBlobRegistry.h:
     25        * html/DirectoryFileListCreator.cpp:
     26        (WebCore::createFileList):
     27        * html/FileInputType.cpp:
     28        (WebCore::FileInputType::filesFromFormControlState):
     29        When the Files are created from a FormControlState, they will be created
     30        without replacement files since they might have been deleted.
     31
     32        (WebCore::FileInputType::filesChosen):
     33        (WebCore::FileInputType::receiveDroppedFiles):
     34        * platform/FileChooser.cpp:
     35        (WebCore::FileChooser::chooseFiles):
     36        (WebCore::FileChooser::chooseMediaFiles):
     37        * platform/FileChooser.h:
     38        (WebCore::FileChooserFileInfo::isolatedCopy const):
     39        (WebCore::FileChooser::chooseFiles):
     40        (WebCore::FileChooserFileInfo::FileChooserFileInfo): Deleted.
     41        * platform/network/BlobDataFileReference.cpp:
     42        (WebCore::BlobDataFileReference::BlobDataFileReference):
     43        (WebCore::BlobDataFileReference::~BlobDataFileReference):
     44        (WebCore::BlobDataFileReference::path):
     45        (WebCore::BlobDataFileReference::startTrackingModifications):
     46        * platform/network/BlobDataFileReference.h:
     47        * platform/network/BlobRegistry.h:
     48
    1492020-07-01  Don Olmstead  <don.olmstead@sony.com>
    250
  • trunk/Source/WebCore/fileapi/File.cpp

    r252349 r263830  
    4747}
    4848
    49 Ref<File> File::create(const String& path, const String& nameOverride)
     49Ref<File> File::create(const String& path, const String& replacementPath, const String& nameOverride)
    5050{
    5151    String name;
    5252    String type;
    53     computeNameAndContentType(path, nameOverride, name, type);
     53    String effectivePath = !replacementPath.isNull() ? replacementPath : path;
     54    computeNameAndContentType(effectivePath, nameOverride, name, type);
    5455
    5556    auto internalURL = BlobURL::createInternalURL();
    56     ThreadableBlobRegistry::registerFileBlobURL(internalURL, path, type);
     57    ThreadableBlobRegistry::registerFileBlobURL(internalURL, path, replacementPath, type);
    5758
    58     return adoptRef(*new File(WTFMove(internalURL), WTFMove(type), String { path }, WTFMove(name)));
     59    return adoptRef(*new File(WTFMove(internalURL), WTFMove(type), WTFMove(effectivePath), WTFMove(name)));
    5960}
    6061
  • trunk/Source/WebCore/fileapi/File.h

    r250061 r263830  
    4343
    4444    // Create a file with an optional name exposed to the author (via File.name and associated DOM properties) that differs from the one provided in the path.
    45     WEBCORE_EXPORT static Ref<File> create(const String& path, const String& nameOverride = { });
     45    WEBCORE_EXPORT static Ref<File> create(const String& path, const String& replacementPath = { }, const String& nameOverride = { });
    4646
    4747    // Create a File using the 'new File' constructor.
  • trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp

    r253544 r263830  
    6565}
    6666
    67 void ThreadableBlobRegistry::registerFileBlobURL(const URL& url, const String& path, const String& contentType)
     67void ThreadableBlobRegistry::registerFileBlobURL(const URL& url, const String& path, const String& replacementPath, const String& contentType)
    6868{
     69    String effectivePath = !replacementPath.isNull() ? replacementPath : path;
     70
    6971    if (isMainThread()) {
    70         blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(path), contentType);
     72        blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(effectivePath), path, contentType);
    7173        return;
    7274    }
    7375
    74     callOnMainThread([url = url.isolatedCopy(), path = path.isolatedCopy(), contentType = contentType.isolatedCopy()] {
    75         blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(path), contentType);
     76    callOnMainThread([url = url.isolatedCopy(), effectivePath = effectivePath.isolatedCopy(), path = path.isolatedCopy(), contentType = contentType.isolatedCopy()] {
     77        blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(effectivePath), path, contentType);
    7678    });
    7779}
  • trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h

    r250287 r263830  
    4141class ThreadableBlobRegistry {
    4242public:
    43     static void registerFileBlobURL(const URL&, const String& path, const String& contentType);
     43    static void registerFileBlobURL(const URL&, const String& path, const String& replacementPath, const String& contentType);
    4444    static void registerBlobURL(const URL&, Vector<BlobPart>&& blobParts, const String& contentType);
    4545    static void registerBlobURL(SecurityOrigin*, const URL&, const URL& srcURL);
  • trunk/Source/WebCore/html/DirectoryFileListCreator.cpp

    r263129 r263830  
    6565            appendDirectoryFiles(info.path, FileSystem::pathGetFileName(info.path), fileObjects);
    6666        else
    67             fileObjects.append(File::create(info.path, info.displayName));
     67            fileObjects.append(File::create(info.path, { }, info.displayName));
    6868    }
    6969    return FileList::create(WTFMove(fileObjects));
  • trunk/Source/WebCore/html/FileInputType.cpp

    r263129 r263830  
    116116    size_t size = state.size();
    117117    files.reserveInitialCapacity(size / 2);
    118     for (size_t i = 0; i < size; i += 2) {
    119         if (!state[i + 1].isEmpty())
    120             files.uncheckedAppend({ state[i], state[i + 1] });
    121         else
    122             files.uncheckedAppend({ state[i] });
    123     }
     118    for (size_t i = 0; i < size; i += 2)
     119        files.uncheckedAppend({ state[i], { }, state[i + 1] });
    124120    return files;
    125121}
    … …  
    415411    if (!allowsDirectories()) {
    416412        auto files = paths.map([](auto& fileInfo) {
    417             return File::create(fileInfo.path, fileInfo.displayName);
     413            return File::create(fileInfo.path, fileInfo.replacementPath, fileInfo.displayName);
    418414        });
    419415        didCreateFileList(FileList::create(WTFMove(files)), icon);
    … …  
    470466        files.reserveInitialCapacity(paths.size());
    471467        for (auto& path : paths)
    472             files.uncheckedAppend({ path });
     468            files.uncheckedAppend({ path, { }, { } });
    473469
    474470        filesChosen(files);
    475471    } else
    476         filesChosen({ FileChooserFileInfo { paths[0] } });
     472        filesChosen({ { paths[0], { }, { } } });
    477473
    478474    return true;
  • trunk/Source/WebCore/platform/FileChooser.cpp

    r237266 r263830  
    5959}
    6060
    61 void FileChooser::chooseFiles(const Vector<String>& filenames)
     61void FileChooser::chooseFiles(const Vector<String>& filenames, const Vector<String>& replacementNames)
    6262{
    6363    // FIXME: This is inelegant. We should not be looking at settings here.
    … …  
    6969
    7070    Vector<FileChooserFileInfo> files;
    71     for (auto& filename : filenames)
    72         files.append(FileChooserFileInfo(filename));
     71    for (size_t i = 0, size = filenames.size(); i < size; ++i)
     72        files.append({ filenames[i], i < replacementNames.size() ? replacementNames[i] : nullString(), { } });
    7373    m_client->filesChosen(files);
    7474}
    … …  
    8989    Vector<FileChooserFileInfo> files;
    9090    for (auto& filename : filenames)
    91         files.append(FileChooserFileInfo(filename));
     91        files.append({ filename, { }, { } });
    9292    m_client->filesChosen(files, displayString, icon);
    9393}
  • trunk/Source/WebCore/platform/FileChooser.h

    r262933 r263830  
    4747
    4848struct FileChooserFileInfo {
    49     FileChooserFileInfo(const String& path, const String& displayName = String())
    50         : path(path)
    51         , displayName(displayName)
    52     {
    53     }
    54 
    5549    FileChooserFileInfo isolatedCopy() const
    5650    {
    57         return { path.isolatedCopy(), displayName.isolatedCopy() };
     51        return { path.isolatedCopy(), replacementPath.isolatedCopy(), displayName.isolatedCopy() };
    5852    }
    5953
    6054    const String path;
     55    const String replacementPath;
    6156    const String displayName;
    6257};
    … …  
    8883
    8984    WEBCORE_EXPORT void chooseFile(const String& path);
    90     WEBCORE_EXPORT void chooseFiles(const Vector<String>& paths);
     85    WEBCORE_EXPORT void chooseFiles(const Vector<String>& paths, const Vector<String>& replacementPaths = { });
    9186#if PLATFORM(IOS_FAMILY)
    9287    // FIXME: This function is almost identical to FileChooser::chooseFiles(). We should merge this
  • trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp

    r240437 r263830  
    3333namespace WebCore {
    3434
    35 BlobDataFileReference::BlobDataFileReference(const String& path)
     35BlobDataFileReference::BlobDataFileReference(const String& path, const String& replacementPath)
    3636    : m_path(path)
     37    , m_replacementPath(replacementPath)
    3738{
    3839}
    … …  
    4041BlobDataFileReference::~BlobDataFileReference()
    4142{
    42 #if ENABLE(FILE_REPLACEMENT)
    4343    if (!m_replacementPath.isNull())
    4444        FileSystem::deleteFile(m_replacementPath);
    45 #endif
    4645}
    4746
    … …  
    5150    if (m_replacementShouldBeGenerated)
    5251        generateReplacementFile();
    53 
     52#endif
    5453    if (!m_replacementPath.isNull())
    5554        return m_replacementPath;
    56 #endif
    5755
    5856    return m_path;
    … …  
    102100#endif
    103101
     102    // This is a registered blob with a replacement file. Get the Metadata of the replacement file.
     103    if (!m_replacementPath.isNull()) {
     104        metadata = FileSystem::fileMetadataFollowingSymlinks(m_replacementPath);
     105        if (!metadata)
     106            return;
     107    }
     108
    104109    m_size = metadata.value().length;
    105110}
  • trunk/Source/WebCore/platform/network/BlobDataFileReference.h

    r239427 r263830  
    3636class WEBCORE_EXPORT BlobDataFileReference : public RefCounted<BlobDataFileReference> {
    3737public:
    38     static Ref<BlobDataFileReference> create(const String& path)
     38    static Ref<BlobDataFileReference> create(const String& path, const String& replacementPath = { })
    3939    {
    40         return adoptRef(*new BlobDataFileReference(path));
     40        return adoptRef(*new BlobDataFileReference(path, replacementPath));
    4141    }
    4242
    … …  
    5353
    5454protected:
    55     BlobDataFileReference(const String& path);
     55    BlobDataFileReference(const String& path, const String& replacementPath);
    5656
    5757private:
    … …  
    6161
    6262    String m_path;
     63    String m_replacementPath;
    6364#if ENABLE(FILE_REPLACEMENT)
    64     String m_replacementPath;
    6565    bool m_replacementShouldBeGenerated { false };
    6666#endif
  • trunk/Source/WebCore/platform/network/BlobRegistry.h

    r250061 r263830  
    4848
    4949    // Registers a blob URL referring to the specified file.
    50     virtual void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& contentType) = 0;
     50    virtual void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& path, const String& contentType) = 0;
    5151
    5252    // Registers a blob URL referring to the specified blob data.
  • trunk/Source/WebKit/ChangeLog

    r263825 r263830  
     12020-07-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Allow the File object to be created with a replacement file
     4        https://bugs.webkit.org/show_bug.cgi?id=213825
     5
     6        Reviewed by Darin Adler.
     7
     8        The UIProcess passes a list of strings which represents the replacement
     9        paths along with a list to the original paths to the WebProcess. The
     10        WebProcess passes these two list to FileChooser which creates the File
     11        objects and register the Blobs.
     12
     13        The WebProcess registers the Blobs in the NetworkProcess which creates
     14        BlobDataFileReference objects with both the original path and the
     15        replacement path.
     16
     17        The WebProcess unregisters the Blobs from the NetworkProcess which deletes
     18        the corresponding BlobDataFileReference from its registry. Upon destroying
     19        the BlobDataFileReference, the replacement file should be deleted.
     20
     21        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     22        (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
     23        (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
     24        * NetworkProcess/NetworkConnectionToWebProcess.h:
     25        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
     26        * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
     27        (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
     28        * Shared/BlobDataFileReferenceWithSandboxExtension.cpp:
     29        (WebKit::BlobDataFileReferenceWithSandboxExtension::BlobDataFileReferenceWithSandboxExtension):
     30        * Shared/BlobDataFileReferenceWithSandboxExtension.h:
     31        * UIProcess/WebPageProxy.cpp:
     32        (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
     33        * WebProcess/FileAPI/BlobRegistryProxy.cpp:
     34        (WebKit::BlobRegistryProxy::registerFileBlobURL):
     35        * WebProcess/FileAPI/BlobRegistryProxy.h:
     36        * WebProcess/WebPage/WebOpenPanelResultListener.cpp:
     37        (WebKit::WebOpenPanelResultListener::didChooseFiles):
     38        * WebProcess/WebPage/WebOpenPanelResultListener.h:
     39        * WebProcess/WebPage/WebPage.cpp:
     40        (WebKit::WebPage::didChooseFilesForOpenPanel):
     41        * WebProcess/WebPage/WebPage.h:
     42        * WebProcess/WebPage/WebPage.messages.in:
     43
    1442020-07-01  Tim Horton  <timothy_horton@apple.com>
    245
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r263789 r263830  
    733733#endif
    734734
    735 void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const String& path, SandboxExtension::Handle&& extensionHandle, const String& contentType)
     735void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const String& path, const String& replacementPath, SandboxExtension::Handle&& extensionHandle, const String& contentType)
    736736{
    737737    NETWORK_PROCESS_MESSAGE_CHECK(!url.isEmpty());
    … …  
    741741        return;
    742742
    743     session->blobRegistry().registerFileBlobURL(url, BlobDataFileReferenceWithSandboxExtension::create(path, SandboxExtension::create(WTFMove(extensionHandle))), contentType);
     743    session->blobRegistry().registerFileBlobURL(url, BlobDataFileReferenceWithSandboxExtension::create(path, replacementPath, SandboxExtension::create(WTFMove(extensionHandle))), contentType);
    744744}
    745745
    … …  
    770770        return;
    771771
    772     session->blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath, nullptr), contentType);
     772    session->blobRegistry().registerBlobURLOptionallyFileBacked(url, srcURL, BlobDataFileReferenceWithSandboxExtension::create(fileBackedPath), contentType);
    773773}
    774774
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h

    r262066 r263830  
    216216    void deleteCookie(const URL&, const String& cookieName);
    217217
    218     void registerFileBlobURL(const URL&, const String& path, SandboxExtension::Handle&&, const String& contentType);
     218    void registerFileBlobURL(const URL&, const String& path, const String& replacementPath, SandboxExtension::Handle&&, const String& contentType);
    219219    void registerBlobURL(const URL&, Vector<WebCore::BlobPart>&&, const String& contentType);
    220220    void registerBlobURLFromURL(const URL&, const URL& srcURL);
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in

    r262066 r263830  
    4747#endif
    4848
    49     RegisterFileBlobURL(URL url, String path, WebKit::SandboxExtension::Handle extensionHandle, String contentType)
     49    RegisterFileBlobURL(URL url, String path, String replacementPath, WebKit::SandboxExtension::Handle extensionHandle, String contentType)
    5050    RegisterBlobURL(URL url, Vector<WebCore::BlobPart> blobParts, String contentType)
    5151    RegisterBlobURLFromURL(URL url, URL srcURL)
  • trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp

    r257551 r263830  
    5858    using namespace WebCore;
    5959    class EmptyBlobRegistry : public WebCore::BlobRegistry {
    60         void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& contentType) final { ASSERT_NOT_REACHED(); }
     60        void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& path, const String& contentType) final { ASSERT_NOT_REACHED(); }
    6161        void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType) final { ASSERT_NOT_REACHED(); }
    6262        void registerBlobURL(const URL&, const URL& srcURL) final { ASSERT_NOT_REACHED(); }
  • trunk/Source/WebKit/Shared/BlobDataFileReferenceWithSandboxExtension.cpp

    r216764 r263830  
    3131namespace WebKit {
    3232
    33 BlobDataFileReferenceWithSandboxExtension::BlobDataFileReferenceWithSandboxExtension(const String& path, RefPtr<SandboxExtension>&& sandboxExtension)
    34     : BlobDataFileReference(path)
     33BlobDataFileReferenceWithSandboxExtension::BlobDataFileReferenceWithSandboxExtension(const String& path, const String& replacementPath, RefPtr<SandboxExtension>&& sandboxExtension)
     34    : BlobDataFileReference(path, replacementPath)
    3535    , m_sandboxExtension(WTFMove(sandboxExtension))
    3636{
  • trunk/Source/WebKit/Shared/BlobDataFileReferenceWithSandboxExtension.h

    r216764 r263830  
    3535class BlobDataFileReferenceWithSandboxExtension final : public WebCore::BlobDataFileReference {
    3636public:
    37     static Ref<BlobDataFileReference> create(const String& path, RefPtr<SandboxExtension>&& sandboxExtension)
     37    static Ref<BlobDataFileReference> create(const String& path, const String& replacementPath = { }, RefPtr<SandboxExtension>&& sandboxExtension = nullptr)
    3838    {
    39         return adoptRef(*new BlobDataFileReferenceWithSandboxExtension(path, WTFMove(sandboxExtension)));
     39        return adoptRef(*new BlobDataFileReferenceWithSandboxExtension(path, replacementPath, WTFMove(sandboxExtension)));
    4040    }
    4141
    4242private:
    43     BlobDataFileReferenceWithSandboxExtension(const String& path, RefPtr<SandboxExtension>&&);
     43    BlobDataFileReferenceWithSandboxExtension(const String& path, const String& replacementPath, RefPtr<SandboxExtension>&&);
    4444    virtual ~BlobDataFileReferenceWithSandboxExtension();
    4545
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r263825 r263830  
    67016701#endif
    67026702
    6703     send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs));
     6703    send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs, { }));
    67046704
    67056705    m_openPanelResultListener->invalidate();
  • trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp

    r250061 r263830  
    3737using namespace WebCore;
    3838
    39 void BlobRegistryProxy::registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& file, const String& contentType)
     39void BlobRegistryProxy::registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& file, const String& path, const String& contentType)
    4040{
    4141    SandboxExtension::Handle extensionHandle;
    … …  
    4545        SandboxExtension::createHandle(file->path(), SandboxExtension::Type::ReadOnly, extensionHandle);
    4646
    47     WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterFileBlobURL(url, file->path(), extensionHandle, contentType), 0);
     47    String replacementPath = path == file->path() ? nullString() : file->path();
     48    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterFileBlobURL(url, path, replacementPath, extensionHandle, contentType), 0);
    4849}
    4950
  • trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h

    r250061 r263830  
    3232class BlobRegistryProxy final : public WebCore::BlobRegistry {
    3333public:
    34     void registerFileBlobURL(const URL&, Ref<WebCore::BlobDataFileReference>&&, const String& contentType) final;
     34    void registerFileBlobURL(const URL&, Ref<WebCore::BlobDataFileReference>&&, const String& path, const String& contentType) final;
    3535    void registerBlobURL(const URL&, Vector<WebCore::BlobPart>&&, const String& contentType) final;
    3636    void registerBlobURL(const URL&, const URL& srcURL) final;
  • trunk/Source/WebKit/WebProcess/WebPage/WebOpenPanelResultListener.cpp

    r237266 r263830  
    4747}
    4848
    49 void WebOpenPanelResultListener::didChooseFiles(const Vector<String>& files)
     49void WebOpenPanelResultListener::didChooseFiles(const Vector<String>& files, const Vector<String>& replacementFiles)
    5050{
    51     m_fileChooser->chooseFiles(files);
     51    m_fileChooser->chooseFiles(files, replacementFiles);
    5252}
    5353
  • trunk/Source/WebKit/WebProcess/WebPage/WebOpenPanelResultListener.h

    r237266 r263830  
    4545
    4646    void disconnectFromPage() { m_page = 0; }
    47     void didChooseFiles(const Vector<String>&);
     47    void didChooseFiles(const Vector<String>& files, const Vector<String>& replacementFiles);
    4848#if PLATFORM(IOS_FAMILY)
    4949    void didChooseFilesWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, WebCore::Icon*);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r263819 r263830  
    43024302#endif
    43034303
    4304 void WebPage::didChooseFilesForOpenPanel(const Vector<String>& files)
     4304void WebPage::didChooseFilesForOpenPanel(const Vector<String>& files, const Vector<String>& replacementFiles)
    43054305{
    43064306    if (!m_activeOpenPanelResultListener)
    43074307        return;
    43084308
    4309     m_activeOpenPanelResultListener->didChooseFiles(files);
     4309    m_activeOpenPanelResultListener->didChooseFiles(files, replacementFiles);
    43104310    m_activeOpenPanelResultListener = nullptr;
    43114311}
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r263819 r263830  
    16031603#endif
    16041604
    1605     void didChooseFilesForOpenPanel(const Vector<String>&);
     1605    void didChooseFilesForOpenPanel(const Vector<String>& files, const Vector<String>& replacementFiles);
    16061606    void didCancelForOpenPanel();
    16071607
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r263498 r263830  
    344344    DidChooseFilesForOpenPanelWithDisplayStringAndIcon(Vector<String> fileURLs, String displayString, IPC::DataReference iconData, WebKit::SandboxExtension::Handle frontboardServicesSandboxExtension, WebKit::SandboxExtension::Handle iconServicesSandboxExtension)
    345345#endif
    346     DidChooseFilesForOpenPanel(Vector<String> fileURLs)
     346    DidChooseFilesForOpenPanel(Vector<String> fileURLs, Vector<String> replacementURLs)
    347347    DidCancelForOpenPanel()
    348348#if ENABLE(SANDBOX_EXTENSIONS)
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r263788 r263830  
     12020-07-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Allow the File object to be created with a replacement file
     4        https://bugs.webkit.org/show_bug.cgi?id=213825
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCoreSupport/WebPlatformStrategies.mm:
     9
    1102020-06-30  Sam Weinig  <weinig@apple.com>
    211
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm

    r259124 r263830  
    9494class WebBlobRegistry final : public BlobRegistry {
    9595private:
    96     void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); }
     96    void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String&, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); }
    9797    void registerBlobURL(const URL& url, Vector<BlobPart>&& parts, const String& contentType) final { m_blobRegistry.registerBlobURL(url, WTFMove(parts), contentType); }
    9898    void registerBlobURL(const URL& url, const URL& srcURL) final { m_blobRegistry.registerBlobURL(url, srcURL); }
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r263635 r263830  
     12020-07-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Allow the File object to be created with a replacement file
     4        https://bugs.webkit.org/show_bug.cgi?id=213825
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCoreSupport/WebPlatformStrategies.cpp:
     9
    1102020-06-28  Geoffrey Garen  <ggaren@apple.com>
    211
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp

    r257551 r263830  
    8181class WebBlobRegistry final : public BlobRegistry {
    8282private:
    83     void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); }
     83    void registerFileBlobURL(const URL& url, Ref<BlobDataFileReference>&& reference, const String&, const String& contentType) final { m_blobRegistry.registerFileBlobURL(url, WTFMove(reference), contentType); }
    8484    void registerBlobURL(const URL& url, Vector<BlobPart>&& parts, const String& contentType) final { m_blobRegistry.registerBlobURL(url, WTFMove(parts), contentType); }
    8585    void registerBlobURL(const URL& url, const URL& srcURL) final { m_blobRegistry.registerBlobURL(url, srcURL); }
Note: See TracChangeset for help on using the changeset viewer.