Index: test/mjsunit/es6/symbols.js |
diff --git a/test/mjsunit/es6/symbols.js b/test/mjsunit/es6/symbols.js |
index 58142cf27f04be74707acda6840a2ca8f9305eea..d071cbc01a2bd4280a5507c818451202e7a42c83 100644 |
--- a/test/mjsunit/es6/symbols.js |
+++ b/test/mjsunit/es6/symbols.js |
@@ -526,3 +526,26 @@ function TestComparison() { |
} |
} |
TestComparison(); |
+ |
+ |
+// Make sure that throws occur in the context of the Symbol function. |
+function TestContext() { |
+ var r = Realm.create(); |
+ var rSymbol = Realm.eval(r, "Symbol"); |
+ var rError = Realm.eval(r, "TypeError"); |
+ |
+ function verifier(symbol, error) { |
+ try { |
+ new symbol(); |
+ } catch(e) { |
+ return e.__proto__ === error.__proto__; |
+ } |
+ assertTrue(false); // should never get here. |
+ } |
+ |
+ assertTrue(verifier(Symbol, TypeError())); |
+ assertTrue(verifier(rSymbol, rError())); |
+ assertFalse(verifier(Symbol, rError())); |
+ assertFalse(verifier(rSymbol, TypeError())); |
+} |
+TestContext(); |