Status: Unconfirmed
Owner: [email protected]
Labels: Type-Bug Pri-2 OS-All Area-Misc

New issue 5748 by alastairpatrick: Chrome does not throw a JavaScript  
exception when an npruntime callback fails
http://code.google.com/p/chromium/issues/detail?id=5748

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:
     Firefox 3: OK
          IE 7: OK (using COM instead of npruntime)

What steps will reproduce the problem?
1. In an npruntime NPClass callback, such as invoke, return false to
indicate failure.
2. From JavaScript, cause the callback to be called:

// invokeDefault will be called on plugin's NPObject.
// Suppose it returns false.
try {
   plugin.createObject();
} catch {
   alert('exception thrown'); // This should be evaluated
}

What is the expected result?

An exception should be thrown into JavaScript when control returns from the
plugin. This is the behavior of Firefox and IE.

What happens instead?

No exception is thrown.

Please provide any additional information below. Attach a screenshot if
possible.

Chrome is not checking the return values of npruntime callbacks. For
example in NPObjectInvokeImpl in webkit/port/bindings/v8/v8_npobject.cpp:

   switch (func_id) {
     case INVOKE_METHOD:
       if (npobject->_class->invoke) {
         v8::Handle<v8::String>  
function_name(v8::String::Cast(*args.Data()));
         NPIdentifier ident = GetStringIdentifier(function_name);
         npobject->_class->invoke(npobject, ident, np_args, argc, &result);
       }
       break;
     case INVOKE_DEFAULT:
       if (npobject->_class->invokeDefault) {
         npobject->_class->invokeDefault(npobject, np_args, argc, &result);
       }
       break;
     default:
       break;
   }

The result of the calls to the invoke and invokeDefault callbacks are not
checked. If they return false an exception should be thrown into JavaScript.


--
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to