public static object SetDefaultNamespace(object @namespace, Context cx)
{
Scriptable scope = cx.currentActivationCall;
if (scope == null)
{
scope = GetTopCallScope(cx);
}
XMLLib xmlLib = CurrentXMLLib(cx);
object ns = xmlLib.ToDefaultXmlNamespace(cx, @namespace);
// XXX : this should be in separated namesapce from Scriptable.get/put
if (!scope.Has(DEFAULT_NS_TAG, scope))
{
// XXX: this is racy of cause
ScriptableObject.DefineProperty(scope, DEFAULT_NS_TAG, ns, ScriptableObject.PERMANENT | ScriptableObject.DONTENUM);
}
else
{
scope.Put(DEFAULT_NS_TAG, scope, ns);
}
return Undefined.instance;
}