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); }
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); }
void runSetUp(ViewportState viewportState, PreloadState preloadState = PreloadEnabled) { HTMLParserOptions options(&m_dummyPageHolder->document()); KURL documentURL(ParsedURLString, "http://whatever.test/"); m_dummyPageHolder->document().settings()->setViewportEnabled(viewportState == ViewportEnabled); m_dummyPageHolder->document().settings()->setViewportMetaEnabled(viewportState == ViewportEnabled); m_dummyPageHolder->document().settings()->setDoHtmlPreloadScanning(preloadState == PreloadEnabled); m_scanner = HTMLPreloadScanner::create(options, documentURL, CachedDocumentParameters::create(&m_dummyPageHolder->document()), createMediaValuesData()); }
bool XMLHttpRequest::urlMatchesDocumentDomain(const KURL& url) const { KURL documentURL(m_doc->URL()); // a local file can load anything if (documentURL.protocol().lower() == "file") return true; // but a remote document can only load from the same port on the server if (documentURL.protocol().lower() == url.protocol().lower() && documentURL.host().lower() == url.host().lower() && documentURL.port() == url.port()) return true; return false; }