From 792a9b41407183e9d8c74acec54f44f579f26eac Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Wed, 9 Sep 2015 16:02:20 -0700 Subject: [PATCH] fix(style): ignore corrupt inline styles --- src/browser/application.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/browser/application.coffee b/src/browser/application.coffee index cdaf8fad2..51320a38a 100644 --- a/src/browser/application.coffee +++ b/src/browser/application.coffee @@ -333,7 +333,14 @@ class Application ipc.on 'inline-style-parse', (event, {body, clientId}) => juice = require 'juice' - body = juice(body) + try + body = juice(body) + catch + # If the juicer fails (because of malformed CSS or some other + # reason), then just return the body. We will still push it + # through the HTML sanitizer which will strip the style tags. Oh + # well. + body = body # win = BrowserWindow.fromWebContents(event.sender) event.sender.send('inline-styles-result', {body, clientId})