Bug 535851 - noscript is rendered in print preview, r=roc

This commit is contained in:
Olli Pettay 2009-12-19 12:35:54 +02:00
parent 9058cc8ee7
commit bf7962ffed

View File

@ -2085,12 +2085,15 @@ PresShell::SetPrefNoScriptRule()
// also handle the case where print is done from print preview
// see bug #342439 for more details
PRBool scriptEnabled = mDocument->IsScriptEnabled() ||
((mPresContext->Type() == nsPresContext::eContext_PrintPreview ||
mPresContext->Type() == nsPresContext::eContext_Print) &&
NS_PTR_TO_INT32(mDocument->GetProperty(
nsGkAtoms::scriptEnabledBeforePrintOrPreview)));
nsIDocument* doc = mDocument;
if (mPresContext->Type() == nsPresContext::eContext_PrintPreview ||
mPresContext->Type() == nsPresContext::eContext_Print) {
while (doc->GetOriginalDocument()) {
doc = doc->GetOriginalDocument();
}
}
PRBool scriptEnabled = doc->IsScriptEnabled();
if (scriptEnabled) {
if (!mPrefStyleSheet) {
rv = CreatePreferenceStyleSheet();