RESOLVED FIXED 156540
WebKit2 should allow clients to use different plug-in load policies for private browsing.
https://bugs.webkit.org/show_bug.cgi?id=156540
Summary WebKit2 should allow clients to use different plug-in load policies for priva...
iting_liu
Reported 2016-04-13 09:06:05 PDT
<rdar://problem/25637141> WebKit2 should allow clients to use different plug-in load policies for private browsing.
Attachments
Patch 1 (34.37 KB, patch)
2016-04-13 10:46 PDT, iting_liu
no flags
Patch v2 (36.37 KB, patch)
2016-04-13 14:41 PDT, iting_liu
andersca: review-
Patch v3 (35.33 KB, patch)
2016-04-14 16:54 PDT, iting_liu
no flags
iting_liu
Comment 1 2016-04-13 10:46:59 PDT
WebKit Commit Bot
Comment 2 2016-04-13 10:49:57 PDT
Attachment 276333 [details] did not pass style-queue: ERROR: Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h:73: The parameter name "clientPolicy" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h:119: The parameter name "clientPolicy" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebKit2/UIProcess/WebProcessPool.h:187: The parameter name "policy" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebKit2/UIProcess/WebProcessPool.h:188: The parameter name "policy" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 4 in 16 files If any of these errors are false positives, please file a bug against check-webkit-style.
Anders Carlsson
Comment 3 2016-04-13 10:57:44 PDT
Comment on attachment 276333 [details] Patch 1 View in context: https://bugs.webkit.org/attachment.cgi?id=276333&action=review > Source/WebKit2/UIProcess/WebProcessPool.cpp:1320 > +void WebProcessPool::setPluginLoadClientPolicyForBrowsingMode(bool forPrivateBrowsing, WebCore::PluginLoadClientPolicy policy, const String& host, const String& bundleIdentifier, const String& versionString) Instead of a boolean here, use an enum class. Something like. enum class ForPrivateBrowsing { No, Yes }; > Source/WebKit2/WebProcess/WebProcess.h:373 > + void setPluginLoadClientPolicyFromCreationParameters(HashMap<String, HashMap<String, HashMap<String, uint8_t>>> *, bool); This hash map should be a const reference. Also, I think you can just call it setPluginLoadClientPolicies.
iting_liu
Comment 4 2016-04-13 14:40:39 PDT
This patch fails to build on mac because I added messages in Derived Sources/WebProcessMessages.h. I should have added it to messages.in to make it auto generate.
iting_liu
Comment 5 2016-04-13 14:41:28 PDT
Created attachment 276356 [details] Patch v2
Anders Carlsson
Comment 6 2016-04-14 13:49:08 PDT
Comment on attachment 276356 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=276356&action=review > Source/WebKit2/UIProcess/WebProcessPool.h:187 > + enum class PageBrowsingMode { BrowsingModePrivate, BrowsingModeGeneral }; Please just name this enum class PrivateBrowsing { Yes, No }; I don't think we use the term "Browsing Mode" anywhere else. > Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:228 > + auto& hostsToPluginIdentifierData = browsingMode == PageBrowsingMode::BrowsingModePrivate ? m_hostsToPluginIdentifierDataInPrivateBrowsing : m_hostsToPluginIdentifierData; Extra spice here. > Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:236 > - if (policiesByIdentifier.contains(bundleIdentifierToSet)) > - versionsToPolicies = policiesByIdentifier.get(bundleIdentifierToSet); > + auto versionsToPoliciesIterator = policiesByIdentifier.find(bundleIdentifierToSet); > + if (versionsToPoliciesIterator != policiesByIdentifier.end()) > + versionsToPolicies = versionsToPoliciesIterator->value; I don't think this change is needed - it's not avoiding a hash lookup and it makes things harder to read.
iting_liu
Comment 7 2016-04-14 15:12:40 PDT
Comment on attachment 276356 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=276356&action=review >> Source/WebKit2/UIProcess/WebProcessPool.h:187 >> + enum class PageBrowsingMode { BrowsingModePrivate, BrowsingModeGeneral }; > > Please just name this > > enum class PrivateBrowsing { Yes, No }; > > I don't think we use the term "Browsing Mode" anywhere else. Sure. >> Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:228 >> + auto& hostsToPluginIdentifierData = browsingMode == PageBrowsingMode::BrowsingModePrivate ? m_hostsToPluginIdentifierDataInPrivateBrowsing : m_hostsToPluginIdentifierData; > > Extra spice here. Oops. Removed. >> Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:236 >> + versionsToPolicies = versionsToPoliciesIterator->value; > > I don't think this change is needed - it's not avoiding a hash lookup and it makes things harder to read. Anders clairified that we don't need to use .contains beforehand; it'll just return a constructed object if it's not in there. I'll revert back to the original and get rid of .contains().
iting_liu
Comment 8 2016-04-14 16:54:54 PDT
Created attachment 276451 [details] Patch v3
WebKit Commit Bot
Comment 9 2016-04-18 14:37:43 PDT
Comment on attachment 276451 [details] Patch v3 Rejecting attachment 276451 [details] from commit-queue. iting_liu@apple.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
Jessie Berlin
Comment 10 2016-04-18 14:39:35 PDT
Comment on attachment 276451 [details] Patch v3 Anders reviewed this, marking commit-queue+
WebKit Commit Bot
Comment 11 2016-04-18 15:28:18 PDT
Comment on attachment 276451 [details] Patch v3 Clearing flags on attachment: 276451 Committed r199691: <http://trac.webkit.org/changeset/199691>
WebKit Commit Bot
Comment 12 2016-04-18 15:28:23 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.