From: <Gou...@ne...> - 2003-10-07 16:35:28
|
Hi Olivier! I have a problem with the popup too. I'm sure 'parent' and 'opener' are implemented. My problem was that the popup is not in a new TopLevelWindow. To find out if yours too, use the following debug code: if (page.getEnclosingWindow() instanceof com.gargoylesoftware.htmlunit.TopLevelWindow) { log.warn("WINDOW OPENER: " + ((com.gargoylesoftware.htmlunit.TopLevelWindow)(page.getEnclosingWindow())).getOpener()); } else { log.warn("WINDOW: page is not in top level window!!! " + page.getEnclosingWindow()); } This will print some useful information about the windows. In my case page is loaded into the frame that supposed to be the 'opener'. After that I'm geting of course 'The undefined value has no properties' Exception, as long as 'opener' is defined only for TopLevelWindow. I would start searching for a reason for this issue in com.gargoylesoftware.htmlunit.javascript.host.Window.jsFunction_open(...). I'm not sure it is exactly there, but it is a good point to start debugging. Best regards Alexei Goussev "Olivier Fourel" <oli...@ne...> wrote: >Hello, > >I wonder if a popup can execute a javascript function contained in its parent. > >Code called from the pop up window : >parent.opener.addElementToList(value); > > >This code throws the followong exception : > >Exception class=[org.mozilla.javascript.EvaluatorException] >com.gargoylesoftware.htmlunit.ScriptException: The undefined value has no properties. > at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:199) > at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:770) > > >Thanks, > >Olivier > > > __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 |