Last modified: 2012-06-23 01:44:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39708, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37708 - mw.Uri.clone() doesn't make a deep copy
mw.Uri.clone() doesn't make a deep copy
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-19 04:39 UTC by Roan Kattouw
Modified: 2012-06-23 01:44 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Roan Kattouw 2012-06-19 04:39:17 UTC
mw.Uri.clone() copies each property individually, but it doesn't make a deep copy of the properties; almost all properties are simple types where it doesn't matter, but query is an object.

What's funny is that this breaks the example in the class documentation:

>>> var a = new mw.Uri('http://localhost/w/index.php?foo=bar')
>>> var b = a.clone()
>>> a.extend({'baz':'quux'})
>>> a.toString()
"http://localhost/w/index.php?foo=bar&baz=quux"
>>> b.toString()
"http://localhost/w/index.php?foo=bar&baz=quux"
Comment 1 Trevor Parscal 2012-06-22 19:09:44 UTC
Using deep copy now for array and object properties being copied over.

https://gerrit.wikimedia.org/r/#/c/12614/
Comment 2 Liangent 2012-06-22 19:17:10 UTC
(In reply to comment #1)
> Using deep copy now for array and object properties being copied over.
> 
> https://gerrit.wikimedia.org/r/#/c/12614/

Linking to a wrong changeset?
Comment 3 Krinkle 2012-06-23 01:44:43 UTC
Indeed, he meant:  I1c5644409c089e0a864292b8bd5a757ac31daa89

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links