Subj : Re: [RHINO] Error while executing HTML Included JavaScript : org.mozilla.javascript.EcmaError:"top"
To : Lukas Weberruss
From : Igor Bukanov
Date : Thu Aug 12 2004 06:36 pm
See
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=407115E9.6030206%40fastmail.fm
Regards, Igor
Lukas Weberruss wrote:
> Hi,
>
> I am wrote a programm which analyses websites. I extended the project
> to support javascript as well. For that I included the rhino library.
> My HTML Parser is able to get the javascript code out of the html code
> and can execute that code using rhino. But most javascripts are
> throwing an error each time they use code like:
> --------------------------------------------------------------------------
> if ((top.window.opener == null) ||
> (top.window.opener.closed==true) ||
> (top.window.opener.su == null)){
> top.su = su;
> } else {
> top.window.opener.su = su;
> }
> --------------------------------------------------------------------------
> It seems that the Object "top" is not defined and "top" is something
> like an allways accessable object for IE/NETSCAPE/... but not for
> rhino
>
> Now my question. How can I manage, that all of such scripts are
> working? Yes I now, that setting object like window/top and so on does
> not change anything at my application.
>
> Here is the complete java stacktrace:
> --------------------------------------------------------------------------
> ReferenceError: "top" is not defined. (; line 3)
> at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:2253)
> at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:2243)
> at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1252)
> at org.mozilla.javascript.gen.c122._c0(:3)
> at org.mozilla.javascript.gen.c122.call()
> at org.mozilla.javascript.gen.c122.exec()
> at org.mozilla.javascript.Context.evaluateString(Context.java:1040)
> at tds.csbetrieb.webchecker.JavaScript.execute(JavaScript.java:21)
> at tds.csbetrieb.webchecker.HTMLParser.executeJs(HTMLParser.java:157)
> at tds.csbetrieb.webchecker.HTMLParser.handleEndTag(HTMLParser.java:88)
> at javax.swing.text.html.parser.DocumentParser.handleEndTag(DocumentParser.java:217)
> at javax.swing.text.html.parser.Parser.endTag(Parser.java:398)
> at javax.swing.text.html.parser.Parser.parseTag(Parser.java:1730)
> at javax.swing.text.html.parser.Parser.parseContent(Parser.java:1881)
> at javax.swing.text.html.parser.Parser.parse(Parser.java:2047)
> at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:106)
> at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:78)
> at tds.csbetrieb.webchecker.CheckThread.parseContent(CheckThread.java:138)
> at tds.csbetrieb.webchecker.CheckThread.checkUrl(CheckThread.java:220)
> at tds.csbetrieb.webchecker.CheckThread.access$400(CheckThread.java:13)
> at tds.csbetrieb.webchecker.CheckThread$UrlChecker.run(CheckThread.java:745)
> --------------------------------------------------------------------------
>
> Thanks for help.
>
> Regards
> Lukas Weberruss
.