Fix bug 642338. r=smaug, a=dveditz
authorJustin Lebar <justin.lebar@gmail.com>
Sun, 24 Apr 2011 22:30:57 -0400
changeset 27405 bee62d2796d5d2ccaaa8143da8222cd04c354f88
parent 27399 a846a6d5bbf8694fa1512d056e90aa0ca1f6f722
child 27406 e97fac945e09ab380fdedf86b56ff1dd83248ccb
push id2720
push userjlebar@mozilla.com
push dateWed, 04 May 2011 20:38:20 +0000
reviewerssmaug, dveditz
bugs642338
milestone1.9.1.20pre
Fix bug 642338. r=smaug, a=dveditz
dom/src/base/nsBarProps.cpp
dom/src/base/nsBarProps.h
dom/src/base/nsGlobalWindow.cpp
dom/src/base/nsGlobalWindow.h
dom/tests/mochitest/bugs/Makefile.in
dom/tests/mochitest/bugs/file_window_bar.html
dom/tests/mochitest/bugs/test_window_bar.html
--- a/dom/src/base/nsBarProps.cpp
+++ b/dom/src/base/nsBarProps.cpp
@@ -46,18 +46,21 @@
 #include "nsIScrollable.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsDOMClassInfo.h"
 
 //
 //  Basic (virtual) BarProp class implementation
 //
-nsBarProp::nsBarProp() : mBrowserChrome(nsnull)
+nsBarProp::nsBarProp(nsGlobalWindow *aWindow)
 {
+  mDOMWindow = aWindow;
+  nsISupports *supwin = static_cast<nsIScriptGlobalObject *>(aWindow);
+  mDOMWindowWeakref = do_GetWeakReference(supwin);
 }
 
 nsBarProp::~nsBarProp()
 {
 }
 
 
 // QueryInterface implementation for BarProp
@@ -66,73 +69,82 @@ NS_INTERFACE_MAP_BEGIN(nsBarProp)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(BarProp)
 NS_INTERFACE_MAP_END
 
 
 NS_IMPL_ADDREF(nsBarProp)
 NS_IMPL_RELEASE(nsBarProp)
 
