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

Side by Side Diff: chrome/browser/resources/settings/settings_ui/settings_ui.js

Issue 2905393002: MD Settings: URL encode text queries before adding them to the URL. (Closed)
Patch Set: Nit. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-ui' implements the UI for the Settings page. 7 * 'settings-ui' implements the UI for the Settings page.
8 * 8 *
9 * Example: 9 * Example:
10 * 10 *
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // Trim leading whitespace only, to prevent searching for empty string. This 241 // Trim leading whitespace only, to prevent searching for empty string. This
242 // still allows the user to search for 'foo bar', while taking a long pause 242 // still allows the user to search for 'foo bar', while taking a long pause
243 // after typing 'foo '. 243 // after typing 'foo '.
244 var query = e.detail.replace(/^\s+/, ''); 244 var query = e.detail.replace(/^\s+/, '');
245 // Prevent duplicate history entries. 245 // Prevent duplicate history entries.
246 if (query == this.lastSearchQuery_) 246 if (query == this.lastSearchQuery_)
247 return; 247 return;
248 248
249 settings.navigateTo( 249 settings.navigateTo(
250 settings.Route.BASIC, 250 settings.Route.BASIC,
251 query.length > 0 ? new URLSearchParams('search=' + query) : undefined, 251 query.length > 0 ?
252 new URLSearchParams('search=' + encodeURIComponent(query)) :
dpapad 2017/05/27 00:18:10 This is the only line necessary for the fix.
253 undefined,
252 /* removeSearch */ true); 254 /* removeSearch */ true);
253 }, 255 },
254 256
255 /** 257 /**
256 * @param {Event} event 258 * @param {Event} event
257 * @private 259 * @private
258 */ 260 */
259 onIronActivate_: function(event) { 261 onIronActivate_: function(event) {
260 if (event.detail.item.id != 'advancedSubmenu') 262 if (event.detail.item.id != 'advancedSubmenu')
261 this.$.drawer.closeDrawer(); 263 this.$.drawer.closeDrawer();
(...skipping 14 matching lines...) Expand all
276 this.$.container.removeAttribute('tabindex'); 278 this.$.container.removeAttribute('tabindex');
277 }.bind(this)); 279 }.bind(this));
278 }, 280 },
279 281
280 /** @private */ 282 /** @private */
281 directionDelegateChanged_: function() { 283 directionDelegateChanged_: function() {
282 this.$.drawer.align = this.directionDelegate.isRtl() ? 284 this.$.drawer.align = this.directionDelegate.isRtl() ?
283 'right' : 'left'; 285 'right' : 'left';
284 }, 286 },
285 }); 287 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698