After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 649624 - gi: Don't throw in JSResolveOp
gi: Don't throw in JSResolveOp
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2011-05-07 03:47 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2011-05-16 23:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gi: Don't throw in JSResolveOp (891 bytes, patch)
2011-05-07 03:47 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2011-05-07 03:47:12 UTC
This broke the looking glass in the shell. Come on man, 'in' should throw
an exception!
Comment 1 Jasper St. Pierre (not reading bugmail) 2011-05-07 03:47:14 UTC
Created attachment 187403 [details] [review]
gi: Don't throw in JSResolveOp

Not only is it extremely inpolite, it broke things like "hasOwnProperty"
and the "in" operator that depended on the return value of it.
Comment 2 Colin Walters 2011-05-16 20:42:02 UTC
We've been doing this since the dawn of time; Fri Oct 10 21:37:39 2008 +0000 to be precise.

Can you give example code that is broken by this?  Is it "for (var x in Gtk)" ?
Comment 3 Jasper St. Pierre (not reading bugmail) 2011-05-16 20:56:03 UTC
gnome-shell's environment.js replaces toString with something that does:

  if ('actor' in this)

Well, the 'in' operator calls the JSResolveOp so it can look up whether the object has something, and oops, an exception was thrown!
Comment 4 Colin Walters 2011-05-16 21:05:42 UTC
Review of attachment 187403 [details] [review]:

Looks good.
Comment 5 Colin Walters 2011-05-16 21:07:20 UTC
(In reply to comment #3)
> gnome-shell's environment.js replaces toString with something that does:
> 
>   if ('actor' in this)
> 
> Well, the 'in' operator calls the JSResolveOp so it can look up whether the
> object has something, and oops, an exception was thrown!

Makes sense, I just like to have explicit examples of what's broken (feel free to add that to the commit message too).
Comment 6 Jasper St. Pierre (not reading bugmail) 2011-05-16 23:07:28 UTC
Attachment 187403 [details] pushed as ae4d4bc - gi: Don't throw in JSResolveOp