Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#16209 closed defect (wontfix)

Mixin of constructor parameters is sometimes ineffective

Reported by: Alexander Kläser Owned by: bill
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:


I do not exactly understand under which circumstances this behaviour happens. For a custom widget (inheriting from _WidgetBase, _TemplatedMixin, _Container) I defined the member variable content (in dojo/_base/lang:declare). Sometimes (1 out of 20-30 times) I observe that although content is specified in the parameter dict that is being passed over to the constructor, after calling lang.mixin the member variable this.content would be an empty string, i.e.:

constructor: function (params) {
  // params.content !== ""
  lang.mixin(this, params)
  // this.content == ""

I did not observe similar problems with Dojo 1.6. Could it have something to do with the checks in lang._mixin ? There seem to be checks that do not overwrite prototype properties. However, in this case I found for the prototype a property content="", as well. Still I do not understand why this behaviour would only occur once in a while.

Change History (3)

comment:1 Changed 10 years ago by Alexander Kläser

I observed the problem with Chromium Version 20.0.1132.47 Ubuntu 12.04 (144678).

In lang._mixin I debugged step by step with Chromium and found that although all conditions in the following loop where met (evaluating to true on the command line in debug mode)

if(!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))){
    dest[name] = copyFunc ? copyFunc(s) : s;

the assignment was not executed.

comment:2 Changed 10 years ago by bill

Resolution: wontfix
Status: newclosed

Hmm OK, it sounds like you should really file a bug against chromium to fix that. It sounds neither feasible nor desirable to workaround this chromium bug in dojo core or dijit.

Of course, in any case you would need an (intermittently) reproducible test case; otherwise no one would have any way of confirming the problem exists, much less fixing it.

Also note that we don't officially support chromium. One would think it would work exactly the same as chrome... until we see bug reports like this.

PS: Besides checking each condition in the if() statement individually you might want to see what the debugger prints for the entire expression !(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s)).

comment:3 Changed 10 years ago by Alexander Kläser

Thanks a lot for your answer, Bill! Your are right, it should be filed as a chromium bug.

In fact, I checked the result of the full expression which resulted to true.

Note: See TracTickets for help on using tickets.