$OpenBSD: patch-browser_base_content_browser_js,v 1.1 2007/03/01 22:46:06 robert Exp $
--- browser/base/content/browser.js.orig	Fri Jan 26 01:05:54 2007
+++ browser/base/content/browser.js	Tue Feb 27 20:32:02 2007
@@ -1745,6 +1745,26 @@ function addBookmarkAs(aBrowser, aBookma
   if ((!browsers || browsers.length == 1) && aBookmarkAllTabs)
     return;
 
+  if (aBookmarkAllTabs) {
+    for (var i = 0; i < browsers.length; ++i) {
+      try {
+        var url = browsers[i].webNavigation.currentURI.spec;
+        urlSecurityCheck(url, url,
+                         nsCI.nsIScriptSecurityManager.DISALLOW_SCRIPT_OR_DATA);
+      } catch (ex) {
+        return; // doesn't pass security check
+      }
+    }
+  } else {
+    try {
+      var url = aBrowser.webNavigation.currentURI.spec;
+      urlSecurityCheck(url, url,
+                       nsCI.nsIScriptSecurityManager.DISALLOW_SCRIPT_OR_DATA);
+    } catch (ex) {
+      return; // doesn't pass security check
+    }
+  }
+
   if (browsers && browsers.length > 1)
     addBookmarkForTabBrowser(aBrowser, aBookmarkAllTabs);
   else
@@ -2279,7 +2299,7 @@ function handleURLBarRevert()
   // don't revert to last valid url unless page is NOT loading
   // and user is NOT key-scrolling through autocomplete list
   if ((!throbberElement || !throbberElement.hasAttribute("busy")) && !isScrolling) {
-    if (url != "about:blank") {
+    if (url != "about:blank" || content.opener) {
       gURLBar.value = url;
       gURLBar.select();
       SetPageProxyState("valid");
@@ -3851,7 +3871,8 @@ nsBrowserStatusHandler.prototype =
 
       var location = aLocation.spec;
 
-      if (location == "about:blank" || location == "") {   //second condition is for new tabs, otherwise
+      if ((location == "about:blank" && !content.opener) 
+          || location == "") {   //second condition is for new tabs, otherwise
         location = "";                                     //reload function is enabled until tab is refreshed
         this.reloadCommand.setAttribute("disabled", "true");
         this.reloadSkipCacheCommand.setAttribute("disabled", "true");
