Ticket #2456 (new defect)

Opened 22 months ago

Last modified 2 months ago

[testcase] dojo.clone mangles object methods during clone

Reported by: guest Owned by: alex
Priority: normal Milestone: 1.3
Component: Core Version: 1.0
Severity: normal Keywords:
Cc:

Description

Steps to reproduce:

 o = {}
[object Object]
>>> o.f = function () {dojo.debug("SSS");}
function () {...}
>>> o2 = dojo.lang.shallowCopy(o, true)
[object Object]
>>> o.f()
SSSdojo.js (line 237)
>>> o2.f()
>>> o2 = dojo.lang.shallowCopy(o, false)
[object Object]
>>> o2.f()
SSS

Dojo 0.4.1 on Firefox 2.0/Ubuntu Linux 6.10

My contact info: apa3a at yahoo dot com

Attachments

dojo._base.lang.clone (422 bytes) - added by matsuri 4 months ago.
dojo.tests._base.lang (332 bytes) - added by matsuri 4 months ago.
util.doh.runner (0.8 kB) - added by matsuri 4 months ago.

Change History

Changed 16 months ago by bill

  • milestone set to 1.1

Changed 10 months ago by peller

Still a problem in 1.x

>>>f2=dojo.clone(function(){console.log("foo");})
foo
anonymous()
>>>f2
anonymous()
>>>f2() // f2 is a function created from Function.constructor; it doesn't do anything

Changed 9 months ago by dylan

  • priority changed from high to normal
  • owner changed from anonymous to alex
  • version changed from 0.4.1 to 1.0
  • severity changed from major to normal
  • summary changed from dojo.lang.shallowCopy mangles object methods during deep copy to [testcase] dojo.clone mangles object methods during clone

The testcase provided by peller is still an issue.

Changed 8 months ago by bill

  • milestone changed from 1.1 to 1.2

Move all milestone 1.1 tickets to 1.2, except for reopened tickets and tickets opened after 1.1RC1 was released.

Changed 4 months ago by matsuri

Changed 4 months ago by matsuri

Changed 4 months ago by matsuri

Changed 4 months ago by matsuri

what ive done

i have 3 patches maybe solving the problem

  1. dojo._base.lang.clone: i added a part to clone functions (was missing before)
  1. dojo.tests._base.lang: i outcommented the error throwing part (with the function)
  1. util.doh.runner: i implemented a funcEq function (which is very simple and surely not enough.. but i dont know better now) and adjusted the assertEqual method

what should probably be done next

  • testing the stuff by an experienced person (knowing all the js func secrets i dont know)
  • maybe adding the funcEq to the other asserts

Changed 2 months ago by bill

  • milestone changed from 1.2 to 1.3

as per today's meeting, punting these core bugs

Note: See TracTickets for help on using tickets.