2013-04-25 09:29:31 +04:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
|
|
|
|
|
|
<bindings id="firefoxBrowserBindings"
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
|
|
|
<binding id="remote-browser" extends="chrome://global/content/bindings/browser.xml#browser">
|
|
|
|
|
2014-12-09 18:48:27 +03:00
|
|
|
<implementation type="application/javascript"
|
|
|
|
implements="nsIObserver, nsIDOMEventListener, nsIMessageListener, nsIRemoteBrowser">
|
2013-04-25 09:29:31 +04:00
|
|
|
|
2013-07-10 06:45:07 +04:00
|
|
|
<field name="_securityUI">null</field>
|
|
|
|
|
2013-04-25 09:29:31 +04:00
|
|
|
<property name="securityUI"
|
2013-07-10 06:45:07 +04:00
|
|
|
readonly="true">
|
|
|
|
<getter><![CDATA[
|
|
|
|
if (!this._securityUI) {
|
2014-12-30 04:09:52 +03:00
|
|
|
// Don't attempt to create the remote web progress if the
|
|
|
|
// messageManager has already gone away
|
|
|
|
if (!this.messageManager)
|
|
|
|
return null;
|
|
|
|
|
2013-07-10 06:45:07 +04:00
|
|
|
let jsm = "resource://gre/modules/RemoteSecurityUI.jsm";
|
2018-01-30 08:17:48 +03:00
|
|
|
let RemoteSecurityUI = Components.utils.import(jsm, {}).RemoteSecurityUI;
|
2013-07-10 06:45:07 +04:00
|
|
|
this._securityUI = new RemoteSecurityUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
// We want to double-wrap the JS implemented interface, so that QI and instanceof works.
|
2016-03-09 04:14:39 +03:00
|
|
|
var ptr = Components.classes["@mozilla.org/supports-interface-pointer;1"]
|
|
|
|
.createInstance(Components.interfaces.nsISupportsInterfacePointer);
|
2013-07-10 06:45:07 +04:00
|
|
|
ptr.data = this._securityUI;
|
2016-03-09 04:14:39 +03:00
|
|
|
return ptr.data.QueryInterface(Components.interfaces.nsISecureBrowserUI);
|
2013-07-10 06:45:07 +04:00
|
|
|
]]></getter>
|
|
|
|
</property>
|
2013-04-25 09:29:31 +04:00
|
|
|
|
2014-12-30 04:09:52 +03:00
|
|
|
<field name="_controller">null</field>
|
|
|
|
|
2015-06-05 15:33:29 +03:00
|
|
|
<field name="_selectParentHelper">null</field>
|
|
|
|
|
2013-08-06 20:35:39 +04:00
|
|
|
<field name="_remoteWebNavigation">null</field>
|
|
|
|
|
2013-10-28 23:24:51 +04:00
|
|
|
<property name="webNavigation"
|
|
|
|
onget="return this._remoteWebNavigation;"
|
|
|
|
readonly="true"/>
|
2013-04-25 09:29:31 +04:00
|
|
|
|
|
|
|
<field name="_remoteWebProgress">null</field>
|
|
|
|
|
|
|
|
<property name="webProgress" readonly="true">
|
2013-07-10 06:45:07 +04:00
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
2013-04-25 09:29:31 +04:00
|
|
|
if (!this._remoteWebProgress) {
|
2014-12-30 04:09:52 +03:00
|
|
|
// Don't attempt to create the remote web progress if the
|
|
|
|
// messageManager has already gone away
|
|
|
|
if (!this.messageManager)
|
|
|
|
return null;
|
|
|
|
|
2013-07-10 06:45:07 +04:00
|
|
|
let jsm = "resource://gre/modules/RemoteWebProgress.jsm";
|
2018-01-30 08:17:48 +03:00
|
|
|
let { RemoteWebProgressManager } = Components.utils.import(jsm, {});
|
2013-11-13 03:02:14 +04:00
|
|
|
this._remoteWebProgressManager = new RemoteWebProgressManager(this);
|
|
|
|
this._remoteWebProgress = this._remoteWebProgressManager.topLevelWebProgress;
|
2013-04-25 09:29:31 +04:00
|
|
|
}
|
|
|
|
return this._remoteWebProgress;
|
2013-07-10 06:45:07 +04:00
|
|
|
]]>
|
|
|
|
</getter>
|
2013-04-25 09:29:31 +04:00
|
|
|
</property>
|
|
|
|
|
2013-09-14 03:27:19 +04:00
|
|
|
<field name="_remoteFinder">null</field>
|
|
|
|
|
|
|
|
<property name="finder" readonly="true">
|
|
|
|
<getter><![CDATA[
|
|
|
|
if (!this._remoteFinder) {
|
2015-02-19 03:47:43 +03:00
|
|
|
// Don't attempt to create the remote finder if the
|
2014-12-30 04:09:52 +03:00
|
|
|
// messageManager has already gone away
|
|
|
|
if (!this.messageManager)
|
|
|
|
return null;
|
|
|
|
|
2013-09-14 03:27:19 +04:00
|
|
|
let jsm = "resource://gre/modules/RemoteFinder.jsm";
|
2018-01-30 08:17:48 +03:00
|
|
|
let { RemoteFinder } = Components.utils.import(jsm, {});
|
2013-09-14 03:27:19 +04:00
|
|
|
this._remoteFinder = new RemoteFinder(this);
|
|
|
|
}
|
|
|
|
return this._remoteFinder;
|
|
|
|
]]></getter>
|
|
|
|
</property>
|
|
|
|
|
2013-07-29 19:03:41 +04:00
|
|
|
<field name="_documentURI">null</field>
|
|
|
|
|
2014-03-12 07:13:41 +04:00
|
|
|
<field name="_documentContentType">null</field>
|
|
|
|
|
2013-11-13 03:02:14 +04:00
|
|
|
<!--
|
|
|
|
Used by session restore to ensure that currentURI is set so
|
|
|
|
that switch-to-tab works before the tab is fully
|
|
|
|
restored. This function also invokes onLocationChanged
|
|
|
|
listeners in tabbrowser.xml.
|
|
|
|
-->
|
|
|
|
<method name="_setCurrentURI">
|
|
|
|
<parameter name="aURI"/>
|
|
|
|
<body><![CDATA[
|
|
|
|
this._remoteWebProgressManager.setCurrentURI(aURI);
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
2013-07-29 19:03:41 +04:00
|
|
|
<property name="documentURI"
|
|
|
|
onget="return this._documentURI;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2014-03-12 07:13:41 +04:00
|
|
|
<property name="documentContentType"
|
|
|
|
onget="return this._documentContentType;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2013-07-27 01:26:35 +04:00
|
|
|
<field name="_contentTitle">""</field>
|
2013-04-25 09:29:39 +04:00
|
|
|
|
|
|
|
<property name="contentTitle"
|
|
|
|
onget="return this._contentTitle"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2014-04-29 22:05:57 +04:00
|
|
|
<field name="_characterSet">""</field>
|
2013-04-27 19:37:04 +04:00
|
|
|
|
|
|
|
<property name="characterSet"
|
2014-08-13 21:29:00 +04:00
|
|
|
onget="return this._characterSet">
|
|
|
|
<setter><![CDATA[
|
|
|
|
this.messageManager.sendAsyncMessage("UpdateCharacterSet", {value: val});
|
|
|
|
this._characterSet = val;
|
|
|
|
]]></setter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<field name="_mayEnableCharacterEncodingMenu">null</field>
|
|
|
|
|
|
|
|
<property name="mayEnableCharacterEncodingMenu"
|
|
|
|
onget="return this._mayEnableCharacterEncodingMenu;"
|
2013-04-27 19:37:04 +04:00
|
|
|
readonly="true"/>
|
|
|
|
|
2013-07-17 17:27:49 +04:00
|
|
|
<field name="_contentWindow">null</field>
|
|
|
|
|
|
|
|
<property name="contentWindow"
|
2014-08-20 23:49:11 +04:00
|
|
|
onget="return null"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentWindowAsCPOW"
|
2013-07-17 17:27:49 +04:00
|
|
|
onget="return this._contentWindow"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentDocument"
|
2014-08-20 23:49:11 +04:00
|
|
|
onget="return null"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2014-09-19 03:26:50 +04:00
|
|
|
<field name="_contentPrincipal">null</field>
|
|
|
|
|
|
|
|
<property name="contentPrincipal"
|
|
|
|
onget="return this._contentPrincipal"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2017-09-21 03:08:00 +03:00
|
|
|
<field name="_contentRequestContextID">null</field>
|
|
|
|
|
|
|
|
<property name="contentRequestContextID"
|
|
|
|
onget="return this._contentRequestContextID"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2017-12-05 03:19:43 +03:00
|
|
|
<field name="_contentDocument">null</field>
|
|
|
|
|
2014-08-20 23:49:11 +04:00
|
|
|
<property name="contentDocumentAsCPOW"
|
2017-12-05 03:19:43 +03:00
|
|
|
onget="return this._contentDocument"
|
2013-07-17 17:27:49 +04:00
|
|
|
readonly="true"/>
|
|
|
|
|
2013-07-29 19:03:41 +04:00
|
|
|
<field name="_imageDocument">null</field>
|
|
|
|
|
|
|
|
<property name="imageDocument"
|
|
|
|
onget="return this._imageDocument"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2014-01-13 21:36:26 +04:00
|
|
|
<field name="_fullZoom">1</field>
|
|
|
|
<property name="fullZoom">
|
|
|
|
<getter><![CDATA[
|
|
|
|
return this._fullZoom;
|
|
|
|
]]></getter>
|
|
|
|
<setter><![CDATA[
|
2016-04-01 21:45:01 +03:00
|
|
|
let changed = val.toFixed(2) != this._fullZoom.toFixed(2);
|
|
|
|
|
2014-03-19 13:25:13 +04:00
|
|
|
this._fullZoom = val;
|
2017-02-21 15:30:17 +03:00
|
|
|
try {
|
|
|
|
this.messageManager.sendAsyncMessage("FullZoom", {value: val});
|
|
|
|
} catch (ex) {}
|
2016-04-01 21:45:01 +03:00
|
|
|
|
|
|
|
if (changed) {
|
|
|
|
let event = new Event("FullZoomChange", {bubbles: true});
|
|
|
|
this.dispatchEvent(event);
|
|
|
|
}
|
2014-01-13 21:36:26 +04:00
|
|
|
]]></setter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<field name="_textZoom">1</field>
|
|
|
|
<property name="textZoom">
|
|
|
|
<getter><![CDATA[
|
|
|
|
return this._textZoom;
|
|
|
|
]]></getter>
|
|
|
|
<setter><![CDATA[
|
2016-04-01 21:45:01 +03:00
|
|
|
let changed = val.toFixed(2) != this._textZoom.toFixed(2);
|
|
|
|
|
2014-03-19 13:25:13 +04:00
|
|
|
this._textZoom = val;
|
2017-02-21 15:30:17 +03:00
|
|
|
try {
|
|
|
|
this.messageManager.sendAsyncMessage("TextZoom", {value: val});
|
|
|
|
} catch (ex) {}
|
2016-04-01 21:45:01 +03:00
|
|
|
|
|
|
|
if (changed) {
|
|
|
|
let event = new Event("TextZoomChange", {bubbles: true});
|
|
|
|
this.dispatchEvent(event);
|
|
|
|
}
|
2014-01-13 21:36:26 +04:00
|
|
|
]]></setter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<field name="_isSyntheticDocument">false</field>
|
|
|
|
<property name="isSyntheticDocument">
|
|
|
|
<getter><![CDATA[
|
|
|
|
return this._isSyntheticDocument;
|
|
|
|
]]></getter>
|
|
|
|
</property>
|
|
|
|
|
2015-05-13 23:42:20 +03:00
|
|
|
<property name="hasContentOpener">
|
|
|
|
<getter><![CDATA[
|
2017-08-19 23:32:58 +03:00
|
|
|
return this.frameLoader.tabParent.hasContentOpener;
|
2015-05-13 23:42:20 +03:00
|
|
|
]]></getter>
|
|
|
|
</property>
|
|
|
|
|
2015-01-28 02:32:40 +03:00
|
|
|
<field name="_outerWindowID">null</field>
|
|
|
|
<property name="outerWindowID"
|
|
|
|
onget="return this._outerWindowID"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2015-12-01 04:56:01 +03:00
|
|
|
<field name="_innerWindowID">null</field>
|
|
|
|
<property name="innerWindowID">
|
|
|
|
<getter><![CDATA[
|
|
|
|
return this._innerWindowID;
|
|
|
|
]]></getter>
|
|
|
|
</property>
|
|
|
|
|
2014-02-20 15:26:13 +04:00
|
|
|
<property name="docShellIsActive">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
2017-08-19 23:32:58 +03:00
|
|
|
return this.frameLoader.tabParent.docShellIsActive;
|
2014-02-20 15:26:13 +04:00
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
<setter>
|
|
|
|
<![CDATA[
|
2017-08-19 23:32:58 +03:00
|
|
|
this.frameLoader.tabParent.docShellIsActive = val;
|
2014-02-20 15:26:13 +04:00
|
|
|
return val;
|
|
|
|
]]>
|
|
|
|
</setter>
|
|
|
|
</property>
|
|
|
|
|
2016-07-23 02:36:45 +03:00
|
|
|
<method name="preserveLayers">
|
|
|
|
<parameter name="preserve"/>
|
2015-11-10 05:38:21 +03:00
|
|
|
<body><![CDATA[
|
2017-08-19 23:32:58 +03:00
|
|
|
let {frameLoader} = this;
|
2016-07-23 02:36:45 +03:00
|
|
|
if (frameLoader.tabParent) {
|
|
|
|
frameLoader.tabParent.preserveLayers(preserve);
|
|
|
|
}
|
2015-11-10 05:38:21 +03:00
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
2017-12-19 19:44:18 +03:00
|
|
|
<property name="renderLayers">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
let {frameLoader} = this;
|
|
|
|
if (frameLoader && frameLoader.tabParent) {
|
|
|
|
return frameLoader.tabParent.renderLayers;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
<setter>
|
|
|
|
<![CDATA[
|
|
|
|
let {frameLoader} = this;
|
|
|
|
if (frameLoader && frameLoader.tabParent) {
|
|
|
|
return frameLoader.tabParent.renderLayers = val;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
]]>
|
|
|
|
</setter>
|
|
|
|
</property>
|
|
|
|
|
2017-11-17 20:55:29 +03:00
|
|
|
<property name="hasLayers" readonly="true">
|
|
|
|
<getter><![CDATA[
|
|
|
|
let {frameLoader} = this;
|
|
|
|
if (frameLoader.tabParent) {
|
|
|
|
return frameLoader.tabParent.hasLayers;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
]]></getter>
|
|
|
|
</property>
|
|
|
|
|
2016-03-21 13:22:16 +03:00
|
|
|
<field name="_manifestURI"/>
|
|
|
|
<property name="manifestURI"
|
|
|
|
onget="return this._manifestURI"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2014-12-30 04:09:52 +03:00
|
|
|
<field name="mDestroyed">false</field>
|
|
|
|
|
2015-09-24 23:32:09 +03:00
|
|
|
<field name="_permitUnloadId">0</field>
|
|
|
|
|
|
|
|
<method name="getInPermitUnload">
|
|
|
|
<parameter name="aCallback"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
let id = this._permitUnloadId++;
|
|
|
|
let mm = this.messageManager;
|
|
|
|
mm.sendAsyncMessage("InPermitUnload", {id});
|
|
|
|
mm.addMessageListener("InPermitUnload", function listener(msg) {
|
|
|
|
if (msg.data.id != id) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-08 15:40:16 +03:00
|
|
|
aCallback(msg.data.inPermitUnload);
|
2015-09-24 23:32:09 +03:00
|
|
|
});
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="permitUnload">
|
2017-11-24 17:14:46 +03:00
|
|
|
<parameter name="aPermitUnloadFlags"/>
|
2015-09-24 23:32:09 +03:00
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2017-08-19 23:32:58 +03:00
|
|
|
let {tabParent} = this.frameLoader;
|
2017-04-14 02:13:34 +03:00
|
|
|
|
2018-01-23 20:49:57 +03:00
|
|
|
if (!tabParent.hasBeforeUnload) {
|
2017-04-14 02:13:34 +03:00
|
|
|
return { permitUnload: true, timedOut: false };
|
|
|
|
}
|
|
|
|
|
2017-05-03 12:07:48 +03:00
|
|
|
const kTimeout = 1000;
|
2015-09-24 23:32:09 +03:00
|
|
|
|
|
|
|
let finished = false;
|
|
|
|
let responded = false;
|
|
|
|
let permitUnload;
|
|
|
|
let id = this._permitUnloadId++;
|
|
|
|
let mm = this.messageManager;
|
2018-01-30 08:17:48 +03:00
|
|
|
let Services = Components.utils.import("resource://gre/modules/Services.jsm", {}).Services;
|
2015-09-24 23:32:09 +03:00
|
|
|
|
|
|
|
let msgListener = msg => {
|
|
|
|
if (msg.data.id != id) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (msg.data.kind == "start") {
|
|
|
|
responded = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
done(msg.data.permitUnload);
|
|
|
|
};
|
|
|
|
|
|
|
|
let observer = subject => {
|
|
|
|
if (subject == mm) {
|
|
|
|
done(true);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
function done(result) {
|
|
|
|
finished = true;
|
|
|
|
permitUnload = result;
|
|
|
|
mm.removeMessageListener("PermitUnload", msgListener);
|
|
|
|
Services.obs.removeObserver(observer, "message-manager-close");
|
|
|
|
}
|
|
|
|
|
2017-11-24 17:14:46 +03:00
|
|
|
mm.sendAsyncMessage("PermitUnload", {id, aPermitUnloadFlags});
|
2015-09-24 23:32:09 +03:00
|
|
|
mm.addMessageListener("PermitUnload", msgListener);
|
2017-04-14 22:51:38 +03:00
|
|
|
Services.obs.addObserver(observer, "message-manager-close");
|
2015-09-24 23:32:09 +03:00
|
|
|
|
|
|
|
let timedOut = false;
|
|
|
|
function timeout() {
|
|
|
|
if (!responded) {
|
|
|
|
timedOut = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dispatch something to ensure that the main thread wakes up.
|
2017-04-14 19:29:12 +03:00
|
|
|
Services.tm.dispatchToMainThread(function() {});
|
2015-09-24 23:32:09 +03:00
|
|
|
}
|
|
|
|
|
2016-03-09 04:14:39 +03:00
|
|
|
let timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
|
2015-09-24 23:32:09 +03:00
|
|
|
timer.initWithCallback(timeout, kTimeout, timer.TYPE_ONE_SHOT);
|
|
|
|
|
|
|
|
while (!finished && !timedOut) {
|
|
|
|
Services.tm.currentThread.processNextEvent(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {permitUnload, timedOut};
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2013-04-25 09:29:31 +04:00
|
|
|
<constructor>
|
|
|
|
<![CDATA[
|
2014-03-12 07:13:52 +04:00
|
|
|
/*
|
|
|
|
* Don't try to send messages from this function. The message manager for
|
|
|
|
* the <browser> element may not be initialized yet.
|
|
|
|
*/
|
|
|
|
|
2016-03-09 04:14:39 +03:00
|
|
|
this._remoteWebNavigation = Components.classes["@mozilla.org/remote-web-navigation;1"]
|
|
|
|
.createInstance(Components.interfaces.nsIWebNavigation);
|
2016-01-13 00:44:08 +03:00
|
|
|
this._remoteWebNavigationImpl = this._remoteWebNavigation.wrappedJSObject;
|
|
|
|
this._remoteWebNavigationImpl.swapBrowser(this);
|
2013-10-28 23:24:51 +04:00
|
|
|
|
2016-09-26 16:47:31 +03:00
|
|
|
// Initialize contentPrincipal to the about:blank principal for this loadcontext
|
2018-01-30 08:17:48 +03:00
|
|
|
let {Services} = Components.utils.import("resource://gre/modules/Services.jsm", {});
|
2017-01-09 22:27:25 +03:00
|
|
|
let aboutBlank = Services.io.newURI("about:blank");
|
2016-09-26 16:47:31 +03:00
|
|
|
let ssm = Services.scriptSecurityManager;
|
|
|
|
this._contentPrincipal = ssm.getLoadContextCodebasePrincipal(aboutBlank, this.loadContext);
|
2016-05-06 14:19:09 +03:00
|
|
|
|
2014-03-12 07:13:52 +04:00
|
|
|
this.messageManager.addMessageListener("Browser:Init", this);
|
2013-04-25 09:29:39 +04:00
|
|
|
this.messageManager.addMessageListener("DOMTitleChanged", this);
|
2013-07-29 19:03:41 +04:00
|
|
|
this.messageManager.addMessageListener("ImageDocumentLoaded", this);
|
2014-01-13 21:36:26 +04:00
|
|
|
this.messageManager.addMessageListener("FullZoomChange", this);
|
|
|
|
this.messageManager.addMessageListener("TextZoomChange", this);
|
2014-08-20 19:13:35 +04:00
|
|
|
this.messageManager.addMessageListener("ZoomChangeUsingMouseWheel", this);
|
2014-08-20 00:58:00 +04:00
|
|
|
this.messageManager.addMessageListener("DOMFullscreen:RequestExit", this);
|
|
|
|
this.messageManager.addMessageListener("DOMFullscreen:RequestRollback", this);
|
2016-03-21 13:22:16 +03:00
|
|
|
this.messageManager.addMessageListener("MozApplicationManifest", this);
|
2013-04-25 09:29:31 +04:00
|
|
|
this.messageManager.loadFrameScript("chrome://global/content/browser-child.js", true);
|
2013-08-26 05:34:23 +04:00
|
|
|
|
2015-01-06 00:38:48 +03:00
|
|
|
if (this.hasAttribute("selectmenulist")) {
|
2013-08-26 05:34:23 +04:00
|
|
|
this.messageManager.addMessageListener("Forms:ShowDropDown", this);
|
|
|
|
this.messageManager.addMessageListener("Forms:HideDropDown", this);
|
|
|
|
}
|
|
|
|
|
2015-08-10 22:15:11 +03:00
|
|
|
if (!this.hasAttribute("disablehistory")) {
|
2016-05-06 14:19:09 +03:00
|
|
|
Services.obs.addObserver(this, "browser:purge-session-history", true);
|
2015-08-10 22:15:11 +03:00
|
|
|
}
|
|
|
|
|
2017-09-01 06:22:34 +03:00
|
|
|
let rc_js = "resource://gre/modules/RemoteController.js";
|
|
|
|
let scope = {};
|
|
|
|
Services.scriptloader.loadSubScript(rc_js, scope);
|
|
|
|
let RemoteController = scope.RemoteController;
|
2013-08-21 21:24:53 +04:00
|
|
|
this._controller = new RemoteController(this);
|
|
|
|
this.controllers.appendController(this._controller);
|
2013-04-25 09:29:31 +04:00
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
|
2014-08-20 00:58:00 +04:00
|
|
|
<destructor>
|
|
|
|
<![CDATA[
|
2014-12-30 04:09:52 +03:00
|
|
|
this.destroy();
|
2014-08-20 00:58:00 +04:00
|
|
|
]]>
|
|
|
|
</destructor>
|
|
|
|
|
2014-12-30 04:09:52 +03:00
|
|
|
<!-- This is necessary because the destructor doesn't always get called when
|
2015-08-10 22:15:11 +03:00
|
|
|
we are removed from a tabbrowser. This will be explicitly called by tabbrowser.
|
|
|
|
|
|
|
|
Note: This overrides the destroy() method from browser.xml. -->
|
2014-12-30 04:09:52 +03:00
|
|
|
<method name="destroy">
|
|
|
|
<body><![CDATA[
|
2016-04-13 20:15:55 +03:00
|
|
|
// Make sure that any open select is closed.
|
|
|
|
if (this._selectParentHelper) {
|
|
|
|
let menulist = document.getElementById(this.getAttribute("selectmenulist"));
|
|
|
|
this._selectParentHelper.hide(menulist, this);
|
|
|
|
}
|
|
|
|
|
2014-12-30 04:09:52 +03:00
|
|
|
if (this.mDestroyed)
|
|
|
|
return;
|
|
|
|
this.mDestroyed = true;
|
|
|
|
|
2016-02-04 14:50:06 +03:00
|
|
|
try {
|
|
|
|
this.controllers.removeController(this._controller);
|
|
|
|
} catch (ex) {
|
|
|
|
// This can fail when this browser element is not attached to a
|
|
|
|
// BrowserDOMWindow.
|
|
|
|
}
|
2015-08-10 22:15:11 +03:00
|
|
|
|
|
|
|
if (!this.hasAttribute("disablehistory")) {
|
2018-01-30 08:17:48 +03:00
|
|
|
let Services = Components.utils.import("resource://gre/modules/Services.jsm", {}).Services;
|
2015-08-10 22:15:11 +03:00
|
|
|
try {
|
|
|
|
Services.obs.removeObserver(this, "browser:purge-session-history");
|
|
|
|
} catch (ex) {
|
|
|
|
// It's not clear why this sometimes throws an exception.
|
|
|
|
}
|
|
|
|
}
|
2014-12-30 04:09:52 +03:00
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
2013-04-25 09:29:39 +04:00
|
|
|
<method name="receiveMessage">
|
|
|
|
<parameter name="aMessage"/>
|
|
|
|
<body><![CDATA[
|
2013-08-26 05:34:23 +04:00
|
|
|
let data = aMessage.data;
|
2013-04-25 09:29:39 +04:00
|
|
|
switch (aMessage.name) {
|
2014-03-12 07:13:52 +04:00
|
|
|
case "Browser:Init":
|
2015-01-28 02:32:40 +03:00
|
|
|
this._outerWindowID = data.outerWindowID;
|
2014-03-12 07:13:52 +04:00
|
|
|
break;
|
2013-04-25 09:29:39 +04:00
|
|
|
case "DOMTitleChanged":
|
2013-08-26 05:34:23 +04:00
|
|
|
this._contentTitle = data.title;
|
2013-04-25 09:29:39 +04:00
|
|
|
break;
|
2013-07-29 19:03:41 +04:00
|
|
|
case "ImageDocumentLoaded":
|
|
|
|
this._imageDocument = {
|
2013-08-26 05:34:23 +04:00
|
|
|
width: data.width,
|
|
|
|
height: data.height
|
2013-07-29 19:03:41 +04:00
|
|
|
};
|
|
|
|
break;
|
2013-08-26 05:34:23 +04:00
|
|
|
|
|
|
|
case "Forms:ShowDropDown": {
|
2015-06-05 15:33:29 +03:00
|
|
|
if (!this._selectParentHelper) {
|
|
|
|
this._selectParentHelper =
|
2018-01-30 08:17:48 +03:00
|
|
|
Cu.import("resource://gre/modules/SelectParentHelper.jsm", {}).SelectParentHelper;
|
2015-06-05 15:33:29 +03:00
|
|
|
}
|
|
|
|
|
2015-01-06 00:38:48 +03:00
|
|
|
let menulist = document.getElementById(this.getAttribute("selectmenulist"));
|
2015-07-14 05:03:51 +03:00
|
|
|
menulist.menupopup.style.direction = data.direction;
|
2016-11-11 18:30:48 +03:00
|
|
|
|
|
|
|
let zoom = Services.prefs.getBoolPref("browser.zoom.full") ||
|
|
|
|
this.isSyntheticDocument ? this._fullZoom : this._textZoom;
|
2017-01-31 23:58:27 +03:00
|
|
|
this._selectParentHelper.populate(menulist, data.options, data.selectedIndex,
|
2017-02-04 08:33:13 +03:00
|
|
|
zoom, data.uaBackgroundColor, data.uaColor,
|
|
|
|
data.uaSelectBackgroundColor, data.uaSelectColor,
|
2017-04-10 23:03:03 +03:00
|
|
|
data.selectBackgroundColor, data.selectColor, data.selectTextShadow);
|
2016-10-20 19:45:39 +03:00
|
|
|
this._selectParentHelper.open(this, menulist, data.rect, data.isOpenedViaTouch);
|
2013-08-26 05:34:23 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-08-21 19:42:41 +04:00
|
|
|
case "FullZoomChange": {
|
2014-01-13 21:36:26 +04:00
|
|
|
this._fullZoom = data.value;
|
2014-08-21 19:42:41 +04:00
|
|
|
let event = document.createEvent("Events");
|
|
|
|
event.initEvent("FullZoomChange", true, false);
|
|
|
|
this.dispatchEvent(event);
|
2014-01-13 21:36:26 +04:00
|
|
|
break;
|
2014-08-21 19:42:41 +04:00
|
|
|
}
|
2014-01-13 21:36:26 +04:00
|
|
|
|
2014-08-21 19:42:41 +04:00
|
|
|
case "TextZoomChange": {
|
2014-01-13 21:36:26 +04:00
|
|
|
this._textZoom = data.value;
|
2014-08-21 19:42:41 +04:00
|
|
|
let event = document.createEvent("Events");
|
|
|
|
event.initEvent("TextZoomChange", true, false);
|
|
|
|
this.dispatchEvent(event);
|
2014-01-13 21:36:26 +04:00
|
|
|
break;
|
2014-08-21 19:42:41 +04:00
|
|
|
}
|
2014-01-13 21:36:26 +04:00
|
|
|
|
2014-08-21 19:42:41 +04:00
|
|
|
case "ZoomChangeUsingMouseWheel": {
|
2014-08-20 19:13:35 +04:00
|
|
|
let event = document.createEvent("Events");
|
|
|
|
event.initEvent("ZoomChangeUsingMouseWheel", true, false);
|
|
|
|
this.dispatchEvent(event);
|
|
|
|
break;
|
2014-08-21 19:42:41 +04:00
|
|
|
}
|
2014-08-20 19:13:35 +04:00
|
|
|
|
2014-08-20 00:58:00 +04:00
|
|
|
case "DOMFullscreen:RequestExit": {
|
2016-03-09 04:14:39 +03:00
|
|
|
let windowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
2014-08-20 00:58:00 +04:00
|
|
|
windowUtils.exitFullscreen();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case "DOMFullscreen:RequestRollback": {
|
2016-03-09 04:14:39 +03:00
|
|
|
let windowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
2014-08-20 00:58:00 +04:00
|
|
|
windowUtils.remoteFrameFullscreenReverted();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-03-21 13:22:16 +03:00
|
|
|
case "MozApplicationManifest":
|
|
|
|
this._manifestURI = aMessage.data.manifest;
|
|
|
|
break;
|
|
|
|
|
2014-03-14 22:45:53 +04:00
|
|
|
default:
|
|
|
|
// Delegate to browser.xml.
|
|
|
|
return this._receiveMessage(aMessage);
|
2013-04-25 09:29:39 +04:00
|
|
|
}
|
2016-04-05 21:33:48 +03:00
|
|
|
return undefined;
|
2013-04-25 09:29:39 +04:00
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
2014-12-09 18:48:27 +03:00
|
|
|
<method name="enableDisableCommands">
|
|
|
|
<parameter name="aAction"/>
|
|
|
|
<parameter name="aEnabledLength"/>
|
|
|
|
<parameter name="aEnabledCommands"/>
|
|
|
|
<parameter name="aDisabledLength"/>
|
|
|
|
<parameter name="aDisabledCommands"/>
|
|
|
|
<body>
|
|
|
|
if (this._controller) {
|
|
|
|
this._controller.enableDisableCommands(aAction,
|
|
|
|
aEnabledLength, aEnabledCommands,
|
|
|
|
aDisabledLength, aDisabledCommands);
|
|
|
|
}
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2015-08-10 22:15:11 +03:00
|
|
|
<method name="purgeSessionHistory">
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2015-08-24 21:34:56 +03:00
|
|
|
try {
|
|
|
|
this.messageManager.sendAsyncMessage("Browser:PurgeSessionHistory");
|
2015-12-11 00:53:46 +03:00
|
|
|
} catch (ex) {
|
2015-08-24 21:34:56 +03:00
|
|
|
// This can throw if the browser has started to go away.
|
2015-12-11 00:53:46 +03:00
|
|
|
if (ex.result != Components.results.NS_ERROR_NOT_INITIALIZED) {
|
|
|
|
throw ex;
|
|
|
|
}
|
2015-08-24 21:34:56 +03:00
|
|
|
}
|
2016-01-13 00:44:08 +03:00
|
|
|
this._remoteWebNavigationImpl.canGoBack = false;
|
|
|
|
this._remoteWebNavigationImpl.canGoForward = false;
|
2015-08-10 22:15:11 +03:00
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2016-09-06 16:19:45 +03:00
|
|
|
|
|
|
|
<method name="createAboutBlankContentViewer">
|
|
|
|
<parameter name="aPrincipal"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2017-03-18 00:04:44 +03:00
|
|
|
// Ensure that the content process has the permissions which are
|
|
|
|
// needed to create a document with the given principal.
|
|
|
|
let permissionPrincipal =
|
|
|
|
BrowserUtils.principalWithMatchingOA(aPrincipal, this.contentPrincipal);
|
2017-08-19 23:32:58 +03:00
|
|
|
this.frameLoader.tabParent.transmitPermissionsForPrincipal(permissionPrincipal);
|
2017-03-18 00:04:44 +03:00
|
|
|
|
|
|
|
// Create the about blank content viewer in the content process
|
2016-09-06 16:19:45 +03:00
|
|
|
this.messageManager.sendAsyncMessage("Browser:CreateAboutBlank", aPrincipal);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
2013-04-25 09:29:31 +04:00
|
|
|
</implementation>
|
2016-03-30 00:10:40 +03:00
|
|
|
<handlers>
|
|
|
|
<handler event="dragstart">
|
|
|
|
<![CDATA[
|
|
|
|
// If we're a remote browser dealing with a dragstart, stop it
|
|
|
|
// from propagating up, since our content process should be dealing
|
|
|
|
// with the mouse movement.
|
|
|
|
event.stopPropagation();
|
|
|
|
]]>
|
|
|
|
</handler>
|
|
|
|
</handlers>
|
2013-04-25 09:29:31 +04:00
|
|
|
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
</bindings>
|