Author: Zhengyu Gu
Date: 2/13/2001
1 Project Description |
This project is to ensure the Applet lifecycle fully comply Applet lifecycle specification, shown as figure 1 and 2.
When legacy applet cycle was re-introduced in Merlin, the shutdown sequence did not fully implemented. In other word, applet destroy method has never been called.
The reason for delaying implementing the shutdown sequence is due to the difficulty for Java Plug-in to distinguish the browser page switch and browser shutdown. IE and Netscape do not provide any notification during the browser shutdown.
This project mainly focus on finding a hook to browser shutdown event, so Java Plug-in will have opportunity to clean up, including calling destroy method on all cached applet.
This feature will be available on all platforms and browsers.
N/A
N/A
N/A
N/A
N/A
All legacy lifecycle test cases have to be retested.
N/A
2 Technical Description |
On UNIX/Linux, Java Plug-in is implemented as out-of-process model, and uses named pipe as communication channel between the browser and plug-in. We can take advantage of this feature, by detecting the broken pipe, Java plug-in should be able to perform clean up before exit.
Every Internet Explorer browser instance implements IWebBrowser2 interface, which can be retrieved through IShellWindows interface. So, when Java plug-in sees the first legacy lifecycle applet, it should be able to use IShellWindows interface to walk through all IWebBrowser2 instances, and by comparing process id, plug-in can identify one of its browser instance.
After plugin identifies one of its IWebBrowser2 instance, it registers an implementation of DWebBrowserEvent2 sink to IWebBrowser2's DWebBrowserEvent2 connection point. Then the sink listens to OnQuit event which is fired when the browser window is about to exit. At this moment, plugin re-walk the all IWebBrowser2 instances, find if there is any other browser instance within its process space. If new instance found, registers DWebBrowserEvent2 sink to new found IWebBrowser2 instance, otherwise, it executes Java plugin clean up code.
Netscape 6.x/Mozilla browser provides a publish/subscribe model of evnet mechanism, and exposed it through XPCOM interface nsIObserverService. By implementing a certain event listener, Java plugin can monitor certain events related to browser profile change and component shutdown, to provide Java plugin a chance to invoke shutdown sequence.
The event listener implements nsIObserver interface, and monitor "profile-after-change" and "xpcom-shutdown" events.
Monitoring "profile-after-change" event allows plugin to reset applet cache once browser profile switched.
"xpcom-shutdown" event is a early indicator of application shutdown, at this moment, JVM is still alive if it has been started, so plugin will have chance to invoke shutdown sequence.
However, nsIObserverService and nsIObserver interfaces are not frozen in Netscape 6.21 and before, and frozen on current Mozilla tree, and they are different. To resolve the conflict, we have to rename a set of interfaces and added to our workspace, and branch the code by browser version (Gecko version).
Rename the non-frozen interfaces to nsIObserverService610 and nsIObserver610, and the interfaces will be used by Netscape 6.21 and before.
For the frozen interfaces, copy they to our workspace and can be removed after we update our mozilla headers.
The disadvantage of above architect is it will break some mozilla browser with Gecko version later than Netscape 6.21 and before the interface changes, unless we can identify the exact version mozilla made changes. Since Mozilla browser is not on our support list, it may not be a big problem.
Netscape 4.7x does not expose any meaningful interfaces/APIs for plugin component to monitor browser's behavior, the only way to achieve the goal is to hook on its windowing system and monitor window messages. Since Netscape 4.7x will not have any more new releases, so we can carefully exam all supported Netscape 4.7x to find a common hook.
Fortunately, Netscape 4.7x browser has a hidden window that lasts application life span, by monitoring this window should be enough to determin the browser shutdown event. So:
N/A
N/A
N/A
3 Marketing |
N/A
Oracle
4 Management and Planning |
Hopper
Zhengyu Gu
|
  |   |   |   |   |
Complete | Started | Not Started | Difficulties | Trouble |
Appendices (as needed, suggestions below) |
|
Revision History |
|