summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/record-tuple/compartments.js
blob: ce05db021e14b90c658d39cc7ac6e8dff5f7447c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// |jit-test| --more-compartments; skip-if: !this.hasOwnProperty("Record")
const realm = newGlobal();

const realm_record = realm.eval(`Record({ x: 1, y: 2 })`);

assertEq(realm_record === #{ x: 1, y: 2 }, true);

const realm_tuple = realm.eval(`Tuple(1, 2, 3)`);

assertEq(realm_tuple === #[1, 2, 3], true);

// Test that an object can point to a record in a different realm
const realm2 = newGlobal();

const realm2_object = realm.eval(`new Object()`);

realm2_object['r'] = realm_record;

assertEq(realm2_object['r'] === #{"x": 1, "y": 2}, true);