summaryrefslogtreecommitdiffstats
path: root/dom/script/ModuleScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/script/ModuleScript.cpp')
-rw-r--r--dom/script/ModuleScript.cpp43
1 files changed, 17 insertions, 26 deletions
diff --git a/dom/script/ModuleScript.cpp b/dom/script/ModuleScript.cpp
index 28b97a3cb..1bf9d0b0f 100644
--- a/dom/script/ModuleScript.cpp
+++ b/dom/script/ModuleScript.cpp
@@ -26,7 +26,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ModuleScript)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLoader)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBaseURL)
tmp->UnlinkModuleRecord();
- tmp->mError.setUndefined();
+ tmp->mParseError.setUndefined();
+ tmp->mErrorToRethrow.setUndefined();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ModuleScript)
@@ -35,7 +36,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ModuleScript)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mModuleRecord)
- NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mError)
+ NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mParseError)
+ NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mErrorToRethrow)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(ModuleScript)
@@ -48,7 +50,8 @@ ModuleScript::ModuleScript(ScriptLoader *aLoader, nsIURI* aBaseURL)
MOZ_ASSERT(mLoader);
MOZ_ASSERT(mBaseURL);
MOZ_ASSERT(!mModuleRecord);
- MOZ_ASSERT(mError.isUndefined());
+ MOZ_ASSERT(!HasParseError());
+ MOZ_ASSERT(!HasErrorToRethrow());
}
void
@@ -74,7 +77,8 @@ void
ModuleScript::SetModuleRecord(JS::Handle<JSObject*> aModuleRecord)
{
MOZ_ASSERT(!mModuleRecord);
- MOZ_ASSERT(mError.isUndefined());
+ MOZ_ASSERT(!HasParseError());
+ MOZ_ASSERT(!HasErrorToRethrow());
mModuleRecord = aModuleRecord;
@@ -85,37 +89,24 @@ ModuleScript::SetModuleRecord(JS::Handle<JSObject*> aModuleRecord)
}
void
-ModuleScript::SetPreInstantiationError(const JS::Value& aError)
+ModuleScript::SetParseError(const JS::Value& aError)
{
MOZ_ASSERT(!aError.isUndefined());
+ MOZ_ASSERT(!HasParseError());
+ MOZ_ASSERT(!HasErrorToRethrow());
UnlinkModuleRecord();
- mError = aError;
-
+ mParseError = aError;
HoldJSObjects(this);
}
-bool
-ModuleScript::IsErrored() const
-{
- if (!mModuleRecord) {
- MOZ_ASSERT(!mError.isUndefined());
- return true;
- }
-
- return JS::IsModuleErrored(mModuleRecord);
-}
-
-JS::Value
-ModuleScript::Error() const
+void
+ModuleScript::SetErrorToRethrow(const JS::Value& aError)
{
- MOZ_ASSERT(IsErrored());
-
- if (!mModuleRecord) {
- return mError;
- }
+ MOZ_ASSERT(!aError.isUndefined());
+ MOZ_ASSERT(!HasErrorToRethrow());
- return JS::GetModuleError(mModuleRecord);
+ mErrorToRethrow = aError;
}
} // dom namespace