Title: [153502] trunk/Source/WebCore
- Revision
- 153502
- Author
- [email protected]
- Date
- 2013-07-30 16:13:40 -0700 (Tue, 30 Jul 2013)
Log Message
Content filter replacement data uses the encoding from the blocked page's response headers
https://bugs.webkit.org/show_bug.cgi?id=119237
Reviewed by Darin Adler.
When a document specifies an encoding in an HTTP response header, or
when the embedder specifies an override encoding, and the content filter
blocks the document, we interpret the content filter's replacement data
using this encoding. This might be the wrong.
Forget about encodings determined from these sources. The replacement
data will specify an encoding in a <meta charset>, so let that be used
instead.
No new tests. We don't currently have a mechanism for testing the
content filter from WebKit.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::commitData): Pretend as if no encoding is
specified if the content filter blocked the load.
(WebCore::DocumentLoader::dataReceived): Stopped calling commitLoad()
before early-returning if the content filter needs more data. This isn't
necessary.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (153501 => 153502)
--- trunk/Source/WebCore/ChangeLog 2013-07-30 22:43:23 UTC (rev 153501)
+++ trunk/Source/WebCore/ChangeLog 2013-07-30 23:13:40 UTC (rev 153502)
@@ -1,3 +1,29 @@
+2013-07-30 Andy Estes <[email protected]>
+
+ Content filter replacement data uses the encoding from the blocked page's response headers
+ https://bugs.webkit.org/show_bug.cgi?id=119237
+
+ Reviewed by Darin Adler.
+
+ When a document specifies an encoding in an HTTP response header, or
+ when the embedder specifies an override encoding, and the content filter
+ blocks the document, we interpret the content filter's replacement data
+ using this encoding. This might be the wrong.
+
+ Forget about encodings determined from these sources. The replacement
+ data will specify an encoding in a <meta charset>, so let that be used
+ instead.
+
+ No new tests. We don't currently have a mechanism for testing the
+ content filter from WebKit.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::commitData): Pretend as if no encoding is
+ specified if the content filter blocked the load.
+ (WebCore::DocumentLoader::dataReceived): Stopped calling commitLoad()
+ before early-returning if the content filter needs more data. This isn't
+ necessary.
+
2013-07-30 Christophe Dumez <[email protected]>
Add 'colno' attribute to ErrorEvent interface
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (153501 => 153502)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2013-07-30 22:43:23 UTC (rev 153501)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2013-07-30 23:13:40 UTC (rev 153502)
@@ -782,16 +782,28 @@
if (!isMultipartReplacingLoad())
frameLoader()->receivedFirstData();
- bool userChosen = true;
- String encoding = overrideEncoding();
- if (encoding.isNull()) {
+ bool userChosen;
+ String encoding;
+#if USE(CONTENT_FILTERING)
+ // The content filter's replacement data has a known encoding that might
+ // differ from the response's encoding.
+ if (m_contentFilter && m_contentFilter->didBlockData()) {
+ ASSERT(!m_contentFilter->needsMoreData());
userChosen = false;
+ } else
+#endif
+ if (overrideEncoding().isNull()) {
+ userChosen = false;
encoding = response().textEncodingName();
#if ENABLE(WEB_ARCHIVE)
if (m_archive && m_archive->type() == Archive::WebArchive)
encoding = m_archive->mainResource()->textEncoding();
#endif
+ } else {
+ userChosen = true;
+ encoding = overrideEncoding();
}
+
m_writer.setEncoding(encoding, userChosen);
}
ASSERT(m_frame->document()->parsing());
@@ -824,9 +836,8 @@
if (m_contentFilter->needsMoreData()) {
// Since the filter still needs more data to make a decision,
- // transition back to the committed state so that we don't partially
- // load content that might later be blocked.
- commitLoad(0, 0);
+ // avoid committing this data to prevent partial rendering of
+ // content that might later be blocked.
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes