RESOLVED FIXED 77917
Web Inspector: In Inspector.json PropertyDescriptor.writable should be declared optional
https://bugs.webkit.org/show_bug.cgi?id=77917
Summary Web Inspector: In Inspector.json PropertyDescriptor.writable should be declar...
Peter Rybin
Reported 2012-02-06 17:27:36 PST
Property PropertyDescriptor.writable in de facto optional. It's also conceptually optional (because only it makes sense for "data" properties, not for "accessor" properties). Inspector.json should be fixed accordingly. Note that it formally breaks compatibility with "1.0" and "0.1". Probably they should be patched retroactively too.
Attachments
Patch (5.56 KB, patch)
2012-02-06 17:34 PST, Peter Rybin
no flags
original InspectorTypeBuilder.h (146.11 KB, text/plain)
2012-02-07 08:54 PST, Peter Rybin
no flags
original InspectorTypeBuilder.cpp (4.79 KB, text/plain)
2012-02-07 08:55 PST, Peter Rybin
no flags
new InspectorTypeBuilder.h (148.10 KB, text/plain)
2012-02-07 09:01 PST, Peter Rybin
no flags
new InspectorTypeBuilder.cpp (7.76 KB, text/plain)
2012-02-07 09:01 PST, Peter Rybin
no flags
Patch (7.06 KB, patch)
2012-02-07 17:38 PST, Peter Rybin
no flags
Patch (6.84 KB, patch)
2012-02-08 15:56 PST, Peter Rybin
no flags
Patch (8.22 KB, patch)
2012-02-09 14:24 PST, Peter Rybin
no flags
Peter Rybin
Comment 1 2012-02-06 17:34:55 PST
Pavel Feldman
Comment 2 2012-02-07 03:26:38 PST
Comment on attachment 125738 [details] Patch Why should it be optional?
Peter Rybin
Comment 3 2012-02-07 04:50:28 PST
(In reply to comment #2) > (From update of attachment 125738 [details]) > Why should it be optional? I'm not sure it must be optional. But it makes sense, because according to JS specification, "writable" exists only for "data" properties, i.e. there's no "writable" when there is getter or setter.
Peter Rybin
Comment 4 2012-02-07 04:51:49 PST
(In reply to comment #3) > (In reply to comment #2) > > (From update of attachment 125738 [details] [details]) > > Why should it be optional? > > I'm not sure it must be optional. Another option would be to patch the code to conform with Inspector.json
Peter Rybin
Comment 5 2012-02-07 08:54:44 PST
Created attachment 125850 [details] original InspectorTypeBuilder.h
Peter Rybin
Comment 6 2012-02-07 08:55:45 PST
Created attachment 125851 [details] original InspectorTypeBuilder.cpp
Peter Rybin
Comment 7 2012-02-07 09:01:30 PST
Created attachment 125853 [details] new InspectorTypeBuilder.h
Peter Rybin
Comment 8 2012-02-07 09:01:57 PST
Created attachment 125854 [details] new InspectorTypeBuilder.cpp
Peter Rybin
Comment 9 2012-02-07 09:04:55 PST
attachments 2-5 are added here by mistake. see correct bug: https://bugs.webkit.org/show_bug.cgi?id=77919
Peter Rybin
Comment 10 2012-02-07 14:36:17 PST
I think "writable" is ok to be optional. I looked at the code. It seems to be correct taking that "writable" is optional.
Peter Rybin
Comment 11 2012-02-07 17:38:02 PST
Peter Rybin
Comment 12 2012-02-07 17:42:38 PST
Additional fix is about "set" and "get" properties. They may be "undefined" in JavaScript descriptor, that gets converted to "null" in JSON format. "Null" is a problem, because our protocol doesn't have nullable types (only type "any" allows "null" value).
Pavel Feldman
Comment 13 2012-02-08 01:50:02 PST
Comment on attachment 125965 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=125965&action=review > Source/WebCore/inspector/InjectedScriptSource.js:236 > + if (typeof descriptor.get != "function") { Should be !==, no need for {} > Source/WebCore/inspector/InjectedScriptSource.js:239 > + if (typeof descriptor.set != "function") { ditto
Peter Rybin
Comment 14 2012-02-08 15:56:07 PST
Peter Rybin
Comment 15 2012-02-08 16:11:14 PST
New patch makes sure the output conforms with our protocol (in all cases, including when exception is thrown). It doesn't lose 'undefined' values of getters and setters, because conceptually accessor property HAS getter and setter, even if both are 'undefined' (this can be checked by getOwnPropertyDescriptor call on such property). This cases undefined getter/setter showing in UI. This may or may not need fixing.
WebKit Review Bot
Comment 16 2012-02-08 17:54:48 PST
Comment on attachment 126171 [details] Patch Attachment 126171 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11460668 New failing tests: inspector/runtime/runtime-getProperties.html
WebKit Review Bot
Comment 17 2012-02-09 05:01:43 PST
Comment on attachment 126171 [details] Patch Rejecting attachment 126171 [details] from commit-queue. New failing tests: inspector/runtime/runtime-getProperties.html Full output: http://queues.webkit.org/results/11447199
Peter Rybin
Comment 18 2012-02-09 14:24:51 PST
Vsevolod Vlasov
Comment 19 2012-02-13 06:28:12 PST
Vsevolod Vlasov
Comment 20 2012-02-14 06:27:28 PST
Comment on attachment 126373 [details] Patch Clearing r?
Note You need to log in before you can comment on or make changes to this bug.