toolkit/mozapps/update/content/updates.xml

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 5
michael@0 6
michael@0 7 <!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/update/updates.dtd">
michael@0 8
michael@0 9 <bindings id="updatesBindings"
michael@0 10 xmlns="http://www.mozilla.org/xbl"
michael@0 11 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 12 xmlns:xbl="http://www.mozilla.org/xbl">
michael@0 13
michael@0 14 <binding id="remotecontent">
michael@0 15 <content>
michael@0 16 <xul:vbox flex="1" class="loadingBox">
michael@0 17 <xul:hbox align="start">
michael@0 18 <xul:image class="remoteLoadingThrobber" xbl:inherits="state"/>
michael@0 19 <xul:vbox flex="1">
michael@0 20 <xul:description flex="1" class="remoteLoadingMessage" crop="right"/>
michael@0 21 </xul:vbox>
michael@0 22 </xul:hbox>
michael@0 23 </xul:vbox>
michael@0 24 <xul:vbox flex="1">
michael@0 25 <xul:browser class="remoteContent" type="content" disablehistory="true"
michael@0 26 flex="1"/>
michael@0 27 </xul:vbox>
michael@0 28 <xul:stringbundle anonid="strings"
michael@0 29 src="chrome://mozapps/locale/update/updates.properties"/>
michael@0 30 </content>
michael@0 31 <implementation>
michael@0 32 <constructor><![CDATA[
michael@0 33 // just to be safe, turn off js, auth, plugins, and subframes
michael@0 34 var docShell = this._content.docShell;
michael@0 35 docShell.allowJavascript = false;
michael@0 36 docShell.allowAuth = false;
michael@0 37 docShell.allowPlugins = false;
michael@0 38 //allow redirects
michael@0 39 //docShell.allowMetaRedirects = false;
michael@0 40 docShell.allowSubframes = false;
michael@0 41 //allow images
michael@0 42 //docShell.allowImages = false;
michael@0 43 ]]></constructor>
michael@0 44
michael@0 45 <destructor><![CDATA[
michael@0 46 // clean up the listener but you may not have one if you never showed
michael@0 47 // the page with a <remotecontent> element
michael@0 48 if (this._remoteProgressListener)
michael@0 49 this._content.webProgress
michael@0 50 .removeProgressListener(this._remoteProgressListener);
michael@0 51 ]]></destructor>
michael@0 52
michael@0 53 <field name="_message">
michael@0 54 document.getAnonymousElementByAttribute(this, "class", "remoteLoadingMessage");
michael@0 55 </field>
michael@0 56 <field name="_content">
michael@0 57 document.getAnonymousElementByAttribute(this, "class", "remoteContent");
michael@0 58 </field>
michael@0 59 <field name="_strings">
michael@0 60 document.getAnonymousElementByAttribute(this, "anonid", "strings");
michael@0 61 </field>
michael@0 62
michael@0 63 <field name="update_name">null</field>
michael@0 64 <field name="update_version">null</field>
michael@0 65 <field name="_remoteProgressListener">null</field>
michael@0 66
michael@0 67 <method name="_setMessageValue">
michael@0 68 <parameter name="value"/>
michael@0 69 <body><![CDATA[
michael@0 70 while (this._message.hasChildNodes())
michael@0 71 this._message.removeChild(this._message.firstChild);
michael@0 72 this._message.appendChild(document.createTextNode(value));
michael@0 73 ]]></body>
michael@0 74 </method>
michael@0 75
michael@0 76 <method name="onError">
michael@0 77 <body><![CDATA[
michael@0 78 this.setAttribute("selectedIndex", "0");
michael@0 79
michael@0 80 var errorPropertyName = this.getAttribute("id") + "NotFound";
michael@0 81 var statusText = this._strings.getFormattedString(errorPropertyName,
michael@0 82 [this.update_name]);
michael@0 83 this._setMessageValue(statusText);
michael@0 84 this.setAttribute("state", "error");
michael@0 85 var e = document.createEvent("Events");
michael@0 86 e.initEvent("load", false, true);
michael@0 87 this.dispatchEvent(e);
michael@0 88 ]]></body>
michael@0 89 </method>
michael@0 90
michael@0 91 <method name="onLoad">
michael@0 92 <body><![CDATA[
michael@0 93 var doc = this._content.contentDocument;
michael@0 94 var type = this.getAttribute("remotetype");
michael@0 95 if (!doc.body.hasAttribute(type)) {
michael@0 96 this.onError();
michael@0 97 return;
michael@0 98 }
michael@0 99 // The remote html can tell us to zoom out the page if the page
michael@0 100 // will create scrollbars by adding a zoomOutToFit attribute to the
michael@0 101 // body of the billboard's html. Since zooming out will not always
michael@0 102 // remove the scrollbars even though the page fits in the client
michael@0 103 // region after zooming out the web page should hide the scrollbar(s)
michael@0 104 // using css. If you choose to use zoomOutToFit you should also verify
michael@0 105 // it is working the way you expect it to with the billboard you have
michael@0 106 // created. Possible values for zoomOutToFit are:
michael@0 107 // both: zoom out if the width or height is greater than the client
michael@0 108 // region.
michael@0 109 // height: zoom out if the height is greater than the client region.
michael@0 110 // width: zoom out if the width is greater than the client region.
michael@0 111 if (doc.body.hasAttribute("zoomOutToFit")) {
michael@0 112 let zoomAdjustWidth = 1;
michael@0 113 let zoomAdjustHeight = 1;
michael@0 114 let zoomOutType = doc.body.getAttribute("zoomOutToFit");
michael@0 115 if ((zoomOutType == "both" || zoomOutType == "width") &&
michael@0 116 doc.width > this.clientWidth)
michael@0 117 zoomAdjustWidth = Math.floor((this.clientWidth / doc.width) * 100) * .01;
michael@0 118
michael@0 119 if ((zoomOutType == "both" || zoomOutType == "height") &&
michael@0 120 doc.height > this.clientHeight)
michael@0 121 zoomAdjustHeight = Math.floor((this.clientHeight / doc.height) * 100) * .01;
michael@0 122
michael@0 123 var zoomAdjust = zoomAdjustWidth < zoomAdjustHeight ? zoomAdjustWidth
michael@0 124 : zoomAdjustHeight;
michael@0 125 if (zoomAdjust < 1)
michael@0 126 this._content.markupDocumentViewer.fullZoom = zoomAdjust;
michael@0 127 }
michael@0 128
michael@0 129 this.setAttribute("selectedIndex", "1");
michael@0 130 this.setAttribute("state", "loaded");
michael@0 131
michael@0 132 var e = document.createEvent("Events");
michael@0 133 e.initEvent("load", false, true);
michael@0 134 this.dispatchEvent(e);
michael@0 135 ]]></body>
michael@0 136 </method>
michael@0 137
michael@0 138 <method name="onStart">
michael@0 139 <body><![CDATA[
michael@0 140 this.setAttribute("selectedIndex", "0");
michael@0 141
michael@0 142 this.setAttribute("state", "loading");
michael@0 143 var loadingPropertyName = this.getAttribute("id") + "Downloading";
michael@0 144 this._setMessageValue(this._strings.getFormattedString(
michael@0 145 loadingPropertyName, [this.update_name, this.update_version]));
michael@0 146 ]]></body>
michael@0 147 </method>
michael@0 148
michael@0 149 <property name="url">
michael@0 150 <getter><![CDATA[
michael@0 151 return this.getAttribute("url");
michael@0 152 ]]></getter>
michael@0 153 <setter><![CDATA[
michael@0 154 if (this._remoteProgressListener)
michael@0 155 this._content.webProgress
michael@0 156 .removeProgressListener(this._remoteProgressListener);
michael@0 157
michael@0 158 var self = this;
michael@0 159
michael@0 160 this._remoteProgressListener = {
michael@0 161 QueryInterface: function(aIID)
michael@0 162 {
michael@0 163 if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
michael@0 164 aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
michael@0 165 aIID.equals(Components.interfaces.nsISupports))
michael@0 166 return this;
michael@0 167 throw Components.results.NS_NOINTERFACE;
michael@0 168 },
michael@0 169 onLocationChange: function() {},
michael@0 170 onProgressChange: function() {},
michael@0 171 onStatusChange: function() {},
michael@0 172 onSecurityChange: function() {},
michael@0 173 onStateChange: function(aWebProgress, aRequest,
michael@0 174 aStateFlags, aStatus)
michael@0 175 {
michael@0 176 if (!aRequest)
michael@0 177 return;
michael@0 178
michael@0 179 const nsIWebProgressListener =
michael@0 180 Components.interfaces.nsIWebProgressListener;
michael@0 181
michael@0 182 if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)
michael@0 183 {
michael@0 184 if (aStateFlags & nsIWebProgressListener.STATE_START)
michael@0 185 self.onStart();
michael@0 186 else if (aStateFlags & nsIWebProgressListener.STATE_STOP)
michael@0 187 {
michael@0 188 const nsIHttpChannel = Components.interfaces.nsIHttpChannel;
michael@0 189 try {
michael@0 190 var channel = aRequest.QueryInterface(nsIHttpChannel);
michael@0 191 if (channel.requestSucceeded)
michael@0 192 {
michael@0 193 // if we get here, the load was OK, report success
michael@0 194 self.onLoad();
michael@0 195 return;
michael@0 196 }
michael@0 197 }
michael@0 198 catch (ex)
michael@0 199 {
michael@0 200 // the channel.requestSucceeded can throw
michael@0 201 // NS_ERROR_NOT_AVAILABLE if you can't reach the server
michael@0 202 // so we treat that as an error
michael@0 203 }
michael@0 204
michael@0 205 // everything else (like a 404) is an error
michael@0 206 self.onError();
michael@0 207 }
michael@0 208 }
michael@0 209 }
michael@0 210 }
michael@0 211
michael@0 212 this._content.webProgress
michael@0 213 .addProgressListener(this._remoteProgressListener,
michael@0 214 Components.interfaces.nsIWebProgress.NOTIFY_ALL);
michael@0 215
michael@0 216 // load the url now that the listener is registered
michael@0 217 this._content.setAttribute("src", val);
michael@0 218 ]]></setter>
michael@0 219 </property>
michael@0 220
michael@0 221 <property name="testFileUrl">
michael@0 222 <getter><![CDATA[
michael@0 223 return this.getAttribute("testFileUrl");
michael@0 224 ]]></getter>
michael@0 225 <setter><![CDATA[
michael@0 226 this._content.setAttribute("src", val);
michael@0 227 this.onLoad()
michael@0 228 ]]></setter>
michael@0 229 </property>
michael@0 230
michael@0 231 <method name="stopDownloading">
michael@0 232 <body><![CDATA[
michael@0 233 this._content.stop();
michael@0 234 ]]></body>
michael@0 235 </method>
michael@0 236 </implementation>
michael@0 237 </binding>
michael@0 238
michael@0 239 <binding id="updateheader" extends="chrome://global/content/bindings/wizard.xml#wizard-header">
michael@0 240 <resources>
michael@0 241 <stylesheet src="chrome://global/skin/wizard.css"/>
michael@0 242 </resources>
michael@0 243 <content>
michael@0 244 <xul:hbox class="wizard-header update-header" flex="1">
michael@0 245 <xul:vbox class="wizard-header-box-1">
michael@0 246 <xul:vbox class="wizard-header-box-text">
michael@0 247 <xul:label class="wizard-header-label" xbl:inherits="value=label"/>
michael@0 248 </xul:vbox>
michael@0 249 </xul:vbox>
michael@0 250 </xul:hbox>
michael@0 251 </content>
michael@0 252 </binding>
michael@0 253
michael@0 254 <binding id="update" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
michael@0 255 <content>
michael@0 256 <xul:hbox>
michael@0 257 <xul:label class="update-name" xbl:inherits="value=name" flex="1" crop="right"/>
michael@0 258 <xul:label xbl:inherits="href=detailsURL,hidden=hideDetailsURL" class="text-link"
michael@0 259 value="&update.details.label;"/>
michael@0 260 </xul:hbox>
michael@0 261 <xul:label class="update-type" xbl:inherits="value=type"/>
michael@0 262 <xul:grid>
michael@0 263 <xul:columns>
michael@0 264 <xul:column class="update-label-column"/>
michael@0 265 <xul:column flex="1"/>
michael@0 266 </xul:columns>
michael@0 267 <xul:rows>
michael@0 268 <xul:row>
michael@0 269 <xul:label class="update-installedOn-label">&update.installedOn.label;</xul:label>
michael@0 270 <xul:label class="update-installedOn-value" xbl:inherits="value=installDate" flex="1" crop="right"/>
michael@0 271 </xul:row>
michael@0 272 <xul:row>
michael@0 273 <xul:label class="update-status-label">&update.status.label;</xul:label>
michael@0 274 <xul:description class="update-status-value" flex="1"/>
michael@0 275 </xul:row>
michael@0 276 </xul:rows>
michael@0 277 </xul:grid>
michael@0 278 </content>
michael@0 279 <implementation>
michael@0 280 <property name="name"
michael@0 281 onget="return this.getAttribute('name');"
michael@0 282 onset="this.setAttribute('name', val); return val;"/>
michael@0 283 <property name="detailsURL"
michael@0 284 onget="return this.getAttribute('detailsURL');"
michael@0 285 onset="this.setAttribute('detailsURL', val); return val;"/>
michael@0 286 <property name="installDate"
michael@0 287 onget="return this.getAttribute('installDate');"
michael@0 288 onset="this.setAttribute('installDate', val); return val;"/>
michael@0 289 <property name="type"
michael@0 290 onget="return this.getAttribute('type');"
michael@0 291 onset="this.setAttribute('type', val); return val;"/>
michael@0 292 <property name="hideDetailsURL"
michael@0 293 onget="return this.getAttribute('hideDetailsURL');"
michael@0 294 onset="this.setAttribute('hideDetailsURL', val); return val;"/>
michael@0 295 <property name="status"
michael@0 296 onget="return this.getAttribute('status');">
michael@0 297 <setter><![CDATA[
michael@0 298 this.setAttribute("status", val);
michael@0 299 var field = document.getAnonymousElementByAttribute(this, "class", "update-status-value");
michael@0 300 while (field.hasChildNodes())
michael@0 301 field.removeChild(field.firstChild);
michael@0 302 field.appendChild(document.createTextNode(val));
michael@0 303 return val;
michael@0 304 ]]></setter>
michael@0 305 </property>
michael@0 306 </implementation>
michael@0 307 </binding>
michael@0 308 </bindings>
michael@0 309

mercurial