File: updates.xml

package info (click to toggle)
iceweasel 2.0.0.19-0etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 298,784 kB
  • ctags: 317,912
  • sloc: cpp: 1,796,902; ansic: 987,677; xml: 109,036; makefile: 47,777; asm: 35,201; perl: 26,983; sh: 20,879; cs: 6,232; java: 5,513; python: 3,249; pascal: 459; lex: 306; php: 244; csh: 132; objc: 97; yacc: 79; ada: 49; awk: 14; sql: 4; sed: 4
file content (394 lines) | stat: -rw-r--r-- 15,422 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
<?xml version="1.0"?>

<!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/update/updates.dtd">

<bindings id="updatesBindings"
          xmlns="http://www.mozilla.org/xbl"
          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
          xmlns:xbl="http://www.mozilla.org/xbl">

  <binding id="update" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
    <resources>
      <stylesheet src="chrome://mozapps/content/update/updates.css"/>
    </resources>
    <content>
      <xul:hbox pack="start">
        <xul:label anonid="name" class="update-item-name" xbl:inherits="value=name" crop="right" flex="1"/>
        <xul:link class="update-item-details" xbl:inherits="href=detailsURL">&details.link;</xul:link>
      </xul:hbox>
      <xul:deck anonid="modeDeck">
        <xul:label class="update-item-status" xbl:inherits="value=status" flex="1"/>
        <xul:vbox>
          <xul:progressmeter class="update-item-progress" anonid="progress"
                             mode="undetermined"/>
          <xul:hbox align="center">
            <xul:label class="update-item-status" xbl:inherits="value=status" flex="1" crop="right"/>
            <xul:button class="update-item-pause" anonid="pauseButton"
                        label="&pause.label;" accesskey="&pause.accesskey;"/>
          </xul:hbox>
        </xul:vbox>
      </xul:deck>
      <xul:stringbundle anonid="strings" 
                        src="chrome://mozapps/locale/update/updates.properties"/>
    </content>
    <implementation>
      <field name="_update">null</field>
      <field name="_strings">
        document.getAnonymousElementByAttribute(this, "anonid", "strings");
      </field>
      <field name="_name">
        document.getAnonymousElementByAttribute(this, "anonid", "name");
      </field>
      <field name="_progressBar">
        document.getAnonymousElementByAttribute(this, "anonid", "progress");
      </field>
      <field name="_modeDeck">
        document.getAnonymousElementByAttribute(this, "anonid", "modeDeck");
      </field>
      <field name="_pauseButton">
        document.getAnonymousElementByAttribute(this, "anonid", "pauseButton");
      </field>
      <method name="setUpdate">
        <parameter name="update"/>
        <body><![CDATA[
          this._update = update;
          
          this.name = update.name;
          this.setAttribute("detailsURL", update.detailsURL);
          this.state = update.selectedPatch.state;
        ]]></body>
      </method>
      
      <property name="name"
                onget="return this._name.getAttribute('value');"
                onset="this._name.setAttribute('value', val); return val;"/>

      <property name="progress"
                onget="return parseInt(this._progressBar.getAttribute('value'));"
                onset="this._progressBar.setAttribute('value', val); return val;"/>
      
      <property name="status"
                onget="return this.getAttribute('status');"
                onset="this.setAttribute('status', val); return val;"/>

      <field name="_started">false</field>
      <method name="startDownload">
        <body><![CDATA[
          if (!this._started) {
            this._progressBar.setAttribute("mode", "normal");
            this._pauseButton.disabled = false;
            this._started = true;
          }
        ]]></body>
      </method>
      
      <method name="stopDownload">
        <body><![CDATA[
          if (this._started) {
            this._progressBar.setAttribute("mode", "undetermined");
            this._pauseButton.disabled = true;
            this._started = false;
          }
        ]]></body>
      </method>
      
      <field name="_paused">false</field>
      <property name="paused">
        <getter><![CDATA[
          return this._paused;
        ]]></getter>
        <setter><![CDATA[
          this._paused = val;
          var key = val ? "pauseButtonResume" : "pauseButtonPause";
          if (val) {
            this.setAttribute("old-status", this.status);
            //this.status = this._strings.getString("pausedStatus");
            this.setAttribute("old-name", this.name);
            this.name = this._strings.getFormattedString("pausedName", [this.name]);
            LOG("GOAT = " + this._strings.getFormattedString("pausedName", [this.name]));
          }
          else {
            this.status = this.getAttribute("old-status");
            this.removeAttribute("old-status");
            this.setAttribute("name", this.getAttribute("old-name"));
            this.removeAttribute("old-name");
          }
          this._pauseButton.label = this._strings.getString(key);
          return val;
        ]]></setter>
      </property>
      
      <property name="state">
        <getter><![CDATA[
          return this.getAttribute("state");
        ]]></getter>
        <setter><![CDATA[
          this.setAttribute("state", val);
          this._modeDeck.setAttribute("selectedIndex", val == "downloading" ? 1 : 0);
          var name = this._update.name;
          if (val == "downloading") {
            var name = this._strings.getFormattedString("downloadingPrefix", 
                                                        [this._update.name]);
          }
          this.setAttribute("name", name);

          if (val == "failed") {
            var failed = this._strings.getString("statusFailed");
            this.setAttribute("status", failed);
          }
          else if (val != "downloading") {
            var sdf = 
                Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
                getService(Components.interfaces.nsIScriptableDateFormat);
            var installDate = new Date(this._update.installDate);
            var dateString = sdf.FormatDateTime("", sdf.dateFormatLong, 
                                                sdf.timeFormatSeconds,
                                                date.getFullYear(),
                                                date.getMonth() + 1,
                                                date.getDate(),
                                                date.getHours(),
                                                date.getMinutes(),
                                                date.getSeconds());
            dateString = this._strings.getFormattedString("statusSucceededFormat",
                                                          [dateString]);
            this.setAttribute("status", dateString);
          }
          return val;
        ]]></setter>
      </property>
      <field name="eventPrefix">"update-"</field>
    </implementation>
    <handlers>
      <handler event="command"><![CDATA[
        if (event.originalTarget.getAttribute("anonid") == "pauseButton")
          this.fireEvent("pause");
      ]]></handler>
    </handlers>
  </binding>
  
  <binding id="license">
    <content>
      <xul:vbox flex="1" class="loadingBox">
        <xul:hbox align="start">
          <xul:image class="licenseLoadingThrobber" xbl:inherits="state"/>
          <xul:vbox flex="1">
            <xul:description flex="1" class="licenseLoadingMessage" crop="right"/>
          </xul:vbox>
        </xul:hbox>
      </xul:vbox>
      <xul:vbox flex="1">
        <xul:browser class="licenseContent" type="content" flex="1"/>
      </xul:vbox>
      <xul:stringbundle anonid="strings" 
                        src="chrome://mozapps/locale/update/updates.properties"/>
    </content>
    <implementation>
      <constructor><![CDATA[
        // just to be safe, turn off js, auth, plugins, and subframes
        var docShell = this._content.docShell;
        docShell.allowJavascript = false;
        docShell.allowAuth = false;
        docShell.allowPlugins = false;
        //allow redirects
        //docShell.allowMetaRedirects = false;
        docShell.allowSubframes = false;
        //allow images
        //docShell.allowImages = false;
      ]]></constructor>

      <destructor><![CDATA[
        // clean up the listener
        // but you may not have one if you never showed the page with
        // a <license> element
        if (this._licenseProgressListener) 
          this._content.webProgress
              .removeProgressListener(this._licenseProgressListener);
      ]]></destructor>

      <field name="_message">
        document.getAnonymousElementByAttribute(this, "class", "licenseLoadingMessage");
      </field>
      <field name="_content">
        document.getAnonymousElementByAttribute(this, "class", "licenseContent");
      </field>
      <field name="_strings">
        document.getAnonymousElementByAttribute(this, "anonid", "strings");
      </field>
      
      <field name="update_name">null</field>
      <field name="update_version">null</field>
      <field name="_licenseProgressListener">null</field>

      <method name="_setMessageValue">
        <parameter name="value"/>
        <body><![CDATA[
          while (this._message.hasChildNodes())
            this._message.removeChild(this._message.firstChild);
          this._message.appendChild(document.createTextNode(value));
        ]]></body>
      </method>

      <method name="onError">
        <body><![CDATA[
          this.setAttribute("selectedIndex", "0");

          var errorPropertyName = this.getAttribute("id") + "NotFound";
          var statusText = this._strings.getFormattedString(errorPropertyName, 
                                                            [this.update_name]);
          this._setMessageValue(statusText);
          this.setAttribute("state", "error");
        ]]></body>
      </method>

      <method name="onLoad">
        <body><![CDATA[
          this.setAttribute("selectedIndex", "1");

          var e = document.createEvent("Events");
          e.initEvent("load", false, true);
          this.dispatchEvent(e);
        ]]></body>
      </method>

      <method name="onStart">
        <body><![CDATA[
          this.setAttribute("selectedIndex", "0");

          this.setAttribute("state", "loading");
          var loadingPropertyName = this.getAttribute("id") + "Downloading";
          this._setMessageValue(this._strings.getFormattedString(
            loadingPropertyName, [this.update_name, this.update_version]));
        ]]></body>
      </method>

      <property name="url">
        <getter><![CDATA[
          return this.getAttribute("url");
        ]]></getter>
        <setter><![CDATA[
          var self = this;

          this._licenseProgressListener = {
            QueryInterface: function(aIID) 
            {
              if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
                  aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
                  aIID.equals(Components.interfaces.nsISupports))
                return this;
              throw Components.results.NS_NOINTERFACE;
            },
            onLocationChange: function() {},
            onProgressChange: function() {},
            onStatusChange:   function() {},
            onSecurityChange: function() {},
            onStateChange:    function(aWebProgress, aRequest, 
                                       aStateFlags, aStatus) 
            {
              if (!aRequest)
                return;

              const nsIWebProgressListener = 
                Components.interfaces.nsIWebProgressListener;
 
              if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) 
              {
                if (aStateFlags & nsIWebProgressListener.STATE_START) 
                  self.onStart();
                else if (aStateFlags & nsIWebProgressListener.STATE_STOP)
                {
                  const nsIHttpChannel = Components.interfaces.nsIHttpChannel;
                  try {
                    var channel = aRequest.QueryInterface(nsIHttpChannel);
                    if (channel.requestSucceeded) 
                    {
                      // if we get here, the load was OK, report success
                      self.onLoad();
                      return;
                    }
                  }
                  catch (ex) 
                  { 
                    // the channel.requestSucceeded can throw 
                    // NS_ERROR_NOT_AVAILABLE if you can't reach the server
                    // so we treat that as an error
                  }

                  // everything else (like a 404) is an error
                  self.onError();
                }
              }
            }
          }

          this._content.webProgress
              .addProgressListener(this._licenseProgressListener,
               Components.interfaces.nsIWebProgress.NOTIFY_ALL);

          // load the url now that the listener is registered
          this._content.setAttribute("src", val);
        ]]></setter>
      </property>
      
      <method name="stopDownloading">
        <body><![CDATA[
          this._content.stop();
        ]]></body>
      </method>
    </implementation>
  </binding>
  
  <binding id="update" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
    <content>
      <xul:hbox>
        <xul:label class="update-name" xbl:inherits="value=name" flex="1" crop="right"/>
        <xul:link xbl:inherits="href=detailsURL" class="update-details-link">
          <xul:label>&update.details.label;</xul:label>
        </xul:link>
      </xul:hbox>
      <xul:label class="update-type" xbl:inherits="value=type"/>
      <xul:grid>
        <xul:columns>
          <xul:column class="update-label-column"/>
          <xul:column flex="1"/>
        </xul:columns>
        <xul:rows>
          <xul:row>
            <xul:label class="update-installedOn-label">&update.installedOn.label;</xul:label>
            <xul:label class="update-installedOn-value" xbl:inherits="value=installDate" flex="1" crop="right"/>
          </xul:row>
          <xul:row>
            <xul:label class="update-status-label">&update.status.label;</xul:label>
            <xul:description class="update-status-value" flex="1"/>
          </xul:row>
        </xul:rows>
      </xul:grid>
    </content>
    <implementation>
      <property name="name"
                onget="return this.getAttribute('name');"
                onset="this.setAttribute('name', val); return val;"/>
      <property name="detailsURL"
                onget="return this.getAttribute('detailsURL');"
                onset="this.setAttribute('detailsURL', val); return val;"/>
      <property name="installDate"
                onget="return this.getAttribute('installDate');"
                onset="this.setAttribute('installDate', val); return val;"/>
      <property name="type"
                onget="return this.getAttribute('type');"
                onset="this.setAttribute('type', val); return val;"/>
      <property name="status"
                onget="return this.getAttribute('status');">
        <setter><![CDATA[
          this.setAttribute("status", val);
          var field = document.getAnonymousElementByAttribute(this, "class", "update-status-value");
          while (field.hasChildNodes())
            field.removeChild(field.firstChild);
          field.appendChild(document.createTextNode(val));
          return val;
        ]]></setter>
      </property>
                onset="this.setAttribute('status', val); return val;"/>
    </implementation>
  </binding>
</bindings>