Title: [189200] trunk/Source/WebCore
- Revision
- 189200
- Author
- [email protected]
- Date
- 2015-08-31 17:29:24 -0700 (Mon, 31 Aug 2015)
Log Message
[Win] WebKit cannot load pages based on "file://" URLs
https://bugs.webkit.org/show_bug.cgi?id=148596
<rdar://problem/22432585>
Reviewed by Dean Jackson.
* platform/URL.cpp:
(WebCore::URL::URL): Work around bug that causes this assertion to fire on
the Apple Windows build.
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::adjustMIMETypeIfNecessary): Added. If the URL is for a local file,
determine the MIME type based on extension. Otherwise use the default MIME type.
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): If
the CFURLResponse has no MIME type, call 'adjustMIMETypeIfNecessary'.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (189199 => 189200)
--- trunk/Source/WebCore/ChangeLog 2015-09-01 00:24:26 UTC (rev 189199)
+++ trunk/Source/WebCore/ChangeLog 2015-09-01 00:29:24 UTC (rev 189200)
@@ -1,3 +1,20 @@
+2015-08-31 Brent Fulgham <[email protected]>
+
+ [Win] WebKit cannot load pages based on "file://" URLs
+ https://bugs.webkit.org/show_bug.cgi?id=148596
+ <rdar://problem/22432585>
+
+ Reviewed by Dean Jackson.
+
+ * platform/URL.cpp:
+ (WebCore::URL::URL): Work around bug that causes this assertion to fire on
+ the Apple Windows build.
+ * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+ (WebCore::adjustMIMETypeIfNecessary): Added. If the URL is for a local file,
+ determine the MIME type based on extension. Otherwise use the default MIME type.
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): If
+ the CFURLResponse has no MIME type, call 'adjustMIMETypeIfNecessary'.
+
2015-08-31 Chris Dumez <[email protected]>
http/tests/w3c/dom/nodes/Element-matches.html is flaky
Modified: trunk/Source/WebCore/platform/URL.cpp (189199 => 189200)
--- trunk/Source/WebCore/platform/URL.cpp 2015-09-01 00:24:26 UTC (rev 189199)
+++ trunk/Source/WebCore/platform/URL.cpp 2015-09-01 00:29:24 UTC (rev 189200)
@@ -432,7 +432,12 @@
URL::URL(ParsedURLStringTag, const String& url)
{
parse(url);
+#if OS(WINDOWS)
+ // FIXME(148598): Work around Windows local file handling bug in CFNetwork
+ ASSERT(isLocalFile() || url == m_string);
+#else
ASSERT(url == m_string);
+#endif
}
URL::URL(const URL& base, const String& relative)
Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (189199 => 189200)
--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2015-09-01 00:24:26 UTC (rev 189199)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2015-09-01 00:29:24 UTC (rev 189200)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -109,6 +109,29 @@
CFURLResponseSetMIMEType(response, defaultMIMETypeString);
}
+
+static void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse)
+{
+ RetainPtr<CFStringRef> result = CFURLResponseGetMIMEType(cfResponse);
+ RetainPtr<CFStringRef> originalResult = result;
+
+ if (!result) {
+ CFURLRef cfURL = CFURLResponseGetURL(cfResponse);
+ URL url(cfURL);
+ if (url.isLocalFile()) {
+ String mimeType = mimeTypeFromURL(url);
+ result = mimeType.createCFString().leakRef();
+ }
+ }
+
+ if (!result) {
+ static CFStringRef defaultMIMETypeString = WebCore::defaultMIMEType().createCFString().leakRef();
+ result = defaultMIMETypeString;
+ }
+
+ if (result != originalResult)
+ CFURLResponseSetMIMEType(cfResponse, result.get());
+}
#endif // !PLATFORM(COCOA)
void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse)
@@ -131,6 +154,9 @@
wkSetCFURLResponseMIMEType(cfResponse, CFSTR("text/html"));
#endif // !PLATFORM(IOS)
#else
+ if (!CFURLResponseGetMIMEType(cfResponse))
+ adjustMIMETypeIfNecessary(cfResponse);
+
if (!CFURLResponseGetMIMEType(cfResponse)) {
// We should never be applying the default MIMEType if we told the networking layer to do content sniffing for handle.
ASSERT(!m_handle->shouldContentSniff());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes