Note that there are some explanatory texts on larger screens.

plurals
  1. POFirefox Cocoa Plugin
    primarykey
    data
    text
    <p>I`ve created simple hello world-like plugin which draws red box.</p> <p>Аfter embedding into xulrunner application the plugin works almost fine. Xulrunner application successfully redraws the box on resizing the application window.</p> <p>But after any mouse event, for instance - left click, my application crashes with "Stack overflow". Debugger says the reason is endless cycle of 2 calls of forwardMethod followed by one call of JSD_GetValueForObject</p> <p>After the crash stack contents is the next:</p> <ul> <li><code>-[NSApplication _indexOfWindow:]</code></li> <li><code>-[NSEvent window]</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>forwardMethod</code></li> <li><code>forwardMethod</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>forwardMethod</code></li> <li><code>forwardMethod</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>forwardMethod</code></li> <li><code>forwardMethod</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>forwardMethod</code></li> <li><code>forwardMethod</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>forwardMethod</code></li> <li><code>forwardMethod</code></li> <li><code>JSD_GetValueForObject</code></li> <li><code>forwardMethod</code></li> <li><code>forwardMethod</code></li> <li>.....etc</li> </ul> <p>My code is:</p> <pre><code>int16_t NPP_HandleEvent(NPP instance, void* event) { EventRecord* carbonEvent = (EventRecord*)event; if (carbonEvent &amp;&amp; (carbonEvent-&gt;what == updateEvt)) { PluginInstance* currentInstance = (PluginInstance*)(instance-&gt;pdata); CGContextRef cgContext = ((NP_CGContext*)(currentInstance-&gt;window.window))-&gt;context; float windowWidth = currentInstance-&gt;window.width; float windowHeight = currentInstance-&gt;window.height; static int x = 0; if (x++) return; NPRect clipRect = currentInstance-&gt;window.clipRect; NP_CGContext* npContext = currentInstance-&gt;window.window; NSWindow* browserWindow = [[[NSWindow alloc] initWithWindowRef:npContext-&gt;window] autorelease]; int y = [browserWindow frame].size.height - (clipRect.bottom - clipRect.top) - currentInstance-&gt;window.y; //[plugin attachToWindow:browserWindow at:NSMakePoint(window-&gt;x, y)]; NSPoint point = NSMakePoint(currentInstance-&gt;window.x, y); // find the NSView at the point NSView* hitView = [[browserWindow contentView] hitTest:NSMakePoint(point.x+1, point.y+1)]; if (hitView == nil || ![[hitView className] isEqualToString:@"ChildView"]) { x = 0; return; } NSView* parentView = hitView; NSBox *box = [[NSBox alloc] initWithFrame:NSMakeRect(0.0, 0.0, 100, 100)]; [box setBoxType:NSBoxCustom]; [box setBorderType:NSLineBorder]; [box setTitlePosition:NSNoTitle]; [box setFillColor:[NSColor redColor]]; [parentView addSubview:box]; //DrawPlugin(cgContext, windowWidth, windowHeight); } return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload