fixing regression committed in r5280. applyDefaults() again allows for an undefined value as the 'from' parameter. thanks tim for report and review. (Closes #1716)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7943 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -563,7 +563,7 @@ OpenLayers.Util.applyDefaults = function (to, from) {
|
||||
* properties with the for(property in object) syntax. Explicitly check if
|
||||
* the source has its own toString property.
|
||||
*/
|
||||
if(!fromIsEvt && from.hasOwnProperty
|
||||
if(!fromIsEvt && from && from.hasOwnProperty
|
||||
&& from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
|
||||
to.toString = from.toString;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
|
||||
function test_Util_applyDefaults(t) {
|
||||
|
||||
t.plan(11);
|
||||
t.plan(12);
|
||||
|
||||
var to = {
|
||||
'a': "abra",
|
||||
@@ -204,6 +204,15 @@
|
||||
|
||||
var ret = OpenLayers.Util.applyDefaults(to, from);
|
||||
t.eq(ret.rand, from.rand, "works with undefined to");
|
||||
|
||||
//regression test for #1716 -- allow undefined from
|
||||
try {
|
||||
OpenLayers.Util.applyDefaults({}, undefined);
|
||||
t.ok(true, "no exception thrown when from is undefined");
|
||||
} catch(err) {
|
||||
t.fail("exception thrown when from is undefined:" + err);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function test_Util_getParameterString(t) {
|
||||
|
||||
Reference in New Issue
Block a user