backout Bug 424377, a=beltzner

This commit is contained in:
Olli.Pettay@helsinki.fi 2008-04-15 11:02:22 -07:00
Родитель 9a038f8a1b
Коммит b348809048
6 изменённых файлов: 12 добавлений и 75 удалений

Просмотреть файл

@ -740,7 +740,7 @@ GK_ATOM(screen, "screen")
GK_ATOM(screenX, "screenX")
GK_ATOM(screenY, "screenY")
GK_ATOM(script, "script")
GK_ATOM(scriptEnabledBeforePrintOrPreview, "scriptEnabledBeforePrintOrPreview")
GK_ATOM(scriptEnabledBeforePrintPreview, "scriptEnabledBeforePrintPreview")
GK_ATOM(scrollbar, "scrollbar")
GK_ATOM(scrollbarbutton, "scrollbarbutton")
GK_ATOM(scrollbox, "scrollbox")

Просмотреть файл

@ -76,8 +76,8 @@ class nsScriptObjectHolder;
class nsXBLPrototypeHandler;
#define NS_PIDOMWINDOW_IID \
{ 0xc9c187f9, 0x2104, 0x4c2c, \
{ 0xb4, 0xd7, 0xc1, 0xb1, 0x9d, 0xa5, 0xc7, 0xd8 } }
{ 0x909852b5, 0xb9e6, 0x4d94, \
{ 0x8d, 0xe3, 0x05, 0x16, 0x34, 0x80, 0x0b, 0x73 } }
class nsPIDOMWindow : public nsIDOMWindowInternal
{
@ -269,8 +269,6 @@ public:
// Restore the window state from aState.
virtual nsresult RestoreWindowState(nsISupports *aState) = 0;
// Suspend timeouts in this and in child windows.
virtual void SuspendTimeouts() = 0;
// Resume suspended timeouts in this window and in child windows.
virtual nsresult ResumeTimeouts() = 0;

Просмотреть файл

@ -605,7 +605,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mFireOfflineStatusChangeEventOnThaw(PR_FALSE),
mCreatingInnerWindow(PR_FALSE),
mIsChrome(PR_FALSE),
mTimersSuspended(PR_FALSE),
mTimeoutInsertionPoint(nsnull),
mTimeoutPublicIdCounter(1),
mTimeoutFiringDepth(0),
@ -8399,11 +8398,6 @@ nsGlobalWindow::SuspendTimeouts()
{
FORWARD_TO_INNER_VOID(SuspendTimeouts, ());
if (mTimersSuspended) {
return;
}
mTimersSuspended = PR_TRUE;
PRTime now = PR_Now();
for (nsTimeout *t = FirstTimeout(); IsTimeout(t); t = t->Next()) {
// Change mWhen to be the time remaining for this timer.
@ -8459,11 +8453,6 @@ nsGlobalWindow::ResumeTimeouts()
{
FORWARD_TO_INNER(ResumeTimeouts, (), NS_ERROR_NOT_INITIALIZED);
if (!mTimersSuspended) {
return NS_OK;
}
mTimersSuspended = PR_FALSE;
// Restore all of the timeouts, using the stored time remaining
// (stored in timeout->mWhen).

Просмотреть файл

@ -300,7 +300,6 @@ public:
virtual NS_HIDDEN_(nsresult) SaveWindowState(nsISupports **aState);
virtual NS_HIDDEN_(nsresult) RestoreWindowState(nsISupports *aState);
virtual NS_HIDDEN_(void) SuspendTimeouts();
virtual NS_HIDDEN_(nsresult) ResumeTimeouts();
virtual NS_HIDDEN_(nsresult) FireDelayedDOMEvents();
virtual NS_HIDDEN_(PRBool) IsFrozen() const
@ -603,6 +602,8 @@ protected:
already_AddRefed<nsIWidget> GetMainWidget();
void SuspendTimeouts();
void Freeze()
{
NS_ASSERTION(!IsFrozen(), "Double-freezing?");
@ -676,8 +677,6 @@ protected:
// Fast way to tell if this is a chrome window (without having to QI).
PRPackedBool mIsChrome : 1;
PRPackedBool mTimersSuspended : 1;
nsCOMPtr<nsIScriptContext> mContext;
nsWeakPtr mOpener;
nsCOMPtr<nsIControllers> mControllers;

Просмотреть файл

@ -1940,7 +1940,7 @@ PresShell::SetPrefNoScriptRule()
((mPresContext->Type() == nsPresContext::eContext_PrintPreview ||
mPresContext->Type() == nsPresContext::eContext_Print) &&
NS_PTR_TO_INT32(mDocument->GetProperty(
nsGkAtoms::scriptEnabledBeforePrintOrPreview)));
nsGkAtoms::scriptEnabledBeforePrintPreview)));
if (scriptEnabled) {
if (!mPrefStyleSheet) {

Просмотреть файл

@ -213,35 +213,6 @@ static void DumpPrintObjectsTreeLayout(nsPrintObject * aPO,nsIDeviceContext * aD
#define DUMP_DOC_TREELAYOUT
#endif
class nsScriptSuppressor
{
public:
nsScriptSuppressor(nsPrintEngine* aPrintEngine)
: mPrintEngine(aPrintEngine), mSuppressed(PR_FALSE) {}
~nsScriptSuppressor() { Unsuppress(); }
void Suppress()
{
if (mPrintEngine) {
mSuppressed = PR_TRUE;
mPrintEngine->TurnScriptingOn(PR_FALSE);
}
}
void Unsuppress()
{
if (mPrintEngine && mSuppressed) {
mPrintEngine->TurnScriptingOn(PR_TRUE);
}
mSuppressed = PR_FALSE;
}
void Disconnect() { mPrintEngine = nsnull; }
protected:
nsRefPtr<nsPrintEngine> mPrintEngine;
PRBool mSuppressed;
};
// Class IDs
static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID);
@ -586,13 +557,11 @@ nsPrintEngine::DoCommonPrint(PRBool aIsPrintPreview,
(do_CreateInstance("@mozilla.org/gfx/devicecontextspec;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsScriptSuppressor scriptSuppressor(this);
if (!aIsPrintPreview) {
#ifdef NS_DEBUG
mPrt->mDebugFilePtr = mDebugFile;
#endif
scriptSuppressor.Suppress();
PRBool printSilently;
mPrt->mPrintSettings->GetPrintSilent(&printSilently);
@ -744,9 +713,6 @@ nsPrintEngine::DoCommonPrint(PRBool aIsPrintPreview,
}
}
// We will enable scripting later after printing has finished.
scriptSuppressor.Disconnect();
return NS_OK;
}
@ -2759,7 +2725,6 @@ nsPrintEngine::DonePrintingPages(nsPrintObject* aPO, nsresult aResult)
FirePrintCompletionEvent();
}
TurnScriptingOn(PR_TRUE);
SetIsPrinting(PR_FALSE);
// Release reference to mPagePrintTimer; the timer object destroys itself
@ -3041,13 +3006,6 @@ nsPrintEngine::FindSmallestSTF()
void
nsPrintEngine::TurnScriptingOn(PRBool aDoTurnOn)
{
if (mIsDoingPrinting && aDoTurnOn && mDocViewerPrint &&
mDocViewerPrint->GetIsPrintPreview()) {
// We don't want to turn scripting on if print preview is shown still after
// printing.
return;
}
nsPrintData* prt = mPrt;
#ifdef NS_PRINT_PREVIEW
if (!prt) {
@ -3071,32 +3029,25 @@ nsPrintEngine::TurnScriptingOn(PRBool aDoTurnOn)
nsIScriptGlobalObject *scriptGlobalObj = doc->GetScriptGlobalObject();
if (scriptGlobalObj) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(scriptGlobalObj);
NS_ASSERTION(window, "Can't get nsPIDOMWindow");
nsIScriptContext *scx = scriptGlobalObj->GetContext();
NS_ASSERTION(scx, "Can't get nsIScriptContext");
nsresult propThere = NS_PROPTABLE_PROP_NOT_THERE;
doc->GetProperty(nsGkAtoms::scriptEnabledBeforePrintOrPreview,
&propThere);
if (aDoTurnOn) {
if (propThere != NS_PROPTABLE_PROP_NOT_THERE) {
doc->DeleteProperty(nsGkAtoms::scriptEnabledBeforePrintOrPreview);
scx->SetScriptsEnabled(PR_TRUE, PR_FALSE);
window->ResumeTimeouts();
}
doc->DeleteProperty(nsGkAtoms::scriptEnabledBeforePrintPreview);
} else {
// Have to be careful, because people call us over and over again with
// aDoTurnOn == PR_FALSE. So don't set the property if it's already
// set, since in that case we'd set it to the wrong value.
nsresult propThere;
doc->GetProperty(nsGkAtoms::scriptEnabledBeforePrintPreview,
&propThere);
if (propThere == NS_PROPTABLE_PROP_NOT_THERE) {
// Stash the current value of IsScriptEnabled on the document, so
// that layout code running in print preview doesn't get confused.
doc->SetProperty(nsGkAtoms::scriptEnabledBeforePrintOrPreview,
doc->SetProperty(nsGkAtoms::scriptEnabledBeforePrintPreview,
NS_INT32_TO_PTR(doc->IsScriptEnabled()));
scx->SetScriptsEnabled(PR_FALSE, PR_FALSE);
window->SuspendTimeouts();
}
}
scx->SetScriptsEnabled(aDoTurnOn, PR_TRUE);
}
}
}