зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472491: Part 5μ - Add WebNavigationChild actor. r=mconley
MozReview-Commit-ID: 3AiCuNfMenb --HG-- rename : toolkit/modules/WebNavigationChild.jsm => toolkit/actors/WebNavigationChild.jsm extra : rebase_source : 085ffbe1d8cf5b51570bb2de406d2c177a6051be
This commit is contained in:
Родитель
be97cc14bc
Коммит
5b2b235a9a
|
@ -60,7 +60,6 @@ const whitelist = {
|
|||
"resource://gre/modules/PrivateBrowsingUtils.jsm",
|
||||
"resource://gre/modules/ReaderMode.jsm",
|
||||
"resource://gre/modules/WebProgressChild.jsm",
|
||||
"resource://gre/modules/WebNavigationChild.jsm",
|
||||
"resource://gre/actors/ZoomChild.jsm",
|
||||
|
||||
// Pocket
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ["WebNavigationChild"];
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
|
@ -18,23 +19,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
|
|||
"@mozilla.org/xre/app-info;1",
|
||||
"nsICrashReporter");
|
||||
|
||||
class WebNavigationChild {
|
||||
constructor(mm) {
|
||||
this.mm = mm;
|
||||
|
||||
this.mm.addMessageListener("WebNavigation:GoBack", this);
|
||||
this.mm.addMessageListener("WebNavigation:GoForward", this);
|
||||
this.mm.addMessageListener("WebNavigation:GotoIndex", this);
|
||||
this.mm.addMessageListener("WebNavigation:LoadURI", this);
|
||||
this.mm.addMessageListener("WebNavigation:SetOriginAttributes", this);
|
||||
this.mm.addMessageListener("WebNavigation:Reload", this);
|
||||
this.mm.addMessageListener("WebNavigation:Stop", this);
|
||||
// This message is used for measuring this.mm.content process startup performance.
|
||||
this.mm.sendAsyncMessage("Content:BrowserChildReady", { time: Services.telemetry.msSystemNow() });
|
||||
|
||||
this.inLoadURI = false;
|
||||
}
|
||||
|
||||
class WebNavigationChild extends ActorChild {
|
||||
get webNavigation() {
|
||||
return this.mm.docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
}
|
||||
|
@ -73,11 +58,11 @@ class WebNavigationChild {
|
|||
}
|
||||
|
||||
_wrapURIChangeCall(fn) {
|
||||
this.inLoadURI = true;
|
||||
this.mm.WebProgress.inLoadURI = true;
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
this.inLoadURI = false;
|
||||
this.mm.WebProgress.inLoadURI = false;
|
||||
this.mm.WebProgress.sendLoadCallResult();
|
||||
}
|
||||
}
|
|
@ -21,5 +21,6 @@ FINAL_TARGET_FILES.actors += [
|
|||
'ThumbnailsChild.jsm',
|
||||
'UnselectedTabHoverChild.jsm',
|
||||
'WebChannelChild.jsm',
|
||||
'WebNavigationChild.jsm',
|
||||
'ZoomChild.jsm',
|
||||
]
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/WebNavigationChild.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/WebProgressChild.jsm");
|
||||
|
||||
this.WebProgress = new WebProgressChild(this);
|
||||
this.WebNavigation = new WebNavigationChild(this);
|
||||
|
||||
addEventListener("DOMTitleChanged", function(aEvent) {
|
||||
if (!aEvent.isTrusted || aEvent.target.defaultView != content)
|
||||
|
|
|
@ -252,6 +252,21 @@ let ACTORS = {
|
|||
},
|
||||
},
|
||||
|
||||
WebNavigation: {
|
||||
child: {
|
||||
module: "resource://gre/actors/WebNavigationChild.jsm",
|
||||
messages: [
|
||||
"WebNavigation:GoBack",
|
||||
"WebNavigation:GoForward",
|
||||
"WebNavigation:GotoIndex",
|
||||
"WebNavigation:LoadURI",
|
||||
"WebNavigation:Reload",
|
||||
"WebNavigation:SetOriginAttributes",
|
||||
"WebNavigation:Stop",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Zoom: {
|
||||
child: {
|
||||
module: "resource://gre/actors/ZoomChild.jsm",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ["WebProgressChild"];
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "AppConstants",
|
||||
|
@ -22,6 +23,8 @@ class WebProgressChild {
|
|||
constructor(mm) {
|
||||
this.mm = mm;
|
||||
|
||||
this.inLoadURI = false;
|
||||
|
||||
this._filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
|
||||
.createInstance(Ci.nsIWebProgress);
|
||||
this._filter.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_ALL);
|
||||
|
@ -30,6 +33,9 @@ class WebProgressChild {
|
|||
let webProgress = this.mm.docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
webProgress.addProgressListener(this._filter, Ci.nsIWebProgress.NOTIFY_ALL);
|
||||
|
||||
// This message is used for measuring this.mm.content process startup performance.
|
||||
this.mm.sendAsyncMessage("Content:BrowserChildReady", { time: Services.telemetry.msSystemNow() });
|
||||
}
|
||||
|
||||
_requestSpec(aRequest, aPropertyName) {
|
||||
|
@ -121,7 +127,7 @@ class WebProgressChild {
|
|||
json.documentURI = this.mm.content.document.documentURIObject.spec;
|
||||
json.charset = this.mm.content.document.characterSet;
|
||||
json.mayEnableCharacterEncodingMenu = this.mm.docShell.mayEnableCharacterEncodingMenu;
|
||||
json.inLoadURI = this.mm.WebNavigation.inLoadURI;
|
||||
json.inLoadURI = this.inLoadURI;
|
||||
}
|
||||
|
||||
this._send("Content:StateChange", json, objects);
|
||||
|
@ -165,7 +171,7 @@ class WebProgressChild {
|
|||
json.mayEnableCharacterEncodingMenu = this.mm.docShell.mayEnableCharacterEncodingMenu;
|
||||
json.principal = this.mm.content.document.nodePrincipal;
|
||||
json.synthetic = this.mm.content.document.mozSyntheticDocument;
|
||||
json.inLoadURI = this.mm.WebNavigation.inLoadURI;
|
||||
json.inLoadURI = this.inLoadURI;
|
||||
json.requestContextID = this.mm.content.document.documentLoadGroup
|
||||
? this.mm.content.document.documentLoadGroup.requestContextID
|
||||
: null;
|
||||
|
|
|
@ -248,7 +248,6 @@ EXTRA_JS_MODULES += [
|
|||
'Troubleshoot.jsm',
|
||||
'UpdateUtils.jsm',
|
||||
'WebChannel.jsm',
|
||||
'WebNavigationChild.jsm',
|
||||
'WebProgressChild.jsm',
|
||||
'WindowDraggingUtils.jsm',
|
||||
'ZipUtils.jsm',
|
||||
|
|
Загрузка…
Ссылка в новой задаче