Changeset 225723 in webkit


Ignore:
Timestamp:
Dec 9, 2017 2:41:32 AM (6 years ago)
Author:
rniwa@webkit.org
Message:

iOS: Crash in Document::updateLayout() via Document::processViewport
https://bugs.webkit.org/show_bug.cgi?id=180619
<rdar://problem/35717575>

Reviewed by Zalan Bujtas.

Source/WebCore:

The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.

Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
since updating the viewport configuration results in a lot of related code running in response,
and making sure all that code never tries to execute an author script is not attainable in the short term,
and a maintenance nightmare in the long term.

Test: media/ios/viewport-change-with-video.html

  • html/HTMLMetaElement.cpp:

(WebCore::HTMLMetaElement::insertedIntoAncestor):
(WebCore::HTMLMetaElement::didFinishInsertingNode): Added.

  • html/HTMLMetaElement.h:

LayoutTests:

Added a regression test for the crash.

  • media/ios/viewport-change-with-video-expected.txt: Added.
  • media/ios/viewport-change-with-video.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r225719 r225723  
     12017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        iOS: Crash in Document::updateLayout() via Document::processViewport
     4        https://bugs.webkit.org/show_bug.cgi?id=180619
     5        <rdar://problem/35717575>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Added a regression test for the crash.
     10
     11        * media/ios/viewport-change-with-video-expected.txt: Added.
     12        * media/ios/viewport-change-with-video.html: Added.
     13
    1142017-12-08  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r225719 r225723  
     12017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        iOS: Crash in Document::updateLayout() via Document::processViewport
     4        https://bugs.webkit.org/show_bug.cgi?id=180619
     5        <rdar://problem/35717575>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
     10        via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.
     11
     12        Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
     13        since updating the viewport configuration results in a lot of related code running in response,
     14        and making sure all that code never tries to execute an author script is not attainable in the short term,
     15        and a maintenance nightmare in the long term.
     16
     17        Test: media/ios/viewport-change-with-video.html
     18
     19        * html/HTMLMetaElement.cpp:
     20        (WebCore::HTMLMetaElement::insertedIntoAncestor):
     21        (WebCore::HTMLMetaElement::didFinishInsertingNode): Added.
     22        * html/HTMLMetaElement.h:
     23
    1242017-12-08  Zalan Bujtas  <zalan@apple.com>
    225
  • trunk/Source/WebCore/html/HTMLMetaElement.cpp

    r223802 r225723  
    6565    HTMLElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
    6666    if (insertionType.connectedToDocument)
    67         process();
     67        return InsertedIntoAncestorResult::NeedsPostInsertionCallback;
    6868    return InsertedIntoAncestorResult::Done;
     69}
     70
     71void HTMLMetaElement::didFinishInsertingNode()
     72{
     73    process();
    6974}
    7075
  • trunk/Source/WebCore/html/HTMLMetaElement.h

    r223802 r225723  
    4141    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4242    InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final;
     43    void didFinishInsertingNode();
    4344
    4445    void process();
Note: See TracChangeset for help on using the changeset viewer.