3 <!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/update/updates.dtd">
5 <bindings id="updatesBindings"
6 xmlns="http://www.mozilla.org/xbl"
7 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
8 xmlns:xbl="http://www.mozilla.org/xbl">
10 <binding id="license">
12 <xul:vbox flex="1" class="loadingBox">
13 <xul:hbox align="start">
14 <xul:image class="licenseLoadingThrobber" xbl:inherits="state"/>
16 <xul:description flex="1" class="licenseLoadingMessage" crop="right"/>
21 <xul:browser class="licenseContent" type="content" flex="1"/>
23 <xul:stringbundle anonid="strings"
24 src="chrome://mozapps/locale/update/updates.properties"/>
27 <constructor><![CDATA[
28 // just to be safe, turn off js, auth, plugins, and subframes
29 var docShell = this._content.docShell;
30 docShell.allowJavascript = false;
31 docShell.allowAuth = false;
32 docShell.allowPlugins = false;
34 //docShell.allowMetaRedirects = false;
35 docShell.allowSubframes = false;
37 //docShell.allowImages = false;
41 // clean up the listener
42 // but you may not have one if you never showed the page with
43 // a <license> element
44 if (this._licenseProgressListener)
45 this._content.webProgress
46 .removeProgressListener(this._licenseProgressListener);
49 <field name="_message">
50 document.getAnonymousElementByAttribute(this, "class", "licenseLoadingMessage");
52 <field name="_content">
53 document.getAnonymousElementByAttribute(this, "class", "licenseContent");
55 <field name="_strings">
56 document.getAnonymousElementByAttribute(this, "anonid", "strings");
59 <field name="update_name">null</field>
60 <field name="update_version">null</field>
61 <field name="_licenseProgressListener">null</field>
63 <method name="_setMessageValue">
64 <parameter name="value"/>
66 while (this._message.hasChildNodes())
67 this._message.removeChild(this._message.firstChild);
68 this._message.appendChild(document.createTextNode(value));
72 <method name="onError">
74 this.setAttribute("selectedIndex", "0");
76 var errorPropertyName = this.getAttribute("id") + "NotFound";
77 var statusText = this._strings.getFormattedString(errorPropertyName,
79 this._setMessageValue(statusText);
80 this.setAttribute("state", "error");
84 <method name="onLoad">
86 this.setAttribute("selectedIndex", "1");
88 var e = document.createEvent("Events");
89 e.initEvent("load", false, true);
90 this.dispatchEvent(e);
94 <method name="onStart">
96 this.setAttribute("selectedIndex", "0");
98 this.setAttribute("state", "loading");
99 var loadingPropertyName = this.getAttribute("id") + "Downloading";
100 this._setMessageValue(this._strings.getFormattedString(
101 loadingPropertyName, [this.update_name, this.update_version]));
105 <property name="url">
107 return this.getAttribute("url");
112 this._licenseProgressListener = {
113 QueryInterface: function(aIID)
115 if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
116 aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
117 aIID.equals(Components.interfaces.nsISupports))
119 throw Components.results.NS_NOINTERFACE;
121 onLocationChange: function() {},
122 onProgressChange: function() {},
123 onStatusChange: function() {},
124 onSecurityChange: function() {},
125 onStateChange: function(aWebProgress, aRequest,
126 aStateFlags, aStatus)
131 const nsIWebProgressListener =
132 Components.interfaces.nsIWebProgressListener;
134 if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)
136 if (aStateFlags & nsIWebProgressListener.STATE_START)
138 else if (aStateFlags & nsIWebProgressListener.STATE_STOP)
140 const nsIHttpChannel = Components.interfaces.nsIHttpChannel;
142 var channel = aRequest.QueryInterface(nsIHttpChannel);
143 if (channel.requestSucceeded)
145 // if we get here, the load was OK, report success
152 // the channel.requestSucceeded can throw
153 // NS_ERROR_NOT_AVAILABLE if you can't reach the server
154 // so we treat that as an error
157 // everything else (like a 404) is an error
164 this._content.webProgress
165 .addProgressListener(this._licenseProgressListener,
166 Components.interfaces.nsIWebProgress.NOTIFY_ALL);
168 // load the url now that the listener is registered
169 this._content.setAttribute("src", val);
173 <method name="stopDownloading">
175 this._content.stop();
181 <binding id="update" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
184 <xul:label class="update-name" xbl:inherits="value=name" flex="1" crop="right"/>
185 <xul:label xbl:inherits="href=detailsURL" class="text-link"
186 value="&update.details.label;"/>
188 <xul:label class="update-type" xbl:inherits="value=type"/>
191 <xul:column class="update-label-column"/>
192 <xul:column flex="1"/>
196 <xul:label class="update-installedOn-label">&update.installedOn.label;</xul:label>
197 <xul:label class="update-installedOn-value" xbl:inherits="value=installDate" flex="1" crop="right"/>
200 <xul:label class="update-status-label">&update.status.label;</xul:label>
201 <xul:description class="update-status-value" flex="1"/>
207 <property name="name"
208 onget="return this.getAttribute('name');"
209 onset="this.setAttribute('name', val); return val;"/>
210 <property name="detailsURL"
211 onget="return this.getAttribute('detailsURL');"
212 onset="this.setAttribute('detailsURL', val); return val;"/>
213 <property name="installDate"
214 onget="return this.getAttribute('installDate');"
215 onset="this.setAttribute('installDate', val); return val;"/>
216 <property name="type"
217 onget="return this.getAttribute('type');"
218 onset="this.setAttribute('type', val); return val;"/>
219 <property name="status"
220 onget="return this.getAttribute('status');">
222 this.setAttribute("status", val);
223 var field = document.getAnonymousElementByAttribute(this, "class", "update-status-value");
224 while (field.hasChildNodes())
225 field.removeChild(field.firstChild);
226 field.appendChild(document.createTextNode(val));