RESOLVED FIXED 184421
Make PluginData cache its web visible plugins
https://bugs.webkit.org/show_bug.cgi?id=184421
Summary Make PluginData cache its web visible plugins
youenn fablet
Reported 2018-04-09 11:22:47 PDT
Make PluginData cache its web visible plugins
Attachments
Patch (17.99 KB, patch)
2018-04-09 12:05 PDT, youenn fablet
no flags
Patch (18.01 KB, patch)
2018-04-09 15:11 PDT, youenn fablet
no flags
Archive of layout-test-results from ews115 for mac-sierra (3.09 MB, application/zip)
2018-04-09 17:11 PDT, EWS Watchlist
no flags
Patch for landing (18.14 KB, patch)
2018-04-20 09:22 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2018-04-09 12:05:25 PDT
Darin Adler
Comment 2 2018-04-09 13:50:04 PDT
Comment on attachment 337519 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337519&action=review > Source/WebCore/plugins/PluginData.cpp:49 > + if (m_visiblePlugins.isEmpty()) > + m_visiblePlugins = m_page.pluginInfoProvider().webVisiblePluginInfo(m_page, m_pageURL); I think we should be using std::optional and nullopt instead of treating an empty vector as a special case, because there is a chance there are *no* visible plug-ins and we don’t want to keep calling the pluginInfoProvider over and over again in that case just because the vector is empty.
youenn fablet
Comment 3 2018-04-09 15:11:29 PDT
EWS Watchlist
Comment 4 2018-04-09 17:11:20 PDT
Comment on attachment 337549 [details] Patch Attachment 337549 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/7259604 New failing tests: imported/w3c/web-platform-tests/workers/name-property.html
EWS Watchlist
Comment 5 2018-04-09 17:11:22 PDT
Created attachment 337560 [details] Archive of layout-test-results from ews115 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-sierra Platform: Mac OS X 10.12.6
Chris Dumez
Comment 6 2018-04-10 13:51:50 PDT
Comment on attachment 337549 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337549&action=review > Source/WebCore/ChangeLog:3 > + Make PluginData cache its web visible plugins Why? The changelog does not explain why we're doing this and there is no associated radar for me to get information from either.
youenn fablet
Comment 7 2018-04-10 14:54:10 PDT
(In reply to Chris Dumez from comment #6) > Comment on attachment 337549 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=337549&action=review > > > Source/WebCore/ChangeLog:3 > > + Make PluginData cache its web visible plugins > > Why? The changelog does not explain why we're doing this and there is no > associated radar for me to get information from either. This is a refactoring when working on a pdf plugin issue. We often call several times webVisiblePlugins() which does create the same Vector over and over. While no longer strictly needed to fix the pdf plugin issue (see latest patch in bug 184369), it seems useful to do it anyway.
Daniel Bates
Comment 8 2018-04-10 22:04:31 PDT
Comment on attachment 337549 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337549&action=review > Source/WebCore/plugins/PluginData.cpp:43 > + if (!documentURL.isNull() && !protocolHostAndPortAreEqual(m_pageURL, documentURL)) { Do we need to worry about file URLs?
youenn fablet
Comment 9 2018-04-11 09:24:34 PDT
> New failing tests: > imported/w3c/web-platform-tests/workers/name-property.html Test failure is unrelated. > > Source/WebCore/plugins/PluginData.cpp:43 > > + if (!documentURL.isNull() && !protocolHostAndPortAreEqual(m_pageURL, documentURL)) { > > Do we need to worry about file URLs? The patch is not optimal with file URLs but I am not sure this is worth optimizing for these.
Daniel Bates
Comment 10 2018-04-11 13:28:46 PDT
(In reply to youenn fablet from comment #9) > > New failing tests: > > imported/w3c/web-platform-tests/workers/name-property.html > > Test failure is unrelated. > > > > Source/WebCore/plugins/PluginData.cpp:43 > > > + if (!documentURL.isNull() && !protocolHostAndPortAreEqual(m_pageURL, documentURL)) { > > > > Do we need to worry about file URLs? > > The patch is not optimal with file URLs but I am not sure this is worth > optimizing for these. Can you please elaborate?
Daniel Bates
Comment 11 2018-04-11 13:30:52 PDT
(In reply to Daniel Bates from comment #8) > Comment on attachment 337549 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=337549&action=review > > > Source/WebCore/plugins/PluginData.cpp:43 > > + if (!documentURL.isNull() && !protocolHostAndPortAreEqual(m_pageURL, documentURL)) { > > Do we need to worry about file URLs? Just to clarify, I am asking: do we need to ensure correctness of this code when documentURL and/or m_pageURL is a file URL?
youenn fablet
Comment 12 2018-04-11 14:11:53 PDT
All file based urls will get the same list of plugins. This code is fine as is.
youenn fablet
Comment 13 2018-04-11 14:13:22 PDT
(In reply to youenn fablet from comment #12) > All file based urls will get the same list of plugins. This code is fine as > is. We could optimize this by not recomputing the list over and over. But I am not sure this optimization meets the bar
Chris Dumez
Comment 14 2018-04-20 09:02:48 PDT
Comment on attachment 337549 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337549&action=review r=me with comment. > Source/WebCore/plugins/PluginData.h:131 > + mutable URL m_pageURL; The naming here is a bit too generic. We should convey that this relates to the m_visiblePlugins cache member below. I would suggest: - m_cachedVisiblePluginsURL - m_cachedVisiblePlugins Or similar. Alternatively, we could merge them into a single data member: mutable std::optional<std::pair<URL, Vector<PluginInfo>>> m_cachedVisiblePlugins;
youenn fablet
Comment 15 2018-04-20 09:22:57 PDT
Created attachment 338432 [details] Patch for landing
youenn fablet
Comment 16 2018-04-20 10:29:33 PDT
(In reply to youenn fablet from comment #15) > Created attachment 338432 [details] > Patch for landing Thanks for the review. I went going with m_cachedVisiblePlugins. I used a struct instead of a pair.
WebKit Commit Bot
Comment 17 2018-04-20 10:45:29 PDT
Comment on attachment 338432 [details] Patch for landing Clearing flags on attachment: 338432 Committed r230843: <https://trac.webkit.org/changeset/230843>
WebKit Commit Bot
Comment 18 2018-04-20 10:45:31 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 19 2018-04-20 10:46:26 PDT
Note You need to log in before you can comment on or make changes to this bug.