Bug 1193837: Part 1 - Cache the last known inner window ID of remote browsers in parent process. r=billm

This commit is contained in:
Kris Maglione 2015-11-30 17:56:01 -08:00
parent f4cfcf44c1
commit 377e85efed
4 changed files with 36 additions and 5 deletions

View File

@ -55,14 +55,19 @@ var WebProgressListener = {
},
_setupJSON: function setupJSON(aWebProgress, aRequest) {
let innerWindowID = null;
if (aWebProgress) {
let domWindowID;
let domWindowID = null;
try {
domWindowID = aWebProgress && aWebProgress.DOMWindowID;
let utils = aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
domWindowID = utils.outerWindowID;
innerWindowID = utils.currentInnerWindowID;
} catch (e) {
// If nsDocShell::Destroy has already been called, then we'll
// get NS_NOINTERFACE when trying to get the DOM window ID.
domWindowID = null;
// get NS_NOINTERFACE when trying to get the DOM window.
// If there is no current inner window, we'll get
// NS_ERROR_NOT_AVAILABLE.
}
aWebProgress = {
@ -77,7 +82,8 @@ var WebProgressListener = {
webProgress: aWebProgress || null,
requestURI: this._requestSpec(aRequest, "URI"),
originalRequestURI: this._requestSpec(aRequest, "originalURI"),
documentContentType: content.document && content.document.contentType
documentContentType: content.document && content.document.contentType,
innerWindowID,
};
},

View File

@ -420,6 +420,22 @@
]]></getter>
</property>
<property name="innerWindowID" readonly="true">
<getter><![CDATA[
try {
return this.contentWindow
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.currentInnerWindowID;
} catch (e) {
if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
throw e;
}
return null;
}
]]></getter>
</property>
<field name="_lastSearchString">null</field>
<field name="_lastSearchHighlight">false</field>
@ -1181,6 +1197,7 @@
"_fullZoom",
"_textZoom",
"_isSyntheticDocument",
"_innerWindowID",
]);
}

View File

@ -212,6 +212,13 @@
onget="return this._outerWindowID"
readonly="true"/>
<field name="_innerWindowID">null</field>
<property name="innerWindowID">
<getter><![CDATA[
return this._innerWindowID;
]]></getter>
</property>
<property name="autoCompletePopup"
onget="return document.getElementById(this.getAttribute('autocompletepopup'))"
readonly="true"/>

View File

@ -235,6 +235,7 @@ RemoteWebProgressManager.prototype = {
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
this._browser._contentPrincipal = json.principal;
this._browser._isSyntheticDocument = json.synthetic;
this._browser._innerWindowID = json.innerWindowID;
}
this._callProgressListeners("onLocationChange", webProgress, request, location, flags);