Eliminate debug warnings when using WebGadget in Linux
Posted: Sat Apr 06, 2013 5:46 pm
When using the WebGadget in Linux, these annoying debug warnings are always displayed in the error log several times in succession and one of them even in the status line:
In this thread I already posted the following possible solution which disables the embedding of scripts in WebKit thus eliminating the annoying warnings.
Therefore it would be nice to have this or a similar solution been implemented in PureBasic natively.
This simple example code demonstrates it:PB error log wrote:[18:28:05] [WARNING] Zeile: 5
[18:28:05] [WARNING] DEBUG: NP_initialize
[18:28:05] [WARNING] Zeile: 5
[18:28:05] [WARNING] DEBUG: NP_initialize succeeded
[18:28:05] [WARNING] Zeile: 5
Code: Select all
OpenWindow(0, 200, 100, 600, 300, "WebGadget")
WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
#G_TYPE_INT = 6 << 2
ImportC "-lwebkitgtk-1.0"
webkit_web_settings_new()
webkit_web_view_set_settings(*WebkitWebView, *WebkitSettings)
EndImport
Define Value.GValue
OpenWindow(0, 200, 100, 600, 300, "WebGadget")
WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")
; ----- Get current webkit settings
WebkitSettings = webkit_web_settings_new()
; ----- Disable embedding of scripting languages
Value\g_type = #G_TYPE_INT
g_value_set_int_(Value, 0)
g_object_set_property_(WebkitSettings, "enable-scripts", @Value)
; ----- Store changed settings
webkit_web_view_set_settings(GadgetID(0), WebkitSettings)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow