Skip to content

Commit

Permalink
try/catch to allow chef to run from prod file
Browse files Browse the repository at this point in the history
  • Loading branch information
d98762625 committed Feb 11, 2019
1 parent 2391e08 commit 9865451
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/web/RecipeWaiter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import HTMLOperation from "./HTMLOperation";
import Sortable from "sortablejs";
import Utils from "../core/Utils";

/*eslint no-console: ["off"] */


/**
* Waiter to handle events related to the recipe.
Expand Down Expand Up @@ -560,14 +562,20 @@ class RecipeWaiter {
this.ingredientRuleID = null;
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.
}
}

Expand Down

0 comments on commit 9865451

Please sign in to comment.