зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
da27c29b8c
Коммит
84cb117bc7
|
@ -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 &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче