Bug 117392 - webkit2: plugins on page reload breaks on non-resident modules
Summary: webkit2: plugins on page reload breaks on non-resident modules
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-09 23:57 PDT by Alban Browaeys
Modified: 2015-11-18 05:41 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alban Browaeys 2013-06-09 23:57:38 PDT
Sum up  of the gnome-shell browser plugin bug report : https://bugzilla.gnome.org/show_bug.cgi?id=691686
"I applied this patch to webkit and now the issue is gone:
--------------------------------------------------------------------
diff -uNr webkitgtk-1.11.92/Source/WebKit2/PluginProcess/PluginProcess.cpp
webkitgtk-1.11.92_prahal/Source/WebKit2/PluginProcess/PluginProcess.cpp
--- webkitgtk-1.11.92/Source/WebKit2/PluginProcess/PluginProcess.cpp   
2013-02-12 17:22:50.000000000 +0100
+++ webkitgtk-1.11.92_prahal/Source/WebKit2/PluginProcess/PluginProcess.cpp    
2013-05-29 19:09:23.607126634 +0200
@@ -115,6 +115,9 @@
     }        

     enableTermination();
+
+    if (shared().shouldTerminate())
+        shared().terminate();
 }

 NetscapePluginModule* PluginProcess::netscapePluginModule()
--------------------------------------------------------------------

that is webkit2 does terminate the plugin process only after a timeout (and
start terminating it when the page close). Also the timeout is 600. 
As jasper pointer out on #gnome-shell irc:
"the plugin process should restart when the page loads" .
webkit2 does only if the time between the close and open of the new page is
more than 600 seconds. Which on reload never happens. So I made this patch that
trigger plain terminate on PluginProcess::removeWebProcessConnection and all is
fine)."

This might affect other plugins.
The crash triggers not only on page reload but also if one go to another page and back to a page that uses the gnome-shell browser plugins.
Comment 1 Michael Catanzaro 2015-11-17 15:47:01 PST
I've renamed "resident" to "non-resident" in the bug title; that looks like it was just a think-o.

(In reply to comment #0)
> "the plugin process should restart when the page loads"

Really? Is this behavior documented somewhere?
Comment 2 Michael Catanzaro 2015-11-17 15:48:26 PST
For the folks not following the GNOME bugs, the resolution there was to fix this in the plugin:

Bastien: "That's not a bug in epiphany or WebKit, you need to mark such libraries as resident if you don't want them to be unloaded. That's not WebKit's problem if your code relies on libraries/types that can't be unloaded.

FWIW, Totem's browser plugin has similar code. You can also use -Wl,-z,nodelete to make sure the plugin never gets unloaded."

Carlos: "This is fixed now, using -Wl,-z,nodelete."
Comment 3 Carlos Garcia Campos 2015-11-17 23:06:45 PST
(In reply to comment #1)
> I've renamed "resident" to "non-resident" in the bug title; that looks like
> it was just a think-o.
> 
> (In reply to comment #0)
> > "the plugin process should restart when the page loads"
> 
> Really? Is this behavior documented somewhere?

No, and of course not.
Comment 4 Carlos Garcia Campos 2015-11-17 23:12:03 PST
This is not a problem of WebKit, this is a specific issue with plugins that use GObject with types defined statically (which is the default). We unload the plugin module when no longer needed, and load it again when needed for the same execution of the plugin process. That not only happens when reloading, but just navigating, and for sure we are not going to kill and re-launch the plugin process for every navigation action. A possible workaround in WebKit would be to not unload the module, but we would be fixing an issue that is specific of some plugins. We could detect automatically if the module uses GObject and prevent the module from being unloaded, adding a plugin quirk for example, but I really think this should be fixed in the plugins.