зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1241085 - part 1: improve inLoadURI support, r=mconley
MozReview-Commit-ID: 8jTbktXGOA1 --HG-- extra : rebase_source : 7012d5d4de32587edb7183de14e4a650b5f48e63
This commit is contained in:
Родитель
1ce577accb
Коммит
9e0d05598d
|
@ -277,19 +277,30 @@ var WebNavigation = {
|
|||
}
|
||||
},
|
||||
|
||||
_wrapURIChangeCall(fn) {
|
||||
this._inLoadURI = true;
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
this._inLoadURI = false;
|
||||
WebProgressListener.sendLoadCallResult();
|
||||
}
|
||||
},
|
||||
|
||||
goBack: function() {
|
||||
if (this.webNavigation.canGoBack) {
|
||||
this.webNavigation.goBack();
|
||||
this._wrapURIChangeCall(() => this.webNavigation.goBack());
|
||||
}
|
||||
},
|
||||
|
||||
goForward: function() {
|
||||
if (this.webNavigation.canGoForward)
|
||||
this.webNavigation.goForward();
|
||||
if (this.webNavigation.canGoForward) {
|
||||
this._wrapURIChangeCall(() => this.webNavigation.goForward());
|
||||
}
|
||||
},
|
||||
|
||||
gotoIndex: function(index) {
|
||||
this.webNavigation.gotoIndex(index);
|
||||
this._wrapURIChangeCall(() => this.webNavigation.gotoIndex(index));
|
||||
},
|
||||
|
||||
loadURI: function(uri, flags, referrer, referrerPolicy, postData, headers, baseURI) {
|
||||
|
@ -312,14 +323,10 @@ var WebNavigation = {
|
|||
headers = makeInputStream(headers);
|
||||
if (baseURI)
|
||||
baseURI = Services.io.newURI(baseURI, null, null);
|
||||
this._inLoadURI = true;
|
||||
try {
|
||||
this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
|
||||
postData, headers, baseURI);
|
||||
} finally {
|
||||
this._inLoadURI = false;
|
||||
WebProgressListener.sendLoadCallResult();
|
||||
}
|
||||
this._wrapURIChangeCall(() => {
|
||||
return this.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
|
||||
postData, headers, baseURI);
|
||||
});
|
||||
},
|
||||
|
||||
reload: function(flags) {
|
||||
|
|
|
@ -39,6 +39,25 @@
|
|||
onget="return this.webNavigation.canGoForward;"
|
||||
readonly="true"/>
|
||||
|
||||
<method name="_wrapURIChangeCall">
|
||||
<parameter name="fn"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.isRemoteBrowser) {
|
||||
this.inLoadURI = true;
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
this.inLoadURI = false;
|
||||
}
|
||||
} else {
|
||||
fn();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
|
||||
<method name="goBack">
|
||||
<body>
|
||||
<![CDATA[
|
||||
|
@ -46,7 +65,7 @@
|
|||
if (webNavigation.canGoBack) {
|
||||
try {
|
||||
this.userTypedClear++;
|
||||
webNavigation.goBack();
|
||||
this._wrapURIChangeCall(() => webNavigation.goBack());
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
|
@ -63,7 +82,7 @@
|
|||
if (webNavigation.canGoForward) {
|
||||
try {
|
||||
this.userTypedClear++;
|
||||
webNavigation.goForward();
|
||||
this._wrapURIChangeCall(() => webNavigation.goForward());
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
|
@ -111,7 +130,8 @@
|
|||
<![CDATA[
|
||||
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
|
||||
const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
this.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset);
|
||||
this._wrapURIChangeCall(() =>
|
||||
this.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset));
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -146,9 +166,10 @@
|
|||
this.userTypedClear++;
|
||||
|
||||
try {
|
||||
this._wrapURIChangeCall(() =>
|
||||
this.webNavigation.loadURIWithOptions(
|
||||
aURI, aFlags, aReferrerURI, aReferrerPolicy,
|
||||
aPostData, null, null);
|
||||
aPostData, null, null));
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
|
@ -196,7 +217,7 @@
|
|||
<![CDATA[
|
||||
try {
|
||||
this.userTypedClear++;
|
||||
this.webNavigation.gotoIndex(aIndex);
|
||||
this._wrapURIChangeCall(() => this.webNavigation.gotoIndex(aIndex));
|
||||
} finally {
|
||||
if (this.userTypedClear)
|
||||
this.userTypedClear--;
|
||||
|
|
Загрузка…
Ссылка в новой задаче