summaryrefslogtreecommitdiff
path: root/toolkit/content
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2017-03-07 21:04:18 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2017-03-07 21:04:18 +0100
commitab346a0a95a5dde12c86371ff587be9f0d634e05 (patch)
tree670db22dd30a2808d689ed61c7ee205d9c8083a9 /toolkit/content
parentd13f68b763d6aedca07d4d902b994e494b554ef6 (diff)
downloadpalemoon-gre-ab346a0a95a5dde12c86371ff587be9f0d634e05.tar.gz
The browser - innerWindowID and outerWindowID (improvements)
Diffstat (limited to 'toolkit/content')
-rw-r--r--toolkit/content/browser-child.js25
-rw-r--r--toolkit/content/widgets/browser.xml19
-rw-r--r--toolkit/content/widgets/remote-browser.xml13
3 files changed, 53 insertions, 4 deletions
diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js
index c7a2ce04e..cbab0d027 100644
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -57,11 +57,26 @@ let WebProgressListener = {
},
_setupJSON: function setupJSON(aWebProgress, aRequest) {
+ let innerWindowID = null;
if (aWebProgress) {
+ let domWindowID = null;
+ try {
+ 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.
+ // If there is no current inner window, we'll get
+ // NS_ERROR_NOT_AVAILABLE.
+ }
+
aWebProgress = {
isTopLevel: aWebProgress.isTopLevel,
isLoadingDocument: aWebProgress.isLoadingDocument,
- loadType: aWebProgress.loadType
+ loadType: aWebProgress.loadType,
+ DOMWindowID: domWindowID
};
}
@@ -69,7 +84,8 @@ let 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,
};
},
@@ -583,7 +599,10 @@ let AutoCompletePopup = {
// We may not get any responses to Browser:Init if the browser element
// is torn down too quickly.
-let initData = sendSyncMessage("Browser:Init");
+let outerWindowID = content.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
+ .outerWindowID;
+let initData = sendSyncMessage("Browser:Init", {outerWindowID: outerWindowID});
if (initData.length) {
docShell.useGlobalHistory = initData[0].useGlobalHistory;
if (initData[0].initPopup) {
diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml
index e0b13dd24..da11d2563 100644
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -417,6 +417,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>
@@ -1109,7 +1125,8 @@
"_webBrowserFind",
"_contentWindow",
"_webNavigation",
- "_permanentKey"
+ "_permanentKey",
+ "_innerWindowID",
];
var ourFieldValues = {};
diff --git a/toolkit/content/widgets/remote-browser.xml b/toolkit/content/widgets/remote-browser.xml
index 45eb3ca2b..7d784e7d5 100644
--- a/toolkit/content/widgets/remote-browser.xml
+++ b/toolkit/content/widgets/remote-browser.xml
@@ -204,6 +204,18 @@
]]></getter>
</property>
+ <field name="_outerWindowID">null</field>
+ <property name="outerWindowID"
+ 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"/>
@@ -289,6 +301,7 @@
let data = aMessage.data;
switch (aMessage.name) {
case "Browser:Init":
+ this._outerWindowID = data.outerWindowID;
let result = {};
result.useGlobalHistory = !this.hasAttribute("disableglobalhistory");
result.initPopup = this.autoCompletePopup != null;