From c01c0765618d669191404c927b1d2c9011979a89 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Mon, 11 Feb 2019 16:46:54 +0000 Subject: [PATCH] try/catch to allow chef to run from prod file --- src/web/RecipeWaiter.mjs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/web/RecipeWaiter.mjs b/src/web/RecipeWaiter.mjs index 8559860..98457bb 100755 --- a/src/web/RecipeWaiter.mjs +++ b/src/web/RecipeWaiter.mjs @@ -561,13 +561,18 @@ class RecipeWaiter { this.ingredientChildRuleID = null; // Find relevant rules in the stylesheet - for (const i in document.styleSheets[0].cssRules) { - if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients") { - this.ingredientRuleID = i; - } - if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients > div") { - this.ingredientChildRuleID = i; + // try/catch for chrome 64+ CORS error on cssRules. + try { + for (const i in document.styleSheets[0].cssRules) { + if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients") { + this.ingredientRuleID = i; + } + if (document.styleSheets[0].cssRules[i].selectorText === ".ingredients > div") { + this.ingredientChildRuleID = i; + } } + } catch (e) { + // Do nothing. } }