summaryrefslogtreecommitdiffstats
path: root/remote/domains/parent/Browser.jsm
blob: 9e496e52f64c31b9e32b8de474d8184f6f8a42f0 (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
26
27
28
29
30
31
32
33
34
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

var EXPORTED_SYMBOLS = ["Browser"];

const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { Domain } = ChromeUtils.import(
  "chrome://remote/content/domains/Domain.jsm"
);

class Browser extends Domain {
  getVersion() {
    const { isHeadless } = Cc["@mozilla.org/gfx/info;1"].getService(
      Ci.nsIGfxInfo
    );
    const { userAgent } = Cc[
      "@mozilla.org/network/protocol;1?name=http"
    ].getService(Ci.nsIHttpProtocolHandler);
    return {
      protocolVersion: "1.3",
      product: (isHeadless ? "Headless " : "") + "Firefox",
      revision: "1",
      userAgent,
      jsVersion: "1.8.5",
    };
  }

  close() {
    Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit);
  }
}