Status: Unconfirmed Owner: [email protected] Labels: Type-Bug Pri-2 OS-All Area-Misc
New issue 5742 by alastairpatrick: Chrome does not call invoke callback on plugin NPObject if hasProperty returns true http://code.google.com/p/chromium/issues/detail?id=5742 Chrome Version : 1.0.154.36 URLs (if applicable) : Other browsers tested: Add OK or FAIL after other browsers where you have tested this issue: Safari 3: Unknown Firefox 3: OK IE 7: OK (but using COM instead of npruntime) What steps will reproduce the problem? 1. From an npruntime plugin, create an NPObject implementing at least hasProperty, hasMethod, getProperty and invoke in its NPClass. 2. hasProperty and hasMethod should return true for some property 'm'. getProperty should return an NPObject representing a function object assigned to property 'm'. invoke should evaluate the function assigned to property 'm'. 3. From JavaScript code in the browser, invoke the method 'm' on an object: var obj = plugin.createObject(); obj.m(); What is the expected result? The NPObject's invoke (and possibly also its hasMethod) functions should be called, allowing the plugin to evaluate the method 'm' in the context of the object 'obj'. If hasMethod returned false, it would be appropriate to continue as described in the section on 'what happens instead'. What happens instead? The NPObject's hasProperty and getProperty functions are invoked, which return an NPObject representing the function stored in property 'm'. The invokeDefault function is then called on the NPObject for the function in 'm'. The is not the correct behavior because when a method is invoked with the 'obj.m()' syntax, the invoke function must be called instead of invokeDefault. The reason is because the invokeDefault function does not provide the value of 'this' whereas invoke does. The value of 'this' (obj in this case) is crucially information for the implementation of many methods. The workaround is for the plugin to incorrectly report that obj does not have a property called 'm'. Then Chrome falls back on the correct behaviour of invoking the method through the invoke callback. This bug prevents plugins from giving their methods JavaScript-like semantics. For example, it prevents this... var obj = plugin.createObject(); int numArgs = obj.m.arity; ... where the plugin provides an arity property on NPObjects representing functions. Firefox does this correctly. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Chromium-bugs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/chromium-bugs?hl=en -~----------~----~----~----~------~----~------~--~---
