~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/build/bloatcycle.html

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<script>
 
2
/* This Source Code Form is subject to the terms of the Mozilla Public
 
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
5
 
 
6
/*
 
7
  From mozilla/toolkit/content
 
8
  These files did not have a license
 
9
*/
 
10
 
 
11
function quitHook()
 
12
{
 
13
  var xhr = new XMLHttpRequest();
 
14
  xhr.open("GET", "http://" + location.host + "/server/shutdown", true);
 
15
  xhr.onreadystatechange = function (event)
 
16
    {
 
17
      if (xhr.readyState == 4)
 
18
        goQuitApplication();
 
19
    };
 
20
  xhr.send(null);
 
21
}
 
22
 
 
23
function canQuitApplication()
 
24
{
 
25
  var os = Components.classes["@mozilla.org/observer-service;1"]
 
26
    .getService(Components.interfaces.nsIObserverService);
 
27
  if (!os) 
 
28
  {
 
29
    return true;
 
30
  }
 
31
  
 
32
  try 
 
33
  {
 
34
    var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
 
35
      .createInstance(Components.interfaces.nsISupportsPRBool);
 
36
    os.notifyObservers(cancelQuit, "quit-application-requested", null);
 
37
    
 
38
    // Something aborted the quit process. 
 
39
    if (cancelQuit.data)
 
40
    {
 
41
      return false;
 
42
    }
 
43
  }
 
44
  catch (ex) 
 
45
  {
 
46
  }
 
47
  os.notifyObservers(null, "quit-application-granted", null);
 
48
  return true;
 
49
}
 
50
 
 
51
function goQuitApplication()
 
52
{
 
53
  const privs = 'UniversalXPConnect';
 
54
 
 
55
  try
 
56
  {
 
57
    netscape.security.PrivilegeManager.enablePrivilege(privs);
 
58
  }
 
59
  catch(ex)
 
60
  {
 
61
    throw('goQuitApplication: privilege failure ' + ex);
 
62
  }
 
63
 
 
64
  if (!canQuitApplication())
 
65
  {
 
66
    return false;
 
67
  }
 
68
 
 
69
  const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
 
70
  const kAppShell   = '@mozilla.org/appshell/appShellService;1';
 
71
  var   appService;
 
72
  var   forceQuit;
 
73
 
 
74
  if (kAppStartup in Components.classes)
 
75
  {
 
76
    appService = Components.classes[kAppStartup].
 
77
      getService(Components.interfaces.nsIAppStartup);
 
78
    forceQuit  = Components.interfaces.nsIAppStartup.eForceQuit;
 
79
 
 
80
  }
 
81
  else if (kAppShell in Components.classes)
 
82
  {
 
83
    appService = Components.classes[kAppShell].
 
84
      getService(Components.interfaces.nsIAppShellService);
 
85
    forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
 
86
  }
 
87
  else
 
88
  {
 
89
    throw 'goQuitApplication: no AppStartup/appShell';
 
90
  }
 
91
 
 
92
  var windowManager = Components.
 
93
    classes['@mozilla.org/appshell/window-mediator;1'].getService();
 
94
 
 
95
  var windowManagerInterface = windowManager.
 
96
    QueryInterface(Components.interfaces.nsIWindowMediator);
 
97
 
 
98
  var enumerator = windowManagerInterface.getEnumerator(null);
 
99
 
 
100
  while (enumerator.hasMoreElements())
 
101
  {
 
102
    var domWindow = enumerator.getNext();
 
103
    if (("tryToClose" in domWindow) && !domWindow.tryToClose())
 
104
    {
 
105
      return false;
 
106
    }
 
107
    domWindow.close();
 
108
  }
 
109
 
 
110
  try
 
111
  {
 
112
    appService.quit(forceQuit);
 
113
  }
 
114
  catch(ex)
 
115
  {
 
116
    throw('goQuitApplication: ' + ex);
 
117
  }
 
118
 
 
119
  return true;
 
120
}
 
121
 
 
122
// bloat test driver for TestGtkEmbed
 
123
//
 
124
// set |user_pref("dom.allow_scripts_to_close_windows", true);| to 
 
125
// allow this to close the window when the loop is done.
 
126
//
 
127
//     "ftp://ftp.mozilla.org",   // not supported for TestGtkEmbed
 
128
//
 
129
 
 
130
var list = 
 
131
    [
 
132
     "sample.html",
 
133
     "forms.html",
 
134
     "grid.html",
 
135
     "forms.html",
 
136
     "elements.html"
 
137
    ];
 
138
var interval = 5000; // 15000
 
139
var idx = 0;
 
140
var w;
 
141
 
 
142
window.onload = function () {
 
143
    w = window.open("about:blank");
 
144
    window.setTimeout(loadURL, interval); 
 
145
};
 
146
function loadURL () {
 
147
    w.location.href = list[idx++];
 
148
    if (idx < list.length) {
 
149
        window.setTimeout(loadURL, interval);
 
150
    } else {
 
151
        if (navigator.platform.indexOf('Mac') != -1) {
 
152
            goQuitApplication();        
 
153
        } else {
 
154
            window.setTimeout("w.close();", interval);
 
155
            window.setTimeout("window.close();", interval*2);
 
156
        }
 
157
    }
 
158
}
 
159
var i;
 
160
 
 
161
for(i=0; i < list.length;i++) {
 
162
    document.write(list[i]);
 
163
    document.write("<br>");
 
164
}
 
165
</script>