Title: [231949] trunk/Source/WebCore
- Revision
- 231949
- Author
- [email protected]
- Date
- 2018-05-18 01:11:17 -0700 (Fri, 18 May 2018)
Log Message
Stop softlinking QuickLook when loading from client-registered schemes
https://bugs.webkit.org/show_bug.cgi?id=185716
<rdar://problem/40303227>
Reviewed by Dan Bernstein.
No new tests, just a performance improvement.
* dom/Document.cpp:
* platform/SchemeRegistry.cpp:
* platform/ios/QuickLook.h:
* platform/ios/QuickLook.mm:
(WebCore::isQuickLookPreviewURL):
(WebCore::QLPreviewProtocol): Deleted.
Hard-code the QuickLook preview URL scheme, instead of loading the QuickLook
framework to retrieve it. It will never change, and just in case it does,
add an ASSERT (which does load QuickLook) so that we'll find out.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (231948 => 231949)
--- trunk/Source/WebCore/ChangeLog 2018-05-18 08:06:57 UTC (rev 231948)
+++ trunk/Source/WebCore/ChangeLog 2018-05-18 08:11:17 UTC (rev 231949)
@@ -1,3 +1,23 @@
+2018-05-18 Tim Horton <[email protected]>
+
+ Stop softlinking QuickLook when loading from client-registered schemes
+ https://bugs.webkit.org/show_bug.cgi?id=185716
+ <rdar://problem/40303227>
+
+ Reviewed by Dan Bernstein.
+
+ No new tests, just a performance improvement.
+
+ * dom/Document.cpp:
+ * platform/SchemeRegistry.cpp:
+ * platform/ios/QuickLook.h:
+ * platform/ios/QuickLook.mm:
+ (WebCore::isQuickLookPreviewURL):
+ (WebCore::QLPreviewProtocol): Deleted.
+ Hard-code the QuickLook preview URL scheme, instead of loading the QuickLook
+ framework to retrieve it. It will never change, and just in case it does,
+ add an ASSERT (which does load QuickLook) so that we'll find out.
+
2018-05-18 Antoine Quint <[email protected]>
[Web Animations] Turn Web Animations with CSS integration on for test runners
Modified: trunk/Source/WebCore/dom/Document.cpp (231948 => 231949)
--- trunk/Source/WebCore/dom/Document.cpp 2018-05-18 08:06:57 UTC (rev 231948)
+++ trunk/Source/WebCore/dom/Document.cpp 2018-05-18 08:11:17 UTC (rev 231949)
@@ -7280,13 +7280,13 @@
void Document::applyQuickLookSandbox()
{
const URL& responseURL = m_frame->loader().activeDocumentLoader()->responseURL();
- ASSERT(responseURL.protocolIs(QLPreviewProtocol()));
+ ASSERT(responseURL.protocolIs(QLPreviewProtocol));
auto securityOrigin = SecurityOrigin::create(responseURL);
securityOrigin->setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage);
setSecurityOriginPolicy(SecurityOriginPolicy::create(WTFMove(securityOrigin)));
- static NeverDestroyed<String> quickLookCSP = makeString("default-src ", QLPreviewProtocol(), ": 'unsafe-inline'; base-uri 'none'; sandbox allow-same-origin allow-scripts");
+ static NeverDestroyed<String> quickLookCSP = makeString("default-src ", QLPreviewProtocol, ": 'unsafe-inline'; base-uri 'none'; sandbox allow-same-origin allow-scripts");
RELEASE_ASSERT(contentSecurityPolicy());
// The sandbox directive is only allowed if the policy is from an HTTP header.
contentSecurityPolicy()->didReceiveHeader(quickLookCSP, ContentSecurityPolicyHeaderType::Enforce, ContentSecurityPolicy::PolicyFrom::HTTPHeader, referrer());
Modified: trunk/Source/WebCore/platform/SchemeRegistry.cpp (231948 => 231949)
--- trunk/Source/WebCore/platform/SchemeRegistry.cpp 2018-05-18 08:06:57 UTC (rev 231948)
+++ trunk/Source/WebCore/platform/SchemeRegistry.cpp 2018-05-18 08:11:17 UTC (rev 231949)
@@ -89,7 +89,7 @@
"safari-extension",
#endif
#if USE(QUICK_LOOK)
- QLPreviewProtocol(),
+ QLPreviewProtocol,
#endif
#if ENABLE(CONTENT_FILTERING)
ContentFilter::urlScheme(),
Modified: trunk/Source/WebCore/platform/ios/QuickLook.h (231948 => 231949)
--- trunk/Source/WebCore/platform/ios/QuickLook.h 2018-05-18 08:06:57 UTC (rev 231948)
+++ trunk/Source/WebCore/platform/ios/QuickLook.h 2018-05-18 08:11:17 UTC (rev 231949)
@@ -40,8 +40,9 @@
WEBCORE_EXPORT NSSet *QLPreviewGetSupportedMIMETypesSet();
WEBCORE_EXPORT void removeQLPreviewConverterForURL(NSURL *);
WEBCORE_EXPORT RetainPtr<NSURLRequest> registerQLPreviewConverterIfNeeded(NSURL *, NSString *mimeType, NSData *);
-WEBCORE_EXPORT const char* QLPreviewProtocol();
WEBCORE_EXPORT bool isQuickLookPreviewURL(const URL&);
WEBCORE_EXPORT NSString *createTemporaryFileForQuickLook(NSString *fileName);
+extern const char* QLPreviewProtocol;
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ios/QuickLook.mm (231948 => 231949)
--- trunk/Source/WebCore/platform/ios/QuickLook.mm 2018-05-18 08:06:57 UTC (rev 231948)
+++ trunk/Source/WebCore/platform/ios/QuickLook.mm 2018-05-18 08:11:17 UTC (rev 231949)
@@ -40,6 +40,8 @@
namespace WebCore {
+const char* QLPreviewProtocol = "x-apple-ql-id";
+
NSSet *QLPreviewGetSupportedMIMETypesSet()
{
static NSSet *set = [QLPreviewGetSupportedMIMETypes() retain];
@@ -96,18 +98,10 @@
return nil;
}
-const char* QLPreviewProtocol()
-{
- static const char* const previewProtocol = fastStrDup([QLPreviewScheme UTF8String]);
- return previewProtocol;
-}
-
bool isQuickLookPreviewURL(const URL& url)
{
- // Use some known protocols as a short-cut to avoid loading the QuickLook framework.
- if (url.protocolIsInHTTPFamily() || url.isBlankURL() || url.protocolIsBlob() || url.protocolIsData() || SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol().toString()))
- return false;
- return url.protocolIs(QLPreviewProtocol());
+ ASSERT([QLPreviewScheme isEqualToString:@(QLPreviewProtocol)]);
+ return url.protocolIs(QLPreviewProtocol);
}
static NSDictionary *temporaryFileAttributes()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes