summaryrefslogtreecommitdiffstats
path: root/xpcom/tests/unit/test_process_directives.js
blob: 807246f46437676dd283f3ae725b3728ddaba0fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var Ci = Components.interfaces;
var Cc = Components.classes;

Components.utils.import("resource:///modules/Services.jsm");

function run_test()
{
  Components.manager.autoRegister(do_get_file("data/process_directive.manifest"));

  let isChild = Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;

  if (isChild) {
    do_check_false("@mozilla.org/xpcom/tests/MainProcessDirectiveTest;1" in Cc);
  } else {
    let svc = Cc["@mozilla.org/xpcom/tests/MainProcessDirectiveTest;1"].createInstance(Ci.nsISupportsString);
    do_check_eq(svc.data, "main process");
  }

  if (!isChild) {
    do_check_false("@mozilla.org/xpcom/tests/ChildProcessDirectiveTest;1" in Cc);
  } else {
    let svc = Cc["@mozilla.org/xpcom/tests/ChildProcessDirectiveTest;1"].createInstance(Ci.nsISupportsString);
    do_check_eq(svc.data, "child process");
  }
}