WebKit Bugzilla
Attachment 340682 Details for
Bug 185716
: Stop softlinking QuickLook when loading from client-registered schemes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185716-20180517233950.patch (text/plain), 5.21 KB, created by
Tim Horton
on 2018-05-17 23:39:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-05-17 23:39:51 PDT
Size:
5.21 KB
patch
obsolete
>Subversion Revision: 231940 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 385dd61ab755a5d049b333bcb2ce9f0b359a9764..fdfb8ed3d5b335d92f90a28313f8d1831ca27202 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-05-17 Tim Horton <timothy_horton@apple.com> >+ >+ 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-17 David Kilzer <ddkilzer@apple.com> > > Lazily create WebCore::Timer for WebCore::Image >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 3887326dc7ee1c4d3115a23108a8ac8fb14bea83..ab12c010dcb3d2f6fef17565721beae35f9b09d8 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -7280,13 +7280,13 @@ bool Document::shouldEnforceQuickLookSandbox() const > 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()); >diff --git a/Source/WebCore/platform/SchemeRegistry.cpp b/Source/WebCore/platform/SchemeRegistry.cpp >index 53dc195272a87c22ffa0cfdd378414a9d8753e62..e8eb5aa8c89c6dd1670df19b906f946e6052b582 100644 >--- a/Source/WebCore/platform/SchemeRegistry.cpp >+++ b/Source/WebCore/platform/SchemeRegistry.cpp >@@ -89,7 +89,7 @@ static const URLSchemesMap& allBuiltinSchemes() > "safari-extension", > #endif > #if USE(QUICK_LOOK) >- QLPreviewProtocol(), >+ QLPreviewProtocol, > #endif > #if ENABLE(CONTENT_FILTERING) > ContentFilter::urlScheme(), >diff --git a/Source/WebCore/platform/ios/QuickLook.h b/Source/WebCore/platform/ios/QuickLook.h >index 0de64b55a7842af09b75ce8fcd69e43bb5c38f56..49d811d5140c8fd0af01629d8d0c1c9e9e994f17 100644 >--- a/Source/WebCore/platform/ios/QuickLook.h >+++ b/Source/WebCore/platform/ios/QuickLook.h >@@ -40,8 +40,9 @@ class URL; > 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 >diff --git a/Source/WebCore/platform/ios/QuickLook.mm b/Source/WebCore/platform/ios/QuickLook.mm >index 37bad00b43722eac5d84d0e13e8581186f768bbe..cb837ee0ac8f8801e758c0f5cfaf495bf0ae8f7a 100644 >--- a/Source/WebCore/platform/ios/QuickLook.mm >+++ b/Source/WebCore/platform/ios/QuickLook.mm >@@ -40,6 +40,8 @@ > > namespace WebCore { > >+const char* QLPreviewProtocol = "x-apple-ql-id"; >+ > NSSet *QLPreviewGetSupportedMIMETypesSet() > { > static NSSet *set = [QLPreviewGetSupportedMIMETypes() retain]; >@@ -96,18 +98,10 @@ RetainPtr<NSURLRequest> registerQLPreviewConverterIfNeeded(NSURL *url, NSString > 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()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185716
:
340562
|
340615
|
340656
|
340673
| 340682