[Webkit-unassigned] [Bug 41651] New: [ Webkit 2 / 6533.16, r62241 ] Webkit plugin embedded into an IFRAME crashes when calling callWebScriptMethod or get nil arguments

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 5 22:56:26 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=41651

           Summary: [ Webkit 2 / 6533.16, r62241 ] Webkit plugin embedded
                    into an IFRAME crashes when calling
                    callWebScriptMethod or get nil arguments
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.6
            Status: UNCONFIRMED
          Severity: Blocker
          Priority: P3
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: philippe.verney at ives.fr


Hello ,

We are developping a Web plugin (using the Webkit API, not the NPAPI) and noticed a major regression related to scriptable plugin in Safari 5 and we have reproduced the issue on the latest Webkit version:

Case 0 : If the plugin is embedded in a simple HTML page, it works perfectly.

Case 1 : If the plugin, is embedded INSIDE and IFRAME, the method gets called correctly from Javascript but when the plugin tries to call a JS function using callWebScriptMethod, then the whole Webket crashes (see report at the end of the mail). This happends everytime.

Case 2 : If my plugin embedded inside an IFRAME which is itself included inside another IFRAME, the plugin gets 'nil' arguments when one of its methods is called by JS.

This happends on OS 10.6 with Webkit 2 / 6533.16, r62241, running in 32 bits compatibility mode as well as with Safari 5.

The same plugin and same HTML pages work fine when running under Mac OS 10.5 with Safari 4.0.4.

Is it a webkit bug? We need to release our Web plugin but this is blocking and for obvious reasons we are unable to modify the page  structures of existing Web sites that are using our plugin to remove all the IFRAMES. How can we correct this?

Philippe VERNEY

---
Here is the code I use to obtain the scripting object :

- (void) initView
{
    if( viewPanel != nil )
    {
        [self setFrame:[viewPanel frame]]; /* adjust the frame from your nib's view to the plug-in's view */
        [self addSubview:viewPanel]; /* add the view from the nib as our one and only sub-view */
    }

    pluginContainer = [pluginArguments objectForKey:WebPlugInContainerKey];
    WebFrame * containerFr = [pluginContainer webFrame];
    m_myWebView = [ containerFr webView ];
    WebFrame * main = [ m_myWebView mainFrame ];
    // Find Iframe of plugin
    // The callback are in the same Iframe of plugin
    if ( main != nil )
    {
        m_mainFrameView = [ main webView ];
    }
    else
    {
        PLG_TRACE(LOG_NOTICE, "No main frame found. Assuming that we are in the main frame.");
        m_mainFrameView = m_myWebView;
    }

    NSString* name = [containerFr name];       
    @try
    {
        if ( name != nil && [name length] > 0)
        {
            PLG_TRACE(LOG_DEBUG,"ScriptableObject : Plugin on IFRAME %s",ID_2_CHAR(name));
            NSMutableArray * chaineFrames = [ NSMutableArray arrayWithObject:name ];
            WebFrame * fr = [containerFr parentFrame];
            while (fr != nil && [[fr name] length] > 0)
            {
                [chaineFrames insertObject:[fr name] atIndex:0];
                fr = [fr parentFrame];
            }
            // Get scriptableObject
            m_scriptBridge = [m_myWebView windowScriptObject];
            // travel the tree to find the Iframe of plugin
            for (unsigned int i=0; i < [chaineFrames count]; i++)
            {
                PLG_TRACE(LOG_DEBUG,"Scripteur for frame %s",ID_2_CHAR( [chaineFrames objectAtIndex:i ] ));
                m_scriptBridge = [ m_scriptBridge valueForKey:[chaineFrames objectAtIndex:i ]];
            }
        }
        else
        {
            m_scriptBridge = [m_myWebView windowScriptObject] ;
        }
    }
    @catch (id e)
    {
        PLG_TRACE(LOG_ERROR,"EXCEPTION: %s --- defaulting on window level scripting object",ID_2_CHAR(e) );
        m_scriptBridge = [m_myWebView windowScriptObject];
    }
}

Here is the code executed when trying to call the JS callback function


- (void) FireEvent :( NSString *) callback :( NSArray *) arg
{
    if (m_scriptBridge)
    {
        @try
        {   
            PLG_TRACE(LOG_NOTICE,"send message to JS : %s [%s]",[callback UTF8String],ID_2_CHAR(arg) );
            [m_scriptBridge callWebScriptMethod: callback withArguments:arg];
        }
        @catch (id e)
        {
            PLG_TRACE(LOG_ERROR,"EXCEPTION: %s ",ID_2_CHAR(e));
        }      
    }
    else
    {
        PLG_TRACE(LOG_ERROR,"No scripting object initialized for callbacks.");
    } }


Have attach the crash report related to the case 1.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list