-
Notifications
You must be signed in to change notification settings - Fork 1
/
whois.mozcmd
49 lines (45 loc) · 1.4 KB
/
whois.mozcmd
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* 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/.
*
* Contributor(s):
* - LouCypher (original code)
*/
[
{
name: "whois",
description: "Whois lookup using DomainTools web service.",
params: [
{
name: "domain",
type: "string",
defaultValue: null,
description: "Domain name to lookup. If no domain specified, lookup current web site."
}
],
//returnType: "string",
exec: function(args, context) {
let environment = context.environment;
let contentWin = environment.window || environment.contentDocument.defaultView;
let chromeWin = environment.chromeWindow || environment.chromeDocument.defaultView;
let hostname;
if (!args.domain)
hostname = contentWin.location.hostname;
else
hostname = args.domain;
if (!hostname) {
return contentWin.location.protocol + " scheme is not supported.";
}
let eTLDsvc = Services.eTLD;
let eTLD, URI = Services.io.newURI("http://" + hostname, null, null);
try {
eTLD = eTLDsvc.getBaseDomain(URI);
} catch (ex) {
eTLD = URI.asciiHost;
}
chromeWin.switchToTabHavingURI("http://whois.domaintools.com/" + eTLD, true);
//return eTLD;
}
}
]