Opened 8 years ago

Closed 8 years ago

#15360 closed defect (fixed)

dojox/mobile/scrollable._runSlideAnimation may fail on non-webkit browser

Reported by: Patrick Ruzand Owned by: Eric Durocher
Priority: high Milestone: 1.8
Component: DojoX Mobile Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Patrick Ruzand)

the scrollable ctor is defined as :

var scrollable = function(/*Object?*/dojo, /*Object?*/dojox){ [1]
...
//>>includeStart("standaloneScrollable", kwArgs.standaloneScrollable); [2]
	if(!dojo){ // namespace objects are not passed
		dojo = window.dojo;
		dojox = window.dojox;
	}
//>>includeEnd("standaloneScrollable");
...

(1) defines the 'dojo' and 'dojox' parameters within the ctor closure where the scrollable methods are defined. _runSlideAnimation references these variables ('dojo' and 'dojox') to check whether dojo.fx has been required for non-webkit browser:

	this._runSlideAnimation = function(/*Object*/from, /*Object*/to, /*Number*/duration, /*String*/easing, node, idx){
		// idx: 0:scrollbarV, 1:scrollbarH, 2:content
		if(has("webkit")){
[...]
		}else if(dojo.fx && dojo.fx.easing && duration){

(2) defines a conditional code block to include at build time if the 'standaloneScrollable' property is defined. The purpose of this property is to support standalone use cases.

The problem appears when 1/ scrollable is instantiated with no parameters, as done in the SpinWheelSlot?.js:

	var cls = declare("", null, {});
	lang.extend(cls, new Scrollable());

2/ AND a dojox/mobile layer is built without the "standaloneScrollable" profile property (since we are in a use case with dojo).

In these conditions, the _runSlideAnimation 'dojo' and 'dojox' variables reference the ctor params (since the method is in the ctor closure) that are undefined, and the code crashes.

Change History (3)

comment:1 Changed 8 years ago by Patrick Ruzand

Description: modified (diff)
Owner: changed from ykami to Eric Durocher
Status: newassigned

comment:2 Changed 8 years ago by ykami

Milestone: tbd1.8
Priority: undecidedhigh

Thanks pruzand for finding this and for good analysis. You are correct.
edurocher, I will commit the fix, since the fix is obvious from the pruzand's analysis.

comment:3 Changed 8 years ago by ykami

Resolution: fixed
Status: assignedclosed

In [28575]:

Fixes #15360 Passes the global dojo to scrollable. !strict

Note: See TracTickets for help on using tickets.