コード例 #1
0
void DocumentLoader::commitData(const char* bytes, size_t length)
{
    if (!m_gotFirstByte) {
        m_gotFirstByte = true;
        m_writer.begin(documentURL(), false);
        m_writer.setDocumentWasLoadedAsPartOfNavigation();
        
#if ENABLE(MHTML)
        // The origin is the MHTML file, we need to set the base URL to the document encoded in the MHTML so
        // relative URLs are resolved properly.
        if (m_archive && m_archive->type() == Archive::MHTML)
            m_frame->document()->setBaseURLOverride(m_archive->mainResource()->url());
#endif

        // Call receivedFirstData() exactly once per load. We should only reach this point multiple times
        // for multipart loads, and isReplacing() will be true after the first time.
        if (!m_mainResourceLoader || !m_mainResourceLoader->isLoadingMultipartContent() || !frameLoader()->isReplacing())
            frameLoader()->receivedFirstData();

        bool userChosen = true;
        String encoding = overrideEncoding();
        if (encoding.isNull()) {
            userChosen = false;
            encoding = response().textEncodingName();
#if ENABLE(WEB_ARCHIVE)
            if (m_archive && m_archive->type() == Archive::WebArchive)
                encoding = m_archive->mainResource()->textEncoding();
#endif
        }
        m_writer.setEncoding(encoding, userChosen);
    }
    ASSERT(m_frame->document()->parsing());
    m_writer.addData(bytes, length);
}
コード例 #2
0
ファイル: DocumentLoader.cpp プロジェクト: windyuuy/opera
void DocumentLoader::commitData(const char* bytes, size_t length)
{
    if (!m_gotFirstByte) {
        m_gotFirstByte = true;
        m_writer.begin(documentURL(), false);
        m_writer.setDocumentWasLoadedAsPartOfNavigation();

        if (frameLoader()->stateMachine()->creatingInitialEmptyDocument())
            return;
        
        // The origin is the MHTML file, we need to set the base URL to the document encoded in the MHTML so
        // relative URLs are resolved properly.
        if (m_archive)
            m_frame->document()->setBaseURLOverride(m_archive->mainResource()->url());

        // Call receivedFirstData() exactly once per load.
        frameLoader()->receivedFirstData();

        bool userChosen = true;
        String encoding = overrideEncoding();
        if (encoding.isNull()) {
            userChosen = false;
            encoding = response().textEncodingName();
        }
        m_writer.setEncoding(encoding, userChosen);
    }
    ASSERT(m_frame->document()->parsing());
    m_writer.addData(bytes, length);
}
コード例 #3
0
void DocumentLoader::commitData(const char* bytes, size_t length)
{
    // Set the text encoding.  This is safe to call multiple times.
    bool userChosen = true;
    String encoding = overrideEncoding();
    if (encoding.isNull()) {
        userChosen = false;
        encoding = response().textEncodingName();
    }
    m_writer.setEncoding(encoding, userChosen);
    ASSERT(m_frame->document()->parsing());
    m_writer.addData(bytes, length);
}
コード例 #4
0
void DocumentLoader::commitData(const char* bytes, int length)
{
    // Set the text encoding.  This is safe to call multiple times.
    bool userChosen = true;
    String encoding = overrideEncoding();
    if (encoding.isNull()) {
        userChosen = false;
        encoding = response().textEncodingName();
    }
    // FIXME: DocumentWriter should be owned by DocumentLoader.
    m_frame->loader()->writer()->setEncoding(encoding, userChosen);
    ASSERT(m_frame->document()->parsing());
    m_frame->loader()->writer()->addData(bytes, length);
}
コード例 #5
0
void DocumentLoader::ensureWriter(const AtomicString& mimeType, const KURL& overridingURL)
{
    if (m_writer)
        return;

    const AtomicString& encoding = overrideEncoding().isNull() ? response().textEncodingName() : overrideEncoding();
    m_writer = createWriterFor(m_frame, 0, url(), mimeType, encoding, false, false);
    m_writer->setDocumentWasLoadedAsPartOfNavigation();
    // This should be set before receivedFirstData().
    if (!overridingURL.isEmpty())
        m_frame->document()->setBaseURLOverride(overridingURL);

    // Call receivedFirstData() exactly once per load.
    frameLoader()->receivedFirstData();
    m_frame->document()->maybeHandleHttpRefresh(m_response.httpHeaderField("Refresh"), Document::HttpRefreshFromHeader);
}