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

--HG--
extra : rebase_source : f8bd9b047518b3e5e220eddc3eab1f0918b83f6b
This commit is contained in:
Nikhil Marathe 2015-03-18 16:14:30 -07:00
Родитель 238374c507
Коммит e0c3f020d5
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -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();