If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Set gAppData in content process

RESOLVED WONTFIX

Status

()

Core
XPCOM
RESOLVED WONTFIX
7 years ago
7 years ago

People

(Reporter: jdm, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
>  var appinfo = Components.classes["@mozilla.org/xre/app-info;1"]
>                          .getService(Components.interfaces.nsIXULAppInfo);
>  if (appinfo.ID == "{a23983c0-fd0e-11dc-95ff-0800200c9a66}") {

This currently doesn't work in a content process (think Mochitest here).  Benjamin, is this something we want to work?

Comment 1

7 years ago
I don't think so, why does the content process need to know this info?
Created attachment 518460 [details]
testcase
Just FYI, we're going to kill enablePrivilege in the near future anyway. Anything that you want to do in Mochitests that requires privileges should go through the SpecialPowers framework.
(Reporter)

Comment 4

7 years ago
WONTFIX it is.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WONTFIX
(In reply to comment #3)
> Just FYI, we're going to kill enablePrivilege in the near future anyway.
> Anything that you want to do in Mochitests that requires privileges should go
> through the SpecialPowers framework.

How does that work then?
I tried adding this:
In SpecialPowersObserver.js:
      case "SPappinfo":
        return "string";
        break;

In specialpowers.js:
  getAppID: function() {
    var  msg = {'op':'get', 'prefName': 'browser.tabs.remote','prefType': 'BOOL'};
    return sendSyncMessage('SPappinfo', msg);
  },

I keep getting nothing returned.
(Reporter)

Comment 6

7 years ago
You need to return sendSyncMessage('SPappinfo', {})[0];  Also the msg var is not used.
I know that the msg var is not used. I'm just trying to get something that is working.
Anyway, I tried your "sendSyncMessage('SPappinfo', {})[0];" suggestion. It doesn't work. When I call "alert(SpecialPowers.getAppID());", I get 'undefined' returned.
It turned out, I had to add "      messageManager.addMessageListener("SPappinfo", this);" in SpecialPowersObserver.js observe function.
You need to log in before you can comment on or make changes to this bug.