@@ -125,7 +125,7 @@ function onClickHanlder(ev) {
125
125
zipWriter . close ( ) ;
126
126
127
127
AddonManager . getInstallForFile ( oFile , aInstall => {
128
- let done = ( aMsg ) => {
128
+ let done = ( aMsg , aAddon ) => {
129
129
let c = 'check' ;
130
130
if ( typeof aMsg === 'number' ) {
131
131
l . textContent = 'Error ' + aMsg ;
@@ -137,7 +137,36 @@ function onClickHanlder(ev) {
137
137
}
138
138
f . style . animation = null ;
139
139
f . className = f . className . replace ( 'hourglass' , c ) ;
140
- iNotify ( aMsg , ( ) => oFile . remove ( ! 1 ) ) ;
140
+ iNotify ( aMsg , ( ) => {
141
+ oFile . remove ( ! 1 ) ;
142
+
143
+ if ( aAddon && aAddon . pendingOperations ) {
144
+ let m = aAddon . name + ' requires restart.\n\n'
145
+ + 'Would you like to restart '
146
+ + Services . appinfo . name + ' now?' ;
147
+
148
+ m = Services . prompt . confirmEx ( null ,
149
+ addon . name , m , 1027 , 0 , 0 , 0 , null , { } ) ;
150
+
151
+ if ( ! m ) {
152
+ let cancelQuit = Cc [ "@mozilla.org/supports-PRBool;1" ]
153
+ . createInstance ( Ci . nsISupportsPRBool ) ;
154
+
155
+ Services . obs . notifyObservers ( cancelQuit ,
156
+ "quit-application-requested" , null ) ;
157
+
158
+ if ( ! cancelQuit . data ) {
159
+ Services . obs . notifyObservers ( null ,
160
+ "quit-application-granted" , null ) ;
161
+
162
+ Services . startup . quit (
163
+ Ci . nsIAppStartup . eAttemptQuit |
164
+ Ci . nsIAppStartup . eRestart
165
+ ) ;
166
+ }
167
+ }
168
+ }
169
+ } ) ;
141
170
} ;
142
171
143
172
aInstall . addListener ( {
@@ -150,7 +179,7 @@ function onClickHanlder(ev) {
150
179
aInstall . removeListener ( this ) ;
151
180
152
181
done ( aAddon . name + ' ' + aAddon . version
153
- + ' has been installed successfully.' ) ;
182
+ + ' has been installed successfully.' , aAddon ) ;
154
183
}
155
184
} ) ;
156
185
aInstall . install ( ) ;
0 commit comments