Opened 7 years ago

Closed 7 years ago

#16607 closed defect (fixed)

dojox/mobile/TransitionEvent throws exception when used without a ViewController

Reported by: Eric Durocher Owned by: Eric Durocher
Priority: undecided Milestone: 1.9
Component: DojoX Mobile Version: 1.8.0
Keywords: Cc: cjolif
Blocked By: Blocking:

Description

The dojox/mobile/TransitionEvent dispatch method can throw an exception when used without ViewController (e.g. in dojox/app).

If the mblCSS3Transition config variable is not defined (which is the default), then transitDeferred is null, which leads to the transition argument being undefined, and the next transition.call throws an exception.

This is usually never a problem in a Dojo Mobile app, since the emitted "startTransition" event is handled by the ViewController, which calls evt.preventDefault() in its onStartTransition method, so the result of the emit() call is always false, and the block containing the Deferred call is never executed.

It can be a problem in applications that do not use a ViewController though, such as some dojox/app applications.

Attachments (1)

16607.patch (1.3 KB) - added by Eric Durocher 7 years ago.
Removed the code which was anyway wrong and unused - Eric Durocher (IBM, CCLA)

Download all attachments as: .zip

Change History (5)

comment:1 Changed 7 years ago by Eric Durocher

Cc: cjolif added
Milestone: tbd1.9

Note: we could also test transitDeferred, but testing transition also handles the (admittedly very unlikely) case where an mblCSS3Transition module would be defined but the module would return a null value.

comment:2 Changed 7 years ago by cjolif

The more I think about the more I'm wondering if we couldn't just remove entirely that code:

1/ it is never executed in regular dojox/mobile application (because of preventDefault on ViewController)

2/ it is never executed in dojox/app application (either because of ViewController preventDefault because dojox/mobile is used or because anyway mblCSS3Transiton won't be set as dojox/app transition on its own).

3/ it calls transition(event) which has no meaning because transition expects a from and to node as parameter.

4/ it fires an event nobody listens to and which is anyway never fired because of 1/ & 2/.

Last edited 7 years ago by cjolif (previous) (diff)

Changed 7 years ago by Eric Durocher

Attachment: 16607.patch added

Removed the code which was anyway wrong and unused - Eric Durocher (IBM, CCLA)

comment:3 Changed 7 years ago by Eric Durocher

I agree. I also removed the endTransition method (will put that in the release notes but I don't think there is a risk that anybody called that...)

comment:4 Changed 7 years ago by cjolif

Resolution: fixed
Status: newclosed

In [30440]:

fixes #16607. Remove un-used code that might fail in some context. Thanks Eric Durocher (IBM, CCLA).

Note: See TracTickets for help on using tickets.