Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 510972

Summary: [Gtk3][Webkit2] Port webkit_window_object_cleared to webkit2.
Product: [Eclipse Project] Platform Reporter: Leo Ufimtsev <lufimtse>
Component: SWTAssignee: Leo Ufimtsev <lufimtse>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P2    
Version: 4.7   
Target Milestone: 4.6 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 441568    

Description Leo Ufimtsev CLA 2017-01-24 11:23:55 EST
I observed Webkit:webkit_window_object_cleared(..) is never called on webkit2.

If I set a breakpoint in the first line of that method and debug-run this test case:
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.test_listener_changedLorg_eclipse_swt_browser_TitleEvent()

On webkit1, the breakpoint is triggered. On webkit2 it is not triggered.

It follows that page changes might not function properly on webkit2. Related jUnits pass, but it seems that those jUnits only test registering the change listener, they don't seem to actually test if it works.


I observed that it's connected with "window-object-cleared" signal.
Further, I observed that the signature is different on webkit1 and on webkit2. (5 vs 4 fields).

* Webkit1: (5 fields)
void user_function (WebKitWebView  *web_view,
               WebKitWebFrame *frame,
               gpointer        context,
               gpointer        window_object,
               gpointer        user_data)
https://webkitgtk.org/reference/webkitgtk/unstable/webkitgtk-webkitwebview.html#WebKitWebView-window-object-cleared

* Webkit2: (4 fields)
void user_function (WebKitScriptWorld *world,
               WebKitWebPage     *page,
               WebKitFrame       *frame,
               gpointer           user_data)
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitScriptWorld.html#WebKitScriptWorld-window-object-cleared

The different method signature might be the reason the callback isn't working properly.

This requires further investigation.
Comment 1 Leo Ufimtsev CLA 2017-01-30 12:23:40 EST
Hmmm, because of this Browser functions are not re-registered when a new page is loaded on webkit2.

Working on fix.
Comment 2 Leo Ufimtsev CLA 2017-01-30 16:00:39 EST
After some research, webkit_window_object_cleared signal was moved into a web-extension on webkit2.
Using a webextension for this is a bit of a pain.
It seems on webkit2 there is a new signal for this purpose: load_changed.
This has already been added to the webkit2 port.

I used the new webkit2 callback to re-register functions. I added the code to the main commit:
https://git.eclipse.org/r/#/c/89469

This resolves this bug.