Don't print-preview <noscript> unless script is really disabled. Bug 334944,
r+sr=jst, a=dveditz git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_0_BRANCH@195280 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -254,6 +254,7 @@ LAYOUT_ATOM(embeddingLevel, "EmbeddingLevel") // PRUint8
|
||||
LAYOUT_ATOM(endsInDiacritic, "EndsInDiacritic") // PRUint32
|
||||
LAYOUT_ATOM(nextBidi, "NextBidi") // nsIFrame*
|
||||
LAYOUT_ATOM(charType, "charType") // PRUint8
|
||||
LAYOUT_ATOM(scriptEnabledBeforePrintPreview, "scriptEnabledBeforePrintPreview") // PRBool
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
// Alphabetical list of SVG frame types
|
||||
|
||||
@@ -2381,7 +2381,12 @@ PresShell::SetPrefNoScriptRule()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mDocument->IsScriptEnabled()) {
|
||||
PRBool scriptEnabled = mDocument->IsScriptEnabled() ||
|
||||
(mPresContext->Type() == nsPresContext::eContext_PrintPreview &&
|
||||
NS_PTR_TO_INT32(mDocument->GetProperty(
|
||||
nsLayoutAtoms::scriptEnabledBeforePrintPreview)));
|
||||
|
||||
if (scriptEnabled) {
|
||||
if (!mPrefStyleSheet) {
|
||||
rv = CreatePreferenceStyleSheet();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@@ -4388,12 +4388,23 @@ nsPrintEngine::TurnScriptingOn(PRBool aDoTurnOn)
|
||||
for (PRInt32 i=0;i<prt->mPrintDocList->Count();i++) {
|
||||
nsPrintObject* po = (nsPrintObject*)prt->mPrintDocList->ElementAt(i);
|
||||
NS_ASSERTION(po, "nsPrintObject can't be null!");
|
||||
|
||||
nsIDocument* doc = po->mDocument;
|
||||
|
||||
// get the script global object
|
||||
nsIScriptGlobalObject *scriptGlobalObj = po->mDocument->GetScriptGlobalObject();
|
||||
nsIScriptGlobalObject *scriptGlobalObj = doc->GetScriptGlobalObject();
|
||||
if (scriptGlobalObj) {
|
||||
nsIScriptContext *scx = scriptGlobalObj->GetContext();
|
||||
NS_ASSERTION(scx, "Can't get nsIScriptContext");
|
||||
if (aDoTurnOn) {
|
||||
doc->DeleteProperty(nsLayoutAtoms::scriptEnabledBeforePrintPreview);
|
||||
} else {
|
||||
// Stash the current value of IsScriptEnabled on the document,
|
||||
// so that layout code running in print preview doesn't get
|
||||
// confused.
|
||||
doc->SetProperty(nsLayoutAtoms::scriptEnabledBeforePrintPreview,
|
||||
NS_INT32_TO_PTR(doc->IsScriptEnabled()));
|
||||
}
|
||||
scx->SetScriptsEnabled(aDoTurnOn, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user