Bug 931249 - Patch 1.1 - Set baseURI when script is obtained from cache. r=khuey

This commit is contained in:
Nikhil Marathe 2015-03-18 16:14:30 -07:00
parent 1b4eb261a9
commit ad93de8c47

View File

@ -973,6 +973,7 @@ private:
DataReceivedFromCache(uint32_t aIndex, const uint8_t* aString,
uint32_t aStringLen)
{
AssertIsOnMainThread();
MOZ_ASSERT(aIndex < mLoadInfos.Length());
ScriptLoadInfo& loadInfo = mLoadInfos[aIndex];
MOZ_ASSERT(loadInfo.mCacheStatus == ScriptLoadInfo::Cached);
@ -982,11 +983,18 @@ private:
MOZ_ASSERT(!loadInfo.mScriptTextBuf);
DebugOnly<nsresult> rv =
nsresult rv =
nsScriptLoader::ConvertToUTF16(nullptr, aString, aStringLen,
NS_LITERAL_STRING("UTF-8"), parentDoc,
loadInfo.mScriptTextBuf,
loadInfo.mScriptTextLength);
if (NS_SUCCEEDED(rv) && IsMainWorkerScript()) {
nsCOMPtr<nsIURI> finalURI;
rv = NS_NewURI(getter_AddRefs(finalURI), loadInfo.mFullURL, nullptr, nullptr);
if (NS_SUCCEEDED(rv)) {
mWorkerPrivate->SetBaseURI(finalURI);
}
}
if (NS_SUCCEEDED(rv)) {
DataReceived();