JSModuleLoader's printableModuleKey() should never throw.
https://bugs.webkit.org/show_bug.cgi?id=206461
<rdar://problem/58696678>

Reviewed by Michael Saboff.

JSTests:

* stress/printableModuleKey-should-never-throw.js: Added.

Source/JavaScriptCore:

Hence, it should be using a CatchScope instead of a ThrowScope.

* runtime/JSModuleLoader.cpp:
(JSC::printableModuleKey):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@254783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JSTests/ChangeLog b/JSTests/ChangeLog
index 22b7115..bf3483a 100644
--- a/JSTests/ChangeLog
+++ b/JSTests/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-17  Mark Lam  <mark.lam@apple.com>
+
+        JSModuleLoader's printableModuleKey() should never throw.
+        https://bugs.webkit.org/show_bug.cgi?id=206461
+        <rdar://problem/58696678>
+
+        Reviewed by Michael Saboff.
+
+        * stress/printableModuleKey-should-never-throw.js: Added.
+
 2020-01-17  Alexey Shvayka  <shvaikalesh@gmail.com>
 
         JSON.parse should lookup prototype chains during revival
diff --git a/JSTests/stress/printableModuleKey-should-never-throw.js b/JSTests/stress/printableModuleKey-should-never-throw.js
new file mode 100644
index 0000000..380a7a3
--- /dev/null
+++ b/JSTests/stress/printableModuleKey-should-never-throw.js
@@ -0,0 +1,3 @@
+//@ runDefault
+
+import(0);
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index e50c4c7..0d521a1 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,16 @@
+2020-01-17  Mark Lam  <mark.lam@apple.com>
+
+        JSModuleLoader's printableModuleKey() should never throw.
+        https://bugs.webkit.org/show_bug.cgi?id=206461
+        <rdar://problem/58696678>
+
+        Reviewed by Michael Saboff.
+
+        Hence, it should be using a CatchScope instead of a ThrowScope.
+
+        * runtime/JSModuleLoader.cpp:
+        (JSC::printableModuleKey):
+
 2020-01-17  Justin Michaud  <justin_michaud@apple.com>
 
         Separate storage of Structure::m_offset into transition and max offset
diff --git a/Source/JavaScriptCore/runtime/JSModuleLoader.cpp b/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
index 4a1a91f..1e27bc8 100644
--- a/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
+++ b/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
@@ -116,7 +116,7 @@
 static String printableModuleKey(JSGlobalObject* globalObject, JSValue key)
 {
     VM& vm = globalObject->vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
+    auto scope = DECLARE_CATCH_SCOPE(vm);
     if (key.isString() || key.isSymbol()) {
         auto propertyName = key.toPropertyKey(globalObject);
         scope.assertNoException(); // This is OK since this function is just for debugging purpose.