Fixed <rdar://problem/
3819234> NPN_SetException (and throwException:) isn't implemented
Reviewed by Chris.
* bindings/NP_jsobject.cpp:
(_NPN_SetException):
* bindings/npruntime.cpp:
(_NPN_SetExceptionWithUTF8):
* bindings/objc/WebScriptObject.mm:
(+[WebScriptObject throwException:]):
* kjs/internal.h:
(KJS::InterpreterImp::context):
WebBrowser:
Added debugging support for:
Fixed <rdar://problem/
3819234> NPN_SetException (and throwException:) isn't implemented
Logging is not enabled in either development or deployment build.
Reviewed by Chris.
* LocationChangeHandler.m:
(+[Logger isSelectorExcludedFromWebScript:]):
(-[Logger logMessage:]):
(-[LocationChangeHandler webView:windowScriptObjectAvailable:]):
(-[LocationChangeHandler webView:locationChangeDone:forDataSource:]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7777
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-10-05 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
+
+ Reviewed by Chris.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_SetException):
+ * bindings/npruntime.cpp:
+ (_NPN_SetExceptionWithUTF8):
+ * bindings/objc/WebScriptObject.mm:
+ (+[WebScriptObject throwException:]):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::context):
+
2004-10-05 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
return false;
}
+
+void _NPN_SetException (NPObject *o, NPString *message)
+{
+ if (o->_class == NPScriptObjectClass) {
+ JavaScriptObject *obj = (JavaScriptObject *)o;
+ ExecState *exec = obj->root->interpreter()->globalExec();
+ Interpreter::lock();
+ char *msg = (char *)malloc (message->UTF8Length + 1);
+ strncpy (msg, message->UTF8Characters, message->UTF8Length);
+ msg[message->UTF8Length] = 0;
+ Object err = Error::create(exec, GeneralError, msg);
+ free (msg);
+ exec->setException (err);
+ Interpreter::unlock();
+ }
+}
_NPN_SetException (obj, &string);
}
}
-
-
-void _NPN_SetException (NPObject *obj, NPString *message)
-{
- // FIX ME. Need to implement.
-}
+ (BOOL)throwException:(NSString *)exceptionMessage
{
- NSLog (@"%s:%d: not yet implemented", __PRETTY_FUNCTION__, __LINE__);
+ InterpreterImp *first, *interp = InterpreterImp::firstInterpreter();
+
+ // This code assumes that we only ever have one running interpreter. A
+ // good assumption for now, as we depend on that elsewhere. However,
+ // in the future we may have the ability to run multiple interpreters,
+ // in which case this will have to change.
+ first = interp;
+ do {
+ ExecState *exec = interp->globalExec();
+ // If the interpreter has a context, we set the exception.
+ if (interp->context()) {
+ Object err = Error::create(exec, GeneralError, [exceptionMessage UTF8String]);
+ exec->setException (err);
+ return YES;
+ }
+ interp = interp->nextInterpreter();
+ } while (interp != first);
+
return NO;
}
static InterpreterImp *interpreterWithGlobalObject(ObjectImp *);
void setContext(ContextImp *c) { _context = c; }
+ ContextImp *context() const { return _context; }
void saveBuiltins (SavedBuiltins &builtins) const;
void restoreBuiltins (const SavedBuiltins &builtins);