Bug or not? WebViewProxy() must be called in the same procedure to work

Mac OSX specific forum
User avatar
Kukulkan
Addict
Addict
Posts: 1422
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Bug or not? WebViewProxy() must be called in the same procedure to work

Post by Kukulkan »

It took me a while to find out, why my application is not working with a proxy. I finally found, that WebViewProxy() must be called in the same procedure than the webview is created. Otherwise, it will not work.

If this is a bug => needs to be fixed

If this is a feature => needs to be in documentation to avoid confusion

Working:

Code: Select all

OpenWindow(0, 100, 100, 700, 500, "Hello", #PB_Window_SystemMenu | #PB_Window_Invisible)

WebViewProxy("http://proxy.mycompany.com", 3128)

WebViewGadget(0, 0, 0, 700, 500)
SetGadgetText(0, "https://www.google.com")

; Show the window once the webview has been fully loaded
HideWindow(0, #False)

Repeat 
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Not working:

Code: Select all

Procedure setProxy()
  WebViewProxy("http://proxy.mycompany.com", 3128)
EndProcedure

OpenWindow(0, 100, 100, 700, 500, "Hello", #PB_Window_SystemMenu | #PB_Window_Invisible)

WebViewGadget(0, 0, 0, 700, 500)
SetGadgetText(0, "https://www.google.com")

; Show the window once the webview has been fully loaded
HideWindow(0, #False)

Repeat 
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
I tested this behavior with PB 6.21 on Windows (x86-32) and MacOS (arm64).

Test hint: Add

Code: Select all

127.0.0.1                www.google.com
to your hosts file in order to validate if the proxy is used or not.
Fred
Administrator
Administrator
Posts: 18549
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Bug or not? WebViewProxy() must be called in the same procedure to work

Post by Fred »

TBH, I didn't expected that, but looking at the code I can't see something relevant to procedure scope here. The fact it happens on OSX and Windows is wierd as the codebase is completely different..
Post Reply