зеркало из https://github.com/mozilla/pjs.git
Don't print-preview <noscript> unless script is really disabled. Bug 334944, r+sr=jst
This commit is contained in:
Родитель
879f1173a1
Коммит
ae1b7a2d2b
|
@ -650,6 +650,7 @@ GK_ATOM(screen, "screen")
|
||||||
GK_ATOM(screenX, "screenX")
|
GK_ATOM(screenX, "screenX")
|
||||||
GK_ATOM(screenY, "screenY")
|
GK_ATOM(screenY, "screenY")
|
||||||
GK_ATOM(script, "script")
|
GK_ATOM(script, "script")
|
||||||
|
GK_ATOM(scriptEnabledBeforePrintPreview, "scriptEnabledBeforePrintPreview")
|
||||||
GK_ATOM(scrollbar, "scrollbar")
|
GK_ATOM(scrollbar, "scrollbar")
|
||||||
GK_ATOM(scrollbarbutton, "scrollbarbutton")
|
GK_ATOM(scrollbarbutton, "scrollbarbutton")
|
||||||
GK_ATOM(scrollbox, "scrollbox")
|
GK_ATOM(scrollbox, "scrollbox")
|
||||||
|
|
|
@ -2335,7 +2335,12 @@ PresShell::SetPrefNoScriptRule()
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
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) {
|
if (!mPrefStyleSheet) {
|
||||||
rv = CreatePreferenceStyleSheet();
|
rv = CreatePreferenceStyleSheet();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
|
@ -3589,13 +3589,23 @@ nsPrintEngine::TurnScriptingOn(PRBool aDoTurnOn)
|
||||||
nsPrintObject* po = (nsPrintObject*)prt->mPrintDocList->ElementAt(i);
|
nsPrintObject* po = (nsPrintObject*)prt->mPrintDocList->ElementAt(i);
|
||||||
NS_ASSERTION(po, "nsPrintObject can't be null!");
|
NS_ASSERTION(po, "nsPrintObject can't be null!");
|
||||||
|
|
||||||
|
nsIDocument* doc = po->mDocument;
|
||||||
|
|
||||||
// get the script global object
|
// get the script global object
|
||||||
nsIScriptGlobalObject *scriptGlobalObj =
|
nsIScriptGlobalObject *scriptGlobalObj = doc->GetScriptGlobalObject();
|
||||||
po->mDocument->GetScriptGlobalObject();
|
|
||||||
|
|
||||||
if (scriptGlobalObj) {
|
if (scriptGlobalObj) {
|
||||||
nsIScriptContext *scx = scriptGlobalObj->GetContext();
|
nsIScriptContext *scx = scriptGlobalObj->GetContext();
|
||||||
NS_ASSERTION(scx, "Can't get nsIScriptContext");
|
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);
|
scx->SetScriptsEnabled(aDoTurnOn, PR_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче