Ignore:
Timestamp:
Apr 26, 2005, 6:03:57 PM (20 years ago)
Author:
rjw
Message:

JavaScriptCore:

Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla

We were incompatible with Mozilla's implementation of the scripting APIs in
two ways:

Their NPN_SetException has the following signature:

void NPN_SetException(NPObject *npobj, const NPUTF8 *message);

ours has:

void NPN_SetException (NPObject * npobj, const NPString *message);

Also, they expect the string returned from NPN_UTF8FromIdentifier() to be freed by caller.
We do not.

I changed both behaviors to match Mozilla.

Reviewed by Chris.

  • bindings/NP_jsobject.cpp: (_NPN_SetException):
  • bindings/npruntime.cpp: (_NPN_UTF8FromIdentifier): (_NPN_IntFromIdentifier): (_NPN_SetExceptionWithUTF8):
  • bindings/npruntime.h:
  • bindings/npruntime_impl.h:

WebKit:

Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla

Reviewed by Chris.

  • Plugins.subproj/npfunctions.h:
  • Plugins.subproj/npruntime.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bindings/NP_jsobject.cpp

    r8384 r9061  
    412412}
    413413
    414 void _NPN_SetException (NPObject *o, NPString *message)
    415 {
    416     if (o->_class == NPScriptObjectClass) {
    417         JavaScriptObject *obj = (JavaScriptObject *)o;
    418         ExecState *exec = obj->executionContext->interpreter()->globalExec();
    419         Interpreter::lock();
    420         char *msg = (char *)malloc (message->UTF8Length + 1);
    421         strncpy (msg, message->UTF8Characters, message->UTF8Length);
    422         msg[message->UTF8Length] = 0;
    423         Object err = Error::create(exec, GeneralError, msg);
    424         free (msg);
     414void _NPN_SetException (NPObject *o, const NPUTF8 *message)
     415{
     416    if (o->_class == NPScriptObjectClass) {
     417        JavaScriptObject *obj = (JavaScriptObject *)o;
     418        ExecState *exec = obj->executionContext->interpreter()->globalExec();
     419        Interpreter::lock();
     420        Object err = Error::create(exec, GeneralError, message);
    425421        exec->setException (err);
    426422        Interpreter::unlock();
Note: See TracChangeset for help on using the changeset viewer.