Bug 12268

Summary: Give object prototypes their own names
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: WebCore JavaScriptAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Enhancement    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
proposed patch
none
proposed patch
mjs: review-
plus global renaming mjs: review+

Alexey Proskuryakov
Reported 2007-01-14 12:13:20 PST
Currently, JS objects and their prototypes have the same names, which can be confusing.
Attachments
proposed patch (36.66 KB, patch)
2007-01-14 12:22 PST, Alexey Proskuryakov
no flags
proposed patch (31.57 KB, patch)
2007-01-16 11:17 PST, Alexey Proskuryakov
mjs: review-
plus global renaming (79.69 KB, patch)
2007-01-16 12:45 PST, Alexey Proskuryakov
mjs: review+
Alexey Proskuryakov
Comment 1 2007-01-14 12:22:47 PST
Created attachment 12431 [details] proposed patch The fast/tokenizer/external-script-document-write.html test seems to have been failing, going to research it separately.
Alexey Proskuryakov
Comment 2 2007-01-14 13:27:06 PST
Comment on attachment 12431 [details] proposed patch Sam has pointed out that this patch has an unintended consequence of changing what property is added to the global object (e.g., HTMLDocumentProto.prototype instead of HTMLDocument.prototype). OTOH, the former isn't available in Firefox anyway. Going to investigate this further.
Alexey Proskuryakov
Comment 3 2007-01-14 13:35:21 PST
That is, [[HTMLDocumentProto.prototype]] instead of [[HTMLDocument.prototype]].
Geoffrey Garen
Comment 4 2007-01-14 15:44:51 PST
(In reply to comment #3) > That is, [[HTMLDocumentProto.prototype]] instead of [[HTMLDocument.prototype]]. > If you're talking about the hidden properties we create through cacheGlobalObject(), the fact that they're reachable at all from client code is really a minor bug, not a feature. Can we spare a few extra letters and use "Prototype" instead of "Proto"?
Alexey Proskuryakov
Comment 5 2007-01-16 11:17:39 PST
Created attachment 12492 [details] proposed patch Mostly the same, just changed to append "Proto" in the macro (similar to how it works for constructors in CodGeneratorJS). > Can we spare a few extra letters and use "Prototype" instead of "Proto"? I tried to match how prototype classes are named in C++, so I guess I'd have to rename them at the same time then, as well.
Darin Adler
Comment 6 2007-01-16 11:22:41 PST
(In reply to comment #5) > > Can we spare a few extra letters and use "Prototype" instead of "Proto"? > > I tried to match how prototype classes are named in C++, so I guess I'd have to > rename them at the same time then, as well. I'm a big fan of words rather than abbreviations, so I like Geoff's suggestion. We could use my rename script to do the renaming of the non-auto-generated C++ in an automated way.
Alexey Proskuryakov
Comment 7 2007-01-16 12:45:04 PST
Created attachment 12493 [details] plus global renaming Adds a global rename of Proto, ProtoFunc etc. Not exactly what I intended to do in this patch, but well.
Maciej Stachowiak
Comment 8 2007-01-17 02:06:52 PST
Comment on attachment 12493 [details] plus global renaming r=me on the fancier patch
Maciej Stachowiak
Comment 9 2007-01-17 02:08:36 PST
Comment on attachment 12492 [details] proposed patch r- the older patch to get it out of the queue
Alexey Proskuryakov
Comment 10 2007-01-17 11:52:58 PST
Committed revision 18912.
Alexey Proskuryakov
Comment 11 2007-01-18 21:40:36 PST
(In reply to comment #1) > The fast/tokenizer/external-script-document-write.html test seems to have been > failing, going to research it separately. Filed bug 12333.
Note You need to log in before you can comment on or make changes to this bug.