Lines 2965-2983
Link Here
|
2965 |
} |
2965 |
} |
2966 |
|
2966 |
|
2967 |
int DestroyBrowserWindow () { |
2967 |
int DestroyBrowserWindow () { |
2968 |
WindowEvent newEvent = new WindowEvent (browser); |
2968 |
final WindowEvent newEvent = new WindowEvent (browser); |
2969 |
newEvent.display = browser.getDisplay (); |
2969 |
Display display = browser.getDisplay (); |
|
|
2970 |
newEvent.display = display; |
2970 |
newEvent.widget = browser; |
2971 |
newEvent.widget = browser; |
2971 |
for (int i = 0; i < closeWindowListeners.length; i++) { |
|
|
2972 |
closeWindowListeners[i].close (newEvent); |
2973 |
} |
2974 |
/* |
2972 |
/* |
2975 |
* Note on Mozilla. The DestroyBrowserWindow notification cannot be cancelled. |
2973 |
* Bug in mozilla 1.8.x. Under some circumstances the browser being destroyed |
2976 |
* The browser widget cannot be used after this notification has been received. |
2974 |
* is still referenced by mozilla when this callback returns. The workaround |
2977 |
* The application is advised to close the window hosting the browser widget. |
2975 |
* is to delay the destroying of the browser and its window. |
2978 |
* The browser widget must be disposed in all cases. |
2976 |
*/ |
2979 |
*/ |
2977 |
Runnable runnable = new Runnable() { |
2980 |
browser.dispose (); |
2978 |
public void run() { |
|
|
2979 |
if (browser.isDisposed ()) return; |
2980 |
for (int i = 0; i < closeWindowListeners.length; i++) { |
2981 |
closeWindowListeners[i].close (newEvent); |
2982 |
} |
2983 |
/* |
2984 |
* Note on Mozilla. The DestroyBrowserWindow notification cannot be cancelled. |
2985 |
* The browser widget cannot be used after this notification has been received. |
2986 |
* The application is advised to close the window hosting the browser widget. |
2987 |
* The browser widget must be disposed in all cases. |
2988 |
*/ |
2989 |
browser.dispose (); |
2990 |
} |
2991 |
}; |
2992 |
if (IsPre_1_9 && !IsPre_1_8) { /* 1.8.x */ |
2993 |
display.asyncExec (runnable); |
2994 |
} else { |
2995 |
display.syncExec (runnable); |
2996 |
} |
2981 |
return XPCOM.NS_OK; |
2997 |
return XPCOM.NS_OK; |
2982 |
} |
2998 |
} |
2983 |
|
2999 |
|