Last Comment Bug 794477 - jsDate setter can't handle a wrapped JS::Value
: jsDate setter can't handle a wrapped JS::Value
Product: Calendar
Classification: Client Software
Component: Internal Components (show other bugs)
: Lightning 1.7
: All All
-- normal (vote)
: 1.9
Assigned To: Philipp Kewisch [:Fallen]
Depends on: 799067
  Show dependency treegraph
Reported: 2012-09-26 08:09 PDT by Philipp Kewisch [:Fallen]
Modified: 2012-10-08 03:32 PDT (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

Fix - v1 (20.00 KB, patch)
2012-09-26 08:12 PDT, Philipp Kewisch [:Fallen]
matthew.mecca: review+
matthew.mecca: approval‑calendar‑aurora+
Details | Diff | Splinter Review

Description User image Philipp Kewisch [:Fallen] 2012-09-26 08:09:12 PDT
Calling cal.jsDateToDateTime() from a place like the error console causes calDateTime::SetJsDate() to receive a wrapped JS Object from a different compartment.

Patch is coming up to unwrap it and enter its compartment. The patch also moves jsDateToDateTime to calUtils.jsm, which I did while trying to find out what the problem was.
Comment 1 User image Philipp Kewisch [:Fallen] 2012-09-26 08:12:01 PDT
Created attachment 664977 [details] [diff] [review]
Fix - v1

Here we go, patch with a test. I'd like to take this for aurora so its in the next ESR, I'm very much surprised this hasn't caused more trouble before, it has been broken at least since gecko 15.
Comment 2 User image Matthew Mecca [:mmecca] 2012-09-28 18:23:27 PDT
Comment on attachment 664977 [details] [diff] [review]
Fix - v1

Review of attachment 664977 [details] [diff] [review]:

Looks good. r=mmecca

::: calendar/base/content/dialogs/calendar-event-dialog-attendees.js
@@ +341,4 @@
>      // jsDate is always in OS timezone, thus we create a calIDateTime
>      // object from the jsDate representation and simply set the new
>      // timezone instead of converting.
> +    var start = cal.jsDateToDateTime(startWidget.value,

you missed one var -> let here

::: calendar/base/content/widgets/minimonth.xml
@@ +398,4 @@
>          <getter><![CDATA[
>              var calbox = document.getAnonymousElementByAttribute(this, "anonid", "minimonth-calendar");
>              var date =;
> +            var lastDateTime = cal.jsDateToDateTime(date);

and here.
Comment 3 User image Philipp Kewisch [:Fallen] 2012-09-29 09:40:27 PDT
Backported to releases/comm-aurora changeset eeab2d773750
Comment 4 User image Philipp Kewisch [:Fallen] 2012-09-29 09:41:50 PDT
And pushed to comm-central changeset 5e3eacc11768

Also, missed pushing review comments therefore changesets:

comm-central changeset 43520ef891ee
releases/comm-aurora changeset 4f0f6ae13498

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