Closed Bug 1180782 Opened 5 years ago Closed 5 years ago

UITour.jsm tries to get the shell service without a try…catch

Categories

(Firefox :: Tours, defect)

All
Linux
defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 1180801

People

(Reporter: MattN, Assigned: jaws)

References

Details

Attachments

(1 file)

(Quoting Matthew N. [:MattN] from bug 1175293 comment #12)
> ::: browser/components/uitour/UITour.jsm
> @@ +727,5 @@
> > +      }
> > +
> > +      case "isDefaultBrowser": {
> > +        let shell = Components.classes["@mozilla.org/browser/shell-service;1"]
> > +                              .getService(Components.interfaces.nsIShellService);
> 
> We usually put the shell service usage in a try…catch as I don't think it's
> implemented for some OSs (though I don't know if that's only non-Linux
> unix-based OSs). We should probably do the same here. We could probably use
> getShellService from utilityOverlay.js and do a null check. I'll file a
> follow-up.
Attached patch PatchSplinter Review
Assignee: nobody → jaws
Status: NEW → ASSIGNED
Attachment #8630046 - Flags: review?(MattN+bmo)
Comment on attachment 8630046 [details] [diff] [review]
Patch

Review of attachment 8630046 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for looking at this.

::: browser/components/uitour/UITour.jsm
@@ +720,5 @@
>        }
>  
>        case "setDefaultBrowser": {
> +        try {
> +          let shell = getShellService();

I'd be surprised if this works. Don't you need window.getShellService();?

@@ +730,5 @@
>        case "isDefaultBrowser": {
> +        try {
> +          let shell = getShellService();
> +          let isDefault = shell.isDefaultBrowser(false);
> +          this.sendPageCallback(messageManager, data.callbackID, { value: isDefault });

Part of the reason I filed this bug is because I think we should still respond to the page so we don't leave it hanging waiting for an answer. Maybe initialize `isDefault` to null outside of the `try` block and send null to the page if we don't know due true/false to no shell service?
Attachment #8630046 - Flags: review?(MattN+bmo) → feedback+
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1180801
You need to log in before you can comment on or make changes to this bug.