Opened 6 years ago

Closed 2 years ago

#14275 closed defect (patchwelcome)

dojo.safeMixin can fail in IE

Reported by: dhaber Owned by: Eugene Lazutkin
Priority: high Milestone: 1.13
Component: Core Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

This applies to dojo 1.4 through 1.6 and IE 6, 7 & 8.

If you declare a new class that has a constructor which uses dojo.safeMixin but you pass no parameters to the constructor it will fail in IE. For example:

dojo.declare("a.b.c", null, {
	
	constructor: function(args) {
		dojo.safeMixin(this, args);
	}});

The above will fail in IE if you do this:

var d = new a.b.c();

Change History (7)

comment:1 Changed 6 years ago by bill

Seems like this ticket is invalid. You are calling

dojo.safeMixin({}, undefined)

whereas the API documentation says that you have to pass in an object as the second argument.

comment:2 Changed 6 years ago by dante

Techincally invalid by API docs. dojo.mixin({}, undefined) works fine. Ironic the mixin() with the word "safe" in it doesn't check presence like the seemingly "unsafe" mixin() (and private _mixin() functions) attached to the dojo object.

comment:3 Changed 6 years ago by bill

Milestone: tbd

comment:4 Changed 6 years ago by acabler

I would really like to see a fix for this. This one just cost me a day and is very difficult to debug, but very easy to fix. If nothing else, it would be nice to have the behavior match across the browsers. Especially since IE bugs are much harder to debug.

comment:5 Changed 6 years ago by bill

Component: GeneralCore
Owner: set to Eugene Lazutkin
Status: newassigned

Giving to Eugene since safeMixin() is defined in declare.js.

comment:6 Changed 4 years ago by soleimani

a simple workaround is always pass {} to declare function

    var jr = new JsonRest(); // cause exception
    var jr = new JsonRest({}); // it works

comment:7 Changed 2 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: assignedclosed

Given that no one has shown interest in creating a patch in the past 4+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.