RESOLVED FIXED 184369
WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
https://bugs.webkit.org/show_bug.cgi?id=184369
Summary WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
youenn fablet
Reported 2018-04-06 14:53:02 PDT
WebFrame sometimes incorrectly rule out PDF as a mime type that can be showed
Attachments
Patch (20.39 KB, patch)
2018-04-06 14:56 PDT, youenn fablet
no flags
WIP (19.75 KB, patch)
2018-04-06 14:58 PDT, youenn fablet
no flags
WIP (19.79 KB, patch)
2018-04-06 15:30 PDT, youenn fablet
no flags
Archive of layout-test-results from ews106 for mac-sierra-wk2 (3.18 MB, application/zip)
2018-04-06 17:57 PDT, EWS Watchlist
no flags
Patch (19.66 KB, patch)
2018-04-06 20:51 PDT, youenn fablet
no flags
Patch (19.67 KB, patch)
2018-04-06 21:14 PDT, youenn fablet
no flags
Archive of layout-test-results from ews106 for mac-sierra-wk2 (2.70 MB, application/zip)
2018-04-07 00:31 PDT, EWS Watchlist
no flags
Patch (19.59 KB, patch)
2018-04-07 08:13 PDT, youenn fablet
no flags
Archive of layout-test-results from ews107 for mac-sierra-wk2 (2.63 MB, application/zip)
2018-04-07 09:27 PDT, EWS Watchlist
no flags
Patch (20.57 KB, patch)
2018-04-07 11:00 PDT, youenn fablet
no flags
Patch (23.20 KB, patch)
2018-04-07 14:32 PDT, youenn fablet
no flags
Patch (12.96 KB, patch)
2018-04-09 12:09 PDT, youenn fablet
no flags
Patch (12.22 KB, patch)
2018-04-20 10:34 PDT, youenn fablet
no flags
Patch for landing (12.25 KB, patch)
2018-04-20 13:15 PDT, youenn fablet
no flags
Patch for landing (12.24 KB, patch)
2018-04-20 13:16 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2018-04-06 14:56:44 PDT
youenn fablet
Comment 2 2018-04-06 14:58:05 PDT
youenn fablet
Comment 3 2018-04-06 15:30:09 PDT
EWS Watchlist
Comment 4 2018-04-06 17:57:14 PDT
Comment on attachment 337396 [details] WIP Attachment 337396 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/7231659 New failing tests: userscripts/user-script-plugin-document.html plugins/plugin-javascript-access.html plugins/access-after-page-destroyed-2.html plugins/embed-attributes-setting.html http/tests/security/contentSecurityPolicy/cross-origin-plugin-document-allowed-in-child-window.html fast/dom/collection-iterators.html plugins/plugin-document-back-forward.html http/tests/plugins/nounsupported-plugin.html http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window.html plugins/iframe-plugin-bgcolor.html http/tests/security/contentSecurityPolicy/1.1/plugintypes-affects-child.html http/tests/plugins/supported-plugin-origin-specific-visibility.html imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html plugins/access-after-page-destroyed.html http/tests/plugins/plugin-javascript-access.html fast/dom/Window/Plug-ins.html plugins/no-mime-with-valid-extension.html
EWS Watchlist
Comment 5 2018-04-06 17:57:15 PDT
Created attachment 337405 [details] Archive of layout-test-results from ews106 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
youenn fablet
Comment 6 2018-04-06 20:51:17 PDT
youenn fablet
Comment 7 2018-04-06 21:14:41 PDT
EWS Watchlist
Comment 8 2018-04-07 00:31:07 PDT
Comment on attachment 337416 [details] Patch Attachment 337416 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/7234383 New failing tests: plugins/navigator-plugins-disabled.html http/tests/plugins/supported-plugin-origin-specific-visibility.html
EWS Watchlist
Comment 9 2018-04-07 00:31:08 PDT
Created attachment 337419 [details] Archive of layout-test-results from ews106 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
youenn fablet
Comment 10 2018-04-07 08:13:46 PDT
EWS Watchlist
Comment 11 2018-04-07 09:27:31 PDT
Comment on attachment 337423 [details] Patch Attachment 337423 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/7237224 New failing tests: http/tests/plugins/supported-plugin-origin-specific-visibility.html
EWS Watchlist
Comment 12 2018-04-07 09:27:32 PDT
Created attachment 337424 [details] Archive of layout-test-results from ews107 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
youenn fablet
Comment 13 2018-04-07 11:00:04 PDT
youenn fablet
Comment 14 2018-04-07 14:32:06 PDT
youenn fablet
Comment 15 2018-04-07 15:49:11 PDT
Comment on attachment 337432 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337432&action=review > Source/WebCore/plugins/PluginData.cpp:45 > + fprintf(stderr, "url %s\n", m_url.string().utf8().data()); Will remove this fprintf in a follow-up or at landing time.
Darin Adler
Comment 16 2018-04-08 18:29:36 PDT
Comment on attachment 337432 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337432&action=review Why no regression test? > Source/WebCore/page/Page.cpp:554 > + if (m_pluginData) { > + URL pageURL = mainFrame().document() ? mainFrame().document()->url() : URL { }; > + if (!protocolHostAndPortAreEqual(pageURL, m_pluginData->url())) > + m_pluginData = nullptr; > + } 1) Ugly that this check is here, but the extraction of the URL is done in the PluginData constructor. Instead there should be a PluginData function to tell if it’s OK to keep using a PluginData. That way the code can be shared and/or kept in sync with the constructor. So the code here would be more like this: if (!m_pluginData || !m_pluginData->canBeReused()) m_pluginData = PluginData::create(*this); Or we could find a cleaner way for the PluginData to "fix itself". Creating a new object doesn’t seem necessary or relevant to me. if (m_pluginData) m_pluginData->updateURL(); else m_pluginData = PluginData::create(*this); 2) It’s unclear to me why matching protocol, host, and port are sufficient, rather than matching the entire URL. 3) It is so inelegant to do this every time someone calls the pluginData function. Is there no better design? > Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h:49 > - void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<Vector<WebCore::SupportedPluginName>>&) final; > - void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final; > + Vector<WebCore::PluginInfo> getPluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginName>>&) final; > + Vector<WebCore::PluginInfo> getWebVisiblePluginInfo(WebCore::Page&, const WebCore::URL&) final; WebKit coding style says that the reason these function names have the word "get" in them is that they use out arguments. When changing them to return vectors, the word "get" should be removed from their names.
youenn fablet
Comment 17 2018-04-08 22:21:36 PDT
Thanks for the feedback. I think I'll split the refactoring and the modification change in two patches. We now have to pass the URL since the page URL is used to match plug-in rules defined by WebKit applications. The rules are matching URLS based on host and protocol information. (In reply to Darin Adler from comment #16) > Comment on attachment 337432 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=337432&action=review > > Why no regression test? > > > Source/WebCore/page/Page.cpp:554 > > + if (m_pluginData) { > > + URL pageURL = mainFrame().document() ? mainFrame().document()->url() : URL { }; > > + if (!protocolHostAndPortAreEqual(pageURL, m_pluginData->url())) > > + m_pluginData = nullptr; > > + } > > 1) Ugly that this check is here, but the extraction of the URL is done in > the PluginData constructor. Instead there should be a PluginData function to > tell if it’s OK to keep using a PluginData. That way the code can be shared > and/or kept in sync with the constructor. So the code here would be more > like this: > > if (!m_pluginData || !m_pluginData->canBeReused()) > m_pluginData = PluginData::create(*this); > > Or we could find a cleaner way for the PluginData to "fix itself". Creating > a new object doesn’t seem necessary or relevant to me. > > if (m_pluginData) > m_pluginData->updateURL(); > else > m_pluginData = PluginData::create(*this); > > 2) It’s unclear to me why matching protocol, host, and port are sufficient, > rather than matching the entire URL. > > 3) It is so inelegant to do this every time someone calls the pluginData > function. Is there no better design? > > > Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h:49 > > - void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<Vector<WebCore::SupportedPluginName>>&) final; > > - void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final; > > + Vector<WebCore::PluginInfo> getPluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginName>>&) final; > > + Vector<WebCore::PluginInfo> getWebVisiblePluginInfo(WebCore::Page&, const WebCore::URL&) final; > > WebKit coding style says that the reason these function names have the word > "get" in them is that they use out arguments. When changing them to return > vectors, the word "get" should be removed from their names.
youenn fablet
Comment 18 2018-04-09 12:09:17 PDT
youenn fablet
Comment 19 2018-04-20 10:34:18 PDT
Chris Dumez
Comment 20 2018-04-20 12:17:08 PDT
Comment on attachment 338436 [details] Patch Patch does not apply on Tip of Tree? I cannot find where m_cachedVisiblePlugins is defined.
Chris Dumez
Comment 21 2018-04-20 13:02:59 PDT
Comment on attachment 338436 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=338436&action=review > Source/WebCore/plugins/PluginData.cpp:125 > + m_cachedVisiblePlugins.pageURL = url; I would suggest: m_cachedVisiblePlugins = { url, m_page.pluginInfoProvider().webVisiblePluginInfo(m_page, url) }; Also, why do we ignore potentially cached data if the domain matches?
youenn fablet
Comment 22 2018-04-20 13:15:10 PDT
Created attachment 338454 [details] Patch for landing
youenn fablet
Comment 23 2018-04-20 13:16:16 PDT
Created attachment 338455 [details] Patch for landing
youenn fablet
Comment 24 2018-04-20 13:24:16 PDT
youenn fablet
Comment 25 2018-04-20 13:33:04 PDT
(In reply to Chris Dumez from comment #21) > Comment on attachment 338436 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=338436&action=review > > > Source/WebCore/plugins/PluginData.cpp:125 > > + m_cachedVisiblePlugins.pageURL = url; > > I would suggest: > m_cachedVisiblePlugins = { url, > m_page.pluginInfoProvider().webVisiblePluginInfo(m_page, url) }; > > Also, why do we ignore potentially cached data if the domain matches? Thanks for the review, updated both points.
WebKit Commit Bot
Comment 26 2018-04-20 14:01:32 PDT
Comment on attachment 338455 [details] Patch for landing Clearing flags on attachment: 338455 Committed r230853: <https://trac.webkit.org/changeset/230853>
WebKit Commit Bot
Comment 27 2018-04-20 14:01:34 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.