Changeset 268162 in webkit
- Timestamp:
- Oct 7, 2020 5:01:27 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r268161 r268162 1 2020-10-07 Tim Horton <timothy_horton@apple.com> 2 3 REGRESSION: Safari unable to load PDF in <embed> (docs.legalconnect.com) 4 https://bugs.webkit.org/show_bug.cgi?id=217451 5 <rdar://problem/69767043> 6 7 Reviewed by Alex Christensen. 8 9 * fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank-expected-mismatch.html: Added. 10 * fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html: Added. 11 Add a test ensuring that <embed> with no specified MIME type still renders the PDF. 12 1 13 2020-10-07 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/platform/win/TestExpectations
r267884 r268162 4279 4279 4280 4280 webkit.org/b/194711 fast/replaced/encrypted-pdf-as-object-and-embed.html [ Failure ] 4281 webkit.org/b/194711 fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html [ Failure ] 4281 4282 4282 4283 webkit.org/b/195461 http/tests/referrer-policy-iframe/no-referrer/cross-origin-http-http.html [ Failure ] -
trunk/Source/WebCore/ChangeLog
r268161 r268162 1 2020-10-07 Tim Horton <timothy_horton@apple.com> 2 3 REGRESSION: Safari unable to load PDF in <embed> (docs.legalconnect.com) 4 https://bugs.webkit.org/show_bug.cgi?id=217451 5 <rdar://problem/69767043> 6 7 Reviewed by Alex Christensen. 8 9 Test: fast/replaced/pdf-as-embed-with-no-mime-type-is-not-blank.html 10 11 If plugins are enabled, we'll always let the request go through, and WebKit will 12 guess that files with PDFPlugin-handled extensions should instantiate PDFPlugin, 13 even if no other plugins are available. 14 15 However, if plugins are disabled, requestPlugin() will early return if the explicitly 16 specified MIME type is not handled by an application plugin (even though the downstream 17 WebKit code would have happily instantiated an application plugin for us). 18 19 Application plugins shouldn't depend on the plugin enablement setting. 20 To fix this, have SubframeLoader guess the MIME type if not explicitly specified 21 (matching WebKit's behavior), and allow the request if it matches an application plugin. 22 23 * loader/SubframeLoader.cpp: 24 (WebCore::findPluginMIMETypeFromURL): 25 Improve this previously logging-only function to use the lastPathComponent 26 of the URL instead of randomly looking at the end of the URL, to ignore 27 query strings and fragments when looking for the file extension. 28 29 (WebCore::FrameLoader::SubframeLoader::requestPlugin): 30 Make use of findPluginMIMETypeFromURL to guess the MIME type if it's not 31 explicitly specified. If the guessed MIME type is one that is handled 32 by application plugins, allow the request to go out to WebKit (which 33 may then instantiate a PDFPlugin, for example). 34 35 (WebCore::logPluginRequest): 36 (WebCore::FrameLoader::SubframeLoader::requestObject): 37 (WebCore::FrameLoader::SubframeLoader::createJavaAppletWidget): 38 Pass the URL instead of stringifying it, so we can lastPathComponent as above. 39 1 40 2020-10-07 Chris Dumez <cdumez@apple.com> 2 41 -
trunk/Source/WebCore/loader/SubframeLoader.cpp
r264878 r268162 149 149 } 150 150 151 bool FrameLoader::SubframeLoader::requestPlugin(HTMLPlugInImageElement& ownerElement, const URL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback) 152 { 153 // Application plug-ins are plug-ins implemented by the user agent, for example Qt plug-ins, 154 // as opposed to third-party code such as Flash. The user agent decides whether or not they are 155 // permitted, rather than WebKit. 156 if (!(m_frame.settings().arePluginsEnabled() || MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))) 157 return false; 158 159 if (!pluginIsLoadable(url, mimeType)) 160 return false; 161 162 ASSERT(ownerElement.hasTagName(objectTag) || ownerElement.hasTagName(embedTag)); 163 return loadPlugin(ownerElement, url, mimeType, paramNames, paramValues, useFallback); 164 } 165 166 static String findPluginMIMETypeFromURL(Page& page, const StringView& url) 167 { 168 if (!url) 169 return { }; 170 171 size_t dotIndex = url.reverseFind('.'); 151 static String findPluginMIMETypeFromURL(Page& page, const URL& url) 152 { 153 auto lastPathComponent = url.lastPathComponent(); 154 size_t dotIndex = lastPathComponent.reverseFind('.'); 172 155 if (dotIndex == notFound) 173 156 return { }; 174 157 175 auto extensionFromURL = url.substring(dotIndex + 1);158 auto extensionFromURL = lastPathComponent.substring(dotIndex + 1); 176 159 177 160 for (auto& type : page.pluginData().webVisibleMimeTypes()) { … … 185 168 } 186 169 187 static void logPluginRequest(Page* page, const String& mimeType, const String& url, bool success) 170 bool FrameLoader::SubframeLoader::requestPlugin(HTMLPlugInImageElement& ownerElement, const URL& url, const String& explicitMIMEType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback) 171 { 172 String mimeType = explicitMIMEType; 173 if (mimeType.isEmpty()) { 174 if (auto page = ownerElement.document().page()) 175 mimeType = findPluginMIMETypeFromURL(*page, url); 176 } 177 178 // Application plug-ins are plug-ins implemented by the user agent, for example Qt plug-ins, 179 // as opposed to third-party code such as Flash. The user agent decides whether or not they are 180 // permitted, rather than WebKit. 181 if (!(m_frame.settings().arePluginsEnabled() || MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))) 182 return false; 183 184 if (!pluginIsLoadable(url, explicitMIMEType)) 185 return false; 186 187 ASSERT(ownerElement.hasTagName(objectTag) || ownerElement.hasTagName(embedTag)); 188 return loadPlugin(ownerElement, url, explicitMIMEType, paramNames, paramValues, useFallback); 189 } 190 191 static void logPluginRequest(Page* page, const String& mimeType, const URL& url, bool success) 188 192 { 189 193 if (!page) … … 231 235 if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent, useFallback)) { 232 236 bool success = requestPlugin(ownerElement, completedURL, mimeType, paramNames, paramValues, useFallback); 233 logPluginRequest(document.page(), mimeType, completedURL .string(), success);237 logPluginRequest(document.page(), mimeType, completedURL, success); 234 238 return success; 235 239 } … … 277 281 widget = m_frame.loader().client().createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); 278 282 279 logPluginRequest(m_frame.page(), element.serviceType(), String(), widget);283 logPluginRequest(m_frame.page(), element.serviceType(), { }, widget); 280 284 281 285 if (!widget) {
Note: See TracChangeset
for help on using the changeset viewer.