Diff
Modified: trunk/Source/WebCore/ChangeLog (145006 => 145007)
--- trunk/Source/WebCore/ChangeLog 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/ChangeLog 2013-03-07 00:35:55 UTC (rev 145007)
@@ -1,3 +1,39 @@
+2013-03-06 Alexey Proskuryakov <[email protected]>
+
+ [Mac] Synthetic ResourceResponses cannot be sent over IPC without losing most information
+ https://bugs.webkit.org/show_bug.cgi?id=111623
+
+ Reviewed by Brady Eidson.
+
+ * WebCore.exp.in: Exported functions for building synthetic responses.
+
+ * platform/network/ResourceResponseBase.cpp:
+ * platform/network/ResourceResponseBase.h:
+ Added a lot of FIXMEs.
+
+ * platform/network/cf/ResourceResponse.h:
+ (WebCore::ResourceResponse::ResourceResponse):
+ (WebCore::ResourceResponse::platformResponseIsUpToDate):
+ Track m_platformResponseIsUpToDate flag as well as we can. Currently, it will
+ be incorrect if a real platform response gets mutated.
+
+ * platform/network/cf/ResourceResponseCFNet.cpp:
+ (WebCore::ResourceResponse::cfURLResponse): Added a FIXME about how useless this
+ function is when it tries to create a new CFURLResponse.
+
+ * platform/network/mac/ResourceResponseMac.mm:
+ (WebCore::ResourceResponse::initNSURLResponse): Added a FIXME.
+ (WebCore::ResourceResponse::nsURLResponse): Added a return to make logic more clear.
+ (WebCore::ResourceResponse::ResourceResponse): Track m_platformResponseIsUpToDate.
+
+ * platform/network/blackberry/ResourceResponse.h:
+ * platform/network/curl/ResourceResponse.h:
+ * platform/network/qt/ResourceResponse.h:
+ * platform/network/soup/ResourceResponse.h:
+ * platform/network/win/ResourceResponse.h:
+ These platforms do not keep a platform response, so it's never up to date, and
+ WebCore data needs to be serialized.
+
2013-03-06 Dana Jansens <[email protected]>
[chromium] Remove WebSharedGraphicsContext3D class
Modified: trunk/Source/WebCore/WebCore.exp.in (145006 => 145007)
--- trunk/Source/WebCore/WebCore.exp.in 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-03-07 00:35:55 UTC (rev 145007)
@@ -618,6 +618,9 @@
__ZN7WebCore20RenderEmbeddedObject29setPluginUnavailabilityReasonENS0_26PluginUnavailabilityReasonE
__ZN7WebCore20ResourceResponseBase11setMimeTypeERKN3WTF6StringE
__ZN7WebCore20ResourceResponseBase17setHTTPStatusCodeEi
+__ZN7WebCore20ResourceResponseBase17setHTTPStatusTextERKN3WTF6StringE
+__ZN7WebCore20ResourceResponseBase18setHTTPHeaderFieldERKN3WTF12AtomicStringERKNS1_6StringE
+__ZN7WebCore20ResourceResponseBase19setTextEncodingNameERKN3WTF6StringE
__ZN7WebCore20ResourceResponseBase20setSuggestedFilenameERKN3WTF6StringE
__ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
__ZN7WebCore20ResourceResponseBase6setURLERKNS_4KURLE
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (145006 => 145007)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp 2013-03-07 00:35:55 UTC (rev 145007)
@@ -156,7 +156,9 @@
lazyInit(CommonFieldsOnly);
m_isNull = false;
- m_url = url;
+ m_url = url;
+
+ // FIXME: Should invalidate or update platform response if present.
}
const String& ResourceResponseBase::mimeType() const
@@ -171,7 +173,10 @@
lazyInit(CommonFieldsOnly);
m_isNull = false;
- m_mimeType = mimeType;
+ // FIXME: MIME type is determined by HTTP Content-Type header. We should update the header, so that it doesn't disagree with m_mimeType.
+ m_mimeType = mimeType;
+
+ // FIXME: Should invalidate or update platform response if present.
}
long long ResourceResponseBase::expectedContentLength() const
@@ -186,7 +191,10 @@
lazyInit(CommonFieldsOnly);
m_isNull = false;
+ // FIXME: Content length is determined by HTTP Content-Length header. We should update the header, so that it doesn't disagree with m_expectedContentLength.
m_expectedContentLength = expectedContentLength;
+
+ // FIXME: Should invalidate or update platform response if present.
}
const String& ResourceResponseBase::textEncodingName() const
@@ -201,7 +209,10 @@
lazyInit(CommonFieldsOnly);
m_isNull = false;
- m_textEncodingName = encodingName;
+ // FIXME: Text encoding is determined by HTTP Content-Type header. We should update the header, so that it doesn't disagree with m_textEncodingName.
+ m_textEncodingName = encodingName;
+
+ // FIXME: Should invalidate or update platform response if present.
}
// FIXME should compute this on the fly
@@ -217,7 +228,10 @@
lazyInit(AllFields);
m_isNull = false;
+ // FIXME: Suggested file name is calculated based on other headers. There should not be a setter for it.
m_suggestedFilename = suggestedName;
+
+ // FIXME: Should invalidate or update platform response if present.
}
int ResourceResponseBase::httpStatusCode() const
@@ -232,6 +246,8 @@
lazyInit(CommonFieldsOnly);
m_httpStatusCode = statusCode;
+
+ // FIXME: Should invalidate or update platform response if present.
}
const String& ResourceResponseBase::httpStatusText() const
@@ -246,6 +262,8 @@
lazyInit(CommonAndUncommonFields);
m_httpStatusText = statusText;
+
+ // FIXME: Should invalidate or update platform response if present.
}
String ResourceResponseBase::httpHeaderField(const AtomicString& name) const
@@ -304,6 +322,8 @@
updateHeaderParsedState(name);
m_httpHeaderFields.set(name, value);
+
+ // FIXME: Should invalidate or update platform response if present.
}
void ResourceResponseBase::addHTTPHeaderField(const AtomicString& name, const String& value)
@@ -504,6 +524,8 @@
lazyInit(CommonAndUncommonFields);
m_lastModifiedDate = lastModifiedDate;
+
+ // FIXME: Should invalidate or update platform response if present.
}
time_t ResourceResponseBase::lastModifiedDate() const
Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (145006 => 145007)
--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -68,7 +68,8 @@
const String& textEncodingName() const;
void setTextEncodingName(const String& name);
- // FIXME should compute this on the fly
+ // FIXME: Should compute this on the fly.
+ // There should not be a setter exposed, as suggested file name is determined based on other headers in a manner that WebCore does not necessarily know about.
const String& suggestedFilename() const;
void setSuggestedFilename(const String&);
@@ -88,7 +89,7 @@
bool isAttachment() const;
- // FIXME: These are used by PluginStream on some platforms. Calculations may differ from just returning plain Last-odified header.
+ // FIXME: These are used by PluginStream on some platforms. Calculations may differ from just returning plain Last-Modified header.
// Leaving it for now but this should go away in favor of generic solution.
void setLastModifiedDate(time_t);
time_t lastModifiedDate() const;
Modified: trunk/Source/WebCore/platform/network/blackberry/ResourceResponse.h (145006 => 145007)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceResponse.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceResponse.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -42,6 +42,8 @@
void setIsMultipartPayload(bool value) { m_isMultipartPayload = value; }
bool isMultipartPayload() const { return m_isMultipartPayload; }
+ bool platformResponseIsUpToDate() const { return false; }
+
private:
bool m_isMultipartPayload;
};
Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponse.h (145006 => 145007)
--- trunk/Source/WebCore/platform/network/cf/ResourceResponse.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponse.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -41,6 +41,7 @@
public:
ResourceResponse()
: m_initLevel(CommonAndUncommonFields)
+ , m_platformResponseIsUpToDate(true)
{
}
@@ -48,6 +49,7 @@
ResourceResponse(CFURLResponseRef cfResponse)
: m_cfResponse(cfResponse)
, m_initLevel(Uninitialized)
+ , m_platformResponseIsUpToDate(true)
{
m_isNull = !cfResponse;
}
@@ -58,6 +60,7 @@
ResourceResponse(NSURLResponse *nsResponse)
: m_nsResponse(nsResponse)
, m_initLevel(Uninitialized)
+ , m_platformResponseIsUpToDate(true)
{
m_isNull = !nsResponse;
}
@@ -66,6 +69,7 @@
ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
: ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
, m_initLevel(CommonAndUncommonFields)
+ , m_platformResponseIsUpToDate(false)
{
}
@@ -93,6 +97,8 @@
RetainPtr<CFArrayRef> certificateChain() const;
#endif
+ bool platformResponseIsUpToDate() const { return m_platformResponseIsUpToDate; }
+
private:
friend class ResourceResponseBase;
@@ -116,6 +122,7 @@
RetainPtr<CFArrayRef> m_externalCertificateChain;
#endif
InitLevel m_initLevel;
+ bool m_platformResponseIsUpToDate;
};
struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataBase {
Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp (145006 => 145007)
--- trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp 2013-03-07 00:35:55 UTC (rev 145007)
@@ -51,6 +51,9 @@
{
if (!m_cfResponse && !m_isNull) {
RetainPtr<CFURLRef> url(AdoptCF, m_url.createCFURL());
+
+ // FIXME: This creates a very incomplete CFURLResponse, which does not even have a status code.
+
m_cfResponse.adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.createCFString().get(), m_expectedContentLength, m_textEncodingName.createCFString().get(), kCFURLCacheStorageAllowed));
}
Modified: trunk/Source/WebCore/platform/network/curl/ResourceResponse.h (145006 => 145007)
--- trunk/Source/WebCore/platform/network/curl/ResourceResponse.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/curl/ResourceResponse.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -51,6 +51,8 @@
// Needed for compatibility.
CFURLResponseRef cfURLResponse() const { return 0; }
+ bool platformResponseIsUpToDate() const { return false; }
+
private:
friend class ResourceResponseBase;
Modified: trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm (145006 => 145007)
--- trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm 2013-03-07 00:35:55 UTC (rev 145007)
@@ -53,7 +53,7 @@
void ResourceResponse::initNSURLResponse() const
{
- // Work around a mistake in the NSURLResponse class - <rdar://problem/3346574>.
+ // Work around a mistake in the NSURLResponse class - <rdar://problem/6875219>.
// The init function takes an NSInteger, even though the accessor returns a long long.
// For values that won't fit in an NSInteger, pass -1 instead.
NSInteger expectedContentLength;
@@ -61,6 +61,9 @@
expectedContentLength = -1;
else
expectedContentLength = static_cast<NSInteger>(m_expectedContentLength);
+
+ // FIXME: This creates a very incomplete NSURLResponse, which does not even have a status code.
+
m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
}
@@ -71,6 +74,7 @@
if (!m_nsResponse && !m_cfResponse && !m_isNull) {
initNSURLResponse();
m_cfResponse = [m_nsResponse.get() _CFURLResponse];
+ return m_nsResponse.get();
}
if (!m_cfResponse)
@@ -86,6 +90,7 @@
: m_cfResponse([nsResponse _CFURLResponse])
, m_nsResponse(nsResponse)
, m_initLevel(Uninitialized)
+ , m_platformResponseIsUpToDate(true)
{
m_isNull = !nsResponse;
}
Modified: trunk/Source/WebCore/platform/network/qt/ResourceResponse.h (145006 => 145007)
--- trunk/Source/WebCore/platform/network/qt/ResourceResponse.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/qt/ResourceResponse.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -41,6 +41,8 @@
{
}
+ bool platformResponseIsUpToDate() const { return false; }
+
private:
friend class ResourceResponseBase;
Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponse.h (145006 => 145007)
--- trunk/Source/WebCore/platform/network/soup/ResourceResponse.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponse.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -73,6 +73,8 @@
GTlsCertificateFlags soupMessageTLSErrors() const { return m_tlsErrors; }
void setSoupMessageTLSErrors(GTlsCertificateFlags tlsErrors) { m_tlsErrors = tlsErrors; }
+ bool platformResponseIsUpToDate() const { return false; }
+
private:
friend class ResourceResponseBase;
Modified: trunk/Source/WebCore/platform/network/win/ResourceResponse.h (145006 => 145007)
--- trunk/Source/WebCore/platform/network/win/ResourceResponse.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebCore/platform/network/win/ResourceResponse.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -40,6 +40,8 @@
{
}
+ bool platformResponseIsUpToDate() const { return false; }
+
private:
friend class ResourceResponseBase;
Modified: trunk/Source/WebKit2/ChangeLog (145006 => 145007)
--- trunk/Source/WebKit2/ChangeLog 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebKit2/ChangeLog 2013-03-07 00:35:55 UTC (rev 145007)
@@ -1,3 +1,23 @@
+2013-03-06 Alexey Proskuryakov <[email protected]>
+
+ [Mac] Synthetic ResourceResponses cannot be sent over IPC without losing most information
+ https://bugs.webkit.org/show_bug.cgi?id=111623
+
+ Reviewed by Brady Eidson.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ * Shared/WebCoreArgumentCoders.h:
+ (CoreIPC::::encode): Made the decision on whether to serialize WebCore data in
+ ResourceResponse dynamic. If the platform data is out of date, we need both
+ (because some platforms use encodePlatformData() to pass additional information).
+ (CoreIPC::::decode): Decode platform data first, because this overwrites the ResourceResponse.
+
+ * Shared/mac/WebCoreArgumentCodersMac.mm: (CoreIPC::::encodePlatformData): Don't
+ encode NSURLResponse if it's out of date. We may have a bad NSURLResponse with 0
+ status code given to client, but it was almost certainly the same on sending side.
+ WebCore doesn't mutate real responses - it either keeps them as is, or builds
+ entirely synthetic ones.
+
2013-03-04 Jer Noble <[email protected]>
Default mouse cursor behavior should be auto-hide for full screen video with custom controls
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (145006 => 145007)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2013-03-07 00:35:55 UTC (rev 145007)
@@ -433,7 +433,16 @@
void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse)
{
- if (kShouldSerializeWebCoreData) {
+#if PLATFORM(MAC)
+ bool shouldSerializeWebCoreData = !resourceResponse.platformResponseIsUpToDate();
+ encoder << shouldSerializeWebCoreData;
+#else
+ bool shouldSerializeWebCoreData = true;
+#endif
+
+ encodePlatformData(encoder, resourceResponse);
+
+ if (shouldSerializeWebCoreData) {
bool responseIsNull = resourceResponse.isNull();
encoder << responseIsNull;
if (responseIsNull)
@@ -449,13 +458,24 @@
encoder << resourceResponse.httpStatusText();
encoder << resourceResponse.suggestedFilename();
}
-
- encodePlatformData(encoder, resourceResponse);
}
bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder& decoder, ResourceResponse& resourceResponse)
{
- if (kShouldSerializeWebCoreData) {
+#if PLATFORM(MAC)
+ bool hasSerializedWebCoreData;
+ if (!decoder.decode(hasSerializedWebCoreData))
+ return false;
+#else
+ bool hasSerializedWebCoreData = true;
+#endif
+
+ ResourceResponse response;
+
+ if (!decodePlatformData(decoder, response))
+ return false;
+
+ if (hasSerializedWebCoreData) {
bool responseIsNull;
if (!decoder.decode(responseIsNull))
return false;
@@ -464,8 +484,6 @@
return true;
}
- ResourceResponse response;
-
String url;
if (!decoder.decode(url))
return false;
@@ -506,11 +524,11 @@
if (!decoder.decode(suggestedFilename))
return false;
response.setSuggestedFilename(suggestedFilename);
-
- resourceResponse = response;
}
- return decodePlatformData(decoder, resourceResponse);
+ resourceResponse = response;
+
+ return true;
}
void ArgumentCoder<ResourceError>::encode(ArgumentEncoder& encoder, const ResourceError& resourceError)
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (145006 => 145007)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2013-03-07 00:35:55 UTC (rev 145007)
@@ -162,12 +162,6 @@
};
template<> struct ArgumentCoder<WebCore::ResourceResponse> {
-#if PLATFORM(MAC)
- static const bool kShouldSerializeWebCoreData = false;
-#else
- static const bool kShouldSerializeWebCoreData = true;
-#endif
-
static void encode(ArgumentEncoder&, const WebCore::ResourceResponse&);
static bool decode(ArgumentDecoder&, WebCore::ResourceResponse&);
static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceResponse&);
Modified: trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm (145006 => 145007)
--- trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm 2013-03-07 00:32:31 UTC (rev 145006)
+++ trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm 2013-03-07 00:35:55 UTC (rev 145007)
@@ -85,7 +85,7 @@
void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse)
{
- bool responseIsPresent = resourceResponse.nsURLResponse();
+ bool responseIsPresent = resourceResponse.platformResponseIsUpToDate() && resourceResponse.nsURLResponse();
encoder << responseIsPresent;
if (!responseIsPresent)