mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 632490: Use a content-type hint in mozJSSubScriptLoader::LoadSubScript. r=shaver a=blocking-fennec
--HG-- extra : rebase_source : ff4aba30c6ac11b97921c368d8220a63d698692d
This commit is contained in:
parent
ae544d7e57
commit
716e09f70f
@ -323,11 +323,18 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
|
|||||||
tmp.Append(uriStr);
|
tmp.Append(uriStr);
|
||||||
|
|
||||||
uriStr = tmp;
|
uriStr = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = NS_OpenURI(getter_AddRefs(instream), uri, serv,
|
// Instead of calling NS_OpenURI, we create the channel ourselves and call
|
||||||
nsnull, nsnull, nsIRequest::LOAD_NORMAL,
|
// SetContentType, to avoid expensive MIME type lookups (bug 632490).
|
||||||
getter_AddRefs(chan));
|
rv = NS_NewChannel(getter_AddRefs(chan), uri, serv,
|
||||||
|
nsnull, nsnull, nsIRequest::LOAD_NORMAL);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
{
|
||||||
|
chan->SetContentType(NS_LITERAL_CSTRING("application/javascript"));
|
||||||
|
rv = chan->Open(getter_AddRefs(instream));
|
||||||
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
{
|
{
|
||||||
errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_NOSTREAM);
|
errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_NOSTREAM);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user