@@ -15,6 +15,7 @@ Cu.import("resource://gre/modules/NetUtil.jsm");
15
15
Cu . import ( "resource://gre/modules/Services.jsm" ) ;
16
16
Cu . import ( "resource://gre/modules/FileUtils.jsm" ) ;
17
17
Cu . import ( "resource://gre/modules/AddonManager.jsm" ) ;
18
+ Cu . import ( "resource://gre/modules/XPCOMUtils.jsm" ) ;
18
19
19
20
function LOG ( m ) ( m = addon . name + ' Message @ '
20
21
+ ( new Date ( ) ) . toISOString ( ) + "\n> " + m ,
@@ -39,10 +40,23 @@ let i$ = {
39
40
let showAlertNotification = Cc [ "@mozilla.org/alerts-service;1" ] . getService ( Ci . nsIAlertsService ) ;
40
41
showAlertNotification = showAlertNotification . showAlertNotification . bind ( showAlertNotification ) ;
41
42
42
- function iNotify ( aMsg , callback ) {
43
+ function iNotify ( aAddon , aMsg , callback ) {
43
44
let nme = addon . branch . getIntPref ( 'nme' ) ;
44
45
45
- if ( nme == 2 ) {
46
+ if ( nme > 1 ) {
47
+ if ( nme == 3 ) try {
48
+ if ( aAddon ) {
49
+ let info = {
50
+ installs : [ { addon :aAddon , name :aAddon . name + ' ' + aAddon . version } ] ,
51
+ originatingWindow : Services . wm . getMostRecentWindow ( 'navigator:browser' ) . gBrowser . contentWindow ,
52
+ QueryInterface : XPCOMUtils . generateQI ( [ Ci . amIWebInstallInfo ] )
53
+ } ;
54
+ Services . obs . notifyObservers ( info , 'addon-install-complete' , null ) ;
55
+ return callback ( null ) ;
56
+ }
57
+ } catch ( e ) {
58
+ Cu . reportError ( e ) ;
59
+ }
46
60
showAlertNotification ( addon . icon , addon . name , aMsg , ! 1 , "" ,
47
61
( s , t ) => t == "alertshow" || callback ( t ) ) ;
48
62
} else {
@@ -136,10 +150,10 @@ function onClickHanlder(ev) {
136
150
}
137
151
f . style . animation = null ;
138
152
f . className = f . className . replace ( 'hourglass' , c ) ;
139
- iNotify ( aMsg , ( ) => {
153
+ iNotify ( aAddon , aMsg , aResult => {
140
154
oFile . remove ( ! 1 ) ;
141
155
142
- if ( aAddon && aAddon . pendingOperations ) {
156
+ if ( aResult !== null && aAddon && aAddon . pendingOperations ) {
143
157
let m = aAddon . name + ' requires restart.\n\n'
144
158
+ 'Would you like to restart '
145
159
+ Services . appinfo . name + ' now?' ;
0 commit comments