As a security precaution, we have turned on the setting "Require API key authentication for API requests" for everyone. If this has broken something, please contact
Last Comment Bug 745361 - Handle conversion rules totally break static typing
: Handle conversion rules totally break static typing
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla14
Assigned To: Brian Hackett (:bhackett)
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2012-04-13 15:20 PDT by Luke Wagner [:luke]
Modified: 2012-04-16 18:59 PDT (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (642 bytes, patch)
2012-04-14 07:32 PDT, Brian Hackett (:bhackett)
luke: review+
Details | Diff | Splinter Review

Description User image Luke Wagner [:luke] 2012-04-13 15:20:53 PDT
This type checks but I don't think it should

  RootedVarString r(...);
  HandleObject h = r;

I think the solution is to remove this constructor and fix other things with explicit (restrict) casts.

  template <class T>
  template <class U>
  Handle<T>::Handle(const RootedVar<U> &);

and the analogous one for Root<U>.

Also, can we move Handle out of jsprvtd.h?
Comment 1 User image Brian Hackett (:bhackett) 2012-04-14 07:32:07 PDT
Created attachment 615047 [details] [diff] [review]

Oops, this constructor was missing a testAssign, which is supposed to only allow handle assignments that follow normal C++ assignment rules for the wrapped type.  See the other Handle constructors, which are also templated on a type other than the handle.  Requiring casts whenever converting between handles of different but compatible types would be a mess I think, with all the subclassing we do for objects and strings.
Comment 2 User image Luke Wagner [:luke] 2012-04-15 21:08:29 PDT
Comment on attachment 615047 [details] [diff] [review]

Ahh, I didn't see testAssign.  Cool.
Comment 3 User image Brian Hackett (:bhackett) 2012-04-15 21:36:43 PDT

Note You need to log in before you can comment on or make changes to this bug.