[ phpeclipse-Bugs-1365431 ] PHP Editor crashes Windows with JavaScript 'windows.close()'

"SourceForge.net" <[email protected]> Sat, 24 Mar 2007 19:19:59 -0700
Newsgroups gmane.comp.ide.eclipse.phpeclipse.devel
Message-ID <[email protected]>
Bugs item #1365431, was opened at 2005-11-24 19:14
Message generated for change (Comment added) made by toshihiro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=484801&aid=1365431&group_id=57621

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PHP Editor
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Damien Tomezzoli (dtomfr)
Assigned to: Nobody/Anonymous (nobody)
Summary: PHP Editor crashes Windows with JavaScript 'windows.close()'

Initial Comment:
PhpEclipse 1.1.8 Eclipse Plugin
Eclipse 3.1.0
Windows XP SP2 (French)
MSIE 6.0.2900.xpsp_sp2_gdr.050301-1519

When the 'popuptest.php' file is open with PHPEditor,
The PHP Browser show a JavaScript message with 
following message: "La page Web enb cours tente de 
fermer la fenĂȘtre en cours".
This JavaScript message can't be closed.
System RAM increase, until Windows crashes.

- File 'popup.js':
function closePopupAndRefresh() {
   if (self.opener){
      self.opener.location.reload();
   }
   window.close();
}

- File 'popuptest.php':
<script type="text/javascript" 
src="popup.js"></script> 
<script>
closePopupAndRefresh();
</script>


----------------------------------------------------------------------

Comment By: Toshihiro (toshihiro)
Date: 2007-03-25 11:19

Message:
Logged In: YES 
user_id=1527096
Originator: NO

This is minimum modification to prevent disaster.

1) avoid NPE in WebBrowser.
2) add 'close view' behaviour to BrowserView.

net.sourceforge.phpeclipse.webbrowser.internal
WebBrowser.java

  protected void addBrowserListeners() {

(snip)

    browser.addCloseWindowListener(new CloseWindowListener() {
      public void close(WindowEvent event) {
        // if shell is not null, it must be a secondary popup window, else
its an editor window
        if (shell != null)
          shell.dispose();
        else
          //editor.closeEditor(); this causes NPE
          if (editor != null) editor.closeEditor();
      }
    });

net.sourceforge.phpeclipse.webbrowser.views
BrowserView.java

    public void createPartControl(Composite frame) {
        try {
            if (WebBrowserUtil.isInternalBrowserOperational()) {
                fInstance = new WebBrowser(frame, true, true);
                //XXX:begin
                fInstance.getBrowser().addCloseWindowListener(new
CloseWindowListener() {
                    public void close(WindowEvent event) {
                       
getViewSite().getPage().hideView(BrowserView.this);
                    }
                });
                //XXX:end
            }
        } catch (Exception e) {
            fInstance = null;
        }
    }


----------------------------------------------------------------------

Comment By: mauromol (mauromol)
Date: 2006-05-01 19:38

Message:
Logged In: YES 
user_id=1471819

I also have this problem. Moreover, you can't close the
confirmation request by PHP Browser, because it's a modal
dialog relative to some invisible Window, so you can't give
it focus, while Eclipse window is on the back and it is not
accessible. You must terminate Eclipse with Task Manager.

Whe workaround is to disable both options in PHPEclipse
preferences (under "Browser Preview Defaults"), while taking
care not to manually open PHP Browser on such a page.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=484801&aid=1365431&group_id=57621

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Phpeclipse-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpeclipse-devel