Bug 18561 - async WebPolicyDelegate do not work
Summary: async WebPolicyDelegate do not work
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-17 16:23 PDT by Eric Seidel (no email)
Modified: 2008-04-17 17:42 PDT (History)
0 users

See Also:


Attachments
test application showing failure (54.19 KB, application/zip)
2008-04-17 16:24 PDT, Eric Seidel (no email)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2008-04-17 16:23:29 PDT
async WebPolicyDelegate do not work

I was trying to make an async WebPolicyDelegate this afternoon.  No such luck.  See attached application.

WebCore definitely seems to assume the WebPolicyDelegate is synchronous:

    m_delegateIsDecidingNavigationPolicy = true;
    m_client->dispatchDecidePolicyForNavigationAction(&FrameLoader::continueAfterNavigationPolicy,
        action, request);
    m_delegateIsDecidingNavigationPolicy = false;

This is directly in conflict with the documentation in WebPolicyDelegate.h:

/*!
    @protocol WebPolicyDecisionListener
    @discussion This protocol is used to call back with the results of a
    policy decision. This provides the ability to make these decisions
    asyncrhonously, which means the decision can be made by prompting
    with a sheet, for example.
*/
Comment 1 Eric Seidel (no email) 2008-04-17 16:24:40 PDT
Created attachment 20654 [details]
test application showing failure
Comment 2 Mark Rowe (bdash) 2008-04-17 17:42:00 PDT
2008-04-17 17:38:39.186 PolicyTest[80860:10b] *** -[WebFramePolicyListener <null selector>]: unrecognized selector sent to instance 0x12f630
2008-04-17 17:38:39.188 PolicyTest[80860:10b] *** -[WebFramePolicyListener <null selector>]: unrecognized selector sent to instance 0x12f630

....

diff -r -u PolicyTest/TestPolicyDelegate.m PolicyTest/TestPolicyDelegate.m
--- PolicyTest/TestPolicyDelegate.m	2008-04-17 16:23:37.000000000 -0700
+++ PolicyTest/TestPolicyDelegate.m	2008-04-17 17:40:39.000000000 -0700
@@ -31,6 +31,7 @@
     NSMethodSignature *signature = [decisionListener methodSignatureForSelector:@selector(use)];
     NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
     [invocation setTarget:listener];
+    [invocation setSelector:@selector(use)];
     [NSTimer scheduledTimerWithTimeInterval:1 invocation:invocation repeats:NO];
 }