Bug 910838 - Electrolysis: Don't update browser information with non-toplevel WebProgress notifications. r=felipe

This commit is contained in:
Tom Schuster 2013-09-05 19:24:29 -04:00
parent 1d2d4a3b19
commit 8bb88c8328
2 changed files with 19 additions and 18 deletions

View File

@ -56,17 +56,17 @@ let WebProgressListener = {
},
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
let spec = aLocationURI ? aLocationURI.spec : "";
let charset = content.document.characterSet;
let json = this._setupJSON(aWebProgress, aRequest);
let objects = this._setupObjects(aWebProgress);
json.documentURI = aWebProgress.DOMWindow.document.documentURIObject.spec;
json.location = spec;
json.canGoBack = docShell.canGoBack;
json.canGoForward = docShell.canGoForward;
json.charset = charset.toString();
json.location = aLocationURI ? aLocationURI.spec : "";
if (json.isTopLevel) {
json.canGoBack = docShell.canGoBack;
json.canGoForward = docShell.canGoForward;
json.documentURI = content.document.documentURIObject.spec;
json.charset = content.document.characterSet;
}
sendAsyncMessage("Content:LocationChange", json, objects);
},

View File

@ -19,8 +19,7 @@ function newURI(spec)
function RemoteWebProgressRequest(spec)
{
this.uri = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService)
.newURI(spec, null, null);
this.uri = newURI(spec);
}
RemoteWebProgressRequest.prototype = {
@ -110,17 +109,19 @@ RemoteWebProgress.prototype = {
break;
case "Content:LocationChange":
let loc = newURI(aMessage.json.location);
let location = newURI(aMessage.json.location);
this._browser.webNavigation._currentURI = loc;
this._browser.webNavigation.canGoBack = aMessage.json.canGoBack;
this._browser.webNavigation.canGoForward = aMessage.json.canGoForward;
this._browser._characterSet = aMessage.json.charset;
this._browser._documentURI = newURI(aMessage.json.documentURI);
this._browser._imageDocument = null;
if (aMessage.json.isTopLevel) {
this._browser.webNavigation._currentURI = location;
this._browser.webNavigation.canGoBack = aMessage.json.canGoBack;
this._browser.webNavigation.canGoForward = aMessage.json.canGoForward;
this._browser._characterSet = aMessage.json.charset;
this._browser._documentURI = newURI(aMessage.json.documentURI);
this._browser._imageDocument = null;
}
for each (let p in this._progressListeners) {
p.onLocationChange(this, req, loc);
p.onLocationChange(this, req, location);
}
break;