Issue #1603 - Part 1: Reorganize ScriptLoader/ScriptElement

- Moves scripting parts of DOM into 'dom/script'
- Renames nsScript{Loader/Element} to Script{Loader/Element}
- Adjusts all callers
This commit is contained in:
Moonchild 2020-06-30 11:32:07 +00:00 committed by Roy Tam
commit f85b274e94
50 changed files with 554 additions and 514 deletions

View file

@ -34,7 +34,6 @@
#include "nsIPipe.h"
#include "nsIOutputStream.h"
#include "nsPrintfCString.h"
#include "nsScriptLoader.h"
#include "nsString.h"
#include "nsStreamUtils.h"
#include "nsTArray.h"
@ -58,6 +57,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseNativeHandler.h"
#include "mozilla/dom/Response.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/SRILogHelper.h"
#include "mozilla/UniquePtr.h"
@ -1075,14 +1075,14 @@ private:
// May be null.
nsIDocument* parentDoc = mWorkerPrivate->GetDocument();
// Use the regular nsScriptLoader for this grunt work! Should be just fine
// Use the regular ScriptLoader for this grunt work! Should be just fine
// because we're running on the main thread.
// Unlike <script> tags, Worker scripts are always decoded as UTF-8,
// per spec. So we explicitly pass in the charset hint.
rv = nsScriptLoader::ConvertToUTF16(aLoadInfo.mChannel, aString, aStringLen,
NS_LITERAL_STRING("UTF-8"), parentDoc,
aLoadInfo.mScriptTextBuf,
aLoadInfo.mScriptTextLength);
rv = ScriptLoader::ConvertToUTF16(aLoadInfo.mChannel, aString, aStringLen,
NS_LITERAL_STRING("UTF-8"), parentDoc,
aLoadInfo.mScriptTextBuf,
aLoadInfo.mScriptTextLength);
if (NS_FAILED(rv)) {
return rv;
}
@ -1289,10 +1289,10 @@ private:
MOZ_ASSERT(!loadInfo.mScriptTextBuf);
nsresult rv =
nsScriptLoader::ConvertToUTF16(nullptr, aString, aStringLen,
NS_LITERAL_STRING("UTF-8"), parentDoc,
loadInfo.mScriptTextBuf,
loadInfo.mScriptTextLength);
ScriptLoader::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);