Bug 375861 - nsAppshellService shouldn't default to a hiddenWindow url that might not existfirst-r=benjamin@smedbergs.us (Benjamin Smedberg)second-r=neil@httl.net (Neil Rashbrook)
--- a/xpfe/appshell/src/nsAppShellService.cpp
+++ b/xpfe/appshell/src/nsAppShellService.cpp
@@ -72,16 +72,19 @@
#include "jsapi.h"
#include "nsAppShellService.h"
#include "nsISupportsPrimitives.h"
#include "nsIPlatformCharset.h"
#include "nsICharsetConverterManager.h"
#include "nsIUnicodeDecoder.h"
+// Default URL for the hidden window, can be overridden by a pref on Mac
+#define DEFAULT_HIDDENWINDOW_URL "resource://gre/res/hiddenWindow.html"
+
class nsIAppShell;
nsAppShellService::nsAppShellService() :
mXPCOMShuttingDown(PR_FALSE),
mModalWindowCount(0)
{
nsCOMPtr<nsIObserverService> obs
(do_GetService("@mozilla.org/observer-service;1"));
@@ -147,26 +150,25 @@ nsresult nsAppShellService::ClearXPConne
NS_IMETHODIMP
nsAppShellService::CreateHiddenWindow(nsIAppShell* aAppShell)
{
nsresult rv;
PRInt32 initialHeight = 100, initialWidth = 100;
#ifdef XP_MACOSX
- static const char defaultHiddenWindowURL[] = "chrome://global/content/hiddenWindow.xul";
PRUint32 chromeMask = 0;
nsCOMPtr<nsIPrefBranch> prefBranch;
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
nsXPIDLCString prefVal;
rv = prefBranch->GetCharPref("browser.hiddenWindowChromeURL", getter_Copies(prefVal));
- const char* hiddenWindowURL = prefVal.get() ? prefVal.get() : defaultHiddenWindowURL;
+ const char* hiddenWindowURL = prefVal.get() ? prefVal.get() : DEFAULT_HIDDENWINDOW_URL;
#else
- static const char hiddenWindowURL[] = "resource://gre/res/hiddenWindow.html";
+ static const char hiddenWindowURL[] = DEFAULT_HIDDENWINDOW_URL;
PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL;
#endif
nsCOMPtr<nsIURI> url;
rv = NS_NewURI(getter_AddRefs(url), hiddenWindowURL);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsWebShellWindow> newWindow;