Bug 1082790 - Remove the nsIScriptContext parameter from nsXMLHttpRequest::Init(). r=mrbkap
--- a/dom/base/test/TestGetURL.cpp
+++ b/dom/base/test/TestGetURL.cpp
@@ -39,17 +39,17 @@ nsresult TestGetURL(const nsCString& aUR
nsCOMPtr<nsIScriptSecurityManager> secman =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
TEST_ENSURE_SUCCESS(rv, "Couldn't get script security manager!");
nsCOMPtr<nsIPrincipal> systemPrincipal;
rv = secman->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
TEST_ENSURE_SUCCESS(rv, "Couldn't get system principal!");
- rv = xhr->Init(systemPrincipal, nullptr, nullptr, nullptr, nullptr);
+ rv = xhr->Init(systemPrincipal, nullptr, nullptr, nullptr);
TEST_ENSURE_SUCCESS(rv, "Couldn't initialize the XHR!");
rv = xhr->Open(getString, aURL, false, empty, empty);
TEST_ENSURE_SUCCESS(rv, "OpenRequest failed!");
rv = xhr->Send(nullptr);
TEST_ENSURE_SUCCESS(rv, "Send failed!");
--- a/dom/base/test/TestNativeXMLHttpRequest.cpp
+++ b/dom/base/test/TestNativeXMLHttpRequest.cpp
@@ -49,17 +49,17 @@ nsresult TestNativeXMLHttpRequest()
nsCOMPtr<nsIScriptSecurityManager> secman =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
TEST_ENSURE_SUCCESS(rv, "Couldn't get script security manager!");
nsCOMPtr<nsIPrincipal> systemPrincipal;
rv = secman->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
TEST_ENSURE_SUCCESS(rv, "Couldn't get system principal!");
- rv = xhr->Init(systemPrincipal, nullptr, nullptr, nullptr, nullptr);
+ rv = xhr->Init(systemPrincipal, nullptr, nullptr, nullptr);
TEST_ENSURE_SUCCESS(rv, "Couldn't initialize the XHR!");
rv = xhr->Open(getString, testURL, false, empty, empty);
TEST_ENSURE_SUCCESS(rv, "Open failed!");
rv = xhr->Send(nullptr);
TEST_ENSURE_SUCCESS(rv, "Send failed!");
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -228,17 +228,16 @@ XMLHttpRequestMainThread::Init()
return NS_OK;
}
/**
* This Init method should only be called by C++ consumers.
*/
NS_IMETHODIMP
XMLHttpRequestMainThread::Init(nsIPrincipal* aPrincipal,
- nsIScriptContext* aScriptContext,
nsIGlobalObject* aGlobalObject,
nsIURI* aBaseURI,
nsILoadGroup* aLoadGroup)
{
NS_ENSURE_ARG_POINTER(aPrincipal);
Construct(aPrincipal, aGlobalObject, aBaseURI, aLoadGroup);
return NS_OK;
}
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -546,17 +546,16 @@ public:
// received data since the last "progress" event. Also dispatches
// "uploadprogress" as needed.
void MaybeDispatchProgressEvents(bool aFinalProgress);
// This is called by the factory constructor.
nsresult Init();
nsresult init(nsIPrincipal* principal,
- nsIScriptContext* scriptContext,
nsPIDOMWindowInner* globalObject,
nsIURI* baseURI);
void SetRequestObserver(nsIRequestObserver* aObserver);
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(XMLHttpRequestMainThread,
XMLHttpRequest)
bool AllowUploadProgress();
--- a/dom/xhr/nsIXMLHttpRequest.idl
+++ b/dom/xhr/nsIXMLHttpRequest.idl
@@ -274,30 +274,27 @@ interface nsIXMLHttpRequest : nsISupport
attribute boolean withCredentials;
/**
* Initialize the object for use from C++ code with the principal, script
* context, and owner window that should be used.
*
* @param principal The principal to use for the request. This must not be
* null.
- * @param scriptContext The script context to use for the request. May be
- * null.
* @param globalObject The associated global for the request. Can be the
* outer window, a sandbox, or a backstage pass.
* May be null, but then the request cannot create a
* document.
* @param baseURI The base URI to use when resolving relative URIs. May be
* null.
* @param loadGroup An optional load group to use when performing the request.
* This will be used even if the global has a window with a
* load group.
*/
[noscript] void init(in nsIPrincipal principal,
- in nsIScriptContext scriptContext,
in nsIGlobalObject globalObject,
in nsIURI baseURI,
[optional] in nsILoadGroup loadGroup);
/**
* Upload process can be tracked by adding event listener to |upload|.
*/
readonly attribute nsIXMLHttpRequestUpload upload;
--- a/dom/xul/templates/nsXULTemplateQueryProcessorXML.cpp
+++ b/dom/xul/templates/nsXULTemplateQueryProcessorXML.cpp
@@ -152,26 +152,21 @@ nsXULTemplateQueryProcessorXML::GetDatas
nsIPrincipal *docPrincipal = doc->NodePrincipal();
bool hasHadScriptObject = true;
nsIScriptGlobalObject* scriptObject =
doc->GetScriptHandlingObject(hasHadScriptObject);
NS_ENSURE_STATE(scriptObject);
- nsIScriptContext *context = scriptObject->GetContext();
- NS_ENSURE_TRUE(context, NS_OK);
-
nsCOMPtr<nsIXMLHttpRequest> req =
do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- rv = req->Init(docPrincipal, context,
- scriptObject ? scriptObject : doc->GetScopeObject(),
- nullptr, nullptr);
+ rv = req->Init(docPrincipal, scriptObject, nullptr, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
rv = req->Open(NS_LITERAL_CSTRING("GET"), uriStr, true,
EmptyString(), EmptyString());
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<EventTarget> target(do_QueryInterface(req));
rv = target->AddEventListener(NS_LITERAL_STRING("load"), this, false);