-
-NS_IMETHODIMP
-nsBarProp::SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome)
-{
-  mBrowserChrome = aBrowserChrome;
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 nsBarProp::GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag)
 {
   *aVisible = PR_FALSE;
-  NS_ENSURE_TRUE(mBrowserChrome, NS_OK);
+
+  nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
+  NS_ENSURE_TRUE(browserChrome, NS_OK);
 
   PRUint32 chromeFlags;
 
-  NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeFlags(&chromeFlags),
+  NS_ENSURE_SUCCESS(browserChrome->GetChromeFlags(&chromeFlags),
                     NS_ERROR_FAILURE);
-  if(chromeFlags & aChromeFlag)
+  if (chromeFlags & aChromeFlag)
     *aVisible = PR_TRUE;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBarProp::SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag)
 {
-  NS_ENSURE_TRUE(mBrowserChrome, NS_OK);
+  nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
+  NS_ENSURE_TRUE(browserChrome, NS_OK);
 
-  PRBool   enabled = PR_FALSE;
+  PRBool enabled = PR_FALSE;
 
   nsCOMPtr<nsIScriptSecurityManager>
            securityManager(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
   if (securityManager)
     securityManager->IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
   if (!enabled)
     return NS_OK;
 
   PRUint32 chromeFlags;
 
-  NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeFlags(&chromeFlags),
+  NS_ENSURE_SUCCESS(browserChrome->GetChromeFlags(&chromeFlags),
                     NS_ERROR_FAILURE);
-  if(aVisible)
+  if (aVisible)
     chromeFlags |= aChromeFlag;
   else
     chromeFlags &= ~aChromeFlag;
-  NS_ENSURE_SUCCESS(mBrowserChrome->SetChromeFlags(chromeFlags),
+  NS_ENSURE_SUCCESS(browserChrome->SetChromeFlags(chromeFlags),
                     NS_ERROR_FAILURE);
 
   return NS_OK;
 }
 
+already_AddRefed<nsIWebBrowserChrome>
+nsBarProp::GetBrowserChrome()
+{
+  // Check that the window is still alive.
+  nsCOMPtr<nsIDOMWindow> domwin(do_QueryReferent(mDOMWindowWeakref));
+  if (!domwin)
+    return nsnull;
+
+  nsIWebBrowserChrome *browserChrome = nsnull;
+  mDOMWindow->GetWebBrowserChrome(&browserChrome);
+  return browserChrome;
+}
+
 //
 // MenubarProp class implementation
 //
 
-nsMenubarProp::nsMenubarProp()
+nsMenubarProp::nsMenubarProp(nsGlobalWindow *aWindow) 
+  : nsBarProp(aWindow)
 {
 }
 
 nsMenubarProp::~nsMenubarProp()
 {
 }
 
 NS_IMETHODIMP
@@ -148,17 +160,18 @@ nsMenubarProp::SetVisible(PRBool aVisibl
   return nsBarProp::SetVisibleByFlag(aVisible,
                                      nsIWebBrowserChrome::CHROME_MENUBAR);
 }
 
 //
 // ToolbarProp class implementation
 //
 
-nsToolbarProp::nsToolbarProp()
+nsToolbarProp::nsToolbarProp(nsGlobalWindow *aWindow)
+  : nsBarProp(aWindow)
 {
 }
 
 nsToolbarProp::~nsToolbarProp()
 {
 }
 
 NS_IMETHODIMP
@@ -174,17 +187,18 @@ nsToolbarProp::SetVisible(PRBool aVisibl
   return nsBarProp::SetVisibleByFlag(aVisible,
                                      nsIWebBrowserChrome::CHROME_TOOLBAR);
 }
 
 //
 // LocationbarProp class implementation
 //
 
-nsLocationbarProp::nsLocationbarProp()
+nsLocationbarProp::nsLocationbarProp(nsGlobalWindow *aWindow)
+  : nsBarProp(aWindow)
 {
 }
 
 nsLocationbarProp::~nsLocationbarProp()
 {
 }
 
 NS_IMETHODIMP
@@ -202,17 +216,18 @@ nsLocationbarProp::SetVisible(PRBool aVi
     nsBarProp::SetVisibleByFlag(aVisible,
                                 nsIWebBrowserChrome::CHROME_LOCATIONBAR);
 }
 
 //
 // PersonalbarProp class implementation
 //
 
-nsPersonalbarProp::nsPersonalbarProp()
+nsPersonalbarProp::nsPersonalbarProp(nsGlobalWindow *aWindow)
+  : nsBarProp(aWindow)
 {
 }
 
 nsPersonalbarProp::~nsPersonalbarProp()
 {
 }
 
 NS_IMETHODIMP
@@ -230,17 +245,18 @@ nsPersonalbarProp::SetVisible(PRBool aVi
     nsBarProp::SetVisibleByFlag(aVisible,
                                 nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR);
 }
 
 //
 // StatusbarProp class implementation
 //
 
-nsStatusbarProp::nsStatusbarProp()
+nsStatusbarProp::nsStatusbarProp(nsGlobalWindow *aWindow)
+  : nsBarProp(aWindow)
 {
 }
 
 nsStatusbarProp::~nsStatusbarProp()
 {
 }
 
 NS_IMETHODIMP
@@ -257,20 +273,18 @@ nsStatusbarProp::SetVisible(PRBool aVisi
                                      nsIWebBrowserChrome::CHROME_STATUSBAR);
 }
 
 //
 // ScrollbarsProp class implementation
 //
 
 nsScrollbarsProp::nsScrollbarsProp(nsGlobalWindow *aWindow)
+: nsBarProp(aWindow)
 {
-  mDOMWindow = aWindow;
-  nsISupports *supwin = static_cast<nsIScriptGlobalObject *>(aWindow);
-  mDOMWindowWeakref = do_GetWeakReference(supwin);
 }
 
 nsScrollbarsProp::~nsScrollbarsProp()
 {
 }
 
 NS_IMETHODIMP
 nsScrollbarsProp::GetVisible(PRBool *aVisible)
@@ -334,17 +348,17 @@ nsScrollbarsProp::SetVisible(PRBool aVis
       scroller->SetDefaultScrollbarPreferences(
                   nsIScrollable::ScrollOrientation_Y, prefValue);
       scroller->SetDefaultScrollbarPreferences(
                   nsIScrollable::ScrollOrientation_X, prefValue);
     }
   }
 
   /* Notably absent is the part where we notify the chrome window using
-     mBrowserChrome->SetChromeFlags(). Given the possibility of multiple
+     GetBrowserChrome()->SetChromeFlags(). Given the possibility of multiple
      DOM windows (multiple top-level windows, even) within a single
      chrome window, the historical concept of a single "has scrollbars"
      flag in the chrome is inapplicable, and we can't tell at this level
      whether we represent the particular DOM window that makes this decision
      for the chrome.
 
      So only this object (and its corresponding DOM window) knows whether
      scrollbars are visible. The corresponding chrome window will need to
--- a/dom/src/base/nsBarProps.h
+++ b/dom/src/base/nsBarProps.h
@@ -51,96 +51,93 @@
 
 class nsGlobalWindow;
 class nsIWebBrowserChrome;
 
 // Script "BarProp" object
 class nsBarProp : public nsIDOMBarProp
 {
 public:
-  nsBarProp();
+  explicit nsBarProp(nsGlobalWindow *aWindow);
   virtual ~nsBarProp();
 
   NS_DECL_ISUPPORTS
 
-  NS_IMETHOD SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome);
-
   NS_IMETHOD GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag);
   NS_IMETHOD SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag);
 
 protected:
-  // Weak Reference
-  nsIWebBrowserChrome* mBrowserChrome;
+  already_AddRefed<nsIWebBrowserChrome> GetBrowserChrome();
+
+  nsGlobalWindow             *mDOMWindow;
+  nsCOMPtr<nsIWeakReference>  mDOMWindowWeakref;
+  /* Note the odd double reference to the owning global window.
+     Since the corresponding DOM window nominally owns this object,
+     but refcounted ownership of this object can be handed off to
+     owners unknown, we need a weak ref back to the DOM window.
+     However we also need access to properties of the DOM Window
+     that aren't available through interfaces. Then it's either
+     a weak ref and some skanky casting, or this funky double ref.
+     Funky beats skanky, so here we are. */
 };
 
 // Script "menubar" object
 class nsMenubarProp : public nsBarProp
 {
 public:
-  nsMenubarProp();
+  explicit nsMenubarProp(nsGlobalWindow *aWindow);
   virtual ~nsMenubarProp();
 
   NS_DECL_NSIDOMBARPROP
 };
 
 // Script "toolbar" object
 class nsToolbarProp : public nsBarProp
 {
 public:
-  nsToolbarProp();
+  explicit nsToolbarProp(nsGlobalWindow *aWindow);
   virtual ~nsToolbarProp();
 
   NS_DECL_NSIDOMBARPROP
 };
 
 // Script "locationbar" object
 class nsLocationbarProp : public nsBarProp
 {
 public:
-  nsLocationbarProp();
+  explicit nsLocationbarProp(nsGlobalWindow *aWindow);
   virtual ~nsLocationbarProp();
 
   NS_DECL_NSIDOMBARPROP
 };
 
 // Script "personalbar" object
 class nsPersonalbarProp : public nsBarProp
 {
 public:
-  nsPersonalbarProp();
+  explicit nsPersonalbarProp(nsGlobalWindow *aWindow);
   virtual ~nsPersonalbarProp();
 
   NS_DECL_NSIDOMBARPROP
 };
 
 // Script "statusbar" object
 class nsStatusbarProp : public nsBarProp
 {
 public:
-  nsStatusbarProp();
+  explicit nsStatusbarProp(nsGlobalWindow *aWindow);
   virtual ~nsStatusbarProp();
 
   NS_DECL_NSIDOMBARPROP
 };
 
 // Script "scrollbars" object
-class nsScrollbarsProp : public nsBarProp {
+class nsScrollbarsProp : public nsBarProp
+{
 public:
-  nsScrollbarsProp(nsGlobalWindow *aWindow);
+  explicit nsScrollbarsProp(nsGlobalWindow *aWindow);
   virtual ~nsScrollbarsProp();
 
   NS_DECL_NSIDOMBARPROP
-
-private:
-  nsGlobalWindow           *mDOMWindow;
-  nsCOMPtr<nsIWeakReference>  mDOMWindowWeakref;
-  /* Note the odd double reference to the owning global window.
-     Since the corresponding DOM window nominally owns this object,
-     yet refcounted ownership of this object can be handed off to
-     owners unknown, we need a weak ref to back to the DOM window.
-     However we also need access to properties of the DOM Window
-     that aren't available through interfaces. Then it's either
-     a weak ref and some skanky casting, or this funky double ref.
-     Funky beats skanky, so here we are. */
 };
 
 #endif /* nsBarProps_h___ */
 
--- a/dom/src/base/nsGlobalWindow.cpp
+++ b/dom/src/base/nsGlobalWindow.cpp
@@ -2187,39 +2187,16 @@ nsGlobalWindow::SetDocShell(nsIDocShell*
     mLocation->SetDocShell(aDocShell);
   if (mHistory)
     mHistory->SetDocShell(aDocShell);
   if (mFrames)
     mFrames->SetDocShell(aDocShell);
   if (mScreen)
     mScreen->SetDocShell(aDocShell);
 
- 
-  // tell our member elements about the new browserwindow
-  nsCOMPtr<nsIWebBrowserChrome> browserChrome;
-  GetWebBrowserChrome(getter_AddRefs(browserChrome));
-  if (mMenubar) {
-    mMenubar->SetWebBrowserChrome(browserChrome);
-  }
-  if (mToolbar) {
-    mToolbar->SetWebBrowserChrome(browserChrome);
-  }
-  if (mLocationbar) {
-    mLocationbar->SetWebBrowserChrome(browserChrome);
-  }
-  if (mPersonalbar) {
-    mPersonalbar->SetWebBrowserChrome(browserChrome);
-  }
-  if (mStatusbar) {
-    mStatusbar->SetWebBrowserChrome(browserChrome);
-  }
-  if (mScrollbars) {
-    mScrollbars->SetWebBrowserChrome(browserChrome);
-  }
- 
   if (mDocShell) {
 
     // Get our enclosing chrome shell and retrieve its global window impl, so
     // that we can do some forwarding to the chrome document.
     nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
     mDocShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
     mChromeEventHandler = do_QueryInterface(chromeEventHandler);
     if (!mChromeEventHandler) {
@@ -2789,121 +2766,96 @@ nsGlobalWindow::GetPrompter(nsIPrompt** 
 NS_IMETHODIMP
 nsGlobalWindow::GetMenubar(nsIDOMBarProp** aMenubar)
 {
   FORWARD_TO_OUTER(GetMenubar, (aMenubar), NS_ERROR_NOT_INITIALIZED);
 
   *aMenubar = nsnull;
 
   if (!mMenubar) {
-    mMenubar = new nsMenubarProp();
+    mMenubar = new nsMenubarProp(this);
     if (!mMenubar) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
-
-    nsCOMPtr<nsIWebBrowserChrome> browserChrome;
-    GetWebBrowserChrome(getter_AddRefs(browserChrome));
-
-    mMenubar->SetWebBrowserChrome(browserChrome);
   }
 
   NS_ADDREF(*aMenubar = mMenubar);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetToolbar(nsIDOMBarProp** aToolbar)
 {
   FORWARD_TO_OUTER(GetToolbar, (aToolbar), NS_ERROR_NOT_INITIALIZED);
 
   *aToolbar = nsnull;
 
   if (!mToolbar) {
-    mToolbar = new nsToolbarProp();
+    mToolbar = new nsToolbarProp(this);
     if (!mToolbar) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
-
-    nsCOMPtr<nsIWebBrowserChrome> browserChrome;
-    GetWebBrowserChrome(getter_AddRefs(browserChrome));
-
-    mToolbar->SetWebBrowserChrome(browserChrome);
   }
 
   NS_ADDREF(*aToolbar = mToolbar);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetLocationbar(nsIDOMBarProp** aLocationbar)
 {
   FORWARD_TO_OUTER(GetLocationbar, (aLocationbar), NS_ERROR_NOT_INITIALIZED);
 
   *aLocationbar = nsnull;
 
   if (!mLocationbar) {
-    mLocationbar = new nsLocationbarProp();
+    mLocationbar = new nsLocationbarProp(this);
     if (!mLocationbar) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
-
-    nsCOMPtr<nsIWebBrowserChrome> browserChrome;
-    GetWebBrowserChrome(getter_AddRefs(browserChrome));
-
-    mLocationbar->SetWebBrowserChrome(browserChrome);
   }
 
   NS_ADDREF(*aLocationbar = mLocationbar);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetPersonalbar(nsIDOMBarProp** aPersonalbar)
 {
   FORWARD_TO_OUTER(GetPersonalbar, (aPersonalbar), NS_ERROR_NOT_INITIALIZED);
 
   *aPersonalbar = nsnull;
 
   if (!mPersonalbar) {
-    mPersonalbar = new nsPersonalbarProp();
+    mPersonalbar = new nsPersonalbarProp(this);
     if (!mPersonalbar) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
-
-    nsCOMPtr<nsIWebBrowserChrome> browserChrome;
-    GetWebBrowserChrome(getter_AddRefs(browserChrome));
-
-    mPersonalbar->SetWebBrowserChrome(browserChrome);
   }
 
   NS_ADDREF(*aPersonalbar = mPersonalbar);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetStatusbar(nsIDOMBarProp** aStatusbar)
 {
   FORWARD_TO_OUTER(GetStatusbar, (aStatusbar), NS_ERROR_NOT_INITIALIZED);
 
   *aStatusbar = nsnull;
 
   if (!mStatusbar) {
-    mStatusbar = new nsStatusbarProp();
+    mStatusbar = new nsStatusbarProp(this);
     if (!mStatusbar) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
-
-    nsCOMPtr<nsIWebBrowserChrome> browserChrome;
-    GetWebBrowserChrome(getter_AddRefs(browserChrome));
-
-    mStatusbar->SetWebBrowserChrome(browserChrome);
   }
 
   NS_ADDREF(*aStatusbar = mStatusbar);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -2913,21 +2865,16 @@ nsGlobalWindow::GetScrollbars(nsIDOMBarP
 
   *aScrollbars = nsnull;
 
   if (!mScrollbars) {
     mScrollbars = new nsScrollbarsProp(this);
     if (!mScrollbars) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
-
-    nsCOMPtr<nsIWebBrowserChrome> browserChrome;
-    GetWebBrowserChrome(getter_AddRefs(browserChrome));
-
-    mScrollbars->SetWebBrowserChrome(browserChrome);
   }
 
   NS_ADDREF(*aScrollbars = mScrollbars);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/dom/src/base/nsGlobalWindow.h
+++ b/dom/src/base/nsGlobalWindow.h
@@ -441,16 +441,18 @@ public:
     CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
                              nsScriptObjectHolder& aHandler);
 
   virtual nsresult SetArguments(nsIArray *aArguments, nsIPrincipal *aOrigin);
 
   static PRBool DOMWindowDumpEnabled();
 
 protected:
+  friend class nsBarProp;
+
   // Object Management
   virtual ~nsGlobalWindow();
   void CleanUp();
   void ClearControllers();
 
   void FreeInnerObjects(PRBool aClearScope);
   nsGlobalWindow *CallerInnerWindow();
 
--- a/dom/tests/mochitest/bugs/Makefile.in
+++ b/dom/tests/mochitest/bugs/Makefile.in
@@ -93,12 +93,14 @@ include $(topsrcdir)/config/rules.mk
 		test_bug479143.html \
 		test_bug495219.html \
 		test_bug504862.html \
 		file_bug504862.html \
 		test_bug531176.html \
 		test_bug583225.html \
 		test_bug406375.html \
 		file_bug406375.html \
+		test_window_bar.html \
+		file_window_bar.html \
 		$(NULL)
 
 libs:: 	$(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_window_bar.html
@@ -0,0 +1,7 @@
+<html>
+<body onload='opener.testWindow(window)'>
+
+Nothing to see here!
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_window_bar.html
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=642338
+-->
+<head>
+  <title>Test for Bug 642338</title>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=642338">Mozilla Bug 642338</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/* Test that the following window properties work:
+
+     menubar
+     toolbar
+     locationbar
+     personalbar
+     statusbar
+     scrollbars
+
+*/
+
+var numWindows = 0;
+
+/* Called when our popup loads. */
+function testWindow(w)
+{
+  // w.location.search == '?true' if we expect the bars to be on, and
+  // '?false' otherwise.
+
+  var e = w.location.search == '?true';
+  
+  is(w.menubar.visible, e, "menubar");
+  is(w.toolbar.visible, e, "toolbar");
+  is(w.personalbar.visible, e, "personalbar");
+  is(w.scrollbars.visible, e, "scrollbars");
+
+  // You can't turn these off even if you try, so check that they're true.
+  is(w.locationbar.visible, true, "locationbar");
+  is(w.statusbar.visible, true, "statusbar");
+
+  w.close();
+
+  numWindows++;
+  if (numWindows == 2) {
+    // We're done!
+    SimpleTest.finish();
+  }
+
+}
+
+SimpleTest.waitForExplicitFinish();
+
+// These will call back into testWindow when they open.
+
+var allBarsWindow =
+  window.open('file_window_bar.html?true', 'all-bars',
+              'menubar=yes,toolbar=yes,location=yes,' +
+              'personalbar=yes,status=yes,scrollbars=yes',
+              true);
+
+var noBarsWindow = 
+  window.open('file_window_bar.html?false', 'no-bars',
+              'menubar=no,toolbar=no,location=no,' +
+              'personalbar=no,status=no,scrollbars=no',
+              false);
+
+</script>
+</pre>
+</body>
+</html>