toolkit/content/widgets/remote-browser.xml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <?xml version="1.0"?>
michael@0 2
michael@0 3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 6
michael@0 7 <bindings id="firefoxBrowserBindings"
michael@0 8 xmlns="http://www.mozilla.org/xbl"
michael@0 9 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 10
michael@0 11 <binding id="remote-browser" extends="chrome://global/content/bindings/browser.xml#browser">
michael@0 12
michael@0 13 <implementation type="application/javascript" implements="nsIObserver, nsIDOMEventListener, nsIMessageListener">
michael@0 14
michael@0 15 <field name="_securityUI">null</field>
michael@0 16
michael@0 17 <property name="securityUI"
michael@0 18 readonly="true">
michael@0 19 <getter><![CDATA[
michael@0 20 if (!this._securityUI) {
michael@0 21 let jsm = "resource://gre/modules/RemoteSecurityUI.jsm";
michael@0 22 let RemoteSecurityUI = Components.utils.import(jsm, {}).RemoteSecurityUI;
michael@0 23 this._securityUI = new RemoteSecurityUI();
michael@0 24 }
michael@0 25
michael@0 26 // We want to double-wrap the JS implemented interface, so that QI and instanceof works.
michael@0 27 var ptr = Cc["@mozilla.org/supports-interface-pointer;1"].
michael@0 28 createInstance(Ci.nsISupportsInterfacePointer);
michael@0 29 ptr.data = this._securityUI;
michael@0 30 return ptr.data.QueryInterface(Ci.nsISecureBrowserUI);
michael@0 31 ]]></getter>
michael@0 32 </property>
michael@0 33
michael@0 34 <method name="adjustPriority">
michael@0 35 <parameter name="adjustment"/>
michael@0 36 <body><![CDATA[
michael@0 37 this.messageManager.sendAsyncMessage("NetworkPrioritizer:AdjustPriority",
michael@0 38 {adjustment: adjustment});
michael@0 39 ]]></body>
michael@0 40 </method>
michael@0 41
michael@0 42 <field name="_remoteWebNavigation">null</field>
michael@0 43
michael@0 44 <property name="webNavigation"
michael@0 45 onget="return this._remoteWebNavigation;"
michael@0 46 readonly="true"/>
michael@0 47
michael@0 48 <field name="_remoteWebProgress">null</field>
michael@0 49
michael@0 50 <property name="webProgress" readonly="true">
michael@0 51 <getter>
michael@0 52 <![CDATA[
michael@0 53 if (!this._remoteWebProgress) {
michael@0 54 let jsm = "resource://gre/modules/RemoteWebProgress.jsm";
michael@0 55 let RemoteWebProgressManager = Cu.import(jsm, {}).RemoteWebProgressManager;
michael@0 56 this._remoteWebProgressManager = new RemoteWebProgressManager(this);
michael@0 57 this._remoteWebProgress = this._remoteWebProgressManager.topLevelWebProgress;
michael@0 58 }
michael@0 59 return this._remoteWebProgress;
michael@0 60 ]]>
michael@0 61 </getter>
michael@0 62 </property>
michael@0 63
michael@0 64 <field name="_remoteFinder">null</field>
michael@0 65
michael@0 66 <property name="finder" readonly="true">
michael@0 67 <getter><![CDATA[
michael@0 68 if (!this._remoteFinder) {
michael@0 69 let jsm = "resource://gre/modules/RemoteFinder.jsm";
michael@0 70 let RemoteFinder = Cu.import(jsm, {}).RemoteFinder;
michael@0 71 this._remoteFinder = new RemoteFinder(this);
michael@0 72 }
michael@0 73 return this._remoteFinder;
michael@0 74 ]]></getter>
michael@0 75 </property>
michael@0 76
michael@0 77 <field name="_documentURI">null</field>
michael@0 78
michael@0 79 <field name="_documentContentType">null</field>
michael@0 80
michael@0 81 <!--
michael@0 82 Used by session restore to ensure that currentURI is set so
michael@0 83 that switch-to-tab works before the tab is fully
michael@0 84 restored. This function also invokes onLocationChanged
michael@0 85 listeners in tabbrowser.xml.
michael@0 86 -->
michael@0 87 <method name="_setCurrentURI">
michael@0 88 <parameter name="aURI"/>
michael@0 89 <body><![CDATA[
michael@0 90 this._remoteWebProgressManager.setCurrentURI(aURI);
michael@0 91 ]]></body>
michael@0 92 </method>
michael@0 93
michael@0 94 <property name="documentURI"
michael@0 95 onget="return this._documentURI;"
michael@0 96 readonly="true"/>
michael@0 97
michael@0 98 <property name="documentContentType"
michael@0 99 onget="return this._documentContentType;"
michael@0 100 readonly="true"/>
michael@0 101
michael@0 102 <field name="_contentTitle">""</field>
michael@0 103
michael@0 104 <property name="contentTitle"
michael@0 105 onget="return this._contentTitle"
michael@0 106 readonly="true"/>
michael@0 107
michael@0 108 <field name="_characterSet">null</field>
michael@0 109
michael@0 110 <property name="characterSet"
michael@0 111 onget="return this._characterSet"
michael@0 112 readonly="true"/>
michael@0 113
michael@0 114 <field name="_contentWindow">null</field>
michael@0 115
michael@0 116 <property name="contentWindow"
michael@0 117 onget="return this._contentWindow"
michael@0 118 readonly="true"/>
michael@0 119
michael@0 120 <property name="contentDocument"
michael@0 121 onget="return this.contentWindow ? this.contentWindow.document : null"
michael@0 122 readonly="true"/>
michael@0 123
michael@0 124 <field name="_syncHandler">null</field>
michael@0 125
michael@0 126 <property name="syncHandler"
michael@0 127 onget="return this._syncHandler"
michael@0 128 readonly="true"/>
michael@0 129
michael@0 130 <field name="_imageDocument">null</field>
michael@0 131
michael@0 132 <property name="imageDocument"
michael@0 133 onget="return this._imageDocument"
michael@0 134 readonly="true"/>
michael@0 135
michael@0 136 <field name="_fullZoom">1</field>
michael@0 137 <property name="fullZoom">
michael@0 138 <getter><![CDATA[
michael@0 139 return this._fullZoom;
michael@0 140 ]]></getter>
michael@0 141 <setter><![CDATA[
michael@0 142 this._fullZoom = val;
michael@0 143 this.messageManager.sendAsyncMessage("FullZoom", {value: val});
michael@0 144 ]]></setter>
michael@0 145 </property>
michael@0 146
michael@0 147 <field name="_textZoom">1</field>
michael@0 148 <property name="textZoom">
michael@0 149 <getter><![CDATA[
michael@0 150 return this._textZoom;
michael@0 151 ]]></getter>
michael@0 152 <setter><![CDATA[
michael@0 153 this._textZoom = val;
michael@0 154 this.messageManager.sendAsyncMessage("TextZoom", {value: val});
michael@0 155 ]]></setter>
michael@0 156 </property>
michael@0 157
michael@0 158 <field name="_isSyntheticDocument">false</field>
michael@0 159 <property name="isSyntheticDocument">
michael@0 160 <getter><![CDATA[
michael@0 161 return this._isSyntheticDocument;
michael@0 162 ]]></getter>
michael@0 163 </property>
michael@0 164
michael@0 165 <property name="autoCompletePopup"
michael@0 166 onget="return document.getElementById(this.getAttribute('autocompletepopup'))"
michael@0 167 readonly="true"/>
michael@0 168
michael@0 169 <property name="docShellIsActive">
michael@0 170 <getter>
michael@0 171 <![CDATA[
michael@0 172 throw new Error("not supported");
michael@0 173 ]]>
michael@0 174 </getter>
michael@0 175 <setter>
michael@0 176 <![CDATA[
michael@0 177 let {frameLoader} = this.QueryInterface(Ci.nsIFrameLoaderOwner);
michael@0 178 frameLoader.tabParent.setIsDocShellActive(val);
michael@0 179 return val;
michael@0 180 ]]>
michael@0 181 </setter>
michael@0 182 </property>
michael@0 183
michael@0 184 <constructor>
michael@0 185 <![CDATA[
michael@0 186 /*
michael@0 187 * Don't try to send messages from this function. The message manager for
michael@0 188 * the <browser> element may not be initialized yet.
michael@0 189 */
michael@0 190
michael@0 191 let jsm = "resource://gre/modules/RemoteWebNavigation.jsm";
michael@0 192 let RemoteWebNavigation = Cu.import(jsm, {}).RemoteWebNavigation;
michael@0 193 this._remoteWebNavigation = new RemoteWebNavigation(this);
michael@0 194
michael@0 195 this.messageManager.addMessageListener("Browser:Init", this);
michael@0 196 this.messageManager.addMessageListener("DOMTitleChanged", this);
michael@0 197 this.messageManager.addMessageListener("ImageDocumentLoaded", this);
michael@0 198 this.messageManager.addMessageListener("SetSyncHandler", this);
michael@0 199 this.messageManager.addMessageListener("DocumentInserted", this);
michael@0 200 this.messageManager.addMessageListener("FullZoomChange", this);
michael@0 201 this.messageManager.addMessageListener("TextZoomChange", this);
michael@0 202 this.messageManager.loadFrameScript("chrome://global/content/browser-child.js", true);
michael@0 203
michael@0 204 if (this.hasAttribute("selectpopup")) {
michael@0 205 this.messageManager.addMessageListener("Forms:ShowDropDown", this);
michael@0 206 this.messageManager.addMessageListener("Forms:HideDropDown", this);
michael@0 207 this.messageManager.loadFrameScript("chrome://global/content/select-child.js", true);
michael@0 208 }
michael@0 209
michael@0 210 jsm = "resource://gre/modules/RemoteController.jsm";
michael@0 211 let RemoteController = Components.utils.import(jsm, {}).RemoteController;
michael@0 212 this._controller = new RemoteController(this);
michael@0 213 this.controllers.appendController(this._controller);
michael@0 214
michael@0 215 jsm = "resource://gre/modules/RemoteAddonsParent.jsm";
michael@0 216 let RemoteAddonsParent = Components.utils.import(jsm, {}).RemoteAddonsParent;
michael@0 217 RemoteAddonsParent.init();
michael@0 218 ]]>
michael@0 219 </constructor>
michael@0 220
michael@0 221 <method name="receiveMessage">
michael@0 222 <parameter name="aMessage"/>
michael@0 223 <body><![CDATA[
michael@0 224 let data = aMessage.data;
michael@0 225 switch (aMessage.name) {
michael@0 226 case "Browser:Init":
michael@0 227 let result = {};
michael@0 228 result.useGlobalHistory = !this.hasAttribute("disableglobalhistory");
michael@0 229 result.initPopup = this.autoCompletePopup;
michael@0 230 return result;
michael@0 231 break;
michael@0 232 case "DOMTitleChanged":
michael@0 233 this._contentTitle = data.title;
michael@0 234 break;
michael@0 235 case "ImageDocumentLoaded":
michael@0 236 this._imageDocument = {
michael@0 237 width: data.width,
michael@0 238 height: data.height
michael@0 239 };
michael@0 240 break;
michael@0 241
michael@0 242 case "SetSyncHandler":
michael@0 243 this._syncHandler = aMessage.objects.handler;
michael@0 244 break;
michael@0 245
michael@0 246 case "Forms:ShowDropDown": {
michael@0 247 Cu.import("resource://gre/modules/SelectParentHelper.jsm");
michael@0 248 let dropdown = document.getElementById(this.getAttribute("selectpopup"));
michael@0 249 SelectParentHelper.populate(dropdown, data.options, data.selectedIndex);
michael@0 250 SelectParentHelper.open(this, dropdown, data.rect);
michael@0 251 break;
michael@0 252 }
michael@0 253
michael@0 254 case "DocumentInserted":
michael@0 255 this._isSyntheticDocument = data.synthetic;
michael@0 256 break;
michael@0 257
michael@0 258 case "FullZoomChange":
michael@0 259 this._fullZoom = data.value;
michael@0 260 break;
michael@0 261
michael@0 262 case "TextZoomChange":
michael@0 263 this._textZoom = data.value;
michael@0 264 break;
michael@0 265
michael@0 266 case "Forms:HideDropDown": {
michael@0 267 Cu.import("resource://gre/modules/SelectParentHelper.jsm");
michael@0 268 let dropdown = document.getElementById(this.getAttribute("selectpopup"));
michael@0 269 SelectParentHelper.hide(dropdown);
michael@0 270 break;
michael@0 271 }
michael@0 272
michael@0 273 default:
michael@0 274 // Delegate to browser.xml.
michael@0 275 return this._receiveMessage(aMessage);
michael@0 276 break;
michael@0 277 }
michael@0 278 ]]></body>
michael@0 279 </method>
michael@0 280
michael@0 281 <!--
michael@0 282 For out-of-process code, event.screen[XY] is relative to the
michael@0 283 left/top of the content view. For in-process code,
michael@0 284 event.screen[XY] is relative to the left/top of the screen. We
michael@0 285 use this method to map screen coordinates received from a
michael@0 286 (possibly out-of-process) <browser> element to coordinates
michael@0 287 that are relative to the screen. This code handles the
michael@0 288 out-of-process case, where we need to translate by the screen
michael@0 289 position of the <browser> element.
michael@0 290 -->
michael@0 291 <method name="mapScreenCoordinatesFromContent">
michael@0 292 <parameter name="aScreenX"/>
michael@0 293 <parameter name="aScreenY"/>
michael@0 294 <body>
michael@0 295 <![CDATA[
michael@0 296 return { x: aScreenX + this.boxObject.screenX,
michael@0 297 y: aScreenY + this.boxObject.screenY };
michael@0 298 ]]>
michael@0 299 </body>
michael@0 300 </method>
michael@0 301
michael@0 302 </implementation>
michael@0 303
michael@0 304 </binding>
michael@0 305
michael@0 306 </bindings>

mercurial