Source code

Revision control

Other Tools

1
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
"use strict";
6
7
var EXPORTED_SYMBOLS = ["URIFixupChild"];
8
9
const { ActorChild } = ChromeUtils.import(
11
);
12
13
class URIFixupChild extends ActorChild {
14
observe(subject) {
15
let fixupInfo = subject.QueryInterface(Ci.nsIURIFixupInfo);
16
if (!fixupInfo.consumer) {
17
return;
18
}
19
20
// Ignore info from other docshells
21
let parent = fixupInfo.consumer.QueryInterface(Ci.nsIDocShellTreeItem)
22
.sameTypeRootTreeItem;
23
if (parent != this.mm.docShell) {
24
return;
25
}
26
27
let data = {};
28
for (let f of Object.keys(fixupInfo)) {
29
if (f == "consumer" || typeof fixupInfo[f] == "function") {
30
continue;
31
}
32
33
if (fixupInfo[f] && fixupInfo[f] instanceof Ci.nsIURI) {
34
data[f] = fixupInfo[f].spec;
35
} else {
36
data[f] = fixupInfo[f];
37
}
38
}
39
40
this.mm.sendAsyncMessage("Browser:URIFixup", data);
41
}
42
}