Changeset 242836 in webkit


Ignore:
Timestamp:
Mar 12, 2019 5:36:02 PM (5 years ago)
Author:
jiewen_tan@apple.com
Message:

Add WebFrameProxy::loadData
https://bugs.webkit.org/show_bug.cgi?id=195647
<rdar://problem/48826856>

Reviewed by Youenn Fablet.

This patch adds WebFrameProxy::loadData which is a simplified version of WebPageProxy::loadData that
loads substitute data to an iframe. This is needed by the Load Optimizer.

  • UIProcess/WebFrameProxy.cpp:

(WebKit::WebFrameProxy::loadData):

  • UIProcess/WebFrameProxy.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::loadDataInFrame):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r242833 r242836  
     12019-03-12  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Add WebFrameProxy::loadData
     4        https://bugs.webkit.org/show_bug.cgi?id=195647
     5        <rdar://problem/48826856>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        This patch adds WebFrameProxy::loadData which is a simplified version of WebPageProxy::loadData that
     10        loads substitute data to an iframe. This is needed by the Load Optimizer.
     11
     12        * UIProcess/WebFrameProxy.cpp:
     13        (WebKit::WebFrameProxy::loadData):
     14        * UIProcess/WebFrameProxy.h:
     15        * WebProcess/WebPage/WebPage.cpp:
     16        (WebKit::WebPage::loadDataInFrame):
     17        * WebProcess/WebPage/WebPage.h:
     18        * WebProcess/WebPage/WebPage.messages.in:
     19
    1202019-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
    221
  • trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp

    r240484 r242836  
    8787}
    8888
     89void WebFrameProxy::loadData(const IPC::DataReference& data, const String& MIMEType, const String& encodingName, const URL& baseURL)
     90{
     91    if (!m_page)
     92        return;
     93
     94    m_page->process().send(Messages::WebPage::LoadDataInFrame(data, MIMEType, encodingName, baseURL, m_frameID), m_page->pageID());
     95}
     96
    8997void WebFrameProxy::stopLoading() const
    9098{
  • trunk/Source/WebKit/UIProcess/WebFrameProxy.h

    r240484 r242836  
    8282
    8383    void loadURL(const URL&);
     84    void loadData(const IPC::DataReference&, const String& MIMEType, const String& encodingName, const URL& baseURL);
    8485    void stopLoading() const;
    8586
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r242833 r242836  
    13911391}
    13921392
     1393void WebPage::loadDataInFrame(IPC::DataReference&& data, String&& MIMEType, String&& encodingName, URL&& baseURL, uint64_t frameID)
     1394{
     1395    WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     1396    if (!frame)
     1397        return;
     1398
     1399    auto sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(data.data()), data.size());
     1400    ResourceResponse response(baseURL, MIMEType, sharedBuffer->size(), encodingName);
     1401    SubstituteData substituteData(WTFMove(sharedBuffer), baseURL, WTFMove(response), SubstituteData::SessionHistoryVisibility::Hidden);
     1402    frame->coreFrame()->loader().load(FrameLoadRequest(*frame->coreFrame(), ResourceRequest(baseURL), ShouldOpenExternalURLsPolicy::ShouldNotAllow, WTFMove(substituteData)));
     1403}
     1404
    13931405#if !PLATFORM(COCOA)
    13941406void WebPage::platformDidReceiveLoadParameters(const LoadParameters& loadParameters)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242833 r242836  
    12901290
    12911291    void loadURLInFrame(URL&&, uint64_t frameID);
     1292    void loadDataInFrame(IPC::DataReference&&, String&& MIMEType, String&& encodingName, URL&& baseURL, uint64_t frameID);
    12921293
    12931294    enum class WasRestoredByAPIRequest { No, Yes };
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r242833 r242836  
    156156
    157157    LoadURLInFrame(URL url, uint64_t frameID)
     158    LoadDataInFrame(IPC::DataReference data, String MIMEType, String encodingName, URL baseURL, uint64_t frameID)
    158159    LoadRequest(struct WebKit::LoadParameters loadParameters)
    159160    LoadData(struct WebKit::LoadParameters loadParameters)
Note: See TracChangeset for help on using the changeset viewer.