Make nsBrowserContentHandler use nsBrowserGlue's getMostRecentBrowserWindow()

RESOLVED FIXED in Firefox 3.6a1

Status

()

Firefox
General
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: Dolske, Assigned: Dolske)

Tracking

({fixed1.9.1})

Trunk
Firefox 3.6a1
fixed1.9.1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

9 years ago
Spun off from bug 456439, which added this function to nsBrowserGlue.
(Assignee)

Comment 1

9 years ago
Created attachment 350712 [details] [diff] [review]
Patch v.1
Attachment #350712 - Flags: review?(gavin.sharp)
(Assignee)

Updated

9 years ago
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]
(Assignee)

Updated

9 years ago
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+
(Assignee)

Comment 4

9 years ago
Pushed http://hg.mozilla.org/mozilla-central/rev/034f60a2969e
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Target Milestone: Firefox 3.1 → Firefox 3.2a1
(Assignee)

Comment 5

9 years ago
Pushed to branch: http://hg.mozilla.org/releases/mozilla-1.9.1/rev/8128fdf22a41
Keywords: fixed1.9.1
You need to log in before you can comment on or make changes to this bug.