Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6373)

Unified Diff: chrome/browser/resources/settings/site_settings/site_details_permission.js

Issue 2021343003: MD Site Settings: Add five new top level categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/site_settings/site_details_permission.js
diff --git a/chrome/browser/resources/settings/site_settings/site_details_permission.js b/chrome/browser/resources/settings/site_settings/site_details_permission.js
index 7ac2f6f59281401bb858847eb0975ea8da5f675f..b134217ab58f099b3fb71c5c43a4a50309780199 100644
--- a/chrome/browser/resources/settings/site_settings/site_details_permission.js
+++ b/chrome/browser/resources/settings/site_settings/site_details_permission.js
@@ -41,6 +41,19 @@ Polymer({
},
/**
+ * Returns true if the origins match (e.g. http://google.com and
+ * http://[*.]google.com.
michaelpg 2016/06/03 13:37:14 nit: closing paren (or if parens and wildcards don
Finnur 2016/06/03 19:58:06 Done.
+ * @param {!string} left The first origin to compare.
michaelpg 2016/06/03 13:37:14 nit here & below: by default strings are non-nulla
Finnur 2016/06/03 19:58:06 Dang. Keep forgetting. :)
+ * @param {!string} right The second origin to compare.
+ * @return {boolean} True if the origins are the same.
+ * @private
+ */
+ sameOrigin_: function(left, right) {
+ return this.removePatternWildcard_(left) ==
+ this.removePatternWildcard_(right);
+ },
+
+ /**
* Sets the site to display.
* @param {!SiteException} site The site to display.
* @private
@@ -51,7 +64,7 @@ Polymer({
this.browserProxy.getExceptionList(this.category).then(
function(exceptionList) {
for (var i = 0; i < exceptionList.length; ++i) {
- if (exceptionList[i].origin == site.origin) {
+ if (this.sameOrigin_(exceptionList[i].origin, site.origin)) {
this.$.permission.selected = exceptionList[i].setting;
this.$.details.hidden = false;
}

Powered by Google App Engine
This is Rietveld 408576698