Closed Bug 462478 Opened 16 years ago Closed 16 years ago

Make nsBrowserContentHandler use nsBrowserGlue's getMostRecentBrowserWindow()

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 3.6a1

People

(Reporter: Dolske, Assigned: Dolske)

Details

(Keywords: fixed1.9.1)

Attachments

(1 file)

Spun off from bug 456439, which added this function to nsBrowserGlue.
Attached patch Patch v.1Splinter Review
Attachment #350712 - Flags: review?(gavin.sharp)
Whiteboard: [needs review gavin]
Comment on attachment 350712 [details] [diff] [review]
Patch v.1

>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js

+    var browserGlue = Components.classes["@mozilla.org/browser/browserglue;1"]
+                      .getService(Components.interfaces.nsIBrowserGlue);
+    return browserGlue.getMostRecentBrowserWindow();

You can use Cc[GLUE_CID].getService(Ci.nsIBrowserGlue) here.

>diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js

>-  // if we're lucky, this isn't a popup, and we can just return this
>-  if (win && win.document.documentElement.getAttribute("chromehidden")) {

Hmm, wonder why this didn't have the "win = null;" line here that the other versions do. I suppose none of its callers handle a null return value... but it's probably not possible for there to be no (non-popup) windows when they call it anyways.

>+  var browserGlue = Components.classes["@mozilla.org/browser/browserglue;1"]
>+                              .getService(Components.interfaces.nsIBrowserGlue);
>+  return browserGlue.getMostRecentBrowserWindow();

I was a bit worried that this might force instantiation of browserglue earlier than it normally would, but from reading nsAppRunner, it looks like app-startup is already fired before command line handlers are run, and browserglue's init just sets some observers anyways, so shouldn't be a problem.
Attachment #350712 - Flags: review?(gavin.sharp) → review+
Whiteboard: [needs review gavin]
Attachment #350712 - Flags: approval1.9.1?
Comment on attachment 350712 [details] [diff] [review]
Patch v.1

a191=beltzner
Attachment #350712 - Flags: approval1.9.1? → approval1.9.1+
Pushed http://hg.mozilla.org/mozilla-central/rev/034f60a2969e
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: Firefox 3.1 → Firefox 3.2a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: