Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@danbeam
Last active April 18, 2017 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danbeam/fc99e28f48b6696ddf9d13176fee3c61 to your computer and use it in GitHub Desktop.
Save danbeam/fc99e28f48b6696ddf9d13176fee3c61 to your computer and use it in GitHub Desktop.
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chrome/browser/resources/settings/appearance_pes
index 5571b2d24992..de068c7715ae 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.js
@@ -262,6 +262,7 @@ Polymer({
themeChanged_: function(themeId, useSystemTheme) {
if (themeId) {
assert(!useSystemTheme);
+ assert(isValidExtensionId(themeId));
this.browserProxy_.getThemeInfo(themeId).then(function(info) {
this.themeSublabel_ = info.name;
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js
index 28a60d2ce137..22b013369dd9 100644
--- a/ui/webui/resources/js/util.js
+++ b/ui/webui/resources/js/util.js
@@ -46,6 +46,14 @@ function announceAccessibleMessage(msg) {
}
/**
+ * @param {?} maybeId
+ * @return {boolean} Whether |maybeId| is a valid extension ID.
+ */
+function isValidExtensionId(maybeId) {
+ return /[a-p]{32}/i.test(maybeId);
+}
+
+/**
* Generates a CSS url string.
* @param {string} s The URL to generate the CSS url for.
* @return {string} The CSS url string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment