[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: JS Breakage (was Re: Auto-proxy problem)
From:       Malte.Starostik () t-online ! de (Malte Starostik)
Date:       2001-05-29 11:54:26
[Download RAW message or body]

On Dienstag, 29. Mai 2001 13:21, Harri Porten wrote:
> On Tue, 29 May 2001, Malte Starostik wrote:
> > There is indeed no other error message about why calling
> > FindProxyForURL() fails. Something must have changed in KJS that makes
> > this break now. After a kdelibs update I can reproduce the problem now.
> > Harri, any idea?
>
> I have changed the way the "window" object is implemented in khtml. That
> might inadvertently have affected the proxy code. Sorry. See
> kjs_proxy.cpp.
>
> I haven't used this feature myself so I can just comment from looking at
> the code but I'll try it out if necessary.
>
> My first guess would be to change
>
>             m_kjs = new KJScript();
>             Global global(Global::current());
>             KJSO bindings(new KProxyBindings);
>             global.put("ProxyConfig", bindings);
>             global.setPrototype(bindings);
>
> to
>
>             m_kjs = new KJScript();
>             m_kjs->globalObject()->setPrototype(new KProxyBindings);
>
> and have a property named "ProxyConfig" in KProxyBindings that returns
> Global::current(). But I can't guarantee that it will really do the job.
Sorry, that doesn't do it. The error message is
JS: Reference error. Can't find variable: FindProxyForURL
which happens when I do

QString code = QString("return FindProxyForURL('%1', '%2');").arg(url.url())  
  if (!m_kjs->evaluate(code.local8Bit()))

although the previous initialization succeeded:

m_kjs->evaluate(m_downloader->data())

with m_downloader containing the script. I tried with something simple to 
avoid any errors about not finding the functions defined by KProxyBindings:

function FindProxyForURL(url, host)
{
        return "PROXY www-proxy.t-online.de:80";
}

I remember last time it didn't work, I had to change
"FindProxyForURL('%1', '%2');" to "return FindProxyForURL('%1', '%2');", 
maybe now the complete function gets lost? Sorry, I don't know about KJS 
internals, mainly used khtml/ecma as a starting point. Do I need to tell it 
explicitly not to clean up something here?
Thanks again,
-Malte
-- 
Wars don't determine who's right, only who's left.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic