From e1d651a2e4d8cf85b51f5bad6d18b27c0d9385f6 Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Sun, 5 Feb 2006 14:58:27 +0000 Subject: [PATCH] Bug 317811: Allow single-window-instance XULRunner applications, patch by Alex Sirota , r=bsmedberg git-svn-id: svn://10.0.0.236/trunk@188956 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/toolkit/components/nsDefaultCLH.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mozilla/toolkit/components/nsDefaultCLH.js b/mozilla/toolkit/components/nsDefaultCLH.js index f7f215b1c10..3364412c283 100644 --- a/mozilla/toolkit/components/nsDefaultCLH.js +++ b/mozilla/toolkit/components/nsDefaultCLH.js @@ -77,6 +77,22 @@ var nsDefaultCLH = { var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(nsIPrefBranch); + try { + var singletonWindowType = + prefs.getCharPref("toolkit.singletonWindowType"); + var windowMediator = + Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + + var win = windowMediator.getMostRecentWindow(singletonWindowType); + if (win) { + win.focus(); + cmdLine.preventDefault = true; + return; + } + } + catch (e) { } + // if the pref is missing, ignore the exception try { var chromeURI = prefs.getCharPref("toolkit.defaultChromeURI");