Merge pull request #210 from aurimasv/wdp-css
[WebPageDump] Don't crash when @import stylesheets are null
This commit is contained in:
commit
55d9d4ba51
1 changed files with 4 additions and 3 deletions
|
@ -633,7 +633,7 @@ var wpdDOMSaver = {
|
||||||
// FONT_FACE_RULE = 5,
|
// FONT_FACE_RULE = 5,
|
||||||
// PAGE_RULE = 6
|
// PAGE_RULE = 6
|
||||||
processCSSRecursively: function (aCSS) {
|
processCSSRecursively: function (aCSS) {
|
||||||
if (aCSS.disabled) return "";
|
if (!aCSS || aCSS.disabled) return "";
|
||||||
var content = "";
|
var content = "";
|
||||||
var medium = aCSS.media.mediaText;
|
var medium = aCSS.media.mediaText;
|
||||||
if (medium != "" && medium.indexOf("screen") < 0 && medium.indexOf("all") < 0) {
|
if (medium != "" && medium.indexOf("screen") < 0 && medium.indexOf("all") < 0) {
|
||||||
|
@ -966,8 +966,9 @@ var wpdDOMSaver = {
|
||||||
if (this.option["format"]) {
|
if (this.option["format"]) {
|
||||||
var myStyleSheets = aDocument.styleSheets;
|
var myStyleSheets = aDocument.styleSheets;
|
||||||
// get all style sheets to "CSSText"
|
// get all style sheets to "CSSText"
|
||||||
for (var i = 0; i < myStyleSheets.length; i++)
|
for (var i = 0; i < myStyleSheets.length; i++) {
|
||||||
CSSText += this.processCSSRecursively(myStyleSheets[i]);
|
CSSText += this.processCSSRecursively(myStyleSheets[i]);
|
||||||
|
}
|
||||||
if (CSSText) {
|
if (CSSText) {
|
||||||
// don't forget to convert the CSS String to the document charset..
|
// don't forget to convert the CSS String to the document charset..
|
||||||
// (necessary for e.g. font-family)
|
// (necessary for e.g. font-family)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue