Opened 5 years ago

Closed 5 months ago

#14275 closed defect (patchwelcome)

dojo.safeMixin can fail in IE

Reported by: dhaber Owned by: elazutkin
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 5 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 5 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 4 years ago by bill

  • Milestone set to tbd

comment:4 Changed 4 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 4 years ago by bill

  • Component changed from General to Core
  • Owner set to elazutkin
  • Status changed from new to assigned

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

comment:6 Changed 2 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 5 months ago by dylan

  • Milestone changed from tbd to 1.12
  • Resolution set to patchwelcome
  • Status changed from assigned to closed

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.