Bug 138142 - Unregistering and re-registering a user message handler does not work
Summary: Unregistering and re-registering a user message handler does not work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-28 12:05 PDT by Adrian Perez
Modified: 2015-07-23 00:32 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.18 KB, patch)
2015-07-22 04:18 PDT, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>