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">
|
|
|
|
|
2013-07-19 08:13:35 +04:00
|
|
|
<implementation type="application/javascript" implements="nsIObserver, nsIDOMEventListener, nsIMessageListener, nsIMessageListener">
|
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) {
|
|
|
|
let jsm = "resource://gre/modules/RemoteSecurityUI.jsm";
|
|
|
|
let RemoteSecurityUI = Components.utils.import(jsm, {}).RemoteSecurityUI;
|
|
|
|
this._securityUI = new RemoteSecurityUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
// We want to double-wrap the JS implemented interface, so that QI and instanceof works.
|
|
|
|
var ptr = Cc["@mozilla.org/supports-interface-pointer;1"].
|
|
|
|
createInstance(Ci.nsISupportsInterfacePointer);
|
|
|
|
ptr.data = this._securityUI;
|
|
|
|
return ptr.data.QueryInterface(Ci.nsISecureBrowserUI);
|
|
|
|
]]></getter>
|
|
|
|
</property>
|
2013-04-25 09:29:31 +04:00
|
|
|
|
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) {
|
2013-07-10 06:45:07 +04:00
|
|
|
let jsm = "resource://gre/modules/RemoteWebProgress.jsm";
|
2013-09-06 21:10:11 +04:00
|
|
|
let RemoteWebProgressManager = Cu.import(jsm, {}).RemoteWebProgressManager;
|
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) {
|
|
|
|
let jsm = "resource://gre/modules/RemoteFinder.jsm";
|
|
|
|
let RemoteFinder = Cu.import(jsm, {}).RemoteFinder;
|
|
|
|
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"/>
|
|
|
|
|
2013-04-27 19:37:04 +04:00
|
|
|
<field name="_characterSet">null</field>
|
|
|
|
|
|
|
|
<property name="characterSet"
|
|
|
|
onget="return this._characterSet"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2013-07-17 17:27:49 +04:00
|
|
|
<field name="_contentWindow">null</field>
|
|
|
|
|
|
|
|
<property name="contentWindow"
|
|
|
|
onget="return this._contentWindow"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentDocument"
|
|
|
|
onget="return this.contentWindow ? this.contentWindow.document : null"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2013-11-20 01:20:15 +04:00
|
|
|
<field name="_syncHandler">null</field>
|
|
|
|
|
|
|
|
<property name="syncHandler"
|
|
|
|
onget="return this._syncHandler"
|
|
|
|
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[
|
|
|
|
this.messageManager.sendAsyncMessage("FullZoom", {value: val});
|
|
|
|
]]></setter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<field name="_textZoom">1</field>
|
|
|
|
<property name="textZoom">
|
|
|
|
<getter><![CDATA[
|
|
|
|
return this._textZoom;
|
|
|
|
]]></getter>
|
|
|
|
<setter><![CDATA[
|
|
|
|
this.messageManager.sendAsyncMessage("TextZoom", {value: val});
|
|
|
|
]]></setter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<field name="_isSyntheticDocument">false</field>
|
|
|
|
<property name="isSyntheticDocument">
|
|
|
|
<getter><![CDATA[
|
|
|
|
return this._isSyntheticDocument;
|
|
|
|
]]></getter>
|
|
|
|
</property>
|
|
|
|
|
2013-12-07 04:02:05 +04:00
|
|
|
<property name="autoCompletePopup"
|
|
|
|
onget="return document.getElementById(this.getAttribute('autocompletepopup'))"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2014-02-20 15:26:13 +04:00
|
|
|
<property name="docShellIsActive">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
throw new Error("not supported");
|
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
<setter>
|
|
|
|
<![CDATA[
|
|
|
|
let {frameLoader} = this.QueryInterface(Ci.nsIFrameLoaderOwner);
|
|
|
|
frameLoader.tabParent.setIsDocShellActive(val);
|
|
|
|
return val;
|
|
|
|
]]>
|
|
|
|
</setter>
|
|
|
|
</property>
|
|
|
|
|
2013-04-25 09:29:31 +04:00
|
|
|
<constructor>
|
|
|
|
<![CDATA[
|
2013-10-28 23:24:51 +04:00
|
|
|
let jsm = "resource://gre/modules/RemoteWebNavigation.jsm";
|
|
|
|
let RemoteWebNavigation = Cu.import(jsm, {}).RemoteWebNavigation;
|
|
|
|
this._remoteWebNavigation = new RemoteWebNavigation(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);
|
2013-11-20 01:20:15 +04:00
|
|
|
this.messageManager.addMessageListener("SetSyncHandler", this);
|
2014-01-13 21:36:26 +04:00
|
|
|
this.messageManager.addMessageListener("DocumentInserted", this);
|
|
|
|
this.messageManager.addMessageListener("FullZoomChange", this);
|
|
|
|
this.messageManager.addMessageListener("TextZoomChange", 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
|
|
|
|
|
|
|
if (this.hasAttribute("selectpopup")) {
|
|
|
|
this.messageManager.addMessageListener("Forms:ShowDropDown", this);
|
|
|
|
this.messageManager.addMessageListener("Forms:HideDropDown", this);
|
|
|
|
this.messageManager.loadFrameScript("chrome://global/content/select-child.js", true);
|
|
|
|
}
|
|
|
|
|
2013-10-28 23:24:51 +04:00
|
|
|
jsm = "resource://gre/modules/RemoteController.jsm";
|
2013-08-21 21:24:53 +04:00
|
|
|
let RemoteController = Components.utils.import(jsm, {}).RemoteController;
|
|
|
|
this._controller = new RemoteController(this);
|
|
|
|
this.controllers.appendController(this._controller);
|
2013-08-29 08:43:00 +04:00
|
|
|
|
|
|
|
jsm = "resource://gre/modules/RemoteAddonsParent.jsm";
|
|
|
|
let RemoteAddonsParent = Components.utils.import(jsm, {}).RemoteAddonsParent;
|
|
|
|
RemoteAddonsParent.init();
|
2013-10-28 23:24:45 +04:00
|
|
|
|
|
|
|
if (!this.hasAttribute("disableglobalhistory")) {
|
|
|
|
this.messageManager.sendAsyncMessage("History:UseGlobalHistory", {enabled:true});
|
|
|
|
}
|
2013-12-07 04:02:05 +04:00
|
|
|
|
|
|
|
if (this.autoCompletePopup) {
|
|
|
|
this.messageManager.sendAsyncMessage("FormAutoComplete:InitPopup");
|
|
|
|
}
|
2013-04-25 09:29:31 +04:00
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
|
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) {
|
|
|
|
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
|
|
|
|
2013-11-20 01:20:15 +04:00
|
|
|
case "SetSyncHandler":
|
|
|
|
this._syncHandler = aMessage.objects.handler;
|
|
|
|
break;
|
|
|
|
|
2013-08-26 05:34:23 +04:00
|
|
|
case "Forms:ShowDropDown": {
|
|
|
|
Cu.import("resource://gre/modules/SelectParentHelper.jsm");
|
|
|
|
let dropdown = document.getElementById(this.getAttribute("selectpopup"));
|
|
|
|
SelectParentHelper.populate(dropdown, data.options, data.selectedIndex);
|
|
|
|
SelectParentHelper.open(this, dropdown, data.rect);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-01-13 21:36:26 +04:00
|
|
|
case "DocumentInserted":
|
|
|
|
this._isSyntheticDocument = data.synthetic;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "FullZoomChange":
|
|
|
|
this._fullZoom = data.value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "TextZoomChange":
|
|
|
|
this._textZoom = data.value;
|
|
|
|
break;
|
|
|
|
|
2013-08-26 05:34:23 +04:00
|
|
|
case "Forms:HideDropDown": {
|
|
|
|
Cu.import("resource://gre/modules/SelectParentHelper.jsm");
|
|
|
|
let dropdown = document.getElementById(this.getAttribute("selectpopup"));
|
|
|
|
SelectParentHelper.hide(dropdown);
|
|
|
|
}
|
2013-04-25 09:29:39 +04:00
|
|
|
}
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
2014-03-01 04:58:52 +04:00
|
|
|
<!--
|
|
|
|
For out-of-process code, event.screen[XY] is relative to the
|
|
|
|
left/top of the content view. For in-process code,
|
|
|
|
event.screen[XY] is relative to the left/top of the screen. We
|
|
|
|
use this method to map screen coordinates received from a
|
|
|
|
(possibly out-of-process) <browser> element to coordinates
|
|
|
|
that are relative to the screen. This code handles the
|
|
|
|
out-of-process case, where we need to translate by the screen
|
|
|
|
position of the <browser> element.
|
|
|
|
-->
|
|
|
|
<method name="mapScreenCoordinatesFromContent">
|
|
|
|
<parameter name="aScreenX"/>
|
|
|
|
<parameter name="aScreenY"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return { x: aScreenX + this.boxObject.screenX,
|
|
|
|
y: aScreenY + this.boxObject.screenY };
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
2013-04-25 09:29:31 +04:00
|
|
|
</implementation>
|
|
|
|
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
</bindings>
|