mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-25 22:29:07 +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);
|
||||
|
||||
uriStr = tmp;
|
||||
}
|
||||
|
||||
rv = NS_OpenURI(getter_AddRefs(instream), uri, serv,
|
||||
nsnull, nsnull, nsIRequest::LOAD_NORMAL,
|
||||
getter_AddRefs(chan));
|
||||
}
|
||||
|
||||
// Instead of calling NS_OpenURI, we create the channel ourselves and call
|
||||
// SetContentType, to avoid expensive MIME type lookups (bug 632490).
|
||||
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))
|
||||
{
|
||||
errmsg = JS_NewStringCopyZ (cx, LOAD_ERROR_NOSTREAM);
|
||||
|
Loading…
x
Reference in New Issue
Block a user