Commit 9c8075c0 authored by finnur's avatar finnur Committed by Commit bot

Site Settings Desktop: Fix issues with entering URL patterns.

BUG=633682, 614277
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2309283002
Cr-Commit-Position: refs/heads/master@{#417254}
parent 0811707d
...@@ -43,8 +43,7 @@ Polymer({ ...@@ -43,8 +43,7 @@ Polymer({
* @private * @private
*/ */
validate_: function() { validate_: function() {
var pattern = this.addPatternWildcard(this.site_); this.browserProxy.isPatternValid(this.site_).then(function(isValid) {
this.browserProxy.isPatternValid(pattern).then(function(isValid) {
this.$.add.disabled = !isValid; this.$.add.disabled = !isValid;
}.bind(this)); }.bind(this));
}, },
......
...@@ -359,12 +359,14 @@ var SiteSettingsBehaviorImpl = { ...@@ -359,12 +359,14 @@ var SiteSettingsBehaviorImpl = {
}, },
/** /**
* Adds the wildcard prefix to a pattern string. * Adds the wildcard prefix to a pattern string (if missing).
* @param {string} pattern The pattern to add the wildcard to. * @param {string} pattern The pattern to add the wildcard to.
* @return {string} The resulting pattern. * @return {string} The resulting pattern.
* @private * @private
*/ */
addPatternWildcard: function(pattern) { addPatternWildcard: function(pattern) {
if (pattern.indexOf('[*.]') > -1)
return pattern;
if (pattern.startsWith('http://')) if (pattern.startsWith('http://'))
return pattern.replace('http://', 'http://[*.]'); return pattern.replace('http://', 'http://[*.]');
else if (pattern.startsWith('https://')) else if (pattern.startsWith('https://'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment