Closed
Bug 311605
Opened 19 years ago
Closed 13 years ago
default browser checking should be done from nsBrowserGlue, not in delayedStartup
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 13
People
(Reporter: Gavin, Assigned: alastair)
References
Details
Attachments
(1 file, 11 obsolete files)
5.65 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
There's no reason to check the default browser status each time a window is
opened, it should only be done once at startup.
Reporter | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → Firefox1.6-
Reporter | ||
Comment 1•19 years ago
|
||
I think this is complete, will check before asking for review.
Reporter | ||
Comment 2•19 years ago
|
||
Comment on attachment 200035 [details] [diff] [review]
patch
not going to change nsIShellService.idl
Attachment #200035 -
Attachment is obsolete: true
Reporter | ||
Updated•19 years ago
|
Priority: -- → P1
Reporter | ||
Comment 3•19 years ago
|
||
Attachment #201221 -
Flags: review?(bugs.mano)
Reporter | ||
Comment 4•19 years ago
|
||
Attachment #201221 -
Attachment is obsolete: true
Attachment #201224 -
Flags: review?(bugs.mano)
Attachment #201221 -
Flags: review?(bugs.mano)
Reporter | ||
Updated•19 years ago
|
Whiteboard: [patch-r?]
Comment 5•19 years ago
|
||
Comment on attachment 201224 [details] [diff] [review]
patch v2 (that works!)
I don't see the value of keeping shouldCheckDefaultBrowser as an attribute of nsIShellService, you can check the pref in nsIBrowserGlue.
Also, checkDefaultBrowser should check for the default browser regardless of the pref state, check the pref in the startup method instead.
>Index: browser/components/shell/public/nsIShellService.idl
>===================================================================
>@@ -40,41 +40,36 @@
> interface nsIDOMElement;
>
> [scriptable, uuid(d6f62053-3769-46f6-bd2b-0a1440d6c394)]
bump the UUID.
Attachment #201224 -
Flags: review?(bugs.mano) → review-
Reporter | ||
Comment 6•19 years ago
|
||
(In reply to comment #5)
> Also, checkDefaultBrowser should check for the default browser regardless of
> the pref state, check the pref in the startup method instead.
I initially attempted to share the code for startup and the options dialog, but since the dialogs behaved differently (checkbox vs. no checkbox, the latter always checks regardless of pref) I just kept them seperate. If I make the pref check seperate then maybe it should be public with a param to indicate whether to show the "Always remember" checkbox? That way it could be used by the options dialog too.
Whiteboard: [patch-r?] → [patch-r-]
Reporter | ||
Comment 7•19 years ago
|
||
Do you prefer this approach? I'm too tired to be attaching patches, so I'll wait before asking for review, but if you want to take a look go ahead! :)
Attachment #201224 -
Attachment is obsolete: true
Comment 8•19 years ago
|
||
+ if (!aForceCheck && !this.prefService.getBoolPref(kCheckEveryTimePref))
+ return;
Calling this method should _alwasys_ check the default browser, any other check should be done in the caller.
Reporter | ||
Comment 9•19 years ago
|
||
Attachment #201716 -
Attachment is obsolete: true
Attachment #201961 -
Flags: review?(bugs.mano)
Reporter | ||
Comment 10•19 years ago
|
||
The latest patch fixes your comment about the pref checking, and changes isDefaultBrowser from a method to an attribute. The interface is already changing enough, I don't see any reason to try and avoid making that change.
Whiteboard: [patch-r-] → [patch-r?]
Comment 11•19 years ago
|
||
Comment on attachment 201961 [details] [diff] [review]
patch v4
I'm still against a property for reading, and a method for setting (or, a property which does a lot when setting it); if you disagree, ask mike to review.
Attachment #201961 -
Flags: review?(bugs.mano) → review-
Reporter | ||
Comment 12•19 years ago
|
||
Same, unbitrotted and without method->attribute change.
Attachment #201961 -
Attachment is obsolete: true
Attachment #203333 -
Flags: review?(bugs.mano)
Comment 13•19 years ago
|
||
Comment on attachment 203333 [details] [diff] [review]
patch v5
>Index: browser/components/Makefile.in
>===================================================================
>+ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
>+DEFINES += -DHAVE_SHELL_SERVICE=1
>+endif
I'm wondering if we should continue to #ifdef it, all tier1 platforms are supported and you're doing runtime checks anyway.
>Index: browser/components/nsBrowserGlue.js
>===================================================================
>+ var sURL = "chrome://branding/locale/brand.properties";
>+ var brandBundle = bundleSvc.createBundle(sURL);
>+ sURL = "chrome://browser/locale/shellservice.properties";
>+ var shellBundle = bundleSvc.createBundle(sURL);
Make them consts.
>Index: browser/components/nsIBrowserGlue.idl
>===================================================================
>+
>+ /**
>+ * Checks whether the browser is set as the system default, and if not,
>+ * prompts the user to make it the default.
>+ *
>+ * @param aForceCheck a boolean value indicating whether an alert should be
>+ * displayed if the browser is already registered as the system
>+ * default. Also controls whether or not the "Should check at startup"
>+ * checkbox appears in the confirmation prompt.
aSilentMode (or, aInteractiveMode if you don't wish to reverse it) would be cleaner.
>+ * @param aParentWindow an optionally null window which is the parent of the
>+ * prompts and alerts
Make that "@param aParentWindow Optional:".
>Index: browser/components/shell/src/nsGNOMEShellService.h
>===================================================================
>
> private:
> ~nsGNOMEShellService() {}
>
> NS_HIDDEN_(PRBool) KeyMatchesAppName(const char *aKeyValue) const;
>
>- PRPackedBool mCheckedThisSession;
>- PRPackedBool mUseLocaleFilenames;
>+ PRBool mUseLocaleFilenames;
Why are you changing mUseLocaleFilenames to PRBool (I don't see you playing with its bitfields ;) ).
>Index: browser/components/shell/src/nsWindowsShellService.h
>===================================================================
> private:
>- PRBool mCheckedThisSession;
>+
Remove the private block.
Attachment #203333 -
Flags: review?(bugs.mano) → review-
Reporter | ||
Comment 14•19 years ago
|
||
(In reply to comment #13)
> I'm wondering if we should continue to #ifdef it, all tier1 platforms are
> supported and you're doing runtime checks anyway.
It's still ifdeffed for components/prefs and base, I won't change that, but I'll remove the one I'm adding.
> >Index: browser/components/nsBrowserGlue.js
> >===================================================================
>
> >+ var sURL = "chrome://branding/locale/brand.properties";
> >+ var brandBundle = bundleSvc.createBundle(sURL);
> >+ sURL = "chrome://browser/locale/shellservice.properties";
> >+ var shellBundle = bundleSvc.createBundle(sURL);
>
> Make them consts.
Ok.
> >Index: browser/components/nsIBrowserGlue.idl
> >+ * @param aForceCheck a boolean value indicating whether an alert should be
> >+ * displayed if the browser is already registered as the system
> >+ * default. Also controls whether or not the "Should check at startup"
> >+ * checkbox appears in the confirmation prompt.
>
> aSilentMode (or, aInteractiveMode if you don't wish to reverse it) would be
> cleaner.
It's not really "interactive" or "silent", though... in both cases a dialog appears if it's not default.
> >+ * @param aParentWindow an optionally null window which is the parent of the
> >+ * prompts and alerts
>
> Make that "@param aParentWindow Optional:".
Ok.
> >Index: browser/components/shell/src/nsWindowsShellService.h
> >===================================================================
> > private:
> >- PRBool mCheckedThisSession;
> >+
>
> Remove the private block.
Ok.
Reporter | ||
Comment 15•19 years ago
|
||
(In reply to comment #13)
> Make that "@param aParentWindow Optional:".
Actually, I did it that way to match the one for "Sanitize" just above it.
Reporter | ||
Comment 16•19 years ago
|
||
address comments (other than the ones mentioned above)
Attachment #203333 -
Attachment is obsolete: true
Attachment #204638 -
Flags: review?(bugs.mano)
Comment 17•19 years ago
|
||
Comment on attachment 204638 [details] [diff] [review]
patch v6
As discussed on IRC:
* s/aForceCheck/aUserInitiated
* fix both comments (regarding optional parameters).
r=mano.
Attachment #204638 -
Flags: review?(bugs.mano) → review+
Reporter | ||
Comment 18•19 years ago
|
||
Attachment #204638 -
Attachment is obsolete: true
Reporter | ||
Updated•19 years ago
|
Whiteboard: [patch-r?] → [checkin needed]
Reporter | ||
Comment 19•19 years ago
|
||
mozilla/browser/base/content/browser.js 1.535
mozilla/browser/components/nsBrowserGlue.js 1.9
mozilla/browser/components/nsIBrowserGlue.idl 1.2
mozilla/browser/components/preferences/general.js 1.5
mozilla/browser/components/shell/public/nsIShellService.idl 1.6
mozilla/browser/components/shell/src/nsGNOMEShellService.cpp 1.11
mozilla/browser/components/shell/src/nsGNOMEShellService.h 1.4
mozilla/browser/components/shell/src/nsMacShellService.cpp 1.8
mozilla/browser/components/shell/src/nsMacShellService.h 1.4
mozilla/browser/components/shell/src/nsShellService.h 1.4
mozilla/browser/components/shell/src/nsWindowsShellService.cpp 1.22
mozilla/browser/components/shell/src/nsWindowsShellService.h 1.5
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•19 years ago
|
Whiteboard: [checkin needed] → [checkin needed
Reporter | ||
Updated•19 years ago
|
Whiteboard: [checkin needed
Reporter | ||
Comment 20•19 years ago
|
||
I've backed this out because it hasn't been tested with the profile migrator.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Reporter | ||
Comment 21•19 years ago
|
||
Also because it makes the dialog appear before the initial browser window, something I'd considered but didn't think was an issue.
Updated•19 years ago
|
Status: REOPENED → NEW
Reporter | ||
Updated•19 years ago
|
Whiteboard: [wontfix?]
Reporter | ||
Updated•19 years ago
|
Priority: P1 → P5
Reporter | ||
Updated•19 years ago
|
Target Milestone: Firefox 2 → Firefox 3
Reporter | ||
Comment 22•17 years ago
|
||
We can probably just use sessionstore-windows-restored for this, to address the issues in comment 20/comment 21.
Reporter | ||
Comment 23•13 years ago
|
||
This would be feasible now that we have _onBrowserStartup and this.getMostRecentBrowserWindow(), I think.
Assignee: gavin.sharp → nobody
Priority: P5 → --
Whiteboard: [wontfix?]
Target Milestone: Firefox 3 → ---
Assignee | ||
Comment 24•13 years ago
|
||
(In reply to Mano from comment #13)
> Comment on attachment 203333 [details] [diff] [review]
> patch v5
>
> >Index: browser/components/Makefile.in
> >===================================================================
>
> >+ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
> >+DEFINES += -DHAVE_SHELL_SERVICE=1
> >+endif
>
> I'm wondering if we should continue to #ifdef it, all tier1 platforms are
> supported and you're doing runtime checks anyway.
I included the #ifdef in my patch as it was still being used in browser.js and I wasn't sure if this 6 year old comment was still relevant. Do we still need this?
I removed the setTimeout() from the default browser check, as it doesn't work in nsBrowserGlue.js. The default browser prompt will block javascript execution until an option is selected (like was happening in bug 654388). Is it possible that this could cause problems here?
Attachment #587063 -
Flags: feedback?(gavin.sharp)
Reporter | ||
Comment 25•13 years ago
|
||
Comment on attachment 587063 [details] [diff] [review]
Patch 1 (alastair)
This looks good. You can get rid of the ifdef, and you can have this continue to by async by using Services.tm.mainThread.dispatch, as in e.g. TelemetryPing.js.
Thanks for looking into this!
Attachment #587063 -
Flags: feedback?(gavin.sharp) → feedback+
Assignee | ||
Comment 26•13 years ago
|
||
Addressed the points made in comment 25.
I'm happy to help :)
Attachment #587063 -
Attachment is obsolete: true
Attachment #588572 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 27•13 years ago
|
||
Attachment #588572 -
Attachment is obsolete: true
Attachment #588740 -
Flags: review?(gavin.sharp)
Attachment #588572 -
Flags: review?(gavin.sharp)
Reporter | ||
Comment 28•13 years ago
|
||
Comment on attachment 588740 [details] [diff] [review]
Patch 2.1 (alastair) - removed .bind(this)
Sorry, I missed something when I looked at this earlier: moving this code to _onBrowserStartup will break the willRecoverSession check (it will always be false, I think, since sessionstore will have already kicked in and restored stuff). To solve that, we'll probably want to change the two NOTIFY_WINDOWS_RESTORED notifyObservers calls in nsSessionStore to pass different final arguments (rather than "") so that they're differentiable, propagate that through to _onBrowserStartup (to be renamed in bug 719254!), and then only show this prompt if a session hasn't been restored.
Attachment #588740 -
Flags: review?(gavin.sharp) → review-
Assignee | ||
Comment 29•13 years ago
|
||
I might not be understanding you correctly, but it appears to me that willRecoverSession is still being set ok:
With "When Firefox starts: Show my windows and tabs from last time" set:
[alastair@arch bin]$ ./firefox
ss.sessionType: 2 (RESUME_SESSION)
Ci.nsISessionStartup.RECOVER_SESSION: 1
willRecoverSession: false
With "When Firefox starts: Show my home page" set:
[alastair@arch bin]$ ./firefox
ss.sessionType: 3 (DEFER_SESSION)
Ci.nsISessionStartup.RECOVER_SESSION: 1
willRecoverSession: false
^C (Force Firefox to "crash")
[alastair@arch bin]$ ./firefox
ss.sessionType: 1 (RECOVER_SESSION)
Ci.nsISessionStartup.RECOVER_SESSION: 1
willRecoverSession: true
[alastair@arch bin]$
I get the same results with and without the patch applied. The prompt is only hidden if Firefox crashed and needs to recover the previous session.
Reporter | ||
Comment 30•13 years ago
|
||
Comment on attachment 588740 [details] [diff] [review]
Patch 2.1 (alastair) - removed .bind(this)
Yep, you're right - sessionType never gets reset (unless history is cleared), so this shouldn't be a problem. Sorry about that, and thanks for following up!
Attachment #588740 -
Flags: review- → review+
Assignee | ||
Comment 31•13 years ago
|
||
Updated to account for other changes in browser.js since Patch 2.1 was created.
Attachment #588740 -
Attachment is obsolete: true
Reporter | ||
Updated•13 years ago
|
Attachment #602534 -
Flags: review+
Reporter | ||
Updated•13 years ago
|
Keywords: checkin-needed
Comment 32•13 years ago
|
||
Updated•13 years ago
|
Attachment #204940 -
Attachment is obsolete: true
Comment 33•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 19 years ago → 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•