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

Changeset 248358 in webkit


Ignore:
Timestamp:
Aug 6, 2019, 11:53:01 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r248148. rdar://problem/54017841

Pages using MessagePorts should be PageCacheable
https://bugs.webkit.org/show_bug.cgi?id=200366
<rdar://problem/53837882>

Reviewed by Geoffrey Garen.

Source/WebCore:

Allow a page to enter PageCache, even if it has MessagePorts (potentially with
pending messages). If there are pending messages on the MessagePorts when
entering PageCache, those will get dispatched upon restoring from PageCache.

Test: fast/history/page-cache-MessagePort-pending-message.html

  • dom/MessagePort.cpp: (WebCore::MessagePort::messageAvailable): (WebCore::MessagePort::dispatchMessages): Do not dispatch messages while in PageCache.

(WebCore::MessagePort::canSuspendForDocumentSuspension const):
Allow pages with MessagePort objects to enter PageCache.

  • dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::resumeActiveDOMObjects): Make sure pending messages on MessagePorts get dispatched asynchronously after restoring from PageCache.
  • loader/DocumentLoader.cpp: (WebCore::areAllLoadersPageCacheAcceptable): Make sure only CachedResources that are still loading upon load cancelation prevent entering PageCache.

LayoutTests:

Add layout test coverage.

  • fast/history/page-cache-MessagePort-pending-message-expected.txt: Added.
  • fast/history/page-cache-MessagePort-pending-message.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-608.1-branch
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608.1-branch/LayoutTests/ChangeLog

    r248354 r248358  
     12019-08-06  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r248148. rdar://problem/54017841
     4
     5    Pages using MessagePorts should be PageCacheable
     6    https://bugs.webkit.org/show_bug.cgi?id=200366
     7    <rdar://problem/53837882>
     8   
     9    Reviewed by Geoffrey Garen.
     10   
     11    Source/WebCore:
     12   
     13    Allow a page to enter PageCache, even if it has MessagePorts (potentially with
     14    pending messages). If there are pending messages on the MessagePorts when
     15    entering PageCache, those will get dispatched upon restoring from PageCache.
     16   
     17    Test: fast/history/page-cache-MessagePort-pending-message.html
     18   
     19    * dom/MessagePort.cpp:
     20    (WebCore::MessagePort::messageAvailable):
     21    (WebCore::MessagePort::dispatchMessages):
     22    Do not dispatch messages while in PageCache.
     23   
     24    (WebCore::MessagePort::canSuspendForDocumentSuspension const):
     25    Allow pages with MessagePort objects to enter PageCache.
     26   
     27    * dom/ScriptExecutionContext.cpp:
     28    (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
     29    Make sure pending messages on MessagePorts get dispatched asynchronously after restoring
     30    from PageCache.
     31   
     32    * loader/DocumentLoader.cpp:
     33    (WebCore::areAllLoadersPageCacheAcceptable):
     34    Make sure only CachedResources that are still loading upon load cancelation prevent
     35    entering PageCache.
     36   
     37    LayoutTests:
     38   
     39    Add layout test coverage.
     40   
     41    * fast/history/page-cache-MessagePort-pending-message-expected.txt: Added.
     42    * fast/history/page-cache-MessagePort-pending-message.html: Added.
     43   
     44   
     45    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     46
     47    2019-08-01  Chris Dumez  <cdumez@apple.com>
     48
     49            Pages using MessagePorts should be PageCacheable
     50            https://bugs.webkit.org/show_bug.cgi?id=200366
     51            <rdar://problem/53837882>
     52
     53            Reviewed by Geoffrey Garen.
     54
     55            Add layout test coverage.
     56
     57            * fast/history/page-cache-MessagePort-pending-message-expected.txt: Added.
     58            * fast/history/page-cache-MessagePort-pending-message.html: Added.
     59
    1602019-08-06  Kocsen Chung  <kocsen_chung@apple.com>
    261
  • branches/safari-608.1-branch/Source/WebCore/ChangeLog

    r248356 r248358  
     12019-08-06  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r248148. rdar://problem/54017841
     4
     5    Pages using MessagePorts should be PageCacheable
     6    https://bugs.webkit.org/show_bug.cgi?id=200366
     7    <rdar://problem/53837882>
     8   
     9    Reviewed by Geoffrey Garen.
     10   
     11    Source/WebCore:
     12   
     13    Allow a page to enter PageCache, even if it has MessagePorts (potentially with
     14    pending messages). If there are pending messages on the MessagePorts when
     15    entering PageCache, those will get dispatched upon restoring from PageCache.
     16   
     17    Test: fast/history/page-cache-MessagePort-pending-message.html
     18   
     19    * dom/MessagePort.cpp:
     20    (WebCore::MessagePort::messageAvailable):
     21    (WebCore::MessagePort::dispatchMessages):
     22    Do not dispatch messages while in PageCache.
     23   
     24    (WebCore::MessagePort::canSuspendForDocumentSuspension const):
     25    Allow pages with MessagePort objects to enter PageCache.
     26   
     27    * dom/ScriptExecutionContext.cpp:
     28    (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
     29    Make sure pending messages on MessagePorts get dispatched asynchronously after restoring
     30    from PageCache.
     31   
     32    * loader/DocumentLoader.cpp:
     33    (WebCore::areAllLoadersPageCacheAcceptable):
     34    Make sure only CachedResources that are still loading upon load cancelation prevent
     35    entering PageCache.
     36   
     37    LayoutTests:
     38   
     39    Add layout test coverage.
     40   
     41    * fast/history/page-cache-MessagePort-pending-message-expected.txt: Added.
     42    * fast/history/page-cache-MessagePort-pending-message.html: Added.
     43   
     44   
     45    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     46
     47    2019-08-01  Chris Dumez  <cdumez@apple.com>
     48
     49            Pages using MessagePorts should be PageCacheable
     50            https://bugs.webkit.org/show_bug.cgi?id=200366
     51            <rdar://problem/53837882>
     52
     53            Reviewed by Geoffrey Garen.
     54
     55            Allow a page to enter PageCache, even if it has MessagePorts (potentially with
     56            pending messages). If there are pending messages on the MessagePorts when
     57            entering PageCache, those will get dispatched upon restoring from PageCache.
     58
     59            Test: fast/history/page-cache-MessagePort-pending-message.html
     60
     61            * dom/MessagePort.cpp:
     62            (WebCore::MessagePort::messageAvailable):
     63            (WebCore::MessagePort::dispatchMessages):
     64            Do not dispatch messages while in PageCache.
     65
     66            (WebCore::MessagePort::canSuspendForDocumentSuspension const):
     67            Allow pages with MessagePort objects to enter PageCache.
     68
     69            * dom/ScriptExecutionContext.cpp:
     70            (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
     71            Make sure pending messages on MessagePorts get dispatched asynchronously after restoring
     72            from PageCache.
     73
     74            * loader/DocumentLoader.cpp:
     75            (WebCore::areAllLoadersPageCacheAcceptable):
     76            Make sure only CachedResources that are still loading upon load cancelation prevent
     77            entering PageCache.
     78
    1792019-08-06  Kocsen Chung  <kocsen_chung@apple.com>
    280
  • branches/safari-608.1-branch/Source/WebCore/dom/MessagePort.cpp

    r246490 r248358  
    196196    // This MessagePort object might be disentangled because the port is being transferred,
    197197    // in which case we'll notify it that messages are available once a new end point is created.
    198     if (!m_scriptExecutionContext)
     198    if (!m_scriptExecutionContext || m_scriptExecutionContext->activeDOMObjectsAreSuspended())
    199199        return;
    200200
     
    244244    ASSERT(started());
    245245
    246     if (!isEntangled())
     246    if (!m_scriptExecutionContext || m_scriptExecutionContext->activeDOMObjectsAreSuspended() || !isEntangled())
    247247        return;
    248248
     
    431431bool MessagePort::canSuspendForDocumentSuspension() const
    432432{
    433     return !hasPendingActivity() || (!m_started || m_closed);
     433    return true;
    434434}
    435435
  • branches/safari-608.1-branch/Source/WebCore/dom/ScriptExecutionContext.cpp

    r243887 r248358  
    308308        return ShouldContinue::Yes;
    309309    });
     310
     311    // In case there were pending messages at the time the script execution context entered PageCache,
     312    // make sure those get dispatched shortly after restoring from PageCache.
     313    processMessageWithMessagePortsSoon();
    310314}
    311315
  • branches/safari-608.1-branch/Source/WebCore/loader/DocumentLoader.cpp

    r247617 r248358  
    136136            return false;
    137137
    138         // Only image and XHR loads do prevent the page from entering the PageCache.
     138        // Only image and XHR loads do not prevent the page from entering the PageCache.
    139139        // All non-image loads will prevent the page from entering the PageCache.
    140         if (!cachedResource->isImage() && !cachedResource->areAllClientsXMLHttpRequests())
     140        if (cachedResource->isLoading() && !cachedResource->isImage() && !cachedResource->areAllClientsXMLHttpRequests())
    141141            return false;
    142142    }
Note: See TracChangeset for help on using the changeset viewer.