Bug 138142

Summary: Unregistering and re-registering a user message handler does not work
Product: WebKit Reporter: Adrian Perez <aperez>
Component: WebCore JavaScriptAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, jberlin, mcatanzaro
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch mrobinson: review+

Description Adrian Perez 2014-10-28 12:05:16 PDT
User script messages sent with “window.webkit.messageHandlers.<name>.postMessage()”
will not work (i.e. “WebScriptMessageHandler::Client::didPostMessage()” is not called)
after performing the following sequence of operations:

 1. Register a handler with “WebUserContentControllerProxy::addUserScriptMessageHandler()”
 2. Unregister the handler with “WebUserContentControllerProxy::removeUserMessageHandlerForName()”
 3. Register again a handler with the same name as in step (1) using
    “WebUserContentControllerProxy::addUserScriptMessageHandler()”

This probably means that either removing the handler does not do all the cleanup it
should and the logic for installing a handler fails when trying to add one with a
name used previously.

I have found this issue while writing the unit tests for the API of the GTK+
port, being worked in bug #133730
Comment 1 Carlos Garcia Campos 2015-07-22 04:15:45 PDT
This has probably been fixed in r184846, the #ifdefed test cases passes now in current trunk
Comment 2 Carlos Garcia Campos 2015-07-22 04:18:23 PDT
Created attachment 257258 [details]
Patch
Comment 3 Carlos Garcia Campos 2015-07-23 00:32:41 PDT
Committed r187218: <http://trac.webkit.org/changeset/187218>