зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472491: Part 5u - Add URIFixupChild actor. r=gijs
MozReview-Commit-ID: IqFGfjXhc6z --HG-- extra : rebase_source : 61cb950eb2322be21ac5d8447ce2bbc3f9ca55d5
This commit is contained in:
Родитель
2cb877e6e7
Коммит
53be0d783d
|
@ -0,0 +1,37 @@
|
|||
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
|
||||
/* 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 = ["URIFixupChild"];
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
|
||||
|
||||
class URIFixupChild extends ActorChild {
|
||||
observe(subject) {
|
||||
let fixupInfo = subject.QueryInterface(Ci.nsIURIFixupInfo);
|
||||
if (!fixupInfo.consumer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore info from other docshells
|
||||
let parent = fixupInfo.consumer.QueryInterface(Ci.nsIDocShellTreeItem).sameTypeRootTreeItem;
|
||||
if (parent != this.mm.docShell)
|
||||
return;
|
||||
|
||||
let data = {};
|
||||
for (let f of Object.keys(fixupInfo)) {
|
||||
if (f == "consumer" || typeof fixupInfo[f] == "function")
|
||||
continue;
|
||||
|
||||
if (fixupInfo[f] && fixupInfo[f] instanceof Ci.nsIURI) {
|
||||
data[f] = fixupInfo[f].spec;
|
||||
} else {
|
||||
data[f] = fixupInfo[f];
|
||||
}
|
||||
}
|
||||
|
||||
this.mm.sendAsyncMessage("Browser:URIFixup", data);
|
||||
}
|
||||
}
|
|
@ -30,4 +30,5 @@ FINAL_TARGET_FILES.actors += [
|
|||
'PageInfoChild.jsm',
|
||||
'PageStyleChild.jsm',
|
||||
'PluginChild.jsm',
|
||||
'URIFixupChild.jsm',
|
||||
]
|
||||
|
|
|
@ -61,36 +61,6 @@ if (Services.prefs.getBoolPref("browser.translation.detectLanguage")) {
|
|||
trHandler = new TranslationContentHandler(global, docShell);
|
||||
}
|
||||
|
||||
function gKeywordURIFixup(fixupInfo) {
|
||||
fixupInfo.QueryInterface(Ci.nsIURIFixupInfo);
|
||||
if (!fixupInfo.consumer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore info from other docshells
|
||||
let parent = fixupInfo.consumer.QueryInterface(Ci.nsIDocShellTreeItem).sameTypeRootTreeItem;
|
||||
if (parent != docShell)
|
||||
return;
|
||||
|
||||
let data = {};
|
||||
for (let f of Object.keys(fixupInfo)) {
|
||||
if (f == "consumer" || typeof fixupInfo[f] == "function")
|
||||
continue;
|
||||
|
||||
if (fixupInfo[f] && fixupInfo[f] instanceof Ci.nsIURI) {
|
||||
data[f] = fixupInfo[f].spec;
|
||||
} else {
|
||||
data[f] = fixupInfo[f];
|
||||
}
|
||||
}
|
||||
|
||||
sendAsyncMessage("Browser:URIFixup", data);
|
||||
}
|
||||
Services.obs.addObserver(gKeywordURIFixup, "keyword-uri-fixup");
|
||||
addEventListener("unload", () => {
|
||||
Services.obs.removeObserver(gKeywordURIFixup, "keyword-uri-fixup");
|
||||
}, false);
|
||||
|
||||
var WebBrowserChrome = {
|
||||
onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab) {
|
||||
return BrowserUtils.onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab);
|
||||
|
|
|
@ -209,6 +209,14 @@ let ACTORS = {
|
|||
],
|
||||
},
|
||||
},
|
||||
|
||||
URIFixup: {
|
||||
child: {
|
||||
module: "resource:///actors/URIFixupChild.jsm",
|
||||
group: "browsers",
|
||||
observers: ["keyword-uri-fixup"],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
(function earlyBlankFirstPaint() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче