зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1806169 - Use UTF8 parser for Worklet code r=hsivonen
Depends on D164933 Differential Revision: https://phabricator.services.mozilla.com/D164934
This commit is contained in:
Родитель
00961cc947
Коммит
c3f0a80601
|
@ -34,7 +34,8 @@ namespace mozilla::dom {
|
|||
class ExecutionRunnable final : public Runnable {
|
||||
public:
|
||||
ExecutionRunnable(WorkletFetchHandler* aHandler, WorkletImpl* aWorkletImpl,
|
||||
JS::UniqueTwoByteChars aScriptBuffer, size_t aScriptLength)
|
||||
UniquePtr<Utf8Unit[], JS::FreePolicy> aScriptBuffer,
|
||||
size_t aScriptLength)
|
||||
: Runnable("Worklet::ExecutionRunnable"),
|
||||
mHandler(aHandler),
|
||||
mWorkletImpl(aWorkletImpl),
|
||||
|
@ -59,7 +60,7 @@ class ExecutionRunnable final : public Runnable {
|
|||
|
||||
RefPtr<WorkletFetchHandler> mHandler;
|
||||
RefPtr<WorkletImpl> mWorkletImpl;
|
||||
JS::UniqueTwoByteChars mScriptBuffer;
|
||||
UniquePtr<Utf8Unit[], JS::FreePolicy> mScriptBuffer;
|
||||
size_t mScriptLength;
|
||||
JSRuntime* mParentRuntime;
|
||||
nsresult mResult;
|
||||
|
@ -243,11 +244,11 @@ class WorkletFetchHandler final : public PromiseNativeHandler,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::UniqueTwoByteChars scriptTextBuf;
|
||||
UniquePtr<Utf8Unit[], JS::FreePolicy> scriptTextBuf;
|
||||
size_t scriptTextLength;
|
||||
nsresult rv =
|
||||
ScriptLoader::ConvertToUTF16(nullptr, aString, aStringLen, u"UTF-8"_ns,
|
||||
nullptr, scriptTextBuf, scriptTextLength);
|
||||
ScriptLoader::ConvertToUTF8(nullptr, aString, aStringLen, u"UTF-8"_ns,
|
||||
nullptr, scriptTextBuf, scriptTextLength);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
RejectPromises(rv);
|
||||
return NS_OK;
|
||||
|
@ -387,7 +388,7 @@ bool ExecutionRunnable::ParseAndLinkModule(
|
|||
compileOptions.setIsRunOnce(true);
|
||||
compileOptions.setNoScriptRval(true);
|
||||
|
||||
JS::SourceText<char16_t> buffer;
|
||||
JS::SourceText<Utf8Unit> buffer;
|
||||
if (!buffer.init(aCx, std::move(mScriptBuffer), mScriptLength)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче