Fixing bug 156248. Remove pointless code that causes JS errors and fix up some comments. r=peterv@netscape.com, sr=heikki@netscape.com

This commit is contained in:
jst%netscape.com 2002-07-10 04:58:59 +00:00
Родитель 22e579e9f9
Коммит 48e46fdb38
1 изменённых файлов: 11 добавлений и 17 удалений

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

@ -541,35 +541,28 @@ GlobalWindowImpl::SetDocShell(nsIDocShell* aDocShell)
if (aDocShell == mDocShell) if (aDocShell == mDocShell)
return NS_OK; return NS_OK;
/* SetDocShell(nsnull) means the window is being torn down. Set the // SetDocShell(nsnull) means the window is being torn down. Drop our
"closed" JS property, Drop our reference to the script context, // reference to the script context, allowing it to be deleted
allowing it to be deleted later, and hand off our reference // later. Meanwhile, keep our weak reference to the script object
to the script object (held via a named JS root) to the context // (mJSObject) so that it can be retrieved later (until it is
so it will be unrooted later. Meanwhile, keep our weak reference // finalized by the JS GC).
to the script object so it can be retrieved later, as the JS glue
is wont to do. */
if (!aDocShell && mContext) { if (!aDocShell && mContext) {
ClearAllTimeouts(); ClearAllTimeouts();
if (mJSObject) { // if we are closing the window while in full screen mode, be sure
// Indicate that the window is now closed. Since we've // to restore os chrome
// cleared scope, we have to explicitly set a property.
jsval val = BOOLEAN_TO_JSVAL(JS_TRUE);
::JS_SetProperty((JSContext *)mContext->GetNativeContext(),
mJSObject, "closed", &val);
}
// if we are closing the window while in full screen mode,
// be sure to restore os chrome
if (mFullScreen) { if (mFullScreen) {
nsCOMPtr<nsIFocusController> focusController; nsCOMPtr<nsIFocusController> focusController;
GetRootFocusController(getter_AddRefs(focusController)); GetRootFocusController(getter_AddRefs(focusController));
PRBool isActive = PR_FALSE; PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive); focusController->GetActive(&isActive);
// only restore OS chrome if the closing window was active // only restore OS chrome if the closing window was active
if (isActive) { if (isActive) {
nsCOMPtr<nsIFullScreen> fullScreen = nsCOMPtr<nsIFullScreen> fullScreen =
do_GetService("@mozilla.org/browser/fullscreen;1"); do_GetService("@mozilla.org/browser/fullscreen;1");
if (fullScreen) if (fullScreen)
fullScreen->ShowAllOSChrome(); fullScreen->ShowAllOSChrome();
} }
@ -579,6 +572,7 @@ GlobalWindowImpl::SetDocShell(nsIDocShell* aDocShell)
mControllers = nsnull; // force release now mControllers = nsnull; // force release now
mChromeEventHandler = nsnull; // force release now mChromeEventHandler = nsnull; // force release now
} }
mDocShell = aDocShell; // Weak Reference mDocShell = aDocShell; // Weak Reference
if (mLocation) if (mLocation)