Changeset 183052 in webkit


Ignore:
Timestamp:
Apr 20, 2015 11:22:57 PM (9 years ago)
Author:
Chris Dumez
Message:

Crash when showing Web Inspector on page with 'multipart/x-mixed-replace' main resource
https://bugs.webkit.org/show_bug.cgi?id=143979
<rdar://problem/20594948>

Reviewed by Timothy Hatcher.

InspectorDOMAgent::m_document was updated only once per load, from
FrameLoader::dispatchDidCommitLoad(). However, dispatchDidCommitLoad()
is not called for follow-up multipart replacing loads. You can see this
from the following check in DocumentLoader::commitData():

if (!isMultipartReplacingLoad())

frameLoader()->receivedFirstData();

As a result, in the case of a 'multipart/x-mixed-replace' main resource
InspectorDOMAgent::m_document would quickly get outdated as we create
a new Document for each replacing load. This would lead to Web Inspector
code using a Document without frame and causing crashes.

This patch calls InspectorInstrumentation::frameDocumentUpdated() from
Frame::setDocument() so that InspectorDOMAgent::m_document is always up
to date.

No new tests, not easily testable as the main resource needs to be
'multipart/x-mixed-replace'.

  • dom/Document.cpp:

(WebCore::Document::applyXSLTransform):
Stop calling InspectorInstrumentation::frameDocumentUpdated() here as
XSLTProcessor::createDocumentFromSource() will call Frame::setDocument()
and frameDocumentUpdated() will be called there.

  • page/Frame.cpp:

(WebCore::Frame::setDocument):
Call InspectorInstrumentation::frameDocumentUpdated() to make sure
InspectorDOMAgent::m_document gets updated.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r183035 r183052  
     12015-04-20  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash when showing Web Inspector on page with 'multipart/x-mixed-replace' main resource
     4        https://bugs.webkit.org/show_bug.cgi?id=143979
     5        <rdar://problem/20594948>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        InspectorDOMAgent::m_document was updated only once per load, from
     10        FrameLoader::dispatchDidCommitLoad(). However, dispatchDidCommitLoad()
     11        is not called for follow-up multipart replacing loads. You can see this
     12        from the following check in DocumentLoader::commitData():
     13            if (!isMultipartReplacingLoad())
     14                frameLoader()->receivedFirstData();
     15
     16        As a result, in the case of a 'multipart/x-mixed-replace' main resource
     17        InspectorDOMAgent::m_document would quickly get outdated as we create
     18        a new Document for each replacing load. This would lead to Web Inspector
     19        code using a Document without frame and causing crashes.
     20
     21        This patch calls InspectorInstrumentation::frameDocumentUpdated() from
     22        Frame::setDocument() so that InspectorDOMAgent::m_document is always up
     23        to date.
     24
     25        No new tests, not easily testable as the main resource needs to be
     26        'multipart/x-mixed-replace'.
     27
     28        * dom/Document.cpp:
     29        (WebCore::Document::applyXSLTransform):
     30        Stop calling InspectorInstrumentation::frameDocumentUpdated() here as
     31        XSLTProcessor::createDocumentFromSource() will call Frame::setDocument()
     32        and frameDocumentUpdated() will be called there.
     33
     34        * page/Frame.cpp:
     35        (WebCore::Frame::setDocument):
     36        Call InspectorInstrumentation::frameDocumentUpdated() to make sure
     37        InspectorDOMAgent::m_document gets updated.
     38
    1392015-04-20  Alex Christensen  <achristensen@webkit.org>
    240
  • trunk/Source/WebCore/dom/Document.cpp

    r183021 r183052  
    45854585    Frame* ownerFrame = frame();
    45864586    processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, this, ownerFrame);
    4587     InspectorInstrumentation::frameDocumentUpdated(ownerFrame);
    45884587}
    45894588
  • trunk/Source/WebCore/page/Frame.cpp

    r182132 r183052  
    285285    if (newDocument)
    286286        newDocument->didBecomeCurrentDocumentInFrame();
     287
     288    InspectorInstrumentation::frameDocumentUpdated(this);
    287289}
    288290
Note: See TracChangeset for help on using the changeset viewer.