WebKit Bugzilla
Attachment 340656 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-20180517150555.patch (text/plain), 4.90 KB, created by
Tim Horton
on 2018-05-17 15:05:56 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-05-17 15:05:56 PDT
Size:
4.90 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 231909) >+++ Source/WebCore/ChangeLog (working copy) >@@ -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 Zalan Bujtas <zalan@apple.com> > > [LFC] Introduce DisplayBox::Style >Index: Source/WebCore/dom/Document.cpp >=================================================================== >--- Source/WebCore/dom/Document.cpp (revision 231909) >+++ Source/WebCore/dom/Document.cpp (working copy) >@@ -7275,13 +7275,13 @@ bool Document::shouldEnforceQuickLookSan > 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()); >Index: Source/WebCore/platform/SchemeRegistry.cpp >=================================================================== >--- Source/WebCore/platform/SchemeRegistry.cpp (revision 231909) >+++ Source/WebCore/platform/SchemeRegistry.cpp (working copy) >@@ -89,7 +89,7 @@ static const URLSchemesMap& allBuiltinSc > "safari-extension", > #endif > #if USE(QUICK_LOOK) >- QLPreviewProtocol(), >+ QLPreviewProtocol, > #endif > #if ENABLE(CONTENT_FILTERING) > ContentFilter::urlScheme(), >Index: Source/WebCore/platform/ios/QuickLook.h >=================================================================== >--- Source/WebCore/platform/ios/QuickLook.h (revision 231909) >+++ Source/WebCore/platform/ios/QuickLook.h (working copy) >@@ -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 >Index: Source/WebCore/platform/ios/QuickLook.mm >=================================================================== >--- Source/WebCore/platform/ios/QuickLook.mm (revision 231909) >+++ Source/WebCore/platform/ios/QuickLook.mm (working copy) >@@ -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> registerQLPrevie > 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