Changeset 192947 in webkit


Ignore:
Timestamp:
Dec 2, 2015 11:04:07 AM (8 years ago)
Author:
jiewen_tan@apple.com
Message:

Null dereference loading Blink layout test fast/loader/unload-mutation-crash.html
https://bugs.webkit.org/show_bug.cgi?id=149305
<rdar://problem/22747892>

Reviewed by Brent Fulgham.

Source/WebCore:

Add an extra guard to replaceDocument() against rude JS in unload event handlers.

Test: fast/loader/unload-mutation-crash.html

  • loader/DocumentWriter.cpp:

(WebCore::DocumentWriter::replaceDocument):
(WebCore::DocumentWriter::begin):

LayoutTests:

This test case is from Blink r180918:
https://codereview.chromium.org/495743003

  • fast/loader/unload-mutation-crash-expected.txt: Added.
  • fast/loader/unload-mutation-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r192945 r192947  
     12015-12-02  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Null dereference loading Blink layout test fast/loader/unload-mutation-crash.html
     4        https://bugs.webkit.org/show_bug.cgi?id=149305
     5        <rdar://problem/22747892>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This test case is from Blink r180918:
     10        https://codereview.chromium.org/495743003
     11
     12        * fast/loader/unload-mutation-crash-expected.txt: Added.
     13        * fast/loader/unload-mutation-crash.html: Added.
     14
    1152015-12-02  Joseph Pecoraro  <pecoraro@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r192943 r192947  
     12015-12-02  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Null dereference loading Blink layout test fast/loader/unload-mutation-crash.html
     4        https://bugs.webkit.org/show_bug.cgi?id=149305
     5        <rdar://problem/22747892>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Add an extra guard to replaceDocument() against rude JS in unload event handlers.
     10
     11        Test: fast/loader/unload-mutation-crash.html
     12
     13        * loader/DocumentWriter.cpp:
     14        (WebCore::DocumentWriter::replaceDocument):
     15        (WebCore::DocumentWriter::begin):
     16
    1172015-12-02  Per Arne Vollan  <peavo@outlook.com>
    218
  • trunk/Source/WebCore/loader/DocumentWriter.cpp

    r189771 r192947  
    7474    begin(m_frame->document()->url(), true, ownerDocument);
    7575
     76    // begin() might fire an unload event, which will result in a situation where no new document has been attached,
     77    // and the old document has been detached. Therefore, bail out if no document is attached.
     78    if (!m_frame->document())
     79        return;
     80
    7681    if (!source.isNull()) {
    7782        if (!m_hasReceivedSomeData) {
     
    141146    m_frame->loader().clear(document.ptr(), !shouldReuseDefaultView, !shouldReuseDefaultView);
    142147    clear();
     148
     149    // m_frame->loader().clear() might fire unload event which could remove the view of the document.
     150    // Bail out if document has no view.
     151    if (!document->view())
     152        return;
    143153
    144154    if (!shouldReuseDefaultView)
Note: See TracChangeset for help on using the changeset viewer.