зеркало из https://github.com/mozilla/gecko-dev.git
Bug 808611 - Move valueOf to nsIDOMLocation. r=mrbkap
This commit is contained in:
Родитель
ea423daca6
Коммит
a209826b20
|
@ -913,6 +913,14 @@ nsLocation::ToString(nsAString& aReturn)
|
|||
return GetHref(aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocation::ValueOf(nsIDOMLocation** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLocation> loc(this);
|
||||
loc.forget(aReturn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLocation::GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(a6cf906d-15b3-11d2-932e-00805f8add32)]
|
||||
[scriptable, uuid(9472bf0f-2d1c-415c-90fd-f4260678b73b)]
|
||||
interface nsIDOMLocation : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -27,4 +27,5 @@ interface nsIDOMLocation : nsISupports
|
|||
void assign(in DOMString url);
|
||||
|
||||
DOMString toString();
|
||||
nsIDOMLocation valueOf();
|
||||
};
|
||||
|
|
|
@ -48,7 +48,6 @@ const char* XPCJSRuntime::mStrings[] = {
|
|||
"constructor", // IDX_CONSTRUCTOR
|
||||
"toString", // IDX_TO_STRING
|
||||
"toSource", // IDX_TO_SOURCE
|
||||
"valueOf", // IDX_VALUE_OF
|
||||
"lastResult", // IDX_LAST_RESULT
|
||||
"returnCode", // IDX_RETURN_CODE
|
||||
"value", // IDX_VALUE
|
||||
|
|
|
@ -768,7 +768,6 @@ public:
|
|||
IDX_CONSTRUCTOR = 0 ,
|
||||
IDX_TO_STRING ,
|
||||
IDX_TO_SOURCE ,
|
||||
IDX_VALUE_OF ,
|
||||
IDX_LAST_RESULT ,
|
||||
IDX_RETURN_CODE ,
|
||||
IDX_VALUE ,
|
||||
|
|
|
@ -731,13 +731,6 @@ XPCWrappedNativeXrayTraits::preserveWrapper(JSObject *target)
|
|||
ci->PreserveWrapper(wn->Native());
|
||||
}
|
||||
|
||||
static JSBool
|
||||
IdentityValueOf(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
JS_SET_RVAL(cx, vp, JS_THIS(cx, vp));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext *cx, JSObject *wrapper,
|
||||
JSObject *holder, jsid id, bool set,
|
||||
|
@ -768,23 +761,6 @@ XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext *cx, JSObject *wrapp
|
|||
return true;
|
||||
}
|
||||
|
||||
// Explicitly make valueOf an identity operation so that it plays better
|
||||
// with the rest of the Xray infrastructure.
|
||||
if (id == rt->GetStringID(XPCJSRuntime::IDX_VALUE_OF) &&
|
||||
Is<nsIDOMLocation>(wrapper))
|
||||
{
|
||||
JSFunction *fun = JS_NewFunctionById(cx, &IdentityValueOf, 0, 0, NULL, id);
|
||||
if (!fun)
|
||||
return false;
|
||||
desc->obj = wrapper;
|
||||
desc->attrs = 0;
|
||||
desc->getter = NULL;
|
||||
desc->setter = NULL;
|
||||
desc->shortid = 0;
|
||||
desc->value = ObjectValue(*JS_GetFunctionObject(fun));
|
||||
return true;
|
||||
}
|
||||
|
||||
desc->obj = NULL;
|
||||
|
||||
// This will do verification and the method lookup for us.
|
||||
|
|
Загрузка…
Ссылка в новой задаче