RESOLVED FIXED105892
Objective-C API: Objective-C functions exposed to JavaScript have the wrong type (object instead of function)
https://bugs.webkit.org/show_bug.cgi?id=105892
Summary Objective-C API: Objective-C functions exposed to JavaScript have the wrong t...
Gavin Barraclough
Reported 2012-12-31 23:45:40 PST
The current implementation ttys to implement a JavaScript Function object via the C-API - it does so imperfectly.
Attachments
Patch (20.80 KB, patch)
2013-03-11 16:26 PDT, Mark Hahnenberg
no flags
Patch (22.34 KB, patch)
2013-03-11 16:42 PDT, Mark Hahnenberg
no flags
Patch (22.38 KB, patch)
2013-03-11 16:59 PDT, Mark Hahnenberg
no flags
Patch (22.37 KB, patch)
2013-03-11 17:36 PDT, Mark Hahnenberg
no flags
Geoffrey Garen
Comment 1 2013-01-03 15:58:51 PST
ObjCCallbackFunction should subclass JSFunction or InternalFunction.
Mark Hahnenberg
Comment 2 2013-03-11 16:26:20 PDT
Early Warning System Bot
Comment 3 2013-03-11 16:36:28 PDT
Early Warning System Bot
Comment 4 2013-03-11 16:38:44 PDT
Mark Hahnenberg
Comment 5 2013-03-11 16:42:18 PDT
Early Warning System Bot
Comment 6 2013-03-11 16:53:27 PDT
Early Warning System Bot
Comment 7 2013-03-11 16:54:14 PDT
Mark Hahnenberg
Comment 8 2013-03-11 16:59:10 PDT
Early Warning System Bot
Comment 9 2013-03-11 17:13:14 PDT
Early Warning System Bot
Comment 10 2013-03-11 17:18:38 PDT
Mark Hahnenberg
Comment 11 2013-03-11 17:36:00 PDT
Mark Hahnenberg
Comment 12 2013-03-11 18:05:16 PDT
Geoffrey Garen
Comment 13 2013-03-12 09:06:03 PDT
Comment on attachment 192606 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=192606&action=review r=me > Source/JavaScriptCore/API/ObjCCallbackFunction.mm:586 > + return toRef(JSC::ObjCCallbackFunction::create(exec, exec->lexicalGlobalObject(), "Objective-C", impl.release())); Should we just leave the function anonymous, instead? I agree that at the JS-mangled selector name would be better, but I don't think "Objective-C" adds all that much. > Source/JavaScriptCore/API/tests/testapi.mm:526 > + JSValue *result = [context evaluateScript:@"Function.prototype.toString.call(testObject.callback)"]; > + checkResult(@"callback function typeof", !context.exception && ![result isUndefined]); This test doesn't actually test typeof. You should name this test "toString', and write a separate test line for typeof that shows it's "Function".
Mark Hahnenberg
Comment 14 2013-03-14 14:16:14 PDT
Mark Hahnenberg
Comment 15 2013-03-14 14:40:09 PDT
Comment on attachment 192606 [details] Patch Clearing flags.
Note You need to log in before you can comment on or make changes to this bug.