commit 07bcccd92e6816417867dfb441c1349439223284
parent 435b1d7bd80a88befdc0810b753eaa0211b77f49
Author: aurimasv <aurimas.dev@gmail.com>
Date: Mon, 10 Dec 2012 20:07:56 -0600
[WebPageDump] Don't crash when @import stylesheets are null (caused by adblock)
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/webpagedump/domsaver.js b/chrome/content/zotero/webpagedump/domsaver.js
@@ -633,7 +633,7 @@ var wpdDOMSaver = {
// FONT_FACE_RULE = 5,
// PAGE_RULE = 6
processCSSRecursively: function (aCSS) {
- if (aCSS.disabled) return "";
+ if (!aCSS || aCSS.disabled) return "";
var content = "";
var medium = aCSS.media.mediaText;
if (medium != "" && medium.indexOf("screen") < 0 && medium.indexOf("all") < 0) {
@@ -966,8 +966,9 @@ var wpdDOMSaver = {
if (this.option["format"]) {
var myStyleSheets = aDocument.styleSheets;
// get all style sheets to "CSSText"
- for (var i = 0; i < myStyleSheets.length; i++)
- CSSText += this.processCSSRecursively(myStyleSheets[i]);
+ for (var i = 0; i < myStyleSheets.length; i++) {
+ CSSText += this.processCSSRecursively(myStyleSheets[i]);
+ }
if (CSSText) {
// don't forget to convert the CSS String to the document charset..
// (necessary for e.g. font-family)