Bug 1137591 part 1. Get rid of SandboxCreateXMLHttpRequest and just use the normal XHR constructor in sandboxes if someone asks for XHR there. r=bholley

This commit is contained in:
Boris Zbarsky 2015-03-03 21:01:58 -05:00
parent f2fc1a4f3c
commit 05f25e0b8b

View File

@ -194,31 +194,6 @@ SandboxImport(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static bool
SandboxCreateXMLHttpRequest(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
MOZ_ASSERT(global);
nsIScriptObjectPrincipal *sop =
static_cast<nsIScriptObjectPrincipal *>(xpc_GetJSPrivate(global));
nsCOMPtr<nsIGlobalObject> iglobal = do_QueryInterface(sop);
nsCOMPtr<nsIXMLHttpRequest> xhr = new nsXMLHttpRequest();
nsresult rv = xhr->Init(nsContentUtils::SubjectPrincipal(), nullptr,
iglobal, nullptr, nullptr);
if (NS_FAILED(rv))
return false;
rv = nsContentUtils::WrapNative(cx, xhr, args.rval());
if (NS_FAILED(rv))
return false;
return true;
}
static bool
SandboxCreateCrypto(JSContext *cx, JS::HandleObject obj)
{
@ -843,7 +818,7 @@ xpc::GlobalProperties::Define(JSContext *cx, JS::HandleObject obj)
return false;
if (XMLHttpRequest &&
!JS_DefineFunction(cx, obj, "XMLHttpRequest", SandboxCreateXMLHttpRequest, 0, JSFUN_CONSTRUCTOR))
!dom::XMLHttpRequestBinding::GetConstructorObject(cx, obj))
return false;
if (TextEncoder &&