RESOLVED FIXED 168578
[Cocoa] Objective-C class whose name begins with an underscore can’t be exported to JavaScript
https://bugs.webkit.org/show_bug.cgi?id=168578
Summary [Cocoa] Objective-C class whose name begins with an underscore can’t be expor...
mitz
Reported 2017-02-19 17:14:32 PST
When an Objective-C class’s name begins with an underscore, its conformance to JSExport is ignored. This is because -[JSWrapperMap classInfoForClass:] skips over classes whose names begin with an underscore. A comment in that method says that it skips “internal classes beginning with '_'” but offers no explanation why. A possible explanation is that this behavior does make instances of class clusters appear somewhat “nicer” when exported to JavaScript. In framework code (including WebKit code), it is common for class names that aren’t part of the public API to being with an underscore, and such classes may have JS exports that they don’t share with a non-underscore-prefixed superclass.
Attachments
Avoid skipping over underscore-prefixed classes that JSExport (8.08 KB, patch)
2017-04-16 19:46 PDT, mitz
ggaren: review+
commit-queue: commit-queue-
mitz
Comment 1 2017-04-16 19:46:15 PDT
Created attachment 307253 [details] Avoid skipping over underscore-prefixed classes that JSExport
mitz
Comment 2 2017-04-17 08:01:39 PDT
Comment on attachment 307253 [details] Avoid skipping over underscore-prefixed classes that JSExport The more I think about this, the more it seems like the right thing to do here is just entirely remove the special-casing of underscore-prefixed class names.
Geoffrey Garen
Comment 3 2017-04-17 15:04:36 PDT
Comment on attachment 307253 [details] Avoid skipping over underscore-prefixed classes that JSExport I wonder what we accomplished previously be excluding classes with _ prefixes, and what we continue to accomplish now by doing the same for classes with _ prefixes that do not have JSExports. Such classes don't export anything, so how are they even visible to JavaScript? I guess they are visible when an empty _Class shows up somewhere in the prototype chain?
WebKit Commit Bot
Comment 4 2017-06-14 22:45:24 PDT
Comment on attachment 307253 [details] Avoid skipping over underscore-prefixed classes that JSExport Rejecting attachment 307253 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'apply-attachment', '--no-update', '--non-interactive', 307253, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: th fuzz 2 (offset -4 lines). 1 out of 4 hunks FAILED -- saving rejects to file Source/JavaScriptCore/API/JSWrapperMap.mm.rej patching file Source/JavaScriptCore/API/ObjcRuntimeExtras.h patching file Source/JavaScriptCore/API/tests/JSExportTests.mm Hunk #3 succeeded at 145 with fuzz 1. Hunk #4 succeeded at 208 with fuzz 2 (offset 40 lines). Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Geoffrey Garen']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.webkit.org/results/3933609
mitz
Comment 5 2017-06-14 22:57:41 PDT
Note You need to log in before you can comment on or make changes to this bug.