Merge mozilla-central to mozilla-inbound. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Sat, 12 Jan 2019 23:40:31 +0200
changeset 453664 0ed38259d2d8e55dd6e00c5ba53cf21a6a390d78
parent 453663 4abb81088a9b49d700cfea840848a9dac6a0010d (current diff)
parent 453638 895c1242462121fe44f1bcb1aa57b412eaa7a167 (diff)
child 453665 9e3564442734c89fa1b735ff8662588576cf0115
push id35365
push userdvarga@mozilla.com
push dateSun, 13 Jan 2019 10:05:55 +0000
treeherdermozilla-central@1218e374fbc7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to mozilla-inbound. CLOSED TREE
devtools/client/responsive.html/images/screenshot.svg
--- a/devtools/client/netmonitor/src/assets/styles/RequestList.css
+++ b/devtools/client/netmonitor/src/assets/styles/RequestList.css
@@ -147,21 +147,21 @@
   width: 7px;
   height: 4px;
   margin-inline-start: 3px;
   margin-inline-end: 6px;
   vertical-align: middle;
 }
 
 .requests-list-header-button[data-sorted=ascending] > .button-icon {
-  background-image: var(--sort-ascending-image);
+  background-image: url("chrome://devtools/skin/images/sort-ascending-arrow.svg");
 }
 
 .requests-list-header-button[data-sorted=descending] > .button-icon {
-  background-image: var(--sort-descending-image);
+  background-image: url("chrome://devtools/skin/images/sort-descending-arrow.svg");
 }
 
 .requests-list-header-button[data-sorted],
 .requests-list-header-button[data-sorted]:hover {
   background-color: var(--theme-selection-background);
   color: var(--theme-selection-color);
 }
 
--- a/devtools/client/netmonitor/src/assets/styles/Toolbar.css
+++ b/devtools/client/netmonitor/src/assets/styles/Toolbar.css
@@ -46,21 +46,21 @@
 }
 
 .devtools-button.devtools-pause-icon::before,
 .devtools-button.devtools-play-icon::before {
   margin-bottom: 1px;
 }
 
 .devtools-button.devtools-pause-icon::before {
-  background-image: var(--pause-icon-url);
+  background-image: url("chrome://devtools/skin/images/pause.svg");
 }
 
 .devtools-button.devtools-play-icon::before {
-  background-image: var(--play-icon-url);
+  background-image: url("chrome://devtools/content/netmonitor/src/assets/icons/play.svg");
 }
 
 /* HAR button */
 
 #devtools-har-button {
   margin-inline-end: 10px;
   padding-left: 2px;
   padding-right: 10px;
--- a/devtools/client/netmonitor/src/assets/styles/variables.css
+++ b/devtools/client/netmonitor/src/assets/styles/variables.css
@@ -9,46 +9,35 @@
 
   --timing-blocked-color: rgba(235, 83, 104, 0.8);
   --timing-dns-color: rgba(223, 128, 255, 0.8); /* pink */
   --timing-ssl-color: rgba(217, 102, 41, 0.8); /* orange */
   --timing-connect-color: rgba(217, 102, 41, 0.8); /* orange */
   --timing-send-color: rgba(70, 175, 227, 0.8); /* light blue */
   --timing-wait-color: rgba(94, 136, 176, 0.8); /* blue grey */
   --timing-receive-color: rgba(112, 191, 83, 0.8); /* green */
-
-  --sort-ascending-image: url(chrome://devtools/skin/images/sort-ascending-arrow.svg);
-  --sort-descending-image: url(chrome://devtools/skin/images/sort-descending-arrow.svg);
 }
 
 :root.theme-light {
   --theme-body-color: var(--grey-70);
 
   --table-text-color: var(--grey-70);
   --table-splitter-color: rgba(0,0,0,0.15);
   --table-zebra-background: rgba(0,0,0,0.05);
 
   --timing-blocked-color: rgba(235, 83, 104, 0.8);
   --timing-dns-color: rgba(223, 128, 255, 0.8); /* pink */
   --timing-ssl-color: rgba(217, 102, 41, 0.8); /* orange */
   --timing-connect-color: rgba(217, 102, 41, 0.8); /* orange */
   --timing-send-color: rgba(0, 136, 204, 0.8); /* blue */
   --timing-wait-color: rgba(95, 136, 176, 0.8); /* blue grey */
   --timing-receive-color: rgba(44, 187, 15, 0.8); /* green */
-
-  --sort-ascending-image: url(chrome://devtools/skin/images/sort-ascending-arrow.svg);
-  --sort-descending-image: url(chrome://devtools/skin/images/sort-descending-arrow.svg);
 }
 
 :root {
   --primary-toolbar-height: 29px;
-
-  /* Icons */
-  --play-icon-url: url("chrome://devtools/content/netmonitor/src/assets/icons/play.svg");
-  --pause-icon-url: url("chrome://devtools/skin/images/pause.svg");
-
   /* HTTP status codes */
   --status-code-color-1xx: var(--theme-highlight-blue);
   --status-code-color-2xx: var(--theme-highlight-green);
   --status-code-color-3xx: transparent;
   --status-code-color-4xx: var(--theme-highlight-pink);
   --status-code-color-5xx: var(--theme-highlight-red);
 }
--- a/devtools/client/responsive.html/images/moz.build
+++ b/devtools/client/responsive.html/images/moz.build
@@ -2,11 +2,10 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DevToolsModules(
     'grippers.svg',
     'rotate-viewport.svg',
-    'screenshot.svg',
     'touch-events.svg',
 )
deleted file mode 100644
--- a/devtools/client/responsive.html/images/screenshot.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="context-fill #0b0b0b">
-  <path d="M14.4,4.1h-3l0-1.3c0-0.9-1.2-1.6-2.1-1.6H6.6c-0.9,0-1.9,0.7-1.9,1.6l0,1.3h-3c-0.9,0-1.6,0.7-1.6,1.6v7.4c0,0.9,0.7,1.3,1.6,1.3h12.7c0.9,0,1.6-0.3,1.6-1.3V5.7C16,4.8,15.3,4.1,14.4,4.1z M14.8,13.2H1.2v-8h4.5l0-3h4.5l0,3h4.4L14.8,13.2z"/>
-  <path d="M8,6.7c-1.3,0-2.4,1.1-2.4,2.4s1.1,2.4,2.4,2.4s2.4-1.1,2.4-2.4S9.3,6.7,8,6.7z M8,10.2c-0.7,0-1.2-0.5-1.2-1.1S7.3,8,8,8s1.2,0.5,1.2,1.1S8.7,10.2,8,10.2z"/>
-</svg>
--- a/devtools/client/responsive.html/index.css
+++ b/devtools/client/responsive.html/index.css
@@ -130,17 +130,17 @@ body,
   width: 100%;
 }
 
 #touch-simulation-button::before {
   background-image: url("./images/touch-events.svg");
 }
 
 #screenshot-button::before {
-  background-image: url("./images/screenshot.svg");
+  background-image: url("chrome://devtools/skin/images/command-screenshot.svg");
 }
 
 #settings-button::before {
   background-image: url("chrome://devtools/skin/images/settings.svg");
 }
 
 #exit-button::before {
   background-image: url("chrome://devtools/skin/images/close.svg");
--- a/devtools/client/themes/images/sort-ascending-arrow.svg
+++ b/devtools/client/themes/images/sort-ascending-arrow.svg
@@ -1,8 +1,6 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<svg xmlns="http://www.w3.org/2000/svg"
-     width="7" height="4" viewBox="0 0 7 4">
-  <path d="M0,4 L3.5,0 L7,4" fill="#edf0f1" fill-opacity="0.8"/>
+<svg xmlns="http://www.w3.org/2000/svg" width="7" height="4" viewBox="0 0 7 4">
+  <path d="M0,4 L3.5,0 L7,4" fill="#f9f9fa" fill-opacity="0.8"/>
 </svg>
-
--- a/devtools/client/themes/images/sort-descending-arrow.svg
+++ b/devtools/client/themes/images/sort-descending-arrow.svg
@@ -1,8 +1,6 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<svg xmlns="http://www.w3.org/2000/svg"
-     width="7" height="4" viewBox="0 0 7 4">
-  <path d="M0,0 L3.5,4 L7,0" fill="#edf0f1" fill-opacity="0.8"/>
+<svg xmlns="http://www.w3.org/2000/svg" width="7" height="4" viewBox="0 0 7 4">
+  <path d="M0,0 L3.5,4 L7,0" fill="#f9f9fa" fill-opacity="0.8"/>
 </svg>
-
--- a/dom/media/webaudio/AudioNodeEngine.cpp
+++ b/dom/media/webaudio/AudioNodeEngine.cpp
@@ -2,17 +2,17 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AudioNodeEngine.h"
 
 #include "mozilla/AbstractThread.h"
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
 #include "mozilla/arm.h"
 #include "AudioNodeEngineNEON.h"
 #endif
 #ifdef USE_SSE2
 #include "mozilla/SSE.h"
 #include "AlignmentUtils.h"
 #include "AudioNodeEngineSSE2.h"
 #endif
@@ -57,17 +57,17 @@ void AudioBufferCopyWithScale(const floa
     for (uint32_t i = 0; i < aSize; ++i) {
       aOutput[i] = aInput[i] * aScale;
     }
   }
 }
 
 void AudioBufferAddWithScale(const float* aInput, float aScale, float* aOutput,
                              uint32_t aSize) {
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
   if (mozilla::supports_neon()) {
     AudioBufferAddWithScale_NEON(aInput, aScale, aOutput, aSize);
     return;
   }
 #endif
 
 #ifdef USE_SSE2
   if (mozilla::supports_sse2()) {
@@ -117,17 +117,17 @@ void AudioBlockAddChannelWithScale(const
   AudioBufferAddWithScale(aInput, aScale, aOutput, WEBAUDIO_BLOCK_SIZE);
 }
 
 void AudioBlockCopyChannelWithScale(const float* aInput, float aScale,
                                     float* aOutput) {
   if (aScale == 1.0f) {
     memcpy(aOutput, aInput, WEBAUDIO_BLOCK_SIZE * sizeof(float));
   } else {
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
     if (mozilla::supports_neon()) {
       AudioBlockCopyChannelWithScale_NEON(aInput, aScale, aOutput);
       return;
     }
 #endif
 
 #ifdef USE_SSE2
     if (mozilla::supports_sse2()) {
@@ -172,17 +172,17 @@ float AudioBufferPeakValue(const float* 
     }
   }
   return max;
 }
 
 void AudioBlockCopyChannelWithScale(const float aInput[WEBAUDIO_BLOCK_SIZE],
                                     const float aScale[WEBAUDIO_BLOCK_SIZE],
                                     float aOutput[WEBAUDIO_BLOCK_SIZE]) {
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
   if (mozilla::supports_neon()) {
     AudioBlockCopyChannelWithScale_NEON(aInput, aScale, aOutput);
     return;
   }
 #endif
 
 #ifdef USE_SSE2
   if (mozilla::supports_sse2()) {
@@ -204,17 +204,17 @@ void AudioBlockInPlaceScale(float aBlock
                             float aScale[WEBAUDIO_BLOCK_SIZE]) {
   AudioBufferInPlaceScale(aBlock, aScale, WEBAUDIO_BLOCK_SIZE);
 }
 
 void AudioBufferInPlaceScale(float* aBlock, float aScale, uint32_t aSize) {
   if (aScale == 1.0f) {
     return;
   }
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
   if (mozilla::supports_neon()) {
     AudioBufferInPlaceScale_NEON(aBlock, aScale, aSize);
     return;
   }
 #endif
 
 #ifdef USE_SSE2
   if (mozilla::supports_sse2()) {
@@ -224,17 +224,17 @@ void AudioBufferInPlaceScale(float* aBlo
 #endif
 
   for (uint32_t i = 0; i < aSize; ++i) {
     *aBlock++ *= aScale;
   }
 }
 
 void AudioBufferInPlaceScale(float* aBlock, float* aScale, uint32_t aSize) {
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
   if (mozilla::supports_neon()) {
     AudioBufferInPlaceScale_NEON(aBlock, aScale, aSize);
     return;
   }
 #endif
 
 #ifdef USE_SSE2
   if (mozilla::supports_sse2()) {
@@ -265,17 +265,17 @@ void AudioBlockPanMonoToStereo(const flo
   AudioBlockCopyChannelWithScale(aInput, aGainR, aOutputR);
 }
 
 void AudioBlockPanStereoToStereo(const float aInputL[WEBAUDIO_BLOCK_SIZE],
                                  const float aInputR[WEBAUDIO_BLOCK_SIZE],
                                  float aGainL, float aGainR, bool aIsOnTheLeft,
                                  float aOutputL[WEBAUDIO_BLOCK_SIZE],
                                  float aOutputR[WEBAUDIO_BLOCK_SIZE]) {
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
   if (mozilla::supports_neon()) {
     AudioBlockPanStereoToStereo_NEON(aInputL, aInputR, aGainL, aGainR,
                                      aIsOnTheLeft, aOutputL, aOutputR);
     return;
   }
 #endif
 
 #ifdef USE_SSE2
@@ -303,17 +303,17 @@ void AudioBlockPanStereoToStereo(const f
 
 void AudioBlockPanStereoToStereo(const float aInputL[WEBAUDIO_BLOCK_SIZE],
                                  const float aInputR[WEBAUDIO_BLOCK_SIZE],
                                  float aGainL[WEBAUDIO_BLOCK_SIZE],
                                  float aGainR[WEBAUDIO_BLOCK_SIZE],
                                  bool aIsOnTheLeft[WEBAUDIO_BLOCK_SIZE],
                                  float aOutputL[WEBAUDIO_BLOCK_SIZE],
                                  float aOutputR[WEBAUDIO_BLOCK_SIZE]) {
-#ifdef BUILD_ARM_NEON
+#ifdef USE_NEON
   if (mozilla::supports_neon()) {
     AudioBlockPanStereoToStereo_NEON(aInputL, aInputR, aGainL, aGainR,
                                      aIsOnTheLeft, aOutputL, aOutputR);
     return;
   }
 #endif
 
   uint32_t i;
--- a/dom/media/webaudio/AudioNodeEngineNEON.cpp
+++ b/dom/media/webaudio/AudioNodeEngineNEON.cpp
@@ -1,15 +1,19 @@
 /* -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* this source code form is subject to the terms of the mozilla public
  * license, v. 2.0. if a copy of the mpl was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AudioNodeEngineNEON.h"
+#if defined(_MSC_VER) && defined(_M_ARM64)
+#include <arm64_neon.h>
+#else
 #include <arm_neon.h>
+#endif
 
 //#ifdef DEBUG
 #if 0  // see bug 921099
 #define ASSERT_ALIGNED(ptr)                                     \
   MOZ_ASSERT((((uintptr_t)ptr + 15) & ~0x0F) == (uintptr_t)ptr, \
              #ptr " has to be aligned 16-bytes aligned.");
 #else
 #define ASSERT_ALIGNED(ptr)
@@ -266,19 +270,25 @@ void AudioBlockPanStereoToStereo_NEON(
   float32x4_t vinL0, vinL1;
   float32x4_t vinR0, vinR1;
   float32x4_t voutL0, voutL1;
   float32x4_t voutR0, voutR1;
   float32x4_t vscaleL0, vscaleL1;
   float32x4_t vscaleR0, vscaleR1;
   float32x4_t onleft0, onleft1, notonleft0, notonleft1;
 
-  float32x4_t zero = {0, 0, 0, 0};
+  float32x4_t zero = vmovq_n_f32(0);
   uint8x8_t isOnTheLeft;
 
+  // Although MSVC throws uninitialized value warning for voutL0 and voutL1,
+  // since we fill all lanes by vsetq_lane_f32, we can ignore it. But to avoid
+  // compiler warning, set zero.
+  voutL0 = zero;
+  voutL1 = zero;
+
   for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i += 8) {
     vinL0 = vld1q_f32(ADDRESS_OF(aInputL, i));
     vinL1 = vld1q_f32(ADDRESS_OF(aInputL, i + 4));
 
     vinR0 = vld1q_f32(ADDRESS_OF(aInputR, i));
     vinR1 = vld1q_f32(ADDRESS_OF(aInputR, i + 4));
 
     vscaleL0 = vld1q_f32(ADDRESS_OF(aGainL, i));
--- a/dom/media/webaudio/moz.build
+++ b/dom/media/webaudio/moz.build
@@ -115,22 +115,24 @@ UNIFIED_SOURCES += [
     'PeriodicWave.cpp',
     'ScriptProcessorNode.cpp',
     'StereoPannerNode.cpp',
     'ThreeDPoint.cpp',
     'WaveShaperNode.cpp',
     'WebAudioUtils.cpp',
 ]
 
-if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['BUILD_ARM_NEON']:
+if CONFIG['CPU_ARCH'] == 'aarch64' or CONFIG['BUILD_ARM_NEON']:
+    DEFINES['USE_NEON'] = True
     SOURCES += ['AudioNodeEngineNEON.cpp']
     SOURCES['AudioNodeEngineNEON.cpp'].flags += CONFIG['NEON_FLAGS']
-    LOCAL_INCLUDES += [
-        '/media/openmax_dl/dl/api/'
-    ]
+    if CONFIG['BUILD_ARM_NEON']:
+        LOCAL_INCLUDES += [
+            '/media/openmax_dl/dl/api/'
+        ]
 
 # Are we targeting x86 or x64?  If so, build SSE2 files.
 if CONFIG['INTEL_ARCHITECTURE']:
     SOURCES += ['AudioNodeEngineSSE2.cpp']
     DEFINES['USE_SSE2'] = True
     SOURCES['AudioNodeEngineSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
 
 
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -603,40 +603,36 @@ bool js::regexp_construct_raw_flags(JSCo
   }
 
   // Step 8.
   regexp->initAndZeroLastIndex(sourceAtom, RegExpFlag(flags), cx);
   args.rval().setObject(*regexp);
   return true;
 }
 
-MOZ_ALWAYS_INLINE bool IsRegExpPrototype(HandleValue v) {
-  if (IsRegExpObject(v) || !v.isObject()) {
-    return false;
-  }
-
-  // Note: The prototype shares its JSClass with instances.
-  return StandardProtoKeyOrNull(&v.toObject()) == JSProto_RegExp;
+MOZ_ALWAYS_INLINE bool IsRegExpPrototype(HandleValue v, JSContext* cx) {
+  return (v.isObject() &&
+          cx->global()->maybeGetRegExpPrototype() == &v.toObject());
 }
 
 // ES 2017 draft 21.2.5.4.
 MOZ_ALWAYS_INLINE bool regexp_global_impl(JSContext* cx, const CallArgs& args) {
   MOZ_ASSERT(IsRegExpObject(args.thisv()));
 
   // Steps 4-6.
   RegExpObject* reObj = &args.thisv().toObject().as<RegExpObject>();
   args.rval().setBoolean(reObj->global());
   return true;
 }
 
 bool js::regexp_global(JSContext* cx, unsigned argc, JS::Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   // Step 3.a.
-  if (IsRegExpPrototype(args.thisv())) {
+  if (IsRegExpPrototype(args.thisv(), cx)) {
     args.rval().setUndefined();
     return true;
   }
 
   // Steps 1-3.
   return CallNonGenericMethod<IsRegExpObject, regexp_global_impl>(cx, args);
 }
 
@@ -650,17 +646,17 @@ MOZ_ALWAYS_INLINE bool regexp_ignoreCase
   args.rval().setBoolean(reObj->ignoreCase());
   return true;
 }
 
 bool js::regexp_ignoreCase(JSContext* cx, unsigned argc, JS::Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   // Step 3.a.
-  if (IsRegExpPrototype(args.thisv())) {
+  if (IsRegExpPrototype(args.thisv(), cx)) {
     args.rval().setUndefined();
     return true;
   }
 
   // Steps 1-3.
   return CallNonGenericMethod<IsRegExpObject, regexp_ignoreCase_impl>(cx, args);
 }
 
@@ -674,17 +670,17 @@ MOZ_ALWAYS_INLINE bool regexp_multiline_
   args.rval().setBoolean(reObj->multiline());
   return true;
 }
 
 bool js::regexp_multiline(JSContext* cx, unsigned argc, JS::Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   // Step 3.a.
-  if (IsRegExpPrototype(args.thisv())) {
+  if (IsRegExpPrototype(args.thisv(), cx)) {
     args.rval().setUndefined();
     return true;
   }
 
   // Steps 1-3.
   return CallNonGenericMethod<IsRegExpObject, regexp_multiline_impl>(cx, args);
 }
 
@@ -708,17 +704,17 @@ MOZ_ALWAYS_INLINE bool regexp_source_imp
   args.rval().setString(str);
   return true;
 }
 
 static bool regexp_source(JSContext* cx, unsigned argc, JS::Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   // Step 3.a.
-  if (IsRegExpPrototype(args.thisv())) {
+  if (IsRegExpPrototype(args.thisv(), cx)) {
     args.rval().setString(cx->names().emptyRegExp);
     return true;
   }
 
   // Steps 1-4.
   return CallNonGenericMethod<IsRegExpObject, regexp_source_impl>(cx, args);
 }
 
@@ -731,17 +727,17 @@ MOZ_ALWAYS_INLINE bool regexp_sticky_imp
   args.rval().setBoolean(reObj->sticky());
   return true;
 }
 
 bool js::regexp_sticky(JSContext* cx, unsigned argc, JS::Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   // Step 3.a.
-  if (IsRegExpPrototype(args.thisv())) {
+  if (IsRegExpPrototype(args.thisv(), cx)) {
     args.rval().setUndefined();
     return true;
   }
 
   // Steps 1-3.
   return CallNonGenericMethod<IsRegExpObject, regexp_sticky_impl>(cx, args);
 }
 
@@ -755,17 +751,17 @@ MOZ_ALWAYS_INLINE bool regexp_unicode_im
   args.rval().setBoolean(reObj->unicode());
   return true;
 }
 
 bool js::regexp_unicode(JSContext* cx, unsigned argc, JS::Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   // Step 3.a.
-  if (IsRegExpPrototype(args.thisv())) {
+  if (IsRegExpPrototype(args.thisv(), cx)) {
     args.rval().setUndefined();
     return true;
   }
 
   // Steps 1-3.
   return CallNonGenericMethod<IsRegExpObject, regexp_unicode_impl>(cx, args);
 }
 
--- a/js/src/jit-test/lib/assert-offset-columns.js
+++ b/js/src/jit-test/lib/assert-offset-columns.js
@@ -10,17 +10,17 @@
 // additional items into this string using items.push("!").
 function assertOffsetColumns(code, expectedBpts, expectedOrdering = null) {
     if (expectedOrdering === null) {
         // The default ordering simply runs the breakpoints in order.
         expectedOrdering = Array.from(expectedBpts.match(/\^/g), (_, i) => i).join(" ");
     }
 
     // Define the function `f` in a new global.
-    const global = newGlobal();
+    const global = newGlobal({newCompartment: true});
 
     const lines = code.split(/\r?\n|\r]/g);
     const initCode = lines.slice(0, -1).join("\n");
     const execCode = lines[lines.length - 1];
 
     // Treat everything but the last line as initialization code.
     global.eval(initCode);
 
--- a/js/src/jit-test/lib/bytecode-cache.js
+++ b/js/src/jit-test/lib/bytecode-cache.js
@@ -6,17 +6,18 @@ function evalWithCache(code, ctx) {
     lineNumber: { value: 0 }
   });
   code = code instanceof Object ? code : cacheEntry(code);
 
   var incremental = ctx.incremental || false;
 
   // We create a new global ...
   if (!("global" in ctx))
-    ctx.global = newGlobal({ cloneSingletons: !incremental });
+      ctx.global = newGlobal({cloneSingletons: !incremental,
+                              newCompartment: ctx.newCompartment});
 
   if (!("isRunOnce" in ctx))
     ctx.isRunOnce = true;
 
   var ctx_save;
   if (incremental)
     ctx_save = Object.create(ctx, {saveIncrementalBytecode: { value: true } });
   else
--- a/js/src/jit-test/lib/evalInFrame.js
+++ b/js/src/jit-test/lib/evalInFrame.js
@@ -1,10 +1,10 @@
 var evalInFrame = (function (global) {
-  var dbgGlobal = newGlobal();
+  var dbgGlobal = newGlobal({newCompartment: true});
   var dbg = new dbgGlobal.Debugger();
 
   return function evalInFrame(upCount, code) {
     dbg.addDebuggee(global);
 
     // Skip ourself.
     var frame = dbg.getNewestFrame().older;
     for (var i = 0; i < upCount; i++) {
--- a/js/src/jit-test/lib/stepping.js
+++ b/js/src/jit-test/lib/stepping.js
@@ -1,14 +1,14 @@
 // Test that stepping through a function stops at the expected lines.
 // `script` is a string, some JS code that evaluates to a function.
 // `expected` is the array of line numbers where stepping is expected to stop
 // when we call the function.
 function testStepping(script, expected) {
-    let g = newGlobal();
+    let g = newGlobal({newCompartment: true});
     let f = g.eval(script);
 
     let log = [];
     function maybePause(frame) {
         let previousLine = log[log.length - 1]; // note: may be undefined
         let line = frame.script.getOffsetLocation(frame.offset).lineNumber;
         if (line !== previousLine)
             log.push(line);
--- a/js/src/jit-test/lib/wasm.js
+++ b/js/src/jit-test/lib/wasm.js
@@ -124,17 +124,17 @@ function wasmFullPassI64(text, expected,
     assertEq(WebAssembly.validate(binary), true, "Must validate.");
 
     let augmentedSrc = _augmentSrc(text, [ { type: 'i64', func: '$run', args, expected } ]);
     let augmentedBinary = wasmTextToBinary(augmentedSrc);
     new WebAssembly.Instance(new WebAssembly.Module(augmentedBinary), maybeImports).exports.assert_0();
 }
 
 function wasmRunWithDebugger(wast, lib, init, done) {
-    let g = newGlobal('');
+    let g = newGlobal({newCompartment: true});
     let dbg = new Debugger(g);
 
     g.eval(`
 var wasm = wasmTextToBinary('${wast}');
 var lib = ${lib || 'undefined'};
 var m = new WebAssembly.Instance(new WebAssembly.Module(wasm), lib);`);
 
     var wasmScript = dbg.findScripts().filter(s => s.format == 'wasm')[0];
--- a/js/src/jit-test/tests/arguments/rest-debugger.js
+++ b/js/src/jit-test/tests/arguments/rest-debugger.js
@@ -1,16 +1,16 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(...x) {}");
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var fw = gw.getOwnPropertyDescriptor("f").value;
 assertEq(fw.parameterNames.toString(), "x");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(...rest) { debugger; }");
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.eval("args = arguments");
 };
 g.f(9, 8, 7);
 
 assertEq(g.args.length, 3);
--- a/js/src/jit-test/tests/asm.js/testBug1236552.js
+++ b/js/src/jit-test/tests/asm.js/testBug1236552.js
@@ -1,3 +1,3 @@
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 Debugger(g).memory.trackingAllocationSites = true;
 evaluate("function h() { 'use asm'; return {}}", { global: g });
--- a/js/src/jit-test/tests/asm.js/testBug893519.js
+++ b/js/src/jit-test/tests/asm.js/testBug893519.js
@@ -1,6 +1,6 @@
 // |jit-test| error:Error; skip-if: !isAsmJSCompilationAvailable()
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 evaluate("function h() { function f() { 'use asm'; function g() { return 42 } return g } return f }", { global:g});
 var h = clone(g.h);
 assertEq(h()()(), 42);
--- a/js/src/jit-test/tests/asm.js/testDebugModeDisables.js
+++ b/js/src/jit-test/tests/asm.js/testDebugModeDisables.js
@@ -1,9 +1,9 @@
 // |jit-test|
 
 load(libdir + "asm.js");
 
 // Turn on debugging for the current global.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new g.Debugger(this);
 
 assertAsmTypeFail("'use asm'; function f() {} return f");
--- a/js/src/jit-test/tests/auto-regress/bug1147907.js
+++ b/js/src/jit-test/tests/auto-regress/bug1147907.js
@@ -1,10 +1,10 @@
 var evalInFrame = (function (global) {
-  var dbgGlobal = newGlobal();
+  var dbgGlobal = newGlobal({newCompartment: true});
   var dbg = new dbgGlobal.Debugger();
   return function evalInFrame(upCount, code) {
     dbg.addDebuggee(global);
     var frame = dbg.getNewestFrame().older;
     var completion = frame.eval(code);
   };
 })(this);
 var x = 5;
--- a/js/src/jit-test/tests/auto-regress/bug1315943.js
+++ b/js/src/jit-test/tests/auto-regress/bug1315943.js
@@ -1,11 +1,11 @@
 var s = "{}";
 for (var i = 0; i < 21; i++) s += s;
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function(frame) {
     var s = frame.eval("f").return.script;
 };
 g.eval("line0 = Error().lineNumber;\n" + "debugger;\n" + // line0 + 1
     "function f(i) {\n" + // line0 + 2
     s + // line0 + 3 ... line0 + where - 2
     "}\n");
--- a/js/src/jit-test/tests/auto-regress/bug1479076.js
+++ b/js/src/jit-test/tests/auto-regress/bug1479076.js
@@ -1,6 +1,6 @@
 fullcompartmentchecks(true);
 var dbg = new Debugger();
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(){}");
 dbg.addDebuggee(g);
 dbg.findScripts();
--- a/js/src/jit-test/tests/auto-regress/bug677386.js
+++ b/js/src/jit-test/tests/auto-regress/bug677386.js
@@ -1,15 +1,15 @@
 // |jit-test| error:ReferenceError
 
 // Binary: cache/js-dbg-64-82545b1e4129-linux
 // Flags:
 //
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var line0 = Error().lineNumber;\n" +
        "function f() {\n" +     // line0 + 1
        "    return 2;\n" +      // line0 + 2
        "}\n");
 var N = 4;
 for (var i = 0; i < N; i++) {
     var dbg = Debugger(g);
     dbg.onDebuggerStatement = function (frame) {
--- a/js/src/jit-test/tests/auto-regress/bug677587.js
+++ b/js/src/jit-test/tests/auto-regress/bug677587.js
@@ -1,11 +1,11 @@
 // Binary: cache/js-dbg-64-f189dd6316eb-linux
 // Flags:
 //
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var a = {};");
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var desc = gw.getOwnPropertyDescriptor("a");
 gw.defineProperty("b", desc);
 Debugger(g.a, g.b);
--- a/js/src/jit-test/tests/auto-regress/bug677977.js
+++ b/js/src/jit-test/tests/auto-regress/bug677977.js
@@ -1,13 +1,13 @@
 // Binary: cache/js-dbg-64-48e43edc8834-linux
 // Flags:
 //
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     var s = frame.eval("f").return.script;
 };
 function test(s) {
     g.eval("line0 = Error().lineNumber;\n" +
            "debugger;\n" +          // line0 + 1
            "function f(i) {\n" +    // line0 + 2
@@ -16,11 +16,11 @@ function test(s) {
 test("i = 128;\n" +  "}\n");
 var hits = 0;
 dbg.onNewScript = function (s) {
     hits++;
 };
 assertEq(g.eval("eval('2 + 3')"), 5);
 this.gczeal(hits, 2);
 var fn = g.evaluate("(function (a) { return 5 + a; })");
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 dbg.addDebuggee(g2, dbg);
 g2.clone(fn);
--- a/js/src/jit-test/tests/auto-regress/bug721497.js
+++ b/js/src/jit-test/tests/auto-regress/bug721497.js
@@ -1,13 +1,13 @@
 // |jit-test| error:ReferenceError
 
 // Binary: cache/js-dbg-64-edf8075b0333-linux
 // Flags:
 //
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     assertEq(dumpStack(), true);
 };
 g.eval("function f(a, [b, c], {x: [y], z: w}, {q}) { debugger; }");
 g.eval("f(1, [2, 3], {x: [4], z: 5}, {q: 6});");
--- a/js/src/jit-test/tests/auto-regress/bug797493.js
+++ b/js/src/jit-test/tests/auto-regress/bug797493.js
@@ -1,15 +1,15 @@
 // |jit-test| error:ReferenceError
 
 // Binary: cache/js-dbg-64-13fd49ef7786-linux
 // Flags:
 //
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     frame.onPop = function handlePop(c) {
       poppedFrames.indexOf(this)
     }
 };
 g.eval("function* g() { for (var i = 0; i < 10; i++) { debugger; yield i; } }");
 assertEq(g.eval("var t = 0; for (j of g()) t += j; t;"), 45);
--- a/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js
+++ b/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js
@@ -1,14 +1,14 @@
 // |jit-test| error:ReferenceError
 
 // for-of should close iterator even if the exception is once caught by the
 // debugger.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("new Debugger(parent).onExceptionUnwind = function () { };");
 // jsfunfuzz-generated
 for (var x of []) {};
 for (var l of [0]) {
     for (var y = 0; y < 1; y++) {
         g2;
     }
--- a/js/src/jit-test/tests/baseline/bug1416727.js
+++ b/js/src/jit-test/tests/baseline/bug1416727.js
@@ -1,10 +1,10 @@
 // |jit-test| allow-overrecursed
-g = newGlobal()
+g = newGlobal({newCompartment: true})
 g.parent = this
 g.eval("new Debugger(parent).onExceptionUnwind = function(){}");
 var depth = 0;
 function test() {
     if (++depth > 50)
         return;
     function f(n) {
         if (n != 0) {
--- a/js/src/jit-test/tests/baseline/bug836742.js
+++ b/js/src/jit-test/tests/baseline/bug836742.js
@@ -1,10 +1,10 @@
 // Ensure the correct frame is passed to exception unwind hooks.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("(" + function () {
     frames = [];
     var dbg = Debugger(debuggeeGlobal);
     dbg.onEnterFrame = function(frame) {
 	frames.push(frame);
     };
     dbg.onExceptionUnwind = function(frame) {
--- a/js/src/jit-test/tests/baseline/bug842431-1.js
+++ b/js/src/jit-test/tests/baseline/bug842431-1.js
@@ -1,10 +1,10 @@
 // |jit-test| error:123
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('function f() { var y; debugger; }');
 
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     frame.onPop = function(c) {
 	this.eval('y = 33');
 	return {throw: 123};
--- a/js/src/jit-test/tests/baseline/bug842431-2.js
+++ b/js/src/jit-test/tests/baseline/bug842431-2.js
@@ -1,13 +1,13 @@
 // |jit-test|
 
 // If a frame's onPop handler throws, we should not call the
 // onExceptionUnwind hook for that frame.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 g.eval('function f() { var y; debugger; }');
 
 dbg.onExceptionUnwind = function() {
     assertEq(0, 1);
 };
 
--- a/js/src/jit-test/tests/baseline/bug842431-3.js
+++ b/js/src/jit-test/tests/baseline/bug842431-3.js
@@ -1,14 +1,14 @@
 // |jit-test|
 
 // If an exception unwind hook performs a forced return, and this calls an
 // onPop handler that throws, the exception should not be handled in the
 // current frame but propagated to the caller.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 g.eval('function f() { try { var y; throw 123; } catch(e) { assertEq(0, 1); } }');
 
 dbg.onExceptionUnwind = function(frame) {
     frame.onPop = function() {
 	return {throw: 321};
     }
--- a/js/src/jit-test/tests/baseline/bug842432.js
+++ b/js/src/jit-test/tests/baseline/bug842432.js
@@ -1,10 +1,10 @@
 // |jit-test| error: fff is not
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 g.eval('function f(n) { if (n > 0) f(n-1); }');
 
 dbg.onEnterFrame = function(frame) {
     frame.onPop = function() {
         fff();
     };
--- a/js/src/jit-test/tests/baseline/bug852175.js
+++ b/js/src/jit-test/tests/baseline/bug852175.js
@@ -1,5 +1,5 @@
 // |jit-test| error: InternalError
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 g.eval("function f(n) { if (n == 0) debugger; else f(n - 1); }");
 g.f("function f() { debugger; }");
--- a/js/src/jit-test/tests/baseline/bug857580.js
+++ b/js/src/jit-test/tests/baseline/bug857580.js
@@ -1,10 +1,10 @@
 gczeal(2,10);
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onNewScript = function(script) {
     fscript = script.getChildScripts()[0];
 }
 g.eval("function f(x) { arguments[0] = 3; return x }");
 fscript.setBreakpoint(0, {hit:function(frame) {
     assertEq(frame.eval('x').return, 1);
     gc();
--- a/js/src/jit-test/tests/basic/bug1141154.js
+++ b/js/src/jit-test/tests/basic/bug1141154.js
@@ -1,13 +1,13 @@
 function foo() {
   (function() {
     Object.preventExtensions(this);
     setJitCompilerOption("ion.warmup.trigger", 4);
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     g.debuggeeGlobal = this;
     g.eval("(" + function () {
         dbg = new Debugger(debuggeeGlobal);
         dbg.onExceptionUnwind = function (frame, exc) {
             var s = '!';
             for (var f = frame; f; f = f.older)
             debuggeeGlobal.log += s;
         };
--- a/js/src/jit-test/tests/basic/bug713226.js
+++ b/js/src/jit-test/tests/basic/bug713226.js
@@ -1,20 +1,20 @@
 // |jit-test|
 gczeal(4);
 var optionNames = options().split(',');
   for (var i = 0; i < optionNames.length; i++)
     var optionName = optionNames[i];
 evaluate("\
 function addDebug(g, id) {\
-    var debuggerGlobal = newGlobal();\
+    var debuggerGlobal = newGlobal({newCompartment: true});\
     debuggerGlobal.debuggee = g;\
     debuggerGlobal.id = id;\
     debuggerGlobal.print = function (s) { print(s); };\
     debuggerGlobal.eval('var dbg = new Debugger(debuggee);dbg.onDebuggerStatement = function () { print(id); debugger; };');\
     return debuggerGlobal;\
 }\
-var base = newGlobal();\
+var base = newGlobal({newCompartment: true});\
 var top = base;\
 for (var i = 0; i < 8; i++ )\
     top = addDebug(top, i);\
 base.eval('debugger;');\
 ");
--- a/js/src/jit-test/tests/basic/bug951632.js
+++ b/js/src/jit-test/tests/basic/bug951632.js
@@ -1,9 +1,9 @@
 enableShellAllocationMetadataBuilder();
-var g = newGlobal()
+var g = newGlobal({newCompartment: true})
 g.eval("function f(a) { return h(); }");
 g.h = function () {
     return [1, 2, 3];
 };
 var o = getAllocationMetadata(g.f(5));
 assertEq(o.stack.length, 1);
 assertEq(o.stack[0], g.h);
--- a/js/src/jit-test/tests/basic/globals-shared-shapes.js
+++ b/js/src/jit-test/tests/basic/globals-shared-shapes.js
@@ -1,30 +1,13 @@
-// Test that objects in different compartments can have the same shape.
+// Test that objects in different compartments can have the same shape if they
+// have a null proto.
 
 var g1 = newGlobal();
 var g2 = newGlobal({sameZoneAs: g1});
 
 g1.eval("x1 = {foo: 1}");
 g2.eval("x2 = {foo: 2}");
-assertEq(unwrappedObjectsHaveSameShape(g1.x1, g2.x2), true);
-
-g1.eval("x1 = [1]");
-g2.eval("x2 = [2]");
-assertEq(unwrappedObjectsHaveSameShape(g1.x1, g2.x2), true);
-
-g1.eval("x1 = function f(){}");
-g2.eval("x2 = function f(){}");
-assertEq(unwrappedObjectsHaveSameShape(g1.x1, g2.x2), true);
+assertEq(unwrappedObjectsHaveSameShape(g1.x1, g2.x2), false);
 
-g1.eval("x1 = /abc/;");
-g2.eval("x2 = /def/");
+g1.eval("x1 = Object.create(null); x1.foo = 1;");
+g2.eval("x2 = Object.create(null); x2.foo = 2;");
 assertEq(unwrappedObjectsHaveSameShape(g1.x1, g2.x2), true);
-
-// Now the same, but we change Array.prototype.__proto__.
-// The arrays should no longer get the same Shape, as their
-// proto chain is different.
-g1 = newGlobal();
-g2 = newGlobal({sameZoneAs: g1});
-g1.eval("x1 = [1];");
-g2.eval("Array.prototype.__proto__ = Math;");
-g2.eval("x2 = [2];");
-assertEq(unwrappedObjectsHaveSameShape(g1.x1, g2.x2), false);
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/more-compartments-flag.js
@@ -0,0 +1,8 @@
+// |jit-test| --more-compartments
+
+// With --more-compartments we should default to creating a new compartment for
+// new globals.
+
+var g = newGlobal();
+assertEq(objectGlobal(g), null); // CCW
+assertEq(isProxy(g), true);
--- a/js/src/jit-test/tests/basic/properly-remove-timeout-root-before-shutdown.js
+++ b/js/src/jit-test/tests/basic/properly-remove-timeout-root-before-shutdown.js
@@ -1,5 +1,5 @@
 // Bug 857050: Remove the timeout function root before shutting down.
 function timeoutfunc() {}
 timeout(1, timeoutfunc);
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
--- a/js/src/jit-test/tests/basic/testBug895774.js
+++ b/js/src/jit-test/tests/basic/testBug895774.js
@@ -1,10 +1,10 @@
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 g1.eval("function f1() { debugger; evaluate('debugger') }");
 g2.eval("function f2() { f1(); assertEq(Number(this), 42) }");
 g2.f1 = g1.f1;
 
 var dbg = new Debugger(g1,g2);
 dbg.onDebuggerStatement = function(frame) {
     var target = frame.older;
     dbg.onDebuggerStatement = function(frame) {
--- a/js/src/jit-test/tests/basic/testGeneratorDieButScopeAlive.js
+++ b/js/src/jit-test/tests/basic/testGeneratorDieButScopeAlive.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 var hits = 0;
 dbg.onDebuggerStatement = function(frame) {
     ++hits;
     frame.older.eval("escaped = function() { return y }");
 }
 
--- a/js/src/jit-test/tests/cacheir/bug1448136.js
+++ b/js/src/jit-test/tests/cacheir/bug1448136.js
@@ -1,13 +1,13 @@
 print = function(s) { return s.toString(); }
 assertEq = function(a,b) {
   try { print(a); print(b); } catch(exc) {}
 }
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("(" + function() {
   Debugger(parent).onExceptionUnwind = function(frame) {
     frame.older
   }
 } + ")()")
 function a() {};
 function b() {};
--- a/js/src/jit-test/tests/cacheir/nukedCCW.js
+++ b/js/src/jit-test/tests/cacheir/nukedCCW.js
@@ -1,10 +1,11 @@
 function testNuke() {
-    var wrapper = evaluate("({a: 15, b: {c: 42}})", {global: newGlobal({sameZoneAs: this})});
+    var wrapper = evaluate("({a: 15, b: {c: 42}})",
+                           {global: newGlobal({newCompartment: true, sameZoneAs: this})});
 
     var i, error;
     try {
         for (i = 0; i < 150; i++) {
             assertEq(wrapper.b.c, 42);
             assertEq(wrapper.a, 15);
 
             if (i == 142) {
@@ -16,17 +17,18 @@ function testNuke() {
         error = e;
     }
 
     assertEq(error.message.includes("dead object"), true);
     assertEq(i, 143);
 }
 
 function testSweep() {
-    var wrapper = evaluate("({a: 15, b: {c: 42}})", {global: newGlobal({})});
+    var wrapper = evaluate("({a: 15, b: {c: 42}})",
+                           {global: newGlobal({newCompartment: true})});
     var error;
     nukeCCW(wrapper);
     gczeal(8, 1); // Sweep zones separately
     try {
       // Next access to wrapper.b should throw.
       wrapper.x = 4;
     } catch (e) {
         error = e;
--- a/js/src/jit-test/tests/collections/bug-743101.js
+++ b/js/src/jit-test/tests/collections/bug-743101.js
@@ -1,7 +1,7 @@
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 for (var cls of [Map, Set]) {
     var getter = Object.getOwnPropertyDescriptor(cls.prototype, "size").get;
     assertThrowsInstanceOf(function () { getter.apply(g, []); }, g.TypeError);
 }
--- a/js/src/jit-test/tests/debug/DebuggeeWouldRun-03.js
+++ b/js/src/jit-test/tests/debug/DebuggeeWouldRun-03.js
@@ -1,9 +1,9 @@
 // Bug 1250190: Shouldn't crash. |jit-test| error: yadda
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onNewGlobalObject = function () {
   dbg.onNewGlobalObject = function () { throw "yadda"; };
-  newGlobal();
+  newGlobal({newCompartment: true});
 }
-newGlobal();
+newGlobal({newCompartment: true});
--- a/js/src/jit-test/tests/debug/DebuggeeWouldRun-04.js
+++ b/js/src/jit-test/tests/debug/DebuggeeWouldRun-04.js
@@ -1,9 +1,9 @@
 // Bug 1250190: Shouldn't crash. |jit-test| error: yadda
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onNewScript = function () {
   dbg.onNewScript = function () { throw "yadda"; };
   g.Function("noodles;");
 }
 g.Function("poodles;");
--- a/js/src/jit-test/tests/debug/Debugger-adoptDebuggeeValue.js
+++ b/js/src/jit-test/tests/debug/Debugger-adoptDebuggeeValue.js
@@ -1,13 +1,13 @@
 // simplest possible test of Debugger.adoptDebuggeeValue
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 var dbg1 = new Debugger();
 var gDO1 = dbg1.addDebuggee(g);
 var obj1 = gDO1.executeInGlobal("({})").return;
 
 var dbg2 = Debugger(g);
 var gDO2 = dbg2.addDebuggee(g);
 var obj2 = gDO2.executeInGlobal("({})").return;
--- a/js/src/jit-test/tests/debug/Debugger-allowUnobservedAsmJS-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-allowUnobservedAsmJS-01.js
@@ -1,11 +1,11 @@
 load(libdir + "asm.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("dbg = new Debugger(parent);");
 
 // Initial state is to inhibit asm.js.
 assertEq(g.dbg.allowUnobservedAsmJS, false);
 
 var asmFunStr = USE_ASM + 'function f() {} return f';
 
--- a/js/src/jit-test/tests/debug/Debugger-allowUnobservedAsmJS-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-allowUnobservedAsmJS-02.js
@@ -1,16 +1,16 @@
 // |jit-test| skip-if: helperThreadCount() === 0
 
 // Debugger.allowUnobservedAsmJS with off-thread parsing.
 
 load(libdir + "asm.js");
 
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("dbg = new Debugger(parent);");
 
 assertEq(g.dbg.allowUnobservedAsmJS, false);
 
 enableLastWarning();
 
 var asmFunStr = USE_ASM + 'function f() {} return f';
--- a/js/src/jit-test/tests/debug/Debugger-clearAllBreakpoints-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-clearAllBreakpoints-01.js
@@ -1,11 +1,11 @@
 // clearAllBreakpoints clears breakpoints for the current Debugger object only.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 var hits = 0;
 function attach(i) {
     var dbg = Debugger(g);
     var handler = {
         hit: function (frame) {
             hits++;
             dbg.clearAllBreakpoints();
--- a/js/src/jit-test/tests/debug/Debugger-ctor-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-ctor-01.js
@@ -10,12 +10,12 @@ assertThrowsInstanceOf(function () { Deb
 assertThrowsInstanceOf(function () { new Debugger(null); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger(true); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger(42); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger("bad"); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger(function () {}); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError);
 
 // From the main compartment, creating a Debugger on a sandbox compartment.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 assertEq(dbg instanceof Debugger, true);
 assertEq(Object.getPrototypeOf(dbg), Debugger.prototype);
--- a/js/src/jit-test/tests/debug/Debugger-ctor-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-ctor-02.js
@@ -1,13 +1,13 @@
 // Test creating a Debugger in a sandbox, debugging the initial global.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("var dbg = new Debugger(debuggeeGlobal);");
 assertEq(g.eval("dbg instanceof Debugger"), true);
 
 // The Debugger constructor from this compartment will not accept as its argument
 // an Object from this compartment. Shenanigans won't fool the membrane.
 g.parent = this;
 assertThrowsInstanceOf(function () { g.eval("parent.Debugger(parent.Object())"); }, TypeError);
--- a/js/src/jit-test/tests/debug/Debugger-ctor-04.js
+++ b/js/src/jit-test/tests/debug/Debugger-ctor-04.js
@@ -1,5 +1,5 @@
 // Repeated Debugger() arguments are ignored.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g, g, g);
 assertEq(dbg.getDebuggees().length, 1);
--- a/js/src/jit-test/tests/debug/Debugger-ctor-05.js
+++ b/js/src/jit-test/tests/debug/Debugger-ctor-05.js
@@ -1,8 +1,8 @@
 // Redundant non-global Debugger() arguments are ignored.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var a = {}, b = {};");
 var dbg = Debugger(g.a, g.b);
 var arr = dbg.getDebuggees();
 assertEq(arr.length, 1);
 assertEq(arr[0], dbg.addDebuggee(g));
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-02.js
@@ -1,10 +1,10 @@
 // The array returned by getDebuggees is just a snapshot, not live.
 var dbg = new Debugger;
 var a1 = dbg.getDebuggees();
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var gw = dbg.addDebuggee(g);
 assertEq(gw instanceof Debugger.Object, true);
 var a2 = dbg.getDebuggees();
 assertEq(a2.length, 1);
 assertEq(a2[0], gw);
 assertEq(a1.length, 0);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-03.js
@@ -1,11 +1,11 @@
 // Debugger hooks fire based on debuggees.
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 g1.eval("var g2 = newGlobal('same-compartment')");
 var g2 = g1.g2;
 g1.eval("function f() { debugger; g2.g(); }");
 g2.eval("function g() { debugger; }");
 
 var log;
 var dbg = new Debugger;
 dbg.onDebuggerStatement = function (frame) { log += frame.callee.name; };
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-04.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-04.js
@@ -1,11 +1,11 @@
 // hasDebuggee tests.
 
-var g1 = newGlobal(), g1w;
+var g1 = newGlobal({newCompartment: true}), g1w;
 g1.eval("var g2 = newGlobal('same-compartment')");
 var g2 = g1.g2;
 var g1w, g2w;
 
 var dbg = new Debugger;
 function checkHas(hasg1, hasg2) {
     assertEq(dbg.hasDebuggee(g1), hasg1);
     if (typeof g1w === 'object')
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-05.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-05.js
@@ -1,8 +1,8 @@
 // addDebuggee returns different Debugger.Object wrappers for different Debugger objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg1 = new Debugger;
 var gw1 = dbg1.addDebuggee(g);
 var dbg2 = new Debugger;
 var gw2 = dbg2.addDebuggee(g);
 assertEq(gw1 !== gw2, true);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-06.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-06.js
@@ -15,13 +15,13 @@ check(undefined);
 check(null);
 check(false);
 check(1);
 check(NaN);
 check("ok");
 check(Symbol("ok"));
 
 // A Debugger.Object that belongs to a different Debugger object is invalid.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg2 = new Debugger;
 var w = dbg2.addDebuggee(g);
 assertEq(w instanceof Debugger.Object, true);
 check(w);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-08.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-08.js
@@ -1,12 +1,12 @@
 // Adding a debuggee more than once is redundant.
 
 var dbg = new Debugger;
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var w = dbg.addDebuggee(g);
 assertEq(w instanceof Debugger.Object, true);
 
 function usual() {
     assertEq(dbg.hasDebuggee(g), true);
     assertEq(dbg.hasDebuggee(w), true);
     var arr = dbg.getDebuggees();
     assertEq(arr.length, 1);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-09.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-09.js
@@ -10,12 +10,12 @@ function check(obj) {
     assertEq(dbg.removeDebuggee(obj), undefined);
 }
 
 // global objects which happen not to be debuggees at the moment
 var g1 = newGlobal('same-compartment');
 check(g1);
 
 // objects in a compartment that is already debugging us
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 g2.parent = this;
 g2.eval("var dbg = new Debugger(parent);");
 check(g2);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-10.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-10.js
@@ -1,13 +1,13 @@
 // Allow diamonds in the graph of the compartment "debugs" relation.
-var program = newGlobal();
-var d1 = newGlobal();
+var program = newGlobal({newCompartment: true});
+var d1 = newGlobal({newCompartment: true});
 d1.top = this;
-var d2 = newGlobal();
+var d2 = newGlobal({newCompartment: true});
 d2.top = this;
 var dbg = new Debugger(d1, d2);
 d1.eval("var dbg = new Debugger(top.program)");
 d2.eval("var dbg = new Debugger(top.program)");
 
 // mess with the edges a little bit -- all this should be fine, no cycles
 d1.dbg.removeDebuggee(program);
 d1.dbg.addDebuggee(program);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-11.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-11.js
@@ -3,20 +3,20 @@
 load(libdir + "asserts.js");
 
 // trivial cycles
 var dbg = new Debugger;
 assertThrowsInstanceOf(function () { dbg.addDebuggee(this); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger(this); }, TypeError);
 
 // cycles of length 2
-var d1 = newGlobal();
+var d1 = newGlobal({newCompartment: true});
 d1.top = this;
 d1.eval("var dbg = new Debugger(top)");
 assertThrowsInstanceOf(function () { dbg.addDebuggee(d1); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger(d1); }, TypeError);
 
 // cycles of length 3
-var d2 = newGlobal();
+var d2 = newGlobal({newCompartment: true});
 d2.top = this;
 d2.eval("var dbg = new Debugger(top.d1)");
 assertThrowsInstanceOf(function () { dbg.addDebuggee(d2); }, TypeError);
 assertThrowsInstanceOf(function () { new Debugger(d2); }, TypeError);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-12.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-12.js
@@ -1,10 +1,10 @@
 // Events in a non-debuggee are ignored, even if a debuggee is in the same compartment.
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 var g2 = g1.eval("newGlobal('same-compartment')");
 var dbg = new Debugger(g1);
 var hits = 0;
 dbg.onDebuggerStatement = function () { hits++; };
 g1.eval("debugger;");
 assertEq(hits, 1);
 g2.eval("debugger;");
 assertEq(hits, 1);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-13.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-13.js
@@ -1,9 +1,9 @@
 // Removing a debuggee does not detach the debugger from a compartment if another debuggee is in it.
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 var g2 = g1.eval("newGlobal('same-compartment')");
 var dbg = new Debugger(g1, g2);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) { hits++; };
 dbg.removeDebuggee(g1);
 g2.eval("debugger;");
 assertEq(hits, 1);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-14.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-14.js
@@ -1,8 +1,8 @@
 // Adding a debuggee in a compartment that is already in debug mode works
 // even if a script from that compartment is on the stack.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg1 = Debugger(g);
 var dbg2 = Debugger();
 g.parent = this;
 g.eval("parent.dbg2.addDebuggee(this);");
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-15.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-15.js
@@ -1,7 +1,7 @@
 // Debugger mode can be disabled for a compartment even if it has scripts running.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 g.parent = this;
 var n = 2;
 g.eval("parent.dbg.removeDebuggee(this); parent.n += 2");
 assertEq(n, 4);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-16.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-16.js
@@ -1,16 +1,16 @@
 // GC can turn off debug mode in a compartment.
 
 var dbgs = [];
 var nonDebugGlobals = [];
 var f = gc;
 for (var i = 0; i < 4; i++) {
     // Create two globals, one debuggee.
-    var g1 = newGlobal();
+    var g1 = newGlobal({newCompartment: true});
     var g2 = g1.eval("newGlobal('same-compartment')");
     var dbg = Debugger(g1);
     dbg.onDebuggerStatement = function () {};
 
     // Thread a chain of functions through the non-debuggee globals.
     g2.eval("function f() { return g() + 1; }");
     g2.g = f;
     f = g2.f;
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-17.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-17.js
@@ -8,19 +8,19 @@ var dbg = new Debugger;
 function check(bad) {
   print("check(" + uneval(bad) + ")");
   assertThrowsInstanceOf(function () { dbg.addDebuggee(bad); }, TypeError);
   assertEq(dbg.getDebuggees().length, 0);
   assertThrowsInstanceOf(function () { dbg.hasDebuggee(bad); }, TypeError);
   assertThrowsInstanceOf(function () { dbg.removeDebuggee(bad); }, TypeError);
 }
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 check(g.Object());
 check(g.Object);
 check(g.Function(""));
 
 // A Debugger.Object belonging to a different Debugger is not a valid way
 // to designate a global, even if its referent is a global.
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 var dbg2 = new Debugger;
 var d2g2 = dbg2.addDebuggee(g2);
 check(d2g2);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-18.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-18.js
@@ -9,18 +9,18 @@ var dbg = new Debugger;
 function assertDebuggees(...expected) {
   print("assertDebuggees([" + expected.map((g) => g.toSource()) + "])");
   var debuggees = dbg.getDebuggees();
   assertEq(expected.length, debuggees.length);
   for (let g of expected)
     assertEq(debuggees.indexOf(g) != -1, true);
 }
 
-var g1 = newGlobal(); g1.toSource = function () { return "[global g1]"; };
-var g2 = newGlobal(); g2.toSource = function () { return "[global g2]"; };
+var g1 = newGlobal({newCompartment: true}); g1.toSource = function () { return "[global g1]"; };
+var g2 = newGlobal({newCompartment: true}); g2.toSource = function () { return "[global g2]"; };
 
 assertDebuggees();
 
 // Produce every possible way to designate g1, for us to play with.
 // Globals can be designated by any of the following:
 //
 // - "CCW": a Cross-Compartment Wrapper (CCW) of a global object
 // - "D.O": a Debugger.Object whose referent is a global object
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-19.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-19.js
@@ -5,29 +5,29 @@ var dbg = new Debugger;
 // If we eval in a debuggee, log which debuggee it was.
 var log;
 dbg.onEnterFrame = function (frame) {
   log += 'e';
   // frame.environment in all evals below is the global lexical env.
   log += frame.environment.parent.object.label;
 };
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 log = '';
 g1.eval('Math');
 assertEq(log, '');              // not yet a debuggee
 
 var g1w = dbg.addDebuggee(g1);
 assertEq(g1w instanceof Debugger.Object, true);
 g1w.label = 'g1';
 log = '';
 g1.eval('Math');                // now a debuggee
 assertEq(log, 'eg1');
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 log = '';
 g1.eval('Math');                // debuggee
 g2.eval('Math');                // not a debuggee
 assertEq(log, 'eg1');
 
 var g2w = dbg.addDebuggee(g2);
 assertEq(g2w instanceof Debugger.Object, true);
 g2w.label = 'g2';
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-20.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-20.js
@@ -1,17 +1,17 @@
 // addAllGlobalsAsDebuggees adds all the globals as debuggees.
 
-var g1 = newGlobal();           // Created before the Debugger; debuggee.
-var g2 = newGlobal();           // Created before the Debugger; not debuggee.
+var g1 = newGlobal({newCompartment: true});           // Created before the Debugger; debuggee.
+var g2 = newGlobal({newCompartment: true});           // Created before the Debugger; not debuggee.
 
 var dbg = new Debugger;
 
-var g3 = newGlobal();           // Created after the Debugger; debuggee.
-var g4 = newGlobal();           // Created after the Debugger; not debuggee.
+var g3 = newGlobal({newCompartment: true});           // Created after the Debugger; debuggee.
+var g4 = newGlobal({newCompartment: true});           // Created after the Debugger; not debuggee.
 
 var g1w = dbg.addDebuggee(g1);
 var g3w = dbg.addDebuggee(g3);
 assertEq(dbg.addAllGlobalsAsDebuggees(), undefined);
 
 // Get Debugger.Objects viewing the globals from their own compartments;
 // this is the sort that findAllGlobals and addDebuggee return.
 assertEq(g1w, g3w.makeDebuggeeValue(g1).unwrap());
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-22.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-22.js
@@ -1,11 +1,11 @@
 // Adding a debuggee allowed with scripts on stack.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.dbg = new Debugger;
 
 g.eval("" + function f(d) {
   g(d);
   if (d)
     assertEq(dbg.hasDebuggee(this), true);
 });
 
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-23.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-23.js
@@ -1,13 +1,13 @@
 // Adding a debuggee allowed with scripts on stack from stranger places.
 
 // Test CCW.
 (function testCCW() {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
   g.dbg = dbg;
   g.GLOBAL = g;
 
   g.turnOnDebugger = function () {
     dbg.addDebuggee(g);
   };
 
@@ -21,81 +21,81 @@
     f(false);
     f(true);
     f(true);
   } + ")();");
 })();
 
 // Test getter.
 (function testGetter() {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   g.dbg = new Debugger;
   g.GLOBAL = g;
 
   g.eval("" + function f(obj) {
     obj.foo;
     assertEq(dbg.hasDebuggee(GLOBAL), true);
   });
 
   g.eval("(" + function test() {
     f({ get foo() { dbg.addDebuggee(GLOBAL); } });
   } + ")();");
 })();
 
 // Test setter.
 (function testSetter() {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   g.dbg = new Debugger;
   g.GLOBAL = g;
 
   g.eval("" + function f(obj) {
     obj.foo = 42;
     assertEq(dbg.hasDebuggee(GLOBAL), true);
   });
 
   g.eval("(" + function test() {
     f({ set foo(v) { dbg.addDebuggee(GLOBAL); } });
   } + ")();");
 })();
 
 // Test toString.
 (function testToString() {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   g.dbg = new Debugger;
   g.GLOBAL = g;
 
   g.eval("" + function f(obj) {
     obj + "";
     assertEq(dbg.hasDebuggee(GLOBAL), true);
   });
 
   g.eval("(" + function test() {
     f({ toString: function () { dbg.addDebuggee(GLOBAL); }});
   } + ")();");
 })();
 
 // Test valueOf.
 (function testValueOf() {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   g.dbg = new Debugger;
   g.GLOBAL = g;
 
   g.eval("" + function f(obj) {
     obj + "";
     assertEq(dbg.hasDebuggee(GLOBAL), true);
   });
 
   g.eval("(" + function test() {
     f({ valueOf: function () { dbg.addDebuggee(GLOBAL); }});
   } + ")();");
 })();
 
 // Test proxy trap.
 (function testProxyTrap() {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   g.dbg = new Debugger;
   g.GLOBAL = g;
 
   g.eval("" + function f(proxy) {
     proxy["foo"];
     assertEq(dbg.hasDebuggee(GLOBAL), true);
   });
 
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-24.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-24.js
@@ -1,14 +1,14 @@
 // Turning debugger on for a particular global with on-stack scripts shouldn't
 // make other globals' scripts observable.
 
-var g1 = newGlobal();
-var g2 = newGlobal();
-var g3 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
+var g3 = newGlobal({newCompartment: true});
 
 g1.eval("" + function f() {
   var name = "f";
   g();
   return name;
 });
 g2.eval("" + function g() {
   var name = "g";
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-25.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-25.js
@@ -1,13 +1,13 @@
 // Turning debugger off global at a time.
 
-var g1 = newGlobal();
-var g2 = newGlobal();
-var g3 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
+var g3 = newGlobal({newCompartment: true});
 
 g1.eval("" + function f() {
   var name = "f";
   g();
   return name;
 });
 g2.eval("" + function g() {
   var name = "g";
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-26.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-26.js
@@ -1,17 +1,17 @@
 // Ion can bail in-place when throwing exceptions with debug mode toggled on.
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit();
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   g.toggle = function toggle(x, d) {
     if (d) {
       dbg.addDebuggee(g);
       var frame = dbg.getNewestFrame().older;
       assertEq(frame.callee.name, "f");
       assertEq(frame.implementation, "ion");
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-27.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-27.js
@@ -1,11 +1,11 @@
 // Test that we can OSR with the same script on the stack multiple times.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 
 g.toggle = function toggle() {
   dbg.addDebuggee(g);
   var frame = dbg.getNewestFrame();
 }
 
 g.eval("" + function f(x) {
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-28.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-28.js
@@ -12,17 +12,17 @@ function removeAdd(dbg, g) {
   dbg.removeDebuggee(g);
   dbg.addDebuggee(g);
   var f = dbg.getNewestFrame();
   while (f)
     f = f.older;
 }
 
 function newGlobalDebuggerPair(toggleSeq) {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   if (toggleSeq == removeAdd)
     dbg.addDebuggee(g);
 
   g.eval("" + function f() { return g(); });
   g.eval("" + function g() { return h(); });
   g.eval("line0 = Error().lineNumber;");
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-29.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-29.js
@@ -1,6 +1,6 @@
 // Debugger.prototype.addDebuggee should not accept invisible-to-debugger globals.
 load(libdir + 'asserts.js');
 
-var g = newGlobal({ invisibleToDebugger: true });
+var g = newGlobal({ newCompartment: true, invisibleToDebugger: true });
 
 assertThrowsInstanceOf(() => { new Debugger(g); }, TypeError);
--- a/js/src/jit-test/tests/debug/Debugger-debuggees-30.js
+++ b/js/src/jit-test/tests/debug/Debugger-debuggees-30.js
@@ -14,19 +14,19 @@ function testAddDebuggee() {
     var dbg = new Debugger();
     assertTypeErrorMessage(() => dbg.addDebuggee(this),
                            "debugger and debuggee must be in different compartments");
 }
 testAddDebuggee();
 
 function testAddAllGlobalsAsDebuggees() {
     var g1 = newGlobal({sameCompartmentAs: this});
-    var g2 = newGlobal();
+    var g2 = newGlobal({newCompartment: true});
     var g3 = newGlobal({sameCompartmentAs: g2});
-    var g4 = newGlobal({sameZoneAs: this});
+    var g4 = newGlobal({newCompartment: true, sameZoneAs: this});
     var dbg = new Debugger();
     dbg.addAllGlobalsAsDebuggees();
     assertEq(dbg.hasDebuggee(g1), false);
     assertEq(dbg.hasDebuggee(g2), true);
     assertEq(dbg.hasDebuggee(g3), true);
     assertEq(dbg.hasDebuggee(g4), true);
 }
 testAddAllGlobalsAsDebuggees();
--- a/js/src/jit-test/tests/debug/Debugger-enabled-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-enabled-01.js
@@ -1,13 +1,13 @@
 var desc = Object.getOwnPropertyDescriptor(Debugger.prototype, "enabled");
 assertEq(typeof desc.get, 'function');
 assertEq(typeof desc.set, 'function');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var hits;
 var dbg = new Debugger(g);
 assertEq(dbg.enabled, true);
 dbg.onDebuggerStatement = function () { hits++; };
 
 var vals = [true, false, null, undefined, NaN, "blah", {}];
 for (var i = 0; i < vals.length; i++) {
     dbg.enabled = vals[i];
--- a/js/src/jit-test/tests/debug/Debugger-enabled-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-enabled-02.js
@@ -1,11 +1,11 @@
 // Tests that hooks work if set while the Debugger is disabled.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log = "";
 
 g.eval("" + function f() { return 42; });
 
 dbg.enabled = false;
 dbg.onEnterFrame = function (frame) {
   log += "1";
--- a/js/src/jit-test/tests/debug/Debugger-findAllGlobals-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-findAllGlobals-02.js
@@ -1,17 +1,17 @@
 // Debugger.prototype.findAllGlobals finds ALL the globals!
 
-var g1 = newGlobal();           // Created before the Debugger; debuggee.
-var g2 = newGlobal();           // Created before the Debugger; not debuggee.
+var g1 = newGlobal({newCompartment: true});           // Created before the Debugger; debuggee.
+var g2 = newGlobal({newCompartment: true});           // Created before the Debugger; not debuggee.
 
 var dbg = new Debugger;
 
-var g3 = newGlobal();           // Created after the Debugger; debuggee.
-var g4 = newGlobal();           // Created after the Debugger; not debuggee.
+var g3 = newGlobal({newCompartment: true});           // Created after the Debugger; debuggee.
+var g4 = newGlobal({newCompartment: true});           // Created after the Debugger; not debuggee.
 
 var g1w = dbg.addDebuggee(g1);
 var g3w = dbg.addDebuggee(g3);
 
 var a = dbg.findAllGlobals();
 
 // Get Debugger.Objects viewing the globals from their own compartments;
 // this is the sort that findAllGlobals and addDebuggee return.
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-02.js
@@ -1,11 +1,11 @@
 // In a debuggee with live objects, findObjects finds those objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 let defObject = v => g.eval(`this.${v} = { toString: () => "[object ${v}]" }`);
 defObject("a");
 defObject("b");
 defObject("c");
 
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-03.js
@@ -1,11 +1,11 @@
 // findObjects' result includes objects referenced by other objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 g.eval('this.a = { b: {} };');
 
 var bw = gw.makeDebuggeeValue(g.a.b);
 
 var objects = dbg.findObjects();
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-04.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-04.js
@@ -1,11 +1,11 @@
 // findObjects' result includes objects captured by closures.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 g.eval(`
   this.f = (function () {
     let a = { foo: () => {} };
     return () => a;
   }());
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-05.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-05.js
@@ -1,10 +1,10 @@
 // findObjects' result doesn't include any duplicates.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 dbg.addDebuggee(g);
 
 let objects = dbg.findObjects();
 let set = new Set(objects);
 
 assertEq(objects.length, set.size);
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-06.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-06.js
@@ -1,12 +1,12 @@
 // In a debugger with multiple debuggees, findObjects finds objects from all debuggees.
 
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var g1w = dbg.addDebuggee(g1);
 var g2w = dbg.addDebuggee(g2);
 
 g1.eval('this.a = {};');
 g2.eval('this.b = {};');
 
 var objects = dbg.findObjects();
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-07.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-07.js
@@ -1,11 +1,11 @@
 // findObjects can filter objects by class name.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 g.eval('this.re = /foo/;');
 g.eval('this.d = new Date();');
 
 var rew = gw.makeDebuggeeValue(g.re);
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-09.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-09.js
@@ -1,9 +1,9 @@
 // We don't return objects where our query's class name is the prefix of the
 // object's class name and vice versa.
 
 var dbg = new Debugger();
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var gw = dbg.addDebuggee(g);
 
 assertEq(dbg.findObjects({ class: "Objec" }).length, 0);
 assertEq(dbg.findObjects({ class: "Objectttttt" }).length, 0);
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-10.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-10.js
@@ -1,5 +1,5 @@
 // Debugger.prototype.findObjects should not expose internal JSFunction objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval(`function f() { return function() {}; }`);
 new Debugger(g).findObjects();
--- a/js/src/jit-test/tests/debug/Debugger-findObjects-11.js
+++ b/js/src/jit-test/tests/debug/Debugger-findObjects-11.js
@@ -1,7 +1,7 @@
 // This shouldn't segfault.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval(`function f() { return function() {
   function g() {}
 }; }`);
 new Debugger(g).findObjects();
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-02.js
@@ -1,11 +1,11 @@
 // In a debuggee with functions, findScripts finds those functions' scripts.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('function f(){}');
 g.eval('function g(){}');
 g.eval('function h(){}');
 
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var fw = gw.makeDebuggeeValue(g.f);
 var gw = gw.makeDebuggeeValue(g.g);
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-03.js
@@ -1,11 +1,11 @@
 // While eval code is running, findScripts returns its script.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 g.check = function () {
     log += 'c';
     var frame = dbg.getNewestFrame();
     assertEq(frame.type, "eval");
     assertEq(dbg.findScripts().indexOf(frame.script) != -1, true);
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-04.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-04.js
@@ -1,10 +1,10 @@
 // Within a series of evals and calls, all their frames' scripts appear in findScripts' result.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 g.check = function () {
     log += 'c';
     var scripts = dbg.findScripts();
 
     var innerEvalFrame = dbg.getNewestFrame();
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-05.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-05.js
@@ -1,10 +1,10 @@
 // findScripts' result includes scripts for nested functions.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var log;
 
 g.eval('function f() { return function g() { return function h() { return "Squee!"; } } }');
 var fw = gw.makeDebuggeeValue(g.f);
 var gw = gw.makeDebuggeeValue(g.f());
 var hw = gw.makeDebuggeeValue(g.f()());
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-06.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-06.js
@@ -1,11 +1,11 @@
 // In a debugger with multiple debuggees, findScripts finds scripts across all debuggees.
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var g1w = dbg.addDebuggee(g1);
 var g2w = dbg.addDebuggee(g2);
 
 g1.eval('function f() {}');
 g2.eval('function g() {}');
 
 var scripts = dbg.findScripts();
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-07.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-07.js
@@ -1,12 +1,12 @@
 // findScripts can filter scripts by global.
-var g1 = newGlobal();
-var g2 = newGlobal();
-var g3 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
+var g3 = newGlobal({newCompartment: true});
 
 var dbg = new Debugger();
 var g1w = dbg.addDebuggee(g1);
 var g2w = dbg.addDebuggee(g2);
 
 g1.eval('function f() {}');
 g2.eval('function g() {}');
 g2.eval('function h() {}');
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-08.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-08.js
@@ -1,12 +1,12 @@
 // Debugger.prototype.findScripts can filter scripts by URL.
-var g1 = newGlobal();
-var g2 = newGlobal();
-var g3 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
+var g3 = newGlobal({newCompartment: true});
 
 // Define some functions whose url will be this test file.
 g1.eval('function g1f() {}');
 g2.eval('function g2f() {}');
 
 // Define some functions whose url will be a different file.
 url2 = scriptdir + "Debugger-findScripts-08-script2";
 load(url2);
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-10.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-10.js
@@ -1,13 +1,13 @@
 // Specifying a non-debuggee global in a Debugger.prototype.findScripts query should
 // cause the query to return no scripts.
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 g1.eval('function f(){}');
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 g2.eval('function g(){}');
 
 var dbg = new Debugger(g1);
 assertEq(dbg.findScripts({global:g1}).length > 0, true);
 assertEq(dbg.findScripts({global:g2}).length, 0);
 assertEq(dbg.findScripts({global:this}).length, 0);
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-11.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-11.js
@@ -1,10 +1,10 @@
 // Debugger.prototype.findScripts can filter scripts by line number.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 var scriptname = scriptdir + 'Debugger-findScripts-11-script2';
 g.load(scriptname);
 
 var gfw = gw.makeDebuggeeValue(g.f);
 var ggw = gw.makeDebuggeeValue(g.f());
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-12.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-12.js
@@ -1,24 +1,24 @@
 // Debugger.prototype.findScripts can filter by global, url, and line number.
 
 // Two scripts, with different functions at the same line numbers.
 var url1 = scriptdir + 'Debugger-findScripts-12-script1';
 var url2 = scriptdir + 'Debugger-findScripts-12-script2';
 
 // Three globals: two with code, one with nothing.
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 g1.toSource = () => "[global g1]";
 g1.load(url1);
 g1.load(url2);
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 g2.toSource = () => "[global g2]";
 g2.load(url1);
 g2.load(url2);
-var g3 = newGlobal();
+var g3 = newGlobal({newCompartment: true});
 
 var dbg = new Debugger(g1, g2, g3);
 
 function script(func) {
     var gw = dbg.addDebuggee(func.global);
     var script = gw.makeDebuggeeValue(func).script;
     script.toString = function () {
         return "[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]";
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-14.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-14.js
@@ -1,11 +1,11 @@
 // Debugger.prototype.findScripts can find the innermost script at a given
 // source location.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 function script(f) {
     return gw.makeDebuggeeValue(f).script;
 }
 
 function arrayIsOnly(array, element) {
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-15.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-15.js
@@ -1,9 +1,9 @@
 // findScripts finds non-compile-and-go scripts
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.evaluate("function f(x) { return x + 1; }");
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var s = dbg.findScripts();
 var fw = gw.getOwnPropertyDescriptor("f").value;
 assertEq(s.indexOf(fw.script) !== -1, true);
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-16.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-16.js
@@ -1,11 +1,11 @@
 // Bug 744731 - findScripts() finds active debugger executeInGlobal scripts.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     assertEq(dbg.findScripts().indexOf(dbg.getNewestFrame().script) !== -1, true);
 };
 gw.executeInGlobal("debugger;");
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-17.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-17.js
@@ -1,11 +1,11 @@
 // Bug 744731 - findScripts() finds active debugger frame.eval scripts.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     dbg.onDebuggerStatement = function (frame) {
         hits++;
         assertEq(dbg.findScripts().indexOf(dbg.getNewestFrame().script) !== -1, true);
     };
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-18.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-18.js
@@ -1,12 +1,12 @@
 // In a debuggee with multiple scripts with varying displayURLs (aka //#
 // sourceURL), findScripts can filter by displayURL.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 g.eval("function f(){} //# sourceURL=f.js");
 g.eval("function g(){} //# sourceURL=g.js");
 g.eval("function h(){}");
 
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var fw = gw.makeDebuggeeValue(g.f);
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-19.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-19.js
@@ -1,5 +1,5 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 try { g.eval('function drag(ev) {'); } catch (ex) { }
 for (s of dbg.findScripts())
   s.lineCount;
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-20.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-20.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 g.eval('function f(){}');
 
 var o = gw.makeDebuggeeValue(g.f);
 
 var allScripts = dbg.findScripts();
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-22.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-22.js
@@ -1,8 +1,8 @@
 // Bug 1239813: Don't let compartments get GC'd while findScripts is holding
 // them in its ScriptQuery's hash set.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 dbg.addDebuggee(g);
 g = newGlobal({sameZoneAs: g.Math});
 dbg.findScripts({get source() { gc(); return undefined; }});
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-23.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-23.js
@@ -1,13 +1,13 @@
 // If a script is (re)lazified, findScripts should not delazify it.
 
 var dbg = new Debugger();
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('function f(){}');
 assertEq(g.eval('isLazyFunction(f)'), true);
 
 dbg.addDebuggee(g);
 dbg.findScripts();
 assertEq(g.eval('isLazyFunction(f)'), true);
 
 dbg.removeAllDebuggees();
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-24.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-24.js
@@ -1,13 +1,13 @@
 // findScripts should reject Debugger.Source objects from other Debuggers.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.evaluate(`function f() { print("earth/heart/hater"); }`,
            { lineNumber: 1800 });
 
 var dbg1 = new Debugger;
 var gDO1 = dbg1.addDebuggee(g);
 var fDO1 = gDO1.getOwnPropertyDescriptor('f').value;
 assertEq(fDO1.script.source instanceof Debugger.Source, true);
 
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-optimized-out.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-optimized-out.js
@@ -1,15 +1,15 @@
 // Accessing Debugger.Script's properties which triggers delazification can
 // fail if the function for the script is optimized out.
 // It shouldn't crash but just throw an error.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 g.eval(`
 function enclosing() {
     (function g1() {});
     (function* g2() {});
     (async function g3() {});
     (async function* g4() {});
     () => {};
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-uncompleted-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-uncompleted-01.js
@@ -1,12 +1,12 @@
 // Uncompleted scripts and their inner scripts shouldn't be found in
 // findScripts.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 let message = "";
 try {
   g.eval(`
 (function nonLazyOuter() {
   (function nonLazyInner() {
     function lazy1() {
--- a/js/src/jit-test/tests/debug/Debugger-findScripts-uncompleted-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-findScripts-uncompleted-02.js
@@ -1,11 +1,11 @@
 // Uncompleted scripts shouldn't be found in findScripts.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 let message = "";
 try {
   g.eval(`
 (function nonLazyOuter() {
   (function nonLazyInner() {
     function lazy1() {
--- a/js/src/jit-test/tests/debug/Debugger-findSources-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-findSources-02.js
@@ -1,11 +1,11 @@
 // In a debugger with scripts, findSources finds the script source.
 
-const g = newGlobal();
+const g = newGlobal({newCompartment: true});
 // Declare a function in order to keep the script source alive across GC.
 g.evaluate(`function fa() {}`, { fileName: "a.js" });
 g.evaluate(`function fb() {}`, { fileName: "b.js" });
 g.evaluate(`function fc() {}`, { fileName: "c.js" });
 
 const dbg = new Debugger();
 const gw = dbg.addDebuggee(g);
 
--- a/js/src/jit-test/tests/debug/Debugger-findSources-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-findSources-03.js
@@ -1,12 +1,12 @@
 // In a debugger with multiple debuggees, findSources finds script sources across all debuggees.
 
-const g1 = newGlobal();
-const g2 = newGlobal();
+const g1 = newGlobal({newCompartment: true});
+const g2 = newGlobal({newCompartment: true});
 // Declare a function in order to keep the script source alive across GC.
 g1.evaluate(`function fa() {}`, { fileName: "a.js" });
 g1.evaluate(`function fb() {}`, { fileName: "b.js" });
 g2.evaluate(`function fc() {}`, { fileName: "c.js" });
 g2.evaluate(`function fd() {}`, { fileName: "d.js" });
 
 const dbg = new Debugger();
 const g1w = dbg.addDebuggee(g1);
--- a/js/src/jit-test/tests/debug/Debugger-getNewestFrame-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-getNewestFrame-01.js
@@ -1,13 +1,13 @@
 // getNewestFrame basics.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 assertEq(dbg.getNewestFrame(), null);
 
 var global = this;
 var frame;
 function f() {
     frame = dbg.getNewestFrame();
     assertEq(frame instanceof Debugger.Frame, true);
--- a/js/src/jit-test/tests/debug/Debugger-getNewestFrame-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-getNewestFrame-02.js
@@ -1,11 +1,11 @@
 // Hooks and Debugger.prototype.getNewestFrame produce the same Frame object.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 var savedFrame, savedCallee;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame, savedFrame);
     assertEq(frame.live, true);
     assertEq(frame.callee, savedCallee);
     hits++;
--- a/js/src/jit-test/tests/debug/Debugger-getNewestFrame-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-getNewestFrame-03.js
@@ -1,9 +1,9 @@
 // Debugger.prototype.getNewestFrame() ignores dummy frames.
 // See bug 678086.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.f = function () { return dbg.getNewestFrame(); };
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var fw = gw.getOwnPropertyDescriptor("f").value;
 assertEq(fw.call().return, null);
--- a/js/src/jit-test/tests/debug/Debugger-getNewestFrame-generators-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-getNewestFrame-generators-01.js
@@ -1,13 +1,13 @@
 // Generator/async frames can be created and revived by calling Debugger.getNewestFrame().
 //
 // Modified copy of Frame-older-generators-01.js.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
     function* gen() {
         f();
         yield 1;
         f();
     }
     function* genDefaults(x=f()) {
         f();
--- a/js/src/jit-test/tests/debug/Debugger-multi-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-multi-01.js
@@ -1,11 +1,11 @@
 // When there are multiple debuggers, their hooks are called in order.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var log;
 var arr = [];
 
 function addDebug(msg) {
     var dbg = new Debugger(g);
     dbg.onDebuggerStatement = function (stack) { log += msg; };
     arr.push(dbg);
 }
--- a/js/src/jit-test/tests/debug/Debugger-multi-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-multi-02.js
@@ -1,13 +1,13 @@
 // Test adding hooks during dispatch. The behavior is deterministic and "nice",
 // but mainly what we are checking here is that we do not crash due to
 // modifying a data structure while we're iterating over it.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var n = 0;
 var hits;
 
 function addDebugger() {
     var dbg = new Debugger(g);
     dbg.onDebuggerStatement = function (stack) {
         hits++;
         addDebugger();
--- a/js/src/jit-test/tests/debug/Debugger-multi-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-multi-03.js
@@ -1,21 +1,21 @@
 // Q: But who shall debug the debuggers?  A: jimb
 
 var log = '';
 
 function addDebug(g, id) {
-    var debuggerGlobal = newGlobal();
+    var debuggerGlobal = newGlobal({newCompartment: true});
     debuggerGlobal.debuggee = g;
     debuggerGlobal.id = id;
     debuggerGlobal.print = function (s) { log += s; };
     debuggerGlobal.eval(
         'var dbg = new Debugger(debuggee);\n' +
         'dbg.onDebuggerStatement = function () { print(id); debugger; print(id); };\n');
     return debuggerGlobal;
 }
 
-var base = newGlobal();
+var base = newGlobal({newCompartment: true});
 var top = base;
 for (var i = 0; i < 8; i++)  // why have 2 debuggers when you can have 8
     top = addDebug(top, i);
 base.eval("debugger;");
 assertEq(log, '0123456776543210');
--- a/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-01.js
@@ -1,11 +1,11 @@
 // If debugger.onEnterFrame returns {return:val}, the frame returns.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.set = false;
 g.eval("function f() {\n" +
        "    set = true;\n" +
        "    return 'fail';\n" +
        "}\n");
 g.eval("function g() { return 'g ' + f(); }");
 g.eval("function h() { return 'h ' + g(); }");
 
--- a/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-02.js
@@ -1,13 +1,13 @@
 // If debugger.onEnterFrame returns {throw:val}, an exception is thrown in the debuggee.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.set = false;
 g.eval("function f() {\n" +
        "    set = true;\n" +
        "    return 'fail';\n" +
        "}\n");
 
 var dbg = Debugger(g);
 var savedFrame;
--- a/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-03.js
@@ -1,13 +1,13 @@
 // If debugger.onEnterFrame returns null, the debuggee is terminated immediately.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.set = false;
 
 var dbg = Debugger(g);
 var savedFrame;
 dbg.onDebuggerStatement = function (frame) {
     var innerSavedFrame;
     dbg.onEnterFrame = function (frame) {
         innerSavedFrame = frame;
--- a/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-04.js
+++ b/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-04.js
@@ -1,11 +1,11 @@
 // If debugger.onEnterFrame returns undefined, the frame should continue execution.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 var savedFrame;
 dbg.onEnterFrame = function (frame) {
     hits++;
     savedFrame = frame;
     return undefined;
 };
--- a/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-05.js
+++ b/js/src/jit-test/tests/debug/Debugger-onEnterFrame-resumption-05.js
@@ -11,17 +11,17 @@
 // The exception is REJOIN_THIS_PROTOTYPE, which can be reached reliably if you
 // add a JS_GC call to stubs::GetPropNoCache. JIT code calls that stub to
 // retrieve the 'prototype' property of a function called as a constructor, if
 // TI can't establish the exact identity of that prototype's value at compile
 // time. Thus the preoccupation with constructors here.
 
 load(libdir + "asserts.js");
 
-var debuggee = newGlobal();
+var debuggee = newGlobal({newCompartment: true});
 var dbg = Debugger(debuggee);
 var hits, savedFrame;
 
 // Allow the constructor to return normally.
 dbg.onEnterFrame = function (frame) {
     hits++;
     if (frame.constructing) {
         savedFrame = frame;
--- a/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-13.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-13.js
@@ -3,15 +3,15 @@
 var dbg = new Debugger;
 
 var gw = null;
 dbg.onNewGlobalObject = function (global) {
   assertEq(arguments.length, 1);
   assertEq(this, dbg);
   gw = global;
 };
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 assertEq(typeof gw, 'object');
 assertEq(dbg.addDebuggee(g), gw);
 
 // The Debugger.Objects passed to onNewGlobalObject are the global as
 // viewed from its own compartment.
 assertEq(gw.makeDebuggeeValue(g), gw);
--- a/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-14.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-14.js
@@ -7,11 +7,11 @@ dbg.onNewGlobalObject = function (global
   var gw = dbg.addDebuggee(global);
   gw.defineProperty('x', { value: -1 });
   // Check that the global's magic lazy properties are working.
   assertEq(gw.executeInGlobalWithBindings('Math.atan2(y,x)', { y: 0 }).return, Math.PI);
   // Check that the global's prototype is hooked up.
   assertEq(gw.executeInGlobalWithBindings('x.toString()', { x: gw }).return, "[object global]");
 };
 
-newGlobal();
+newGlobal({newCompartment: true});
 
 assertEq(log, 'n');
--- a/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-15.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-15.js
@@ -8,17 +8,18 @@ dbg.onNewGlobalObject = function (global
   log += 'n';
 }
 
 assertEq(typeof newGlobal(), "object");
 assertEq(typeof newGlobal({invisibleToDebugger: false}), "object");
 assertEq(log, 'nn');
 
 log = '';
-assertEq(typeof newGlobal({invisibleToDebugger: true}), "object");
+assertEq(typeof newGlobal({newCompartment: true, invisibleToDebugger: true}), "object");
 assertEq(log, '');
 
-assertThrowsInstanceOf(() => dbg.addDebuggee(newGlobal({invisibleToDebugger: true})), Error);
+assertThrowsInstanceOf(() => dbg.addDebuggee(newGlobal({newCompartment: true, invisibleToDebugger: true})),
+                       Error);
 
-var glob = newGlobal({invisibleToDebugger: true});
+var glob = newGlobal({newCompartment: true, invisibleToDebugger: true});
 dbg.addAllGlobalsAsDebuggees();
 dbg.onDebuggerStatement = function (frame) { assertEq(true, false); };
 glob.eval('debugger');
--- a/js/src/jit-test/tests/debug/Debugger-onNewPromise-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-01.js
@@ -1,12 +1,12 @@
 // Test that the onNewPromise hook gets called when promises are allocated in
 // the scope of debuggee globals.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 
 let promisesFound = [];
 dbg.onNewPromise = p => { promisesFound.push(p); };
 
 let p1 = new g.Promise(function (){});
--- a/js/src/jit-test/tests/debug/Debugger-onNewPromise-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-02.js
@@ -1,11 +1,11 @@
 // onNewPromise handlers fire, until they are removed.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 log = '';
 new g.Promise(function (){});
 assertEq(log, '');
 
 dbg.onNewPromise = function (promise) {
--- a/js/src/jit-test/tests/debug/Debugger-onNewPromise-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-03.js
@@ -1,11 +1,11 @@
 // onNewPromise handlers on different Debugger instances are independent.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg1 = new Debugger(g);
 var log1;
 function h1(promise) {
   log1 += 'n';
   assertEq(promise.seen, undefined);
   promise.seen = true;
 }
 
--- a/js/src/jit-test/tests/debug/Debugger-onNewPromise-04.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-04.js
@@ -1,10 +1,10 @@
 // An onNewPromise handler can disable itself.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onNewPromise = function (promise) {
   log += 'n';
   dbg.onNewPromise = undefined;
 };
 
--- a/js/src/jit-test/tests/debug/Debugger-onNewPromise-05.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-05.js
@@ -1,11 +1,11 @@
 // Creating a promise within an onNewPromise handler causes a recursive handler
 // invocation.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var log;
 var depth;
 
 dbg.onNewPromise = function (promise) {
   log += '('; depth++;
 
--- a/js/src/jit-test/tests/debug/Debugger-onNewPromise-06.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-06.js
@@ -1,13 +1,13 @@
 // Resumption values from onNewPromise handlers are disallowed.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onNewPromise = function (g) { log += 'n'; return undefined; };
 log = '';
 assertEq(typeof new g.Promise(function (){}), "object");
 assertEq(log, 'n');
 
--- a/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js
@@ -1,12 +1,12 @@
 // Errors in onNewPromise handlers are reported correctly, and don't mess up the
 // promise creation.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 let e;
 dbg.uncaughtExceptionHook = ee => { e = ee; };
 dbg.onNewPromise = () => { throw new Error("woops!"); };
 
 assertEq(typeof new g.Promise(function (){}), "object");
 assertEq(!!e, true);
--- a/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-01.js
+++ b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-01.js
@@ -1,11 +1,11 @@
 // Test that the onPromiseSettled hook gets called when a promise settles.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 let log = "";
 let pw;
 dbg.onPromiseSettled = pw_ => {
   pw = pw_;
   log += "s";
--- a/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js
+++ b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js
@@ -1,11 +1,11 @@
 // onPromiseSettled handlers fire, until they are removed.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 log = '';
 g.settlePromiseNow(new g.Promise(function (){}));
 assertEq(log, '');
 
 dbg.onPromiseSettled = function (promise) {
--- a/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-03.js
+++ b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-03.js
@@ -1,10 +1,10 @@
 // onPromiseSettled handlers on different Debugger instances are independent.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg1 = new Debugger(g);
 var log1;
 function h1(promise) {
   log1 += 's';
   assertEq(promise.seen, undefined);
   promise.seen = true;
 }
 
--- a/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-04.js
+++ b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-04.js
@@ -1,10 +1,10 @@
 // An onPromiseSettled handler can disable itself.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onPromiseSettled = function (promise) {
   log += 's';
   dbg.onPromiseSettled = undefined;
 };
 
--- a/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-05.js
+++ b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-05.js
@@ -1,12 +1,12 @@
 // Settling a promise within an onPromiseSettled handler causes a recursive
 // handler invocation.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var log;
 var depth;
 
 dbg.onPromiseSettled = function (promise) {
   log += '('; depth++;
 
--- a/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-06.js
+++ b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-06.js
@@ -1,13 +1,13 @@
 // Resumption values from onPromiseSettled handlers are disallowed.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onPromiseSettled = function (g) { log += 's'; return undefined; };
 log = '';
 g.settlePromiseNow(new g.Promise(function (){}));
 assertEq(log, 's');
 
--- a/js/src/jit-test/tests/debug/Environment-01.js
+++ b/js/src/jit-test/tests/debug/Environment-01.js
@@ -1,11 +1,11 @@
 // A live Environment can observe the new variables introduced by ES5 non-strict direct eval.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var x = 'global'; function f(s) { h(); eval(s); h(); }");
 g.eval("function h() { debugger; }");
 var dbg = Debugger(g);
 var env = undefined;
 var hits = 0;
 dbg.onDebuggerStatement = function (hframe) {
     if (env === undefined) {
         // First debugger statement.
--- a/js/src/jit-test/tests/debug/Environment-02.js
+++ b/js/src/jit-test/tests/debug/Environment-02.js
@@ -1,11 +1,11 @@
 // The last Environment on the environment chain always has .type == "object" and .object === the global object.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 g.eval("function h() { debugger; }");
 var hits = 0;
 dbg.onDebuggerStatement = function (hframe) {
     var env = hframe.older.environment;
     while (env.parent)
         env = env.parent;
--- a/js/src/jit-test/tests/debug/Environment-03.js
+++ b/js/src/jit-test/tests/debug/Environment-03.js
@@ -1,10 +1,10 @@
 // Test that getting a function's environment can unlazify scripts.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('function f() { }');
 var dbg = new Debugger;
 var gw = dbg.makeGlobalObjectReference(g);
 var fw = gw.getOwnPropertyDescriptor('f').value;
 gc();
 dbg.addDebuggee(g);
 var fenv = fw.environment;
--- a/js/src/jit-test/tests/debug/Environment-Function-prototype.js
+++ b/js/src/jit-test/tests/debug/Environment-Function-prototype.js
@@ -1,7 +1,7 @@
 // Don't crash when getting the Debugger.Environment of a frame inside
 // Function.prototype.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onEnterFrame = function (frame) { frame.environment; };
 g.Function.prototype();
--- a/js/src/jit-test/tests/debug/Environment-bug-1431461.js
+++ b/js/src/jit-test/tests/debug/Environment-bug-1431461.js
@@ -1,11 +1,11 @@
 // Check that duplicate bindings are not created for let/const variables.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 g.eval(`
 function f(x, y=x) {
     let z = "Z";
     debugger;
     return x + y + z;
 }
--- a/js/src/jit-test/tests/debug/Environment-callee-01.js
+++ b/js/src/jit-test/tests/debug/Environment-callee-01.js
@@ -1,12 +1,12 @@
 // Debugger.Environment.prototype.callee reveals the callee of environments
 // that have them.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 function check(code, expectedType, expectedCallee) {
   print("check(" + uneval(code) + ")");
   var hits;
   dbg.onDebuggerStatement = function (frame) {
     hits++;
--- a/js/src/jit-test/tests/debug/Environment-callee-02.js
+++ b/js/src/jit-test/tests/debug/Environment-callee-02.js
@@ -1,11 +1,11 @@
 // Debugger.Environment.prototype.callee gets the right closure.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 g.eval('function f(x) { return function (y) { debugger; return x + y; } }');
 g.eval('var g = f(2);');
 g.eval('var h = f(3);');
 
 function check(fun, label) {
--- a/js/src/jit-test/tests/debug/Environment-callee-03.js
+++ b/js/src/jit-test/tests/debug/Environment-callee-03.js
@@ -1,12 +1,12 @@
 // Environments of different instances of the same generator have the same
 // callee. I love this job.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 function check(gen, label) {
   print("check(" + label + ")");
   var hits;
   dbg.onDebuggerStatement = function (frame) {
     hits++;
--- a/js/src/jit-test/tests/debug/Environment-callee-04.js
+++ b/js/src/jit-test/tests/debug/Environment-callee-04.js
@@ -1,13 +1,13 @@
 // We shouldn't hand out environment callees when we can only provide the
 // internal function object, not the live function object. (We should never
 // create Debugger.Object instances referring to internal function objects.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = function (frame) {
   assertEq(frame.older.environment.parent.callee, null);
 }
 
 g.evaluate(`
 
--- a/js/src/jit-test/tests/debug/Environment-find-01.js
+++ b/js/src/jit-test/tests/debug/Environment-find-01.js
@@ -1,11 +1,11 @@
 // find sees that vars are hoisted out of with statements.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.environment.find("x").type, "with");
     hits++;
 };
 
 assertEq(g.eval("(function () {\n" +
--- a/js/src/jit-test/tests/debug/Environment-find-02.js
+++ b/js/src/jit-test/tests/debug/Environment-find-02.js
@@ -1,11 +1,11 @@
 // env.find() finds nonenumerable names in the global environment.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 g.h = function () {
     var env = dbg.getNewestFrame().environment;
     var last = env;
     while (last.parent)
         last = last.parent;
 
--- a/js/src/jit-test/tests/debug/Environment-find-03.js
+++ b/js/src/jit-test/tests/debug/Environment-find-03.js
@@ -1,11 +1,11 @@
 // env.find() finds nonenumerable properties in with statements.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 g.h = function () {
     var frame = dbg.getNewestFrame();
     var target = frame.eval("obj").return;
     var env = frame.environment.find("PI");
     assertEq(env.object, target);
     hits++;
--- a/js/src/jit-test/tests/debug/Environment-find-04.js
+++ b/js/src/jit-test/tests/debug/Environment-find-04.js
@@ -1,13 +1,13 @@
 // env.find throws a TypeError if the argument is not an identifier.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 g.h = function () {
     var env = dbg.getNewestFrame().environment;
     assertThrowsInstanceOf(function () { env.find(); }, TypeError);
     assertThrowsInstanceOf(function () { env.find(""); }, TypeError);
     assertThrowsInstanceOf(function () { env.find(" "); }, TypeError);
     assertThrowsInstanceOf(function () { env.find(0); }, TypeError);
--- a/js/src/jit-test/tests/debug/Environment-find-06.js
+++ b/js/src/jit-test/tests/debug/Environment-find-06.js
@@ -1,12 +1,12 @@
 // Environment.prototype.find finds bindings that are function arguments, 'let'
 // bindings, or FunctionExpression names.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function h() { debugger; }");
 
 var dbg = new Debugger(g);
 
 function test1(code) {
     var hits = 0;
     dbg.onDebuggerStatement = function (frame) {
         var env = frame.older.environment.find('X');
--- a/js/src/jit-test/tests/debug/Environment-find-07.js
+++ b/js/src/jit-test/tests/debug/Environment-find-07.js
@@ -1,11 +1,11 @@
 // We can find into and from optimized out scopes.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 dbg.addDebuggee(g);
 
 g.eval("" + function f() {
   var x = 42;
   function g() { }
   g();
 });
--- a/js/src/jit-test/tests/debug/Environment-gc-01.js
+++ b/js/src/jit-test/tests/debug/Environment-gc-01.js
@@ -1,11 +1,11 @@
 // An Environment keeps its referent alive.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(x) { return 2 * x; }");
 var dbg = Debugger(g);
 var env;
 dbg.onEnterFrame = function (frame) { env = frame.environment; };
 assertEq(g.f(22), 44);
 dbg.onEnterFrame = undefined;
 
 assertEq(env.find("x"), env);
--- a/js/src/jit-test/tests/debug/Environment-gc-02.js
+++ b/js/src/jit-test/tests/debug/Environment-gc-02.js
@@ -1,12 +1,12 @@
 // A closure's .environment keeps the lexical environment alive even if the closure is destroyed.
 
 var N = 4;
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function add(a) { return function (b) { return eval('a + b'); }; }");
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var aw = gw.getOwnPropertyDescriptor("add").value;
 
 // Create N closures and collect environments.
 var arr = [];
 for (var i = 0; i < N; i++)
--- a/js/src/jit-test/tests/debug/Environment-gc-03.js
+++ b/js/src/jit-test/tests/debug/Environment-gc-03.js
@@ -1,11 +1,11 @@
 // Test that block scopes cannot be resurrected by onStep.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function(frame) {
     frame.onStep = (function() {
         frame.environment;
     });
 };
 
 g.eval("debugger; for (let i = 0; i < 1; i++) (function(){});");
--- a/js/src/jit-test/tests/debug/Environment-getVariable-01.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-01.js
@@ -1,11 +1,11 @@
 // Environment.prototype.getVariable does not see variables bound in enclosing scopes.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.environment.getVariable("x"), 13);
     assertEq(frame.environment.getVariable("k"), undefined);
     assertEq(frame.environment.find("k").getVariable("k"), 3);
     hits++;
 };
--- a/js/src/jit-test/tests/debug/Environment-getVariable-02.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-02.js
@@ -1,11 +1,11 @@
 // getVariable works in function scopes.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var lexicalEnv = frame.environment;
     var varEnv = lexicalEnv.parent;
     assertEq(varEnv.getVariable("a"), 1);
     assertEq(varEnv.getVariable("b"), 2);
     assertEq(varEnv.getVariable("c"), 3);
--- a/js/src/jit-test/tests/debug/Environment-getVariable-03.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-03.js
@@ -1,11 +1,11 @@
 // getVariable sees bindings in let-block scopes.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
     log += frame.environment.getVariable("x");
 };
 g.eval("function f() {\n" +
        "    let x = 'a';\n" +
        "    debugger;\n" +
--- a/js/src/jit-test/tests/debug/Environment-getVariable-04.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-04.js
@@ -1,11 +1,11 @@
 // getVariable sees variables in function scopes added by non-strict direct eval.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var v;
 dbg.onDebuggerStatement = function (frame) {
     v = frame.environment.getVariable("x");
 };
 
 g.eval("function f(s) { eval(s); debugger; }");
 g.f("var x = 'Q';");
--- a/js/src/jit-test/tests/debug/Environment-getVariable-05.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-05.js
@@ -1,10 +1,10 @@
 // getVariable sees global variables.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
     log += frame.environment.parent.getVariable("x") + frame.environment.parent.getVariable("y");
 };
 g.eval("var x = 'a'; this.y = 'b'; debugger;");
 assertEq(log, 'ab');
--- a/js/src/jit-test/tests/debug/Environment-getVariable-06.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-06.js
@@ -1,11 +1,11 @@
 // getVariable sees properties inherited from the global object's prototype chain.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
     log += frame.environment.parent.getVariable("x") + frame.environment.parent.getVariable("y");
 };
 g.eval("Object.getPrototypeOf(this).x = 'a';\n" +
        "Object.prototype.y = 'b';\n" +
        "debugger;\n");
--- a/js/src/jit-test/tests/debug/Environment-getVariable-07.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-07.js
@@ -1,10 +1,10 @@
 // getVariable can get properties from with-block scopes.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var v;
 dbg.onDebuggerStatement = function (frame) {
     v = frame.environment.getVariable("x");
 };
 g.eval("var x = 1; { let x = 2; with ({x: 3}) { debugger; } }");
 assertEq(v, 3);
--- a/js/src/jit-test/tests/debug/Environment-getVariable-08.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-08.js
@@ -1,10 +1,10 @@
 // getVariable sees properties inherited from a with-object's prototype chain.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var v;
 dbg.onDebuggerStatement = function (frame) {
     v = frame.environment.getVariable("x");
 };
 g.eval("var x = 1; { let x = 2; with (Object.create({x: 3})) { debugger; } }");
 assertEq(v, 3);
--- a/js/src/jit-test/tests/debug/Environment-getVariable-09.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-09.js
@@ -1,11 +1,11 @@
 // getVariable works on ancestors of frame.environment.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
     for (var env = frame.environment; env; env = env.parent) {
         if (env.find("x") === env)
             log += env.getVariable("x");
     }
 };
--- a/js/src/jit-test/tests/debug/Environment-getVariable-10.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-10.js
@@ -1,11 +1,11 @@
 // getVariable works on a heavyweight environment after control leaves its scope.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var envs = [];
 dbg.onDebuggerStatement = function (frame) {
     envs.push(frame.environment);
 };
 g.eval("var f;\n" +
        "for (var x = 0; x < 3; x++) {\n" +
        "    (function (x) {\n" +
--- a/js/src/jit-test/tests/debug/Environment-getVariable-11.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-11.js
@@ -1,11 +1,11 @@
 // The value returned by getVariable can be a Debugger.Object.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var a = frame.environment.parent.getVariable('Math');
     assertEq(a instanceof Debugger.Object, true);
     var b = gw.getOwnPropertyDescriptor('Math').value;
     assertEq(a, b);
--- a/js/src/jit-test/tests/debug/Environment-getVariable-12.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-12.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     assertEq(frame.environment.parent.getVariable('y'), true);
 };
--- a/js/src/jit-test/tests/debug/Environment-getVariable-13.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-13.js
@@ -4,17 +4,17 @@
 // kicking in.
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit(0);
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   // Note that this *depends* on CCW scripted functions being opaque to Ion
   // optimization and not deoptimizing the frames below the call to toggle.
   g.toggle = function toggle(d) {
     if (d) {
       dbg.addDebuggee(g);
       var frame = dbg.getNewestFrame();
--- a/js/src/jit-test/tests/debug/Environment-getVariable-14.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-14.js
@@ -1,11 +1,11 @@
 // Debugger.Environment can reflect optimized out function scopes
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 dbg.addDebuggee(g);
 
 g.eval("" + function f() {
   var x = 42;
   function g() { }
   g();
 });
--- a/js/src/jit-test/tests/debug/Environment-getVariable-15.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-15.js
@@ -2,17 +2,17 @@
 
 // When the real scope chain object holding the binding for 'f' in 'function f()
 // { ... }' is optimized out because it's never used, we whip up fake scope
 // chain objects for Debugger to use, if it looks. However, the value of the
 // variable f will be an internal function object, not a live function object,
 // since the latter was not recorded. Internal function objects should not be
 // exposed via Debugger.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = function (frame) {
   var g_call_env = frame.older.environment;     // g's locals
   var g_decl_env = g_call_env.parent;           // 'function g' binding
   var f_call_env = g_decl_env.parent;           // f's locals
   var f_decl_env = f_call_env.parent;           // 'function f' binding
   assertEq(f_decl_env.getVariable('f').optimizedOut, true);
--- a/js/src/jit-test/tests/debug/Environment-getVariable-WouldRun.js
+++ b/js/src/jit-test/tests/debug/Environment-getVariable-WouldRun.js
@@ -1,14 +1,14 @@
 // getVariable that would trigger a getter does not crash or explode.
 // It should throw WouldRunDebuggee, but that isn't implemented yet.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertThrowsInstanceOf(function () {
         frame.environment.parent.parent.getVariable("x");
     }, Error);
     hits++;
 };
--- a/js/src/jit-test/tests/debug/Environment-identity-01.js
+++ b/js/src/jit-test/tests/debug/Environment-identity-01.js
@@ -1,12 +1,12 @@
 // The value of frame.environment is the same Environment object at different
 // times within a single visit to a scope.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 g.eval("function h() { debugger; }");
 var hits, env;
 dbg.onDebuggerStatement = function (hframe) {
     var frame = hframe.older;
     var e = frame.environment;
 
     // frame.environment is at least cached from one moment to the next.
--- a/js/src/jit-test/tests/debug/Environment-identity-02.js
+++ b/js/src/jit-test/tests/debug/Environment-identity-02.js
@@ -1,11 +1,11 @@
 // frame.environment is different for different activations of a scope.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 g.eval("function h() { debugger; }");
 var arr;
 dbg.onDebuggerStatement = function (hframe) {
     var e = hframe.older.environment;
     assertEq(arr.indexOf(e), -1);
     arr.push(e);
 };
--- a/js/src/jit-test/tests/debug/Environment-identity-03.js
+++ b/js/src/jit-test/tests/debug/Environment-identity-03.js
@@ -1,16 +1,16 @@
 // Two Environments nested in the same runtime scope share the correct tail of their parent chains.
 
 // The compiler must be allowed to elide empty scopes and so forth, so this
 // test does not check the number of unshared Environments. Instead, each test
 // case identifies the expected innermost shared scope by the name of a
 // variable in it.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function h() { debugger; }");
 var dbg = Debugger(g);
 var hits, name, shared, unshared;
 dbg.onDebuggerStatement = function (hframe) {
     var frame = hframe.older;
 
     // Find name in frame.environment.
     var env, child = null;
--- a/js/src/jit-test/tests/debug/Environment-identity-04.js
+++ b/js/src/jit-test/tests/debug/Environment-identity-04.js
@@ -1,11 +1,11 @@
 // Observably different visits to the same with-statement produce distinct Environments.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(a, obj) { with (obj) return function () { return a; }; }");
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     // Even though the two visits to the with-statement have the same target
     // object, Math, the environments are observably different.
     var f1 = frame.eval("f(1, Math);").return;
     var f2 = frame.eval("f(2, Math);").return;
--- a/js/src/jit-test/tests/debug/Environment-identity-05.js
+++ b/js/src/jit-test/tests/debug/Environment-identity-05.js
@@ -1,11 +1,11 @@
 // Tests that freshened blocks behave correctly in Debugger.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 var oldEnv = null;
 dbg.onDebuggerStatement = function (frame) {
   if (!oldEnv) {
     oldEnv = frame.environment;
   } else {
     // Block has been freshened by |for (let ...)|, should be different
--- a/js/src/jit-test/tests/debug/Environment-inspectable-01.js
+++ b/js/src/jit-test/tests/debug/Environment-inspectable-01.js
@@ -1,14 +1,14 @@
 // Environments are only inspectable while their globals are debuggees.
 
 load(libdir + 'asserts.js');
 
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 g2.g1 = g1;
 g1.g2 = g2;
 
 g1.eval('function f(xf) { return function h(xh) { debugger; } }');
 g1.eval('var h = f("value of xf");');
 
 // To ensure that xk gets located on the heap, and thus outlives its stack frame, we
 // store a function that captures it here. Kind of a kludge.
--- a/js/src/jit-test/tests/debug/Environment-names-01.js
+++ b/js/src/jit-test/tests/debug/Environment-names-01.js
@@ -1,11 +1,11 @@
 // env.names() lists nonenumerable names in with-statement environments.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 g.h = function () {
     var env = dbg.getNewestFrame().environment;
     var names = env.names();
     assertEq(names.indexOf("a") !== -1, true);
 
     // FIXME: Bug 748592 - proxies don't correctly propagate JSITER_HIDDEN
--- a/js/src/jit-test/tests/debug/Environment-names-02.js
+++ b/js/src/jit-test/tests/debug/Environment-names-02.js
@@ -1,11 +1,11 @@
 // env.names() on object environments ignores property names that are not identifiers.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var withNames, globalNames;
 g.h = function () {
     var env = dbg.getNewestFrame().environment;
     withNames = env.names();
     while (env.parent !== null)
         env = env.parent;
     globalNames = env.names();
--- a/js/src/jit-test/tests/debug/Environment-names-03.js
+++ b/js/src/jit-test/tests/debug/Environment-names-03.js
@@ -1,11 +1,11 @@
 // Optimized out scopes should have working names().
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 dbg.addDebuggee(g);
 
 g.eval("" + function f() {
   var x = 42;
   function g() { }
   g();
 });
--- a/js/src/jit-test/tests/debug/Environment-nondebuggee.js
+++ b/js/src/jit-test/tests/debug/Environment-nondebuggee.js
@@ -1,13 +1,13 @@
 // Using an environment that is not a debuggee should throw.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 let gw = dbg.addDebuggee(g);
 var log;
 
 function check(env) {
   assertEq(env.inspectable, false);
   assertThrowsInstanceOf(() => env.type, Error);
   assertThrowsInstanceOf(() => env.object, Error);
--- a/js/src/jit-test/tests/debug/Environment-object-01.js
+++ b/js/src/jit-test/tests/debug/Environment-object-01.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = (frame) => {
   assertEq(frame.environment.parent.type, "with");
   assertEq(frame.environment.parent.parent.type, "object");
   assertEq(frame.environment.parent.parent.object.getOwnPropertyDescriptor("x").value, 42);
 }
 g.evalReturningScope("x = 42; debugger;");
--- a/js/src/jit-test/tests/debug/Environment-optimizedOut-01.js
+++ b/js/src/jit-test/tests/debug/Environment-optimizedOut-01.js
@@ -1,11 +1,11 @@
 // Optimized out scopes should be considered optimizedOut.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 dbg.addDebuggee(g);
 
 g.eval("" + function f() {
   var x = 42;
   {
     let y = 43;
     (function () { })();
--- a/js/src/jit-test/tests/debug/Environment-parent-01.js
+++ b/js/src/jit-test/tests/debug/Environment-parent-01.js
@@ -1,12 +1,12 @@
 // The objects on the environment chain are all Debugger.Environment objects.
 // The environment chain ends in null.
 
-var g = newGlobal()
+var g = newGlobal({newCompartment: true})
 g.eval("function f(a) { return function (b) { return function (c) { h(); return a + b + c; }; }; }");
 var dbg = Debugger(g);
 var hits = 0;
 g.h = function () {
     var n = 0;
     for (var env = dbg.getNewestFrame().environment; env !== null; env = env.parent) {
         n++;
         assertEq(env instanceof Debugger.Environment, true);
--- a/js/src/jit-test/tests/debug/Environment-setVariable-01.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-01.js
@@ -1,9 +1,9 @@
 // Environment.prototype.setVariable can set global variables.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.environment.parent.setVariable("x", 2);
 };
 g.eval("var x = 1; debugger;");
 assertEq(g.x, 2);
--- a/js/src/jit-test/tests/debug/Environment-setVariable-02.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-02.js
@@ -1,10 +1,10 @@
 // The argument to setVariable can be a Debugger.Object.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.environment.parent.setVariable("x", gw);
 };
 g.eval("var x = 1; debugger;");
 assertEq(g.x, g);
--- a/js/src/jit-test/tests/debug/Environment-setVariable-03.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-03.js
@@ -1,14 +1,14 @@
 // setVariable cannot create new global variables.
 // (Other kinds of environment are tested in Environment-variables.js.)
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertThrowsInstanceOf(function () { frame.environment.setVariable("x", 7); }, TypeError);
     hits++;
 };
 g.eval("debugger");
 assertEq("x" in g, false);
--- a/js/src/jit-test/tests/debug/Environment-setVariable-04.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-04.js
@@ -1,10 +1,10 @@
 // setVariable can set variables and arguments in functions.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.environment.setVariable("a", 100);
     frame.environment.setVariable("b", 200);
 };
 g.eval("function f(a) { var b = a + 1; debugger; return a + b; }");
 assertEq(g.f(1), 300);
--- a/js/src/jit-test/tests/debug/Environment-setVariable-05.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-05.js
@@ -1,11 +1,11 @@
 // setVariable can change the types of variables and arguments in functions.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(a) { var b = a + 1; debugger; return a + b; }");
 for (var i = 0; i < 20; i++)
     assertEq(g.f(i), 2 * i + 1);
 
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.environment.setVariable("a", "xyz");
     frame.environment.setVariable("b", "zy");
--- a/js/src/jit-test/tests/debug/Environment-setVariable-06.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-06.js
@@ -1,9 +1,9 @@
 // setVariable on an argument works as expected with non-strict 'arguments'.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(a) { debugger; return arguments[0]; }");
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.environment.setVariable("a", 2);
 };
 assertEq(g.f(1), 2);
--- a/js/src/jit-test/tests/debug/Environment-setVariable-07.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-07.js
@@ -1,11 +1,11 @@
 // setVariable works on let-bindings.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 function test(code, val) {
     g.eval("function f() { " + code + " }");
     var dbg = new Debugger(g);
     dbg.onDebuggerStatement = function (frame) {
         frame.environment.setVariable("a", val);
     };
     assertEq(g.f(), val);
 }
--- a/js/src/jit-test/tests/debug/Environment-setVariable-08.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-08.js
@@ -1,14 +1,14 @@
 // setVariable throws if no binding exists.
 
 load(libdir + "asserts.js");
 
 function test(code) {
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     var dbg = new Debugger(g);
     var hits = 0;
     dbg.onDebuggerStatement = function (frame) {
         var env = frame.older.environment;
         assertThrowsInstanceOf(function () { env.setVariable("y", 2); }, Error);
         hits++;
     };
     g.eval("var y = 0; function d() { debugger; }");
--- a/js/src/jit-test/tests/debug/Environment-setVariable-10.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-10.js
@@ -1,17 +1,17 @@
 // setVariable works on non-innermost environments.
 
 // (The debuggee code here is a bit convoluted to defeat optimizations that
 // could make obj.b a null closure or obj.i a flat closure--that is, a function
 // that gets a frozen copy of i instead of a reference to the runtime
 // environment that contains it. setVariable does not currently detect this
 // flat closure case.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function d() { debugger; }\n" +
        "var i = 'FAIL';\n" +
        "function a() {\n" +
        "    var obj = {b: function (i) { d(obj); return i; },\n" +
        "               i: function () { return i; }};\n" +
        "    var i = 'FAIL2';\n" +
        "    return obj;\n" +
        "}\n");
--- a/js/src/jit-test/tests/debug/Environment-setVariable-11.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-11.js
@@ -1,13 +1,13 @@
 // setVariable cannot modify the binding for a FunctionExpression's name.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var env = frame.environment.find("f");
     assertEq(env.getVariable("f"), frame.callee);
     assertThrowsInstanceOf(function () { env.setVariable("f", 0) }, TypeError);
     assertThrowsInstanceOf(function () { env.setVariable("f", frame.callee) }, TypeError);
     hits++;
--- a/js/src/jit-test/tests/debug/Environment-setVariable-12.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-12.js
@@ -1,12 +1,12 @@
 // setVariable can create a new property on a with block's bindings object, if
 // it is shadowing an existing property on the prototype chain.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     var env = frame.environment.find("x");
     env.setVariable("x", 2);
 };
 g.eval("var obj1 = {x: 1}, obj2 = Object.create(obj1), z; with (obj2) { debugger; z = x; }");
 assertEq(g.obj1.x, 1);
 assertEq(g.obj2.x, 2);
--- a/js/src/jit-test/tests/debug/Environment-setVariable-13.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-13.js
@@ -1,13 +1,13 @@
 // Debugger.Environment should throw trying to setVariable on optimized out scope.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 dbg.addDebuggee(g);
 
 g.eval("" + function f() {
   var x = 42;
   function g() { }
   g();
 });
--- a/js/src/jit-test/tests/debug/Environment-setVariable-WouldRun.js
+++ b/js/src/jit-test/tests/debug/Environment-setVariable-WouldRun.js
@@ -1,14 +1,14 @@
 // setVariable triggering a setter throws WouldRunDebuggee.
 
 load(libdir + "asserts.js");
 
 function test(code) {
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     g.eval("function d() { debugger; }");
     var dbg = Debugger(g);
     var hits = 0;
     dbg.onDebuggerStatement = function (frame) {
         var env = frame.older.environment.find("x");
         assertThrowsInstanceOf(
             () => env.setVariable("x", 0),
             Debugger.DebuggeeWouldRun);
--- a/js/src/jit-test/tests/debug/Environment-type-01.js
+++ b/js/src/jit-test/tests/debug/Environment-type-01.js
@@ -1,11 +1,11 @@
 // env.type is 'object' in global environments and with-blocks, and 'declarative' otherwise.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 function test(code, expected) {
     var actual = '';
     g.h = function () { actual += dbg.getNewestFrame().environment.type; }
     g.eval(code);
     assertEq(actual, expected);
 }
 
--- a/js/src/jit-test/tests/debug/Environment-unscopables.js
+++ b/js/src/jit-test/tests/debug/Environment-unscopables.js
@@ -1,13 +1,13 @@
 // An Environment for a `with` statement does not observe bindings ruled out by @@unscopables.
 
 load(libdir + "asserts.js");
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
     let x = 'global';
     function f() {
         let obj = {
             x: 'obj',
             y: 'obj',
             [Symbol.unscopables]: {x: 1},
         };
--- a/js/src/jit-test/tests/debug/Environment-variables.js
+++ b/js/src/jit-test/tests/debug/Environment-variables.js
@@ -37,17 +37,17 @@ var cases = [
 ];
 
 var nextval = 1000;
 
 function test(code, debugStmts, followupStmts) {
     var val = nextval++;
     var hits = 0;
 
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     g.eval("function debugMe() { var x = 'wrong-x'; debugger; }");
     g.capture = null;
 
     var dbg = Debugger(g);
     dbg.onDebuggerStatement = function (frame) {
         if (frame.callee !== null && frame.callee.name == 'debugMe')
             frame = frame.older;
         var env = frame.environment.find("x");
--- a/js/src/jit-test/tests/debug/Frame-01.js
+++ b/js/src/jit-test/tests/debug/Frame-01.js
@@ -1,11 +1,11 @@
 // Test .type and .generator fields of topmost stack frame passed to onDebuggerStatement.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var expected, hits;
 dbg.onDebuggerStatement = function (f) {
     assertEq(Object.getPrototypeOf(f), Debugger.Frame.prototype);
     assertEq(f.type, expected.type);
     assertEq(f.generator, expected.generator);
     assertEq(f.constructing, expected.constructing);
     hits++;
--- a/js/src/jit-test/tests/debug/Frame-02.js
+++ b/js/src/jit-test/tests/debug/Frame-02.js
@@ -1,12 +1,12 @@
 // When the debugger is triggered twice from the same stack frame, the same
 // Debugger.Frame object is passed to the hook both times.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var hits, frame;
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (f) {
     if (hits++ == 0)
         frame = f;
     else
         assertEq(f, frame);
 };
--- a/js/src/jit-test/tests/debug/Frame-03.js
+++ b/js/src/jit-test/tests/debug/Frame-03.js
@@ -1,12 +1,12 @@
 // When the debugger is triggered from different stack frames that happen to
 // occupy the same memory, it delivers different Debugger.Frame objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits;
 var a = [];
 dbg.onDebuggerStatement = function (frame) {
     for (var i = 0; i < a.length; i++) 
         assertEq(a[i] === frame, false);
     a.push(frame);
     hits++;
--- a/js/src/jit-test/tests/debug/Frame-arguments-01.js
+++ b/js/src/jit-test/tests/debug/Frame-arguments-01.js
@@ -1,11 +1,11 @@
 // Frame.prototype.arguments with primitive values
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.args = null;
 var dbg = new Debugger(g);
 var hits;
 var v;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     var args = frame.arguments;
     assertEq(args instanceof Array, true);
--- a/js/src/jit-test/tests/debug/Frame-arguments-02.js
+++ b/js/src/jit-test/tests/debug/Frame-arguments-02.js
@@ -1,11 +1,11 @@
 // Object arguments.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var args = frame.arguments;
     assertEq(args, frame.arguments);
     assertEq(args instanceof Array, true);
     assertEq(args.length, 2);
     assertEq(args[0] instanceof Debugger.Object, true);
--- a/js/src/jit-test/tests/debug/Frame-arguments-03.js
+++ b/js/src/jit-test/tests/debug/Frame-arguments-03.js
@@ -1,11 +1,11 @@
 // Destructuring arguments.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var args = frame.arguments;
     assertEq(args[0], 1);
     assertEq(args.length, 4);
 
     assertEq(args[1] instanceof Debugger.Object, true);
--- a/js/src/jit-test/tests/debug/Frame-arguments-04.js
+++ b/js/src/jit-test/tests/debug/Frame-arguments-04.js
@@ -1,11 +1,11 @@
 // frame.arguments works for all live frames
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     for (var i = 0; i <= 4; i++) {
         assertEq(frame.arguments.length, 1);
         assertEq(frame.arguments[0], i);
         frame = frame.older;
     }
--- a/js/src/jit-test/tests/debug/Frame-arguments-05.js
+++ b/js/src/jit-test/tests/debug/Frame-arguments-05.js
@@ -1,11 +1,11 @@
 // frame.arguments is "live" (it reflects assignments to arguments).
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log = '';
 var args;
 dbg.onDebuggerStatement = function (frame) {
     if (args === undefined)
         args = frame.arguments;
     else
         assertEq(frame.arguments, args);
--- a/js/src/jit-test/tests/debug/Frame-arguments-06.js
+++ b/js/src/jit-test/tests/debug/Frame-arguments-06.js
@@ -1,14 +1,14 @@
 // Test extracting frame.arguments element getters and calling them in
 // various awkward ways.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 var fframe, farguments, fgetter;
 dbg.onDebuggerStatement = function (frame) {
     if (hits === 0) {
         fframe = frame;
         farguments = frame.arguments;
         fgetter = Object.getOwnPropertyDescriptor(farguments, "0").get;
--- a/js/src/jit-test/tests/debug/Frame-arguments-07.js
+++ b/js/src/jit-test/tests/debug/Frame-arguments-07.js
@@ -1,11 +1,11 @@
 // When argument[x] is assigned, where x > callee.length, frame.arguments reflects the change.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(a, b) {\n" +
        "    for (var i = 0; i < arguments.length; i++)\n" +
        "        arguments[i] = i;\n" +
        "    debugger;\n" +
        "}\n");
 
 var dbg = Debugger(g);
 var hits = 0;
--- a/js/src/jit-test/tests/debug/Frame-environment-01.js
+++ b/js/src/jit-test/tests/debug/Frame-environment-01.js
@@ -1,11 +1,11 @@
 // frame.environment is a Debugger.Environment object
 
-var g = newGlobal()
+var g = newGlobal({newCompartment: true})
 var dbg = Debugger(g);
 g.h = function () {
     assertEq(dbg.getNewestFrame().environment instanceof Debugger.Environment, true);
 };
 
 g.eval("h()");
 g.evaluate("h()");
 g.eval("eval('h()')");
--- a/js/src/jit-test/tests/debug/Frame-environment-02.js
+++ b/js/src/jit-test/tests/debug/Frame-environment-02.js
@@ -1,11 +1,11 @@
 // dbg.getNewestFrame().environment works.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 g.h = function () {
     var env = dbg.getNewestFrame().environment.parent;
     assertEq(env instanceof Debugger.Environment, true);
     assertEq(env.object, gw);
     assertEq(env.parent, null);
 };
--- a/js/src/jit-test/tests/debug/Frame-environment-03.js
+++ b/js/src/jit-test/tests/debug/Frame-environment-03.js
@@ -1,11 +1,11 @@
 // If !frame.live, frame.environment throws.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var frame;
 g.h = function () { frame = dbg.getNewestFrame(); };
 g.eval("h();");
 assertEq(frame.live, false);
 assertThrowsInstanceOf(function () { frame.environment; }, Error);
--- a/js/src/jit-test/tests/debug/Frame-environment-04.js
+++ b/js/src/jit-test/tests/debug/Frame-environment-04.js
@@ -1,11 +1,11 @@
 // frame.environment can be called from the onEnterFrame hook.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(x) { return 2 * x; }");
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onEnterFrame = function (frame) {
     assertEq(frame.environment.names().join(","), "arguments,x");
     hits++;
 };
 assertEq(g.f(22), 44);
--- a/js/src/jit-test/tests/debug/Frame-environment-05.js
+++ b/js/src/jit-test/tests/debug/Frame-environment-05.js
@@ -1,9 +1,9 @@
 // Test that Debugger.Frame.prototype.environment works at all pcs of a script
 // with an aliased block scope.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
   frame.onStep = (function ()  { frame.environment; });
 };
 g.eval("debugger; for (let i of [1,2,3]) print(i);");
--- a/js/src/jit-test/tests/debug/Frame-eval-01.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-01.js
@@ -1,8 +1,8 @@
 // simplest possible test of Debugger.Frame.prototype.eval
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var c;
 dbg.onDebuggerStatement = function (frame) { c = frame.eval("2 + 2"); };
 g.eval("debugger;");
 assertEq(c.return, 4);
--- a/js/src/jit-test/tests/debug/Frame-eval-02.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-02.js
@@ -1,10 +1,10 @@
 // frame.eval() throws if frame is not live
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var f;
 dbg.onDebuggerStatement = function (frame) { f = frame; };
 g.eval("debugger;");
 assertThrowsInstanceOf(function () { f.eval("2 + 2"); }, Error);
--- a/js/src/jit-test/tests/debug/Frame-eval-03.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-03.js
@@ -1,13 +1,13 @@
 // Test eval-ing names in a topmost script frame
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.eval("a").return, 2);
     assertEq(frame.eval("c").return, 4);
     var exc = frame.eval("d").throw;
     assertEq(exc instanceof Debugger.Object, true);
     assertEq(exc.proto, frame.eval("ReferenceError.prototype").return);
--- a/js/src/jit-test/tests/debug/Frame-eval-04.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-04.js
@@ -1,11 +1,11 @@
 // frame.eval SyntaxErrors are reflected, not thrown
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var exc, SEp;
 dbg.onDebuggerStatement = function (frame) {
     exc = frame.eval("#$@!").throw;
     SEp = frame.eval("SyntaxError.prototype").return;
 };
 g.eval("debugger;");
 assertEq(exc.proto, SEp);
--- a/js/src/jit-test/tests/debug/Frame-eval-05.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-05.js
@@ -1,11 +1,11 @@
 // var declarations in strict frame.eval do not modify the frame
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var cv;
 dbg.onDebuggerStatement = function (frame) {
     cv = frame.eval("'use strict'; var a = 2; h();");
 };
 g.a = 1;
 g.eval("function f(s) { function h() { return a; } eval(s); debugger; } ");
 g.eval("f('0');");
--- a/js/src/jit-test/tests/debug/Frame-eval-06.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-06.js
@@ -1,13 +1,13 @@
 // frame.eval throws if frame is a generator frame that isn't currently on the stack
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function* gen(a) { debugger; yield a; }");
 g.eval("function test() { debugger; }");
 var dbg = new Debugger(g);
 var genframe;
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     if (frame.callee.name == 'gen')
         genframe = frame;
--- a/js/src/jit-test/tests/debug/Frame-eval-07.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-07.js
@@ -1,11 +1,11 @@
 // test frame.eval in non-top frames
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var N = g.N = 12; // must be even
 assertEq(N % 2, 0);
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var n = frame.eval("n").return;
     if (n === 0) {
         for (var i = 0; i <= N; i++) {
--- a/js/src/jit-test/tests/debug/Frame-eval-08.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-08.js
@@ -1,11 +1,11 @@
 // The arguments can escape from a function via a debugging hook.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // capture arguments object and test function
 var args, testfn;
 dbg.onDebuggerStatement = function (frame) {
     args = frame.eval("arguments").return;
     testfn = frame.eval("test").return;
 };
--- a/js/src/jit-test/tests/debug/Frame-eval-09.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-09.js
@@ -1,11 +1,11 @@
 // assigning to local variables in frame.eval code
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.eval("outerarg = 1; outervar = 2; innerarg = 3; innervar = 4;");
 };
 
 var result = g.eval("(" + function outer(outerarg) {
         var outervar = 200;
         function inner(innerarg) {
--- a/js/src/jit-test/tests/debug/Frame-eval-10.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-10.js
@@ -1,11 +1,11 @@
 // frame.eval returns null if the eval code fails with an uncatchable error.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     if (hits++ === 0)
         assertEq(frame.eval("debugger;"), null);
     else
         return null;
 };
--- a/js/src/jit-test/tests/debug/Frame-eval-11.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-11.js
@@ -1,11 +1,11 @@
 // The arguments can escape from a function via a debugging hook.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // capture arguments object and test function
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.older.eval('arguments[0]').return, 'ponies');
     hits++;
 };
--- a/js/src/jit-test/tests/debug/Frame-eval-12.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-12.js
@@ -1,11 +1,11 @@
 // The arguments can escape from a function via a debugging hook.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // capture arguments object and test function
 dbg.onDebuggerStatement = function (frame) {
   var args = frame.older.environment.parent.getVariable('arguments');
   assertEq(args.missingArguments, true);
 };
 g.eval("function h() { debugger; }");
--- a/js/src/jit-test/tests/debug/Frame-eval-13.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-13.js
@@ -1,11 +1,11 @@
 // The debugger may add new bindings into existing scopes
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function(frame) {
     assertEq(frame.eval("var x = 3; x").return, 3);
     hits++;
 }
 var hits = 0;
 g.eval("(function() { debugger; })()");
 assertEq(hits, 1);
--- a/js/src/jit-test/tests/debug/Frame-eval-14.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-14.js
@@ -1,12 +1,12 @@
 // Test the corner case of accessing an unaliased variable of a block
 // while the block is not live.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function h() { debugger }");
 g.eval("function f() { { let x = 1, y; (function() { y = 0 })(); h() } }");
 g.eval("var surprise = null");
 
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 dbg.onDebuggerStatement = function(hFrame) {
     var fFrame = hFrame.older;
--- a/js/src/jit-test/tests/debug/Frame-eval-15.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-15.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 g.eval("function h() { debugger }");
 g.eval("function f() { h() }");
 g.blah = 42;
 dbg.onDebuggerStatement = function(frame) {
     frame.older.eval("var blah = 43");
     frame.older.eval("blah = 44");
--- a/js/src/jit-test/tests/debug/Frame-eval-16.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-16.js
@@ -1,10 +1,10 @@
 // eval correctly handles optional custom url option
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var count = 0;
 
 function testUrl (options, expected) {
     count++;
     dbg.onDebuggerStatement = function (frame) {
         dbg.onNewScript = function (script) {
             dbg.onNewScript = undefined;
--- a/js/src/jit-test/tests/debug/Frame-eval-17.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-17.js
@@ -1,10 +1,10 @@
 // eval correctly handles optional lineNumber option
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var count = 0;
 
 function testLineNumber (options, expected) {
     count++;
     dbg.onDebuggerStatement = function (frame) {
         dbg.onNewScript = function (script) {
             dbg.onNewScript = undefined;
--- a/js/src/jit-test/tests/debug/Frame-eval-18.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-18.js
@@ -1,12 +1,12 @@
 // yield is not allowed in eval in a star generator.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = function (frame) {
     assertThrowsInstanceOf(function() { frame.eval('yield 10;') }, SyntaxError);
 };
 
 g.eval("(function*g(){ debugger; })()");
--- a/js/src/jit-test/tests/debug/Frame-eval-19.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-19.js
@@ -1,17 +1,17 @@
 // Eval-in-frame of optimized frames to break out of an infinite loop.
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_IonEagerNoOffthreadCompilation))
   quit(0);
 
 withJitOptions(Opts_IonEagerNoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   g.eval("" + function f(d) { g(d); });
   g.eval("" + function g(d) { h(d); });
   g.eval("" + function h(d) {
     var i = 0;
     while (d)
       interruptIf(d && i++ == 4000);
--- a/js/src/jit-test/tests/debug/Frame-eval-20.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-20.js
@@ -2,17 +2,17 @@
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit(0);
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
   function test(shadow) {
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     var dbg = new Debugger;
 
     // Note that we depend on CCW scripted functions being opaque to Ion
     // optimization for this test.
     g.h = function h(d) {
       if (d) {
         dbg.addDebuggee(g);
         var f = dbg.getNewestFrame().older;
--- a/js/src/jit-test/tests/debug/Frame-eval-21.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-21.js
@@ -1,17 +1,17 @@
 // Eval-in-frame with different type on baseline frame with let-scoping
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_BaselineEager))
   quit(0);
 
 withJitOptions(Opts_BaselineEager, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   g.h = function h(d) {
     if (d) {
       dbg.addDebuggee(g);
       var f = dbg.getNewestFrame().older;
       assertEq(f.implementation, "baseline");
       assertEq(f.environment.getVariable("foo"), 42);
--- a/js/src/jit-test/tests/debug/Frame-eval-22.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-22.js
@@ -1,17 +1,17 @@
 // Debugger.Frame preserves Ion frame identity
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit();
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg1 = new Debugger;
   var dbg2 = new Debugger;
 
   g.toggle = function toggle(x, d) {
     if (d) {
       dbg1.addDebuggee(g);
       dbg2.addDebuggee(g);
       var frame1 = dbg1.getNewestFrame();
--- a/js/src/jit-test/tests/debug/Frame-eval-23.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-23.js
@@ -1,17 +1,17 @@
 // Debugger.Frame preserves Ion frame mutations after removing debuggee.
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit();
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   g.toggle = function toggle(x, d) {
     if (d) {
       dbg.addDebuggee(g);
       var frame = dbg.getNewestFrame().older;
       assertEq(frame.callee.name, "f");
       assertEq(frame.environment.getVariable("x"), x);
--- a/js/src/jit-test/tests/debug/Frame-eval-24.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-24.js
@@ -1,11 +1,11 @@
 // Make sure the getVariable/setVariable/eval functions work correctly with
 // unaliased locals.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('\
 function g() { debugger; };\
 function f(arg) {\
     var y = arg - 3;\
     var a1 = 1;\
     var a2 = 1;\
     var b = arg + 9;\
     var z = function() { return a1 + a2; };\
--- a/js/src/jit-test/tests/debug/Frame-eval-26.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-26.js
@@ -1,12 +1,12 @@
 // Bug 1026477: Defining functions with D.F.p.eval works, even if there's
 // already a non-aliased var binding for the identifier.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
   frame.older.eval('function f() { }');
 };
 
 // When the compiler sees the 'debugger' statement, it marks all variables as
 // aliased, but we want to test the case where f is in a stack frame slot, so we
 // put the 'debugger' statement in a separate function, and use frame.older to
--- a/js/src/jit-test/tests/debug/Frame-eval-27.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-27.js
@@ -1,12 +1,12 @@
 // Bug 1026477: Defining functions with D.F.p.eval works, even if there's
 // already a var binding for the identifier.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
   frame.eval('function f() { }');
 };
 
 // When the compiler sees the 'debugger' statement, it marks all variables as
 // aliased, so f will live in a Call object.
 assertEq(typeof g.eval('(function () { var f = 42; debugger; return f;})();'),
--- a/js/src/jit-test/tests/debug/Frame-eval-28.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-28.js
@@ -1,11 +1,11 @@
 // Test that strict Debugger.Frame.eval has a correct static scope.
 options('strict_mode');
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onEnterFrame = function(f) {
   hits++;
   if (hits > 2)
     return;
   f.eval("42");
 };
--- a/js/src/jit-test/tests/debug/Frame-eval-stack.js
+++ b/js/src/jit-test/tests/debug/Frame-eval-stack.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 g.eval("function h() { debugger; }");
 g.eval("function g() { h() }");
 g.eval("function f() { var blah = 333; g() }");
 
 dbg.onDebuggerStatement = function(frame) {
     frame = frame.older;
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-01.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-01.js
@@ -1,11 +1,11 @@
 // evalWithBindings basics
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.evalWithBindings("x", {x: 2}).return, 2);
     assertEq(frame.evalWithBindings("x + y", {x: 2}).return, 5);
     hits++;
 };
 
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-02.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-02.js
@@ -1,11 +1,11 @@
 // evalWithBindings to call a method of a debuggee value
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var global = dbg.addDebuggee(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var obj = frame.arguments[0];
     var expected = frame.arguments[1];
     assertEq(frame.evalWithBindings("obj.toString()", {obj: obj}).return, expected);
     hits++;
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-03.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-03.js
@@ -1,10 +1,10 @@
 // arguments works in evalWithBindings (it does not interpose a function scope)
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var global = dbg.addDebuggee(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var argc = frame.arguments.length;
     assertEq(argc, 8);
     assertEq(frame.evalWithBindings("arguments[prop]", {prop: "length"}).return, argc);
     for (var i = 0; i < argc; i++)
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-04.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-04.js
@@ -1,10 +1,10 @@
 // evalWithBindings works on non-top frames.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var f1;
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.older.evalWithBindings("q + r", {r: 3}).return, 5);
 
     // frame.older.older is in the same function as frame, but a different activation of it
     assertEq(frame.older.older.evalWithBindings("q + r", {r: 3}).return, 6);
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-05.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-05.js
@@ -1,10 +1,10 @@
 // evalWithBindings code can assign to the bindings.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.evalWithBindings("for (i = 0; i < 5; i++) {}  i;", {i: 10}).return, 5);
     hits++;
 };
 
 g.eval("debugger;");
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-06.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-06.js
@@ -1,9 +1,9 @@
 // In evalWithBindings code, assignment to any name not in the bindings works just as in eval.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.evalWithBindings("y = z; x = w;", {z: 2, w: 3}).return, 3);
 };
 g.eval("function f(x) { debugger; assertEq(x, 3); }");
 g.eval("var y = 0; f(0);");
 assertEq(g.y, 2);
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-07.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-07.js
@@ -1,10 +1,10 @@
 // var statements in strict evalWithBindings code behave like strict eval.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.evalWithBindings("var i = a*a + b*b; i === 25;", {a: 3, b: 4}).return, true);
     hits++;
 };
 g.eval("'use strict'; debugger;");
 assertEq(hits, 1);
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-08.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-08.js
@@ -1,10 +1,10 @@
 // evalWithBindings ignores non-enumerable and non-own properties.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.evalWithBindings("toString + constructor + length", []).return, 112233);
     var obj = Object.create({constructor: "FAIL"}, {length: {value: "fail"}});
     assertEq(frame.evalWithBindings("toString + constructor + length", obj).return, 112233);
     hits++;
 };
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-09.js
@@ -1,10 +1,10 @@
 // evalWithBindings code is debuggee code, so it can trip the debugger. It nests!
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var f1;
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     f1 = frame;
 
     // This trips the onExceptionUnwind hook.
     var x = frame.evalWithBindings("wrongSpeling", {rightSpelling: 2}).throw;
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-10.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-10.js
@@ -1,11 +1,11 @@
 // Direct eval code under evalWithBindings sees both the bindings and the enclosing scope.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var code =
         "assertEq(a, 1234);\n" +
         "assertEq(b, null);\n" +
         "assertEq(c, 'ok');\n";
     assertEq(frame.evalWithBindings("eval(s)", {s: code, a: 1234}).return, undefined);
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-11.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-11.js
@@ -1,10 +1,10 @@
 // var statements in non-strict evalWithBindings code behave like non-strict direct eval.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 dbg.onDebuggerStatement = function (frame) {
   log += 'd';
   assertEq(frame.evalWithBindings("var i = v; 42;", { v: 'inner' }).return, 42);
 };
 
 g.i = 'outer';
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-12.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-12.js
@@ -1,10 +1,10 @@
 // evalWithBindings correctly handles optional custom url option
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var count = 0;
 
 function testUrl (options, expected) {
     count++;
     dbg.onDebuggerStatement = function (frame) {
         dbg.onNewScript = function (script) {
             dbg.onNewScript = undefined;
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-13.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-13.js
@@ -1,10 +1,10 @@
 // evalWithBindings correctly handles optional lineNumber option
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var count = 0;
 
 function testLineNumber (options, expected) {
     count++;
     dbg.onDebuggerStatement = function (frame) {
         dbg.onNewScript = function (script) {
             dbg.onNewScript = undefined;
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-14.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-14.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 // We're going to need to eval with a thrown exception from inside
 // onExceptionUnwind, so guard against infinite recursion.
 var exceptionCount = 0;
 dbg.onDebuggerStatement = function (frame) {
     var x = frame.evalWithBindings("throw 'haha'", { rightSpelling: 4 }).throw;
     assertEq(x, "haha");
 };
--- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-15.js
+++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-15.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = function (frame) {
   // The bindings object is unused but adds another environment on the
   // environment chain. Make sure 'this' computes the right value in light of
   // this.
   assertEq(frame.evalWithBindings(`this === foo;`, { bar: 42 }).return, true);
   assertEq(frame.evalWithBindings(`eval('this') === foo;`, { bar: 42 }).return, true);
--- a/js/src/jit-test/tests/debug/Frame-identity-01.js
+++ b/js/src/jit-test/tests/debug/Frame-identity-01.js
@@ -1,11 +1,11 @@
 // Check that {return:} resumption kills the current stack frame.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("(" + function () {
         var dbg = new Debugger(debuggeeGlobal);
         var prev = null;
         dbg.onDebuggerStatement = function (frame) {
             assertEq(frame === prev, false);
             if (prev)
                 assertEq(prev.live, false);
--- a/js/src/jit-test/tests/debug/Frame-identity-02.js
+++ b/js/src/jit-test/tests/debug/Frame-identity-02.js
@@ -1,13 +1,13 @@
 // Check that {throw:} resumption kills the current stack frame.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("(" + function () {
         var dbg = new Debugger(debuggeeGlobal);
         var prev = null;
         dbg.onDebuggerStatement = function (frame) {
             assertEq(frame === prev, false);
             if (prev)
                 assertEq(prev.live, false);
--- a/js/src/jit-test/tests/debug/Frame-identity-03.js
+++ b/js/src/jit-test/tests/debug/Frame-identity-03.js
@@ -1,11 +1,11 @@
 // Test that we create new Debugger.Frames and reuse old ones correctly with recursion.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("(" + function () {
         function id(f) {
             return ("id" in f) ? f.id : (f.id = nextid++);
         }
 
         var dbg = new Debugger(debuggeeGlobal);
         dbg.onDebuggerStatement = function (frame) {
--- a/js/src/jit-test/tests/debug/Frame-identity-04.js
+++ b/js/src/jit-test/tests/debug/Frame-identity-04.js
@@ -1,12 +1,12 @@
 // Test that on-stack Debugger.Frames are not GC'd even if they are only reachable
 // from the js::Debugger::frames table.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(n) { if (n) f(n - 1); debugger; }");
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     if (hits === 0) {
         for (; frame; frame = frame.older)
             frame.seen = true;
     } else {
--- a/js/src/jit-test/tests/debug/Frame-identity-05.js
+++ b/js/src/jit-test/tests/debug/Frame-identity-05.js
@@ -1,11 +1,11 @@
 // Suspended generators keep their associated Debugger.Frames gc-alive.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function* f() { debugger; yield 1; debugger; }");
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     if (hits === 0)
         frame.seen = true;
     else
         assertEq(frame.seen, true);
--- a/js/src/jit-test/tests/debug/Frame-identity-06.js
+++ b/js/src/jit-test/tests/debug/Frame-identity-06.js
@@ -1,12 +1,12 @@
 // Debugger.Frames for async functions are not GC'd while they're suspended.
 // The awaited promise keeps the generator alive, via its reaction lists.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval(`
     // Create a few promises.
     var promises = [], resolvers = [];
     for (let i = 0; i < 3; i++)
         promises.push(new Promise(r => { resolvers.push(r); }));
 
     async function f() {
         debugger;
--- a/js/src/jit-test/tests/debug/Frame-identity-07.js
+++ b/js/src/jit-test/tests/debug/Frame-identity-07.js
@@ -1,11 +1,11 @@
 // Distinct generator calls result in distinct Debugger.Frames.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
     function* count(n) {
         if (n > 0) {
             for (let x of count(n - 1))
                 yield x;
             yield n;
         }
     }
--- a/js/src/jit-test/tests/debug/Frame-implementation-01.js
+++ b/js/src/jit-test/tests/debug/Frame-implementation-01.js
@@ -2,17 +2,17 @@
 
 load(libdir + "jitopts.js");
 
 function testFrameImpl(jitopts, assertFrameImpl) {
   if (!jitTogglesMatch(jitopts))
     return;
 
   withJitOptions(jitopts, function () {
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     var dbg = new Debugger;
 
     g.toggle = function toggle(d) {
       if (d) {
         dbg.addDebuggee(g);
         var frame = dbg.getNewestFrame();
         // We only care about the f and g frames.
         for (var i = 0; i < 2; i++) {
--- a/js/src/jit-test/tests/debug/Frame-implementation-02.js
+++ b/js/src/jit-test/tests/debug/Frame-implementation-02.js
@@ -3,17 +3,17 @@
 // handlers, so we test for the handlers being called.
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit();
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
   var onPopExecuted = false;
   var breakpointHit = false;
 
   g.toggle = function toggle(d) {
     if (d) {
       dbg.addDebuggee(g);
 
--- a/js/src/jit-test/tests/debug/Frame-live-01.js
+++ b/js/src/jit-test/tests/debug/Frame-live-01.js
@@ -4,17 +4,17 @@
 var desc = Object.getOwnPropertyDescriptor(Debugger.Frame.prototype, "live");
 assertEq(typeof desc.get, "function");
 assertEq(desc.set, undefined);
 assertEq(desc.configurable, true);
 assertEq(desc.enumerable, false);
 
 var loc;
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("var hits = 0;");
 g.eval("(" + function () {
         var a = [];
         var dbg = Debugger(debuggeeGlobal);
         dbg.onDebuggerStatement = function (frame) {
             var loc = debuggeeGlobal.loc;
             a[loc] = frame;
--- a/js/src/jit-test/tests/debug/Frame-live-02.js
+++ b/js/src/jit-test/tests/debug/Frame-live-02.js
@@ -1,13 +1,13 @@
 // Debugger.Frame.prototype.live is false for frames that have thrown or been thrown through
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("var finalCheck;");
 g.eval("(" + function () {
         var a = [];
         var dbg = Debugger(debuggeeGlobal);
         dbg.onDebuggerStatement = function (frame) {
             a.push(frame);
             for (var i = 0; i < a.length; i++)
--- a/js/src/jit-test/tests/debug/Frame-live-03.js
+++ b/js/src/jit-test/tests/debug/Frame-live-03.js
@@ -1,13 +1,13 @@
 // frame properties throw if !frame.live
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var f;
 Debugger(g).onDebuggerStatement = function (frame) {
     assertEq(frame.live, true);
     assertEq(frame.type, "call");
     assertEq(frame.this instanceof Object, true);
     assertEq(frame.older instanceof Debugger.Frame, true);
     assertEq(frame.callee instanceof Debugger.Object, true);
     assertEq(frame.generator, false);
--- a/js/src/jit-test/tests/debug/Frame-live-04.js
+++ b/js/src/jit-test/tests/debug/Frame-live-04.js
@@ -1,13 +1,13 @@
 // frame.live is false for frames discarded during uncatchable error unwinding.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 var snapshot;
 dbg.onDebuggerStatement = function (frame) {
     var stack = [];
     for (var f = frame; f; f = f.older) {
         if (f.type === "call" && f.script !== null)
             stack.push(f);
--- a/js/src/jit-test/tests/debug/Frame-live-05.js
+++ b/js/src/jit-test/tests/debug/Frame-live-05.js
@@ -1,14 +1,14 @@
 // frame.live is false for frames removed after their compartments stopped being debuggees.
 
 load(libdir + 'asserts.js');
 
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 var dbg = Debugger(g1, g2);
 var hits = 0;
 var snapshot = [];
 dbg.onDebuggerStatement = function (frame) {
     if (hits++ === 0) {
         assertEq(frame.eval("x();"), null);
     } else {
         for (var f = frame; f; f = f.older) {
--- a/js/src/jit-test/tests/debug/Frame-live-06.js
+++ b/js/src/jit-test/tests/debug/Frame-live-06.js
@@ -1,11 +1,11 @@
 // frame.live is false for generator frames after they return.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval("function* f() { debugger; }");
 
 let dbg = Debugger(g);
 let savedFrame;
 
 dbg.onDebuggerStatement = frame => {
     savedFrame = frame;
     assertEq(frame.callee.name, "f");
--- a/js/src/jit-test/tests/debug/Frame-live-07.js
+++ b/js/src/jit-test/tests/debug/Frame-live-07.js
@@ -1,14 +1,14 @@
 // frame.live is false for generator frames popped due to exception or termination.
 
 load(libdir + "/asserts.js");
 
 function test(when, what) {
-    let g = newGlobal();
+    let g = newGlobal({newCompartment: true});
     g.eval("function* f(x) { yield x; }");
 
     let dbg = new Debugger;
     let gw = dbg.addDebuggee(g);
     let fw = gw.getOwnPropertyDescriptor("f").value;
 
     let t = 0;
     let poppedFrame;
--- a/js/src/jit-test/tests/debug/Frame-newTargetEval-01.js
+++ b/js/src/jit-test/tests/debug/Frame-newTargetEval-01.js
@@ -3,17 +3,17 @@
 gczeal(0);
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit();
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   g.toggle = function toggle(d, expected) {
     if (d) {
       dbg.addDebuggee(g);
 
       var frame = dbg.getNewestFrame();
       assertEq(frame.implementation, "ion");
--- a/js/src/jit-test/tests/debug/Frame-newTargetEval-02.js
+++ b/js/src/jit-test/tests/debug/Frame-newTargetEval-02.js
@@ -3,17 +3,17 @@
 gczeal(0);
 
 load(libdir + "jitopts.js");
 
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit();
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   g.toggle = function toggle(d, expected) {
     if (d) {
       dbg.addDebuggee(g);
 
       var frame = dbg.getNewestFrame();
       assertEq(frame.implementation, "ion");
--- a/js/src/jit-test/tests/debug/Frame-newTargetOverflow-01.js
+++ b/js/src/jit-test/tests/debug/Frame-newTargetOverflow-01.js
@@ -7,17 +7,17 @@ load(libdir + "jitopts.js");
 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
   quit();
 
 // GCs can invalidate JIT code and cause this test to fail.
 if ('gczeal' in this)
     gczeal(0);
 
 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
 
   g.toggle = function toggle(d) {
     if (d) {
       dbg.addDebuggee(g);
 
       var frame = dbg.getNewestFrame();
       assertEq(frame.implementation, "ion");
--- a/js/src/jit-test/tests/debug/Frame-offset-01.js
+++ b/js/src/jit-test/tests/debug/Frame-offset-01.js
@@ -1,11 +1,11 @@
 // frame.offset throws if !frame.live.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var f;
 dbg.onDebuggerStatement = function (frame) { f = frame; };
 g.eval("debugger;");
 assertEq(f.live, false);
 assertThrowsInstanceOf(function () { f.offset; }, Error);
--- a/js/src/jit-test/tests/debug/Frame-offset-02.js
+++ b/js/src/jit-test/tests/debug/Frame-offset-02.js
@@ -1,11 +1,11 @@
 // frame.offset gives different values at different points in a script.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var s = undefined, a = []
 dbg.onDebuggerStatement = function (frame) {
     if (s === undefined)
         s = frame.script;
     else
         assertEq(s, frame.script);
     assertEq(frame.offset !== undefined, true);
--- a/js/src/jit-test/tests/debug/Frame-older-01.js
+++ b/js/src/jit-test/tests/debug/Frame-older-01.js
@@ -1,11 +1,11 @@
 // Basic call chain.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var result = null;
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     var a = [];
     assertEq(frame === frame.older, false);
     for (; frame; frame = frame.older)
         a.push(frame.type === 'call' ? frame.callee.name : frame.type);
     a.reverse();
--- a/js/src/jit-test/tests/debug/Frame-older-generators-01.js
+++ b/js/src/jit-test/tests/debug/Frame-older-generators-01.js
@@ -1,15 +1,15 @@
 // Generator/async frames can be created by following .older.
 //
 // The goal here is to get some test coverage creating generator Frame objects
 // at some time other than when firing onEnterFrame. Here they're created after
 // the initial yield.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
     function f() {
         debugger;
     }
     function* gen() {
         f();
         yield 1;
         f();
--- a/js/src/jit-test/tests/debug/Frame-older-generators-02.js
+++ b/js/src/jit-test/tests/debug/Frame-older-generators-02.js
@@ -1,14 +1,14 @@
 // Like Frame-older-generators-01.js, but attach the debugger on the fly.
 //
 // (That is, check that it works even if the debugger never received
 // onNewGenerator for the generator, because it wasn't attached at the time.)
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
     function f() {
         attach();
         debugger;
     }
     function* gen() {
         f();
         yield 1;
--- a/js/src/jit-test/tests/debug/Frame-onPop-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-01.js
@@ -1,10 +1,10 @@
 // When multiple frames have onPop handlers, they are called in the correct order.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; }");
 g.eval("function g() { f(); }");
 g.eval("function h() { g(); }");
 g.eval("function i() { h(); }");
 
 var dbg = new Debugger(g);
 var log;
 function logger(frame, mark) { 
--- a/js/src/jit-test/tests/debug/Frame-onPop-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-02.js
@@ -1,10 +1,10 @@
 // Clearing a frame's onPop handler works.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; }");
 var dbg = new Debugger(g);
 
 var log;
 dbg.onEnterFrame = function handleEnter(f) {
     log += "(";
     f.onPop = function handlePop() {
         assertEq("handlePop was called", "handlePop should never be called");
--- a/js/src/jit-test/tests/debug/Frame-onPop-03.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-03.js
@@ -1,11 +1,11 @@
 // When an exception is propagated out of multiple frames, their onPop
 // and onExceptionUnwind handlers are called in the correct order.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { throw 'mud'; }");
 g.eval("function g() { f(); }");
 g.eval("function h() { g(); }");
 g.eval("function i() { h(); }");
 
 var dbg = new Debugger(g);
 var log;
 function makePopHandler(label) {
--- a/js/src/jit-test/tests/debug/Frame-onPop-04.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-04.js
@@ -1,12 +1,12 @@
 // When a termination is propagated out of multiple frames, their onPop
 // handlers are called in the correct order, and no onExceptionUnwind
 // handlers are called.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { terminate(); }");
 g.eval("function g() { f(); }");
 g.eval("function h() { g(); }");
 g.eval("function i() { h(); }");
 
 var dbg = new Debugger(g);
 var log;
 var count = 0;
--- a/js/src/jit-test/tests/debug/Frame-onPop-05.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-05.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 g.debuggerGlobal = this;
 var log;
 
 dbg.onEnterFrame = function handleEnter(f) {
     log += '(';
     f.onPop = function handlePop(c) {
         log += ')';
--- a/js/src/jit-test/tests/debug/Frame-onPop-06.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-06.js
@@ -1,11 +1,11 @@
 // dbg.getNewestFrame in an onPop handler returns the frame being popped.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; }");
 g.eval("function g() { f(); }");
 g.eval("function h() { g(); }");
 g.eval("function i() { h(); }");
 
 var dbg = new Debugger(g);
 var log;
 dbg.onEnterFrame = function handleEnter(f) {
--- a/js/src/jit-test/tests/debug/Frame-onPop-07.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-07.js
@@ -1,10 +1,10 @@
 // Trying to set an onPop handler on a dead frame throws an exception.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { }");
 g.eval("function g() { f(); }");
 g.eval("function h() { g(); }");
 g.eval("function i() { h(); }");
 var dbg = new Debugger(g);
 var log;
 
 var frames = [];
--- a/js/src/jit-test/tests/debug/Frame-onPop-08.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-08.js
@@ -1,10 +1,10 @@
 // Setting onPop handlers from a 'debugger' statement handler works.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     assertEq(frame.type, "eval");
     log += 'd';
     frame.onPop = function handlePop(c) {
         log += ')';
--- a/js/src/jit-test/tests/debug/Frame-onPop-09.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-09.js
@@ -1,10 +1,10 @@
 // Setting onPop handlers from an onExceptionUnwind handler works.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onExceptionUnwind = function handleUnwind(frame) {
     log += 'u';
     assertEq(frame.type, "eval");
     frame.onPop = function handleCallPop(c) {
         log += ')';
--- a/js/src/jit-test/tests/debug/Frame-onPop-10.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-10.js
@@ -1,10 +1,10 @@
 // Setting onPop handlers from an onStep handler works.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     log += 'd';
     assertEq(frame.type, "eval");
     frame.onStep = function handleStep() {
         log += 's';
--- a/js/src/jit-test/tests/debug/Frame-onPop-11.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-11.js
@@ -1,10 +1,10 @@
 // Setting onPop handlers from breakpoint handlers works.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(){ return 'to normalcy'; }");
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var log;
 
 // Set a breakpoint at the start of g.f
 var gf = gw.makeDebuggeeValue(g.f);
 var fStartOffset = gf.script.getLineOffsets(gf.script.startLine)[0];
--- a/js/src/jit-test/tests/debug/Frame-onPop-12.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-12.js
@@ -1,11 +1,11 @@
 // Setting an onPop handler from an onPop handler doesn't throw, but the
 // new handler doesn't fire.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     log += 'd';
     assertEq(frame.type, "eval");
     frame.onPop = function firstHandlePop(c) {
         log +=')';
--- a/js/src/jit-test/tests/debug/Frame-onPop-13.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-13.js
@@ -1,10 +1,10 @@
 // One can set onPop handlers on some frames but not others.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(n) { if (n > 0) f(n-1); else debugger; }");
 var dbg = new Debugger(g);
 var log;
 
 Debugger.Frame.prototype.nthOlder = function nthOlder(n) {
     var f = this;
     while (n-- > 0)
         f = f.older;
--- a/js/src/jit-test/tests/debug/Frame-onPop-14.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-14.js
@@ -1,11 +1,11 @@
 // A frame's onPop handler is called only once, even if it is for a function
 // called from a loop.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 var count;
 dbg.onDebuggerStatement = function handleDebug(frame) {
     log += 'd';
     assertEq(frame.type, "call");
     count++;
--- a/js/src/jit-test/tests/debug/Frame-onPop-15.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-15.js
@@ -1,12 +1,12 @@
 // Each resumption of a generator gets the same Frame; its onPop handler
 // fires each time the generator yields.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 var seenFrame = null;
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     log += 'd';
     assertEq(frame.type, "call");
 
--- a/js/src/jit-test/tests/debug/Frame-onPop-16.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-16.js
@@ -1,10 +1,10 @@
 // onPop handlers fire even on frames that make tail calls.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 g.eval('function f(n) { if (n > 0) f(n-1); else debugger; }');
 
 dbg.onEnterFrame = function handleEnter(frame) {
     log += '(';
     frame.onPop = function handlePop(c) {
--- a/js/src/jit-test/tests/debug/Frame-onPop-17.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-17.js
@@ -1,12 +1,12 @@
 // onPop surfaces.
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // Assigning a bogus value to Debugger.Frame.prototype.onPop raises a TypeError.
 function test(badValue) {
     print("store " + uneval(badValue) + " in Debugger.Frame.prototype.onPop");
 
     var log;
     dbg.onDebuggerStatement = function handleDebugger(frame) {
--- a/js/src/jit-test/tests/debug/Frame-onPop-18.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-18.js
@@ -1,11 +1,11 @@
 // A garbage collection in the debugger compartment does not disturb onPop
 // handlers.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onEnterFrame = function handleEnter(frame) {
     log += '(';
     frame.onPop = function handlePop(completion) {
         log += ')';
     };
--- a/js/src/jit-test/tests/debug/Frame-onPop-19.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-19.js
@@ -1,11 +1,11 @@
 // A garbage collection in the debuggee compartment does not disturb onPop
 // handlers.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onEnterFrame = function handleEnter(frame) {
     log += '(';
     frame.onPop = function handlePop(completion) {
         log += ')';
     };
--- a/js/src/jit-test/tests/debug/Frame-onPop-20.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-20.js
@@ -1,10 +1,10 @@
 // A global garbage collection does not disturb onPop handlers.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 
 dbg.onEnterFrame = function handleEnter(frame) {
     log += '(';
     frame.onPop = function handlePop(completion) {
         log += ')';
     };
--- a/js/src/jit-test/tests/debug/Frame-onPop-21.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-21.js
@@ -1,10 +1,10 @@
 // frame.eval works from an onPop handler.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('function f(a,b) { var x = "entablature", y; debugger; return x+y+a+b; }');
 
 var dbg = new Debugger(g);
 var log;
 
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     log += 'd';
     frame.onPop = handlePop;
--- a/js/src/jit-test/tests/debug/Frame-onPop-23.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-23.js
@@ -1,12 +1,12 @@
 // Check that the line number reported at an onPop stop makes sense,
 // even when it happens on an "artificial" instruction.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 // This bit of code arranges for the line number of the "artificial"
 // instruction to be something nonsensical -- the middle of a loop
 // which cannot be entered.
 g.eval(`function f() {
   debugger;                   // +0
   if(false) {                 // +1
     for(var b=0; b<0; b++) {  // +2
--- a/js/src/jit-test/tests/debug/Frame-onPop-after-debugger-return.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-after-debugger-return.js
@@ -1,11 +1,11 @@
 // Bug 744730.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (f) { return {return: 1234}; };
 var hit = false;
 dbg.onEnterFrame = function (f) {
     f.onPop = function () { hit = true};
 };
 g.eval("debugger;");
 assertEq(hit, true);
--- a/js/src/jit-test/tests/debug/Frame-onPop-async-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-async-01.js
@@ -1,14 +1,14 @@
 // When an async function awaits, if Frame.onPop processes microtasks,
 // the async function itself will not run. It'll run later.
 //
 // This is a reentrancy test, like Frame-onPop-generators-03.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.log = "";
 g.eval(`
     async function f() {
         log += "1";
         debugger;
         log += "2";
         await Promise.resolve(3);
         log += "3";
--- a/js/src/jit-test/tests/debug/Frame-onPop-disabled.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-disabled.js
@@ -1,11 +1,11 @@
 // An onPop handler in a disabled Debugger's frame shouldn't fire.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 g.eval('function f() { debugger; }');
 var log;
 dbg.onEnterFrame = function handleEnterFrame(f) {
     log += '(';
     assertEq(f.callee.name, 'f');
     f.onPop = function handlePop(c) {
         log += ')';
--- a/js/src/jit-test/tests/debug/Frame-onPop-error-error.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error-error.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop can request a termination when stopped for a termination
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // We use Debugger.Frame.prototype.eval and ignore the outer 'eval' frame so we 
 // can catch the termination.
 
 function test(type, provocation) {
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-error-return.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error-return.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop can change a termination into a normal return.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
     var wasConstructing;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-01.js
@@ -1,11 +1,11 @@
 // Tests that exception handling works with block scopes.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var correct;
 dbg.onEnterFrame = function (f) {
   if (f.callee && f.callee.name == "f") {
     f.onPop = function() {
       // The scope at the point of onPop is at the point of popping (the
       // noSuchFn call).
       correct = (f.environment.getVariable("e") === 42 &&
--- a/js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error-scope-unwind-02.js
@@ -1,11 +1,11 @@
 // Tests that exception handling works with block scopes.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var correct;
 dbg.onEnterFrame = function (f) {
   if (f.callee && f.callee.name == "f") {
     f.onPop = function() {
       // The scope at the point of onPop is at the point of popping (the
       // noSuchFn call).
       correct = (f.environment.getVariable("e") === 42 &&
--- a/js/src/jit-test/tests/debug/Frame-onPop-error-throw.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error-throw.js
@@ -1,13 +1,13 @@
 // |jit-test| error: TestComplete
 // onPop can change a termination into a throw.
 
 load(libdir + "asserts.js");
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
     print("provocation: " + uneval(provocation));
--- a/js/src/jit-test/tests/debug/Frame-onPop-error.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-error.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop fires when frames are terminated.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // We use Debugger.Frame.prototype.eval and ignore the outer 'eval' frame so we 
 // can catch the termination.
 
 function test(type, provocation) {
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-generator-resumption-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-generator-resumption-01.js
@@ -1,11 +1,11 @@
 // A generator is left closed after frame.onPop returns a {return:} resumption value.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 dbg.onDebuggerStatement = frame => {
     frame.onPop = completion => ({return: "ok"});
 };
 g.eval("function* g() { for (var i = 0; i < 10; i++) { debugger; yield i; } }");
 var it = g.g();
 var result = it.next();
--- a/js/src/jit-test/tests/debug/Frame-onPop-generators-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-generators-01.js
@@ -1,14 +1,14 @@
 // Returning {throw:} from an onPop handler when yielding works.
 // It closes the generator-iterator.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     frame.onPop = function (c) {
         return {throw: "fit"};
     };
 };
 g.eval("function* g() { for (var i = 0; i < 10; i++) { debugger; yield i; } }");
--- a/js/src/jit-test/tests/debug/Frame-onPop-generators-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-generators-02.js
@@ -1,14 +1,14 @@
 // |jit-test| error: fit
 
 // Throwing an exception from an onPop handler when yielding terminates the debuggee
 // but does not close the generator-iterator.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 dbg.onDebuggerStatement = function handleDebugger(frame) {
     frame.onPop = function (c) {
         throw "fit";
     };
 };
 g.eval("function* g() { for (var i = 0; i < 10; i++) { debugger; yield i; } }");
--- a/js/src/jit-test/tests/debug/Frame-onPop-generators-03.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-generators-03.js
@@ -1,16 +1,16 @@
 // onPop fires while the [[GeneratorState]] is still "executing".
 //
 // This test checks that Debugger doesn't accidentally make it possible to
 // reenter a generator frame that's on the stack.
 
 load(libdir + "asserts.js");
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval('function* f() { debugger; yield 1; debugger; yield 2; debugger; }');
 let dbg = Debugger(g);
 let genObj = g.f();
 
 let hits = 0;
 dbg.onDebuggerStatement = frame => {
     frame.onPop = completion => {
         dbg.removeDebuggee(g);  // avoid the DebuggeeWouldRun exception
--- a/js/src/jit-test/tests/debug/Frame-onPop-generators-04.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-generators-04.js
@@ -1,14 +1,14 @@
 // Terminating a generator from the onPop callback for its initial yield
 // leaves the Frame in a sane but inactive state.
 
 load(libdir + "asserts.js");
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval("function* f(x) { yield x; }");
 let dbg = new Debugger;
 let gw = dbg.addDebuggee(g);
 
 let genFrame = null;
 dbg.onDebuggerStatement = frame => {
     dbg.onEnterFrame = frame => {
         if (frame.callee == gw.getOwnPropertyDescriptor("f").value) {
--- a/js/src/jit-test/tests/debug/Frame-onPop-generators-05.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-generators-05.js
@@ -1,12 +1,12 @@
 // In .onPop for the "initial yield" of a generator, while the generator frame
 // is on the stack, the generator object's .next() method throws.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
     function* f() {
         return "ok";
     }
 `);
 
 let hits = 0;
 let dbg = new Debugger;
--- a/js/src/jit-test/tests/debug/Frame-onPop-multiple-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-multiple-01.js
@@ -15,17 +15,17 @@ function completionString(c) {
         return 'x';
     if (c.return)
         return 'r' + c.return;
     if (c.throw)
         return 't' + c.throw;
     return '?';
 }
 
-var g = newGlobal(); // poor thing
+var g = newGlobal({newCompartment: true}); // poor thing
 g.eval('function f() { debugger; return "1"; }');
 
 // We create a bunch of debuggers, but they all consult this global variable
 // for expectations and responses, so the order in which events get
 // reported to the debuggers doesn't matter.
 // 
 // This list includes every pair of transitions, and is of minimal length.
 // As if opportunity cost were just some theoretical concern.
--- a/js/src/jit-test/tests/debug/Frame-onPop-multiple-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-multiple-02.js
@@ -1,10 +1,10 @@
 // One Debugger's onPop handler can remove another Debugger's onPop handler.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg1 = new Debugger(g);
 var dbg2 = new Debugger(g);
 
 var log;
 var frames = [];
 var firstPop = true;
 
 function handleEnter(frame) {
--- a/js/src/jit-test/tests/debug/Frame-onPop-multiple-03.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-multiple-03.js
@@ -1,10 +1,10 @@
 // One Debugger's onPop handler can disable another Debugger.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg1 = new Debugger(g);
 var dbg2 = new Debugger(g);
 
 var log;
 var frames = [];
 var firstPop = true;
 
 function handleEnter(frame) {
--- a/js/src/jit-test/tests/debug/Frame-onPop-multiple-04.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-multiple-04.js
@@ -1,12 +1,12 @@
 // If one Debugger's onPop handler causes another Debugger to create a
 // Debugger.Frame instance referring to the same frame, that frame still
 // gets marked as not live after all the onPop handlers have run.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg1 = new Debugger(g);
 var dbg2 = new Debugger(g);
 
 var log;
 var frame2;
 
 dbg1.onEnterFrame = function handleEnter(frame) {
     log += '(';
--- a/js/src/jit-test/tests/debug/Frame-onPop-return-error.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-return-error.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop can change a normal return into a termination.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // We use Debugger.Frame.prototype.eval and ignore the outer 'eval' frame so we 
 // can catch the termination.
 
 function test(type, provocation) {
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-return-return.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-return-return.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop can change a normal return into a normal return of a different value.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
     var wasConstructing;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-return-throw.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-return-throw.js
@@ -1,13 +1,13 @@
 // |jit-test| error: TestComplete
 // onPop can change a normal return into a throw.
 
 load(libdir + "asserts.js");
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
     print("provocation: " + uneval(provocation));
--- a/js/src/jit-test/tests/debug/Frame-onPop-return.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-return.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop fires when frames return normally.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
     var wasConstructing;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-throw-error.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-throw-error.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop can change a throw into a termination.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // We use Debugger.Frame.prototype.eval and ignore the outer 'eval' frame so we 
 // can catch the termination.
 
 function test(type, provocation) {
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-throw-return.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-throw-return.js
@@ -1,12 +1,12 @@
 // |jit-test| error: TestComplete
 // onPop can change a throw into a normal return.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
     var wasConstructing;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
--- a/js/src/jit-test/tests/debug/Frame-onPop-throw-throw.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-throw-throw.js
@@ -1,13 +1,13 @@
 // |jit-test| error: TestComplete
 // onPop can change a throw into a throw of a different value.
 
 load(libdir + "asserts.js");
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
     print("provocation: " + uneval(provocation));
--- a/js/src/jit-test/tests/debug/Frame-onPop-throw.js
+++ b/js/src/jit-test/tests/debug/Frame-onPop-throw.js
@@ -1,13 +1,13 @@
 // |jit-test| error: TestComplete
 // onPop fires when frames throw an exception.
 
 load(libdir + "asserts.js");
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 function test(type, provocation) {
     var log;
 
     // Help people figure out which 'test' call failed.
     print("type:        " + uneval(type));
     print("provocation: " + uneval(provocation));
--- a/js/src/jit-test/tests/debug/Frame-onStep-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-01.js
@@ -1,12 +1,12 @@
 // Simple Debugger.Frame.prototype.onStep test.
 // Test that onStep fires often enough to see all four values of a.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.a = 0;
 g.eval("function f() {\n" +
        "    a += 2;\n" +
        "    a += 2;\n" +
        "    a += 2;\n" +
        "    return a;\n" +
        "}\n");
 
--- a/js/src/jit-test/tests/debug/Frame-onStep-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-02.js
@@ -1,11 +1,11 @@
 // Setting frame.onStep to undefined turns off single-stepping.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.a = 0;
 g.eval("function f() {\n" +
        "    a++;\n" +
        "    a++;\n" +
        "    a++;\n" +
        "    a++;\n" +
        "    return a;\n" +
        "}\n");
--- a/js/src/jit-test/tests/debug/Frame-onStep-03.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-03.js
@@ -1,12 +1,12 @@
 // Setting onStep does not affect later calls to the same function.
 // (onStep is per-frame, not per-function.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.a = 1;
 g.eval("function f(a) {\n" +
        "    var x = 2 * a;\n" +
        "    return x * x;\n" +
        "}\n");
 
 var dbg = Debugger(g);
 var log = '';
--- a/js/src/jit-test/tests/debug/Frame-onStep-04.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-04.js
@@ -1,12 +1,12 @@
 // When a recursive function has many frames on the stack, onStep may be set or
 // not independently on each frame.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(x) {\n" +
        "    if (x > 0)\n" +
        "        f(x - 1);\n" +
        "    else\n" +
        "        debugger;\n" +
        "    return x;\n" +
        "}");
 
--- a/js/src/jit-test/tests/debug/Frame-onStep-05.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-05.js
@@ -1,12 +1,12 @@
 // Upon returning to a frame with an onStep hook, the hook is called before the
 // next line.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.log = '';
 g.eval("function f() { debugger; }");
 
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     frame.older.onStep = function () { g.log += 's'; };
 };
 g.eval("f();\n" +
--- a/js/src/jit-test/tests/debug/Frame-onStep-06.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-06.js
@@ -1,12 +1,12 @@
 // After returning from an implicit toString call, the calling frame's onStep
 // hook fires.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var originalX = {toString: function () { debugger; log += 'x'; return 1; }};\n");
 
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     g.log += 'd';
     frame.older.onStep = function () {
         if (!g.log.match(/[sy]$/))
             g.log += 's';
--- a/js/src/jit-test/tests/debug/Frame-onStep-07.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-07.js
@@ -1,15 +1,15 @@
 // The tracejit does not interfere with frame.onStep.
 //
 // The function f() writes 'L' to the log in a loop. If we enable stepping and
 // write an 's' each time frame.onStep is called, any two Ls should have at
 // least one 's' between them.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.N = 11;
 g.log = '';
 g.eval("function f() {\n" +
        "    for (var i = 0; i <= N; i++)\n" +
        "        log += 'L';\n" +
        "}\n");
 g.f();
 assertEq(/LL/.exec(g.log) !== null, true);
--- a/js/src/jit-test/tests/debug/Frame-onStep-08.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-08.js
@@ -1,11 +1,11 @@
 // frame.onStep can coexist with breakpoints.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onEnterFrame = function (frame) {
     var handler = {hit: function () { log += 'B'; }};
     var lines = frame.script.getAllOffsets();
     for (var line in lines) {
         line = Number(line);
         var offs = lines[line];
--- a/js/src/jit-test/tests/debug/Frame-onStep-09.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-09.js
@@ -1,12 +1,12 @@
 // After an implicit toString call throws an exception, the calling frame's
 // onStep hook fires.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var x = {toString: function () { debugger; log += 'x'; throw 'mud'; }};");
 
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     g.log += 'd';
     frame.older.onStep = function () {
         if (!g.log.match(/[sy]$/))
             g.log += 's';
--- a/js/src/jit-test/tests/debug/Frame-onStep-10.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-10.js
@@ -1,12 +1,12 @@
 // Throwing and catching an error in an onStep handler shouldn't interfere
 // with throwing and catching in the debuggee.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; throw 'mud'; }");
 
 var dbg = Debugger(g);
 var stepped = false;
 dbg.onDebuggerStatement = function (frame) {
     frame.older.onStep = function () {
         stepped = true;
         try {
--- a/js/src/jit-test/tests/debug/Frame-onStep-11.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-11.js
@@ -1,12 +1,12 @@
 // Stepping out of a finally should not appear to
 // step backward to some earlier statement.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval(`function f() {
          debugger;              // +0
          var x = 0;             // +1
          try {                  // +2
            x = 1;               // +3
            throw 'something';   // +4
          } catch (e) {          // +5
            x = 2;               // +6
--- a/js/src/jit-test/tests/debug/Frame-onStep-12.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-12.js
@@ -29,17 +29,17 @@
 
 var bitOfCode = `debugger;                    // +0
                  if(false) {                  // +1
                    for(var b=0; b<0; b++) {   // +2
                       c = 2                   // +3
                     }                         // +4
                  }`;                          // +5
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 
 g.eval("function nothing() { }\n");
 
 var log = '';
 dbg.onDebuggerStatement = function(frame) {
   let debugLine = frame.script.getOffsetLocation(frame.offset).lineNumber;
   frame.onStep = function() {
--- a/js/src/jit-test/tests/debug/Frame-onStep-13.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-13.js
@@ -1,13 +1,13 @@
 // Stepping over a not-taken "if" that is at the end of the function
 // should move to the end of the function, not somewhere in the body
 // of the "if".
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval(`function f() {        // 1
   var a,c;                    // 2
   debugger;                   // 3
   if(false) {                 // 4
     for(var b=0; b<0; b++) {  // 5
       c = 2;                  // 6
     }                         // 7
   }                           // 8
--- a/js/src/jit-test/tests/debug/Frame-onStep-14.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-14.js
@@ -1,11 +1,11 @@
 // Test how stepping interacts with switch statements.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 g.eval('function bob() { return "bob"; }');
 
 // Stepping into a sparse switch should not stop on literal cases.
 evaluate(`function lit(x) {     // 1
   debugger;                     // 2
   switch(x) {                   // 3
   case "nope":                  // 4
--- a/js/src/jit-test/tests/debug/Frame-onStep-15.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-15.js
@@ -1,11 +1,11 @@
 // Test how stepping interacts with for(;;) statements.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 
 // We want a for(;;) loop whose body is evaluated at least once, to
 // see whether the loop head is hit a second time.
 g.eval(`function f() {
   let x = 0;
   debugger;                     // +0
   for(;;) {                     // +1
     if (x++ == 1) break;        // +2
--- a/js/src/jit-test/tests/debug/Frame-onStep-16.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-16.js
@@ -1,12 +1,12 @@
 // Stepping through a function with a return statement should pause on
 // the closing brace of the function.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log;
 
 function test(fnStr) {
   log = '';
   g.eval(fnStr);
 
   dbg.onDebuggerStatement = function(frame) {
--- a/js/src/jit-test/tests/debug/Frame-onStep-17.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-17.js
@@ -1,11 +1,11 @@
 // Test how stepping interacts with for-in/of statements.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var log;
 var previous;
 
 dbg.onDebuggerStatement = function (frame) {
   let debugLine = frame.script.getOffsetLocation(frame.offset).lineNumber;
   log = '';
--- a/js/src/jit-test/tests/debug/Frame-onStep-18.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-18.js
@@ -1,11 +1,11 @@
 // Regression test for bug 1370648.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 
 let dbg = Debugger(g);
 let lines = [0, 0, 0, 0, 0];
 dbg.onDebuggerStatement = function (frame) {
   let dLine = frame.script.getOffsetLocation(frame.offset).lineNumber;
   lines[0] = 1;
   frame.onStep = function () {
     lines[frame.script.getOffsetLocation(this.offset).lineNumber - dLine] = 1;
--- a/js/src/jit-test/tests/debug/Frame-onStep-20.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-20.js
@@ -1,11 +1,11 @@
 // Stepping should always pause in a frame between two function calls.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.evaluate(`
     class X {
         constructor() { this._p = 0; }
         m() { return this; }
         get p() { return this._p; }
         set p(value) { this._p = value; }
     }
     let x = new X;
--- a/js/src/jit-test/tests/debug/Frame-onStep-async-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-async-01.js
@@ -1,12 +1,12 @@
 // Stepping works across `await` in async functions.
 
 // Set up debuggee.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.log = "";
 g.eval(`                              // line 1
 async function aloop() {              // 2
     for (let i = 0; i < 3; i++) {     // 3
         await i;                      // 4
         log += " ";                   // 5
     }                                 // 6
     log += "^";                       // 7
--- a/js/src/jit-test/tests/debug/Frame-onStep-async-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-async-02.js
@@ -8,17 +8,17 @@
 // onStep fires in extra places that end users would find very confusing--see
 // the comment marked (!) below. As a result, Debugger API consumers must do
 // some extra work to skip pausing there. This test is a proof of concept that
 // shows what sort of effort is needed. It maintains a single `asyncStack` and
 // skips the onStep hook if we're not running the function at top of the async
 // stack. Real debuggers would have to maintain multiple async stacks.
 
 // Set up debuggee.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval(`\
 async function outer() {                                // line 1
     return (await inner()) + (await inner()) + "!";     // 2
 }                                                       // 3
 async function inner() {                                // 4
     return (await leaf()) + (await leaf());             // 5
 }                                                       // 6
 async function leaf() {                                 // 7
--- a/js/src/jit-test/tests/debug/Frame-onStep-async-gc-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-async-gc-01.js
@@ -1,11 +1,11 @@
 // An onStep handler on a suspended async function frame keeps a Debugger alive.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
   async function f() {
     debugger;
     await Promise.resolve(0);
     return 'ok';
   }
 `);
 
--- a/js/src/jit-test/tests/debug/Frame-onStep-generator-resumption-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-generator-resumption-01.js
@@ -1,11 +1,11 @@
 // The debugger can force an early return from any instruction before the initial yield.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`
   function* f() {
     yield 1;
   }
 `);
 
 function test(ttl) {
     let dbg = new Debugger(g);
--- a/js/src/jit-test/tests/debug/Frame-onStep-generators-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-generators-01.js
@@ -1,11 +1,11 @@
 // Stepping into the `.next()` method of a generator works as expected.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`\
 function* nums() {      // line 1
     yield 1;            //  2
     yield 2;            //  3
 }                       //  4
 function f() {          //  5
     let gen = nums();   //  6
     gen.next();         //  7
--- a/js/src/jit-test/tests/debug/Frame-onStep-generators-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-generators-02.js
@@ -1,16 +1,16 @@
 // Stepping into the `.throw()` method of a generator with no relevant catch block.
 //
 // The debugger fires onEnterFrame and then frame.onPop for the generator frame when
 // `gen.throw()` is called.
 
 load(libdir + "asserts.js");
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`\
 function* z() {         // line 1
     yield 1;            // 2
     yield 2;            // 3
 }                       // 4
 function f() {          // 5
     let gen = z();      // 6
     gen.next();         // 7
--- a/js/src/jit-test/tests/debug/Frame-onStep-generators-03.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-generators-03.js
@@ -1,13 +1,13 @@
 // Stepping into the `.throw()` method of a generator with a relevant catch block.
 
 load(libdir + "asserts.js");
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`\
 function* z() {         // line 1
     try {               // 2
         yield 1;        // 3
     } catch (exc) {     // 4
         yield 2;        // 5
     }                   // 6
 }                       // 7
--- a/js/src/jit-test/tests/debug/Frame-onStep-generators-04.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-generators-04.js
@@ -1,12 +1,12 @@
 // Stepping works across `yield` in generators.
 
 // Set up debuggee.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.log = "";
 g.eval(`
 function* range(stop) {               // line 2
     for (let i = 0; i < stop; i++) {  // 3
         yield i;                      // 4
         log += " ";                   // 5
     }                                 // 6
     log += "^";                       // 7
--- a/js/src/jit-test/tests/debug/Frame-onStep-generators-defaults.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-generators-defaults.js
@@ -1,14 +1,14 @@
 // onStep works during the evaluation of default parameter values in generators.
 //
 // (They're evaluated at a weird time in the generator life cycle, before the
 // generator object is created.)
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`\
     function f1() {}        // line 1
     function f2() {}        //  2
     function f3() {}        //  3
                             //  4
     function* gen(          //  5
         name,               //  6
         schema = f1(),      //  7
--- a/js/src/jit-test/tests/debug/Frame-onStep-generators-gc-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-generators-gc-01.js
@@ -19,27 +19,27 @@ var resuming2 = false;
 function onStep2() {
     if (resuming2) {
         hits2++;
         resuming2 = false;
     }
 }
 
 function setup() {
-    let g1 = newGlobal();
+    let g1 = newGlobal({newCompartment: true});
     g1.eval(`
         function* gf1() {
              debugger;
              yield 1;
              return 'done';
         }
     `);
     gen0 = g1.gf1();
 
-    let g2 = newGlobal();
+    let g2 = newGlobal({newCompartment: true});
     g2.eval(`
         function* gf2() { debugger; yield 1; return 'done'; }
 
         var resuming1 = false;
 
         function makeOnStepHook1(dbg1) {
             // We use this WeakMap as a weak reference from frame1.onStep to dbg1.
             var weak = new WeakMap();
--- a/js/src/jit-test/tests/debug/Frame-onStep-iterators.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-iterators.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var log;
 var a = [];
 
 dbg.onDebuggerStatement = function (frame) {
   log += 'd';
   frame.onStep = function () {
--- a/js/src/jit-test/tests/debug/Frame-onStep-lines-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-lines-01.js
@@ -1,11 +1,11 @@
 // Test that a frame's onStep handler gets called at least once on each line of a function.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // When we hit a 'debugger' statement, set offsets to the frame's script's
 // table of line offsets --- a sparse array indexed by line number. Begin
 // single-stepping the current frame; for each source line we hit, delete
 // the line's entry in offsets. Thus, at the end, offsets is an array with
 // an element for each line we did not reach.
 var doSingleStep = true;
--- a/js/src/jit-test/tests/debug/Frame-onStep-resumption-01.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-resumption-01.js
@@ -1,11 +1,11 @@
 // If frame.onStep returns {return:val}, the frame returns.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(x) {\n" +
        "    var a = x * x;\n" +
        "    return a;\n" +
        "}\n");
 
 var dbg = Debugger(g);
 dbg.onEnterFrame = function (frame) {
     frame.onStep = function () { return {return: "pass"}; };
--- a/js/src/jit-test/tests/debug/Frame-onStep-resumption-02.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-resumption-02.js
@@ -1,13 +1,13 @@
 // If frame.onStep returns {throw:}, an exception is thrown in the debuggee.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function h() { debugger; }\n" +
        "function f() {\n" +
        "    h();\n" +
        "    return 'fail';\n" +
        "}\n");
 
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
--- a/js/src/jit-test/tests/debug/Frame-onStep-resumption-03.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-resumption-03.js
@@ -1,11 +1,11 @@
 // If frame.onStep returns null, the debuggee terminates.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function h() { debugger; }");
 
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     if (hits == 1) {
         var rv = frame.eval("h();\n" +
--- a/js/src/jit-test/tests/debug/Frame-onStep-resumption-04.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-resumption-04.js
@@ -1,11 +1,11 @@
 // If frame.onStep returns null, debuggee catch and finally blocks are skipped.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function h() { debugger; }");
 
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     if (hits == 1) {
         var rv = frame.eval("try {\n" +
--- a/js/src/jit-test/tests/debug/Frame-onStep-resumption-05.js
+++ b/js/src/jit-test/tests/debug/Frame-onStep-resumption-05.js
@@ -1,12 +1,12 @@
 // Test that invoking the interrupt callback counts as a step.
 
 function testResumptionVal(resumptionVal, turnOffDebugMode) {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
   g.log = "";
   g.resumptionVal = resumptionVal;
 
   setInterruptCallback(function () {
     g.log += "i";
     dbg.addDebuggee(g);
     var frame = dbg.getNewestFrame();
--- a/js/src/jit-test/tests/debug/Frame-script-01.js
+++ b/js/src/jit-test/tests/debug/Frame-script-01.js
@@ -1,11 +1,11 @@
 // Frame.prototype.script for eval frames.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // Apply |f| to each frame that is |skip| frames up from each frame that
 // executes a 'debugger' statement when evaluating |code| in the global g.
 function ApplyToFrameScript(code, skip, f) {
     dbg.onDebuggerStatement = function (frame) {
         while (skip-- > 0)
             frame = frame.older;
--- a/js/src/jit-test/tests/debug/Frame-script-02.js
+++ b/js/src/jit-test/tests/debug/Frame-script-02.js
@@ -1,11 +1,11 @@
 // Frame.prototype.script for call frames.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 // Apply |f| to each frame that is |skip| frames up from each frame that
 // executes a 'debugger' statement when evaluating |code| in the global g.
 function ApplyToFrameScript(code, skip, f) {
     dbg.onDebuggerStatement = function (frame) {
         while (skip-- > 0)
             frame = frame.older;
--- a/js/src/jit-test/tests/debug/Frame-script-03.js
+++ b/js/src/jit-test/tests/debug/Frame-script-03.js
@@ -1,8 +1,8 @@
 // frame.script can create a Debugger.Script for a JS_Evaluate* script.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var s;
 dbg.onDebuggerStatement = function (frame) { s = frame.script; };
 g.evaluate("debugger;");
 assertEq(s instanceof Debugger.Script, true);
--- a/js/src/jit-test/tests/debug/Frame-script-environment-nondebuggee.js
+++ b/js/src/jit-test/tests/debug/Frame-script-environment-nondebuggee.js
@@ -1,13 +1,13 @@
 // The script and environment of a non-debuggee frame are inaccessible.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 
 var log;
 dbg.onDebuggerStatement = function (frame) {
   log += frame.type;
   // Initially, 'frame' is a debuggee frame, and we should be able to see its script and environment.
   assertEq(frame.script instanceof Debugger.Script, true);
   assertEq(frame.environment instanceof Debugger.Environment, true);
--- a/js/src/jit-test/tests/debug/Frame-this-01.js
+++ b/js/src/jit-test/tests/debug/Frame-this-01.js
@@ -1,11 +1,11 @@
 // Frame.prototype.this in strict-mode functions, with primitive values
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     assertEq(frame.this, g.v);
 };
 
 g.eval("function f() { 'use strict'; debugger; }");
--- a/js/src/jit-test/tests/debug/Frame-this-02.js
+++ b/js/src/jit-test/tests/debug/Frame-this-02.js
@@ -1,11 +1,11 @@
 // Frame.prototype.this in strict direct eval frames
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     assertEq(frame.this, g.v);
 };
 
 g.eval("function f() { 'use strict'; eval('debugger;'); }");
--- a/js/src/jit-test/tests/debug/Frame-this-03.js
+++ b/js/src/jit-test/tests/debug/Frame-this-03.js
@@ -1,15 +1,15 @@
 // Frame.prototype.this in non-strict-mode functions, with primitive values
 
 function classOf(obj) {
     return Object.prototype.toString.call(obj).match(/^\[object (.*)\]$/)[1];
 }
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     assertEq(frame.this instanceof Debugger.Object, true);
     assertEq(frame.this.class, g.v == null ? classOf(g) : classOf(Object(g.v)));
 };
 
--- a/js/src/jit-test/tests/debug/Frame-this-04.js
+++ b/js/src/jit-test/tests/debug/Frame-this-04.js
@@ -1,15 +1,15 @@
 // Debugger.Frame.prototype.this in functions, with object values
 
 function classOf(obj) {
     return Object.prototype.toString.call(obj).match(/^\[object (.*)\]$/)[1];
 }
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     hits++;
     assertEq(frame.this instanceof Debugger.Object, true);
     assertEq(frame.this.class, classOf(Object(g.v)));
 };
 
--- a/js/src/jit-test/tests/debug/Frame-this-05.js
+++ b/js/src/jit-test/tests/debug/Frame-this-05.js
@@ -1,10 +1,10 @@
 // Frame.this and evalInFrame in the global scope.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("x = 4; this['.this'] = 222;");
 var dbg = new Debugger(g);
 var res;
 dbg.onDebuggerStatement = function (frame) {
     res = frame.eval("this.x").return;
     res += frame.this.unsafeDereference().x;
 };
 g.eval("debugger;");
--- a/js/src/jit-test/tests/debug/Frame-this-06.js
+++ b/js/src/jit-test/tests/debug/Frame-this-06.js
@@ -1,10 +1,10 @@
 // Frame.this and evalInFrame with missing this, strict and non-strict.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var evalThis, frameThis;
 dbg.onEnterFrame = function (frame) {
     if (frame.type === "eval")
 	return;
     assertEq(frame.type, "call");
     evalThis = frame.eval("this");
     frameThis = frame.this;
--- a/js/src/jit-test/tests/debug/Frame-this-07.js
+++ b/js/src/jit-test/tests/debug/Frame-this-07.js
@@ -1,12 +1,12 @@
 // Frame.this can be marked as optimized-out in some cases. Here we call an
 // arrow function but its enclosing function is no longer live, so it's
 // impossible to recover its missing 'this' binding.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("x = 4");
 g.eval("var foo = function() { return () => 1; }; var arrow = foo.call(3);");
 var dbg = new Debugger(g);
 var log = "";
 dbg.onEnterFrame = function (frame) {
     if (frame.type === "eval")
 	return;
     assertEq(frame.type, "call");
--- a/js/src/jit-test/tests/debug/Frame-this-08.js
+++ b/js/src/jit-test/tests/debug/Frame-this-08.js
@@ -1,10 +1,10 @@
 // Frame.this and evalInFrame in arrow function that uses 'this'.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("x = 4");
 g.eval("var foo = function() { 'use strict'; return () => this; }; var arrow = foo.call(3);");
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onEnterFrame = function (frame) {
     if (frame.type === "eval")
 	return;
     hits++;
--- a/js/src/jit-test/tests/debug/Frame-this-09.js
+++ b/js/src/jit-test/tests/debug/Frame-this-09.js
@@ -1,12 +1,12 @@
 // Ensure |Frame.this| returns the right value even if we're still in the
 // script's prologue, before JSOP_FUNCTIONTHIS.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onEnterFrame = function (frame) {
     if (frame.type === 'eval')
         return;
     hits++;
 
     var frameThis = frame.this;
--- a/js/src/jit-test/tests/debug/Frame-this-10.js
+++ b/js/src/jit-test/tests/debug/Frame-this-10.js
@@ -1,12 +1,12 @@
 // Check the Frame.this getter always returns the same object for a given frame.
 // Primitive this-values should not be boxed multiple times.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var framesEntered = 0;
 var framesPopped = 0;
 var numSteps = 0;
 dbg.onEnterFrame = function (frame) {
     if (frame.type === 'eval')
         return;
     framesEntered++;
--- a/js/src/jit-test/tests/debug/Frame-this-11.js
+++ b/js/src/jit-test/tests/debug/Frame-this-11.js
@@ -1,12 +1,12 @@
 // Ensure evalInFrame("this") returns the right value even if we're still in the
 // script's prologue, before JSOP_FUNCTIONTHIS.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onEnterFrame = function (frame) {
     if (frame.type === 'eval')
         return;
     hits++;
 
     var frameThis = frame.eval('this').return;
--- a/js/src/jit-test/tests/debug/Frame-this-12.js
+++ b/js/src/jit-test/tests/debug/Frame-this-12.js
@@ -1,12 +1,12 @@
 // Check evalInFrame("this") always returns the same object for a given frame.
 // Primitive this-values should not be boxed multiple times.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var framesEntered = 0;
 var framesPopped = 0;
 var numSteps = 0;
 dbg.onEnterFrame = function (frame) {
     if (frame.type === 'eval')
         return;
     framesEntered++;
--- a/js/src/jit-test/tests/debug/Memory-allocationSamplingProbability-01.js
+++ b/js/src/jit-test/tests/debug/Memory-allocationSamplingProbability-01.js
@@ -1,14 +1,14 @@
 // Test that setting Debugger.Memory.prototype.allocationSamplingProbability to
 // a bad number throws.
 
 load(libdir + "asserts.js");
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root);
 
 var mem = dbg.memory;
 
 // Out of range, negative
 assertThrowsInstanceOf(() => mem.allocationSamplingProbability = -Number.MAX_VALUE,
--- a/js/src/jit-test/tests/debug/Memory-allocationSamplingProbability-02.js
+++ b/js/src/jit-test/tests/debug/Memory-allocationSamplingProbability-02.js
@@ -1,12 +1,12 @@
 // Test that we only sample about allocationSamplingProbability * 100 percent of
 // allocations.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root);
 
 root.eval(`
   objs = [];
   objs.push(new Object);
 `);
--- a/js/src/jit-test/tests/debug/Memory-allocationsLogOverflowed-01.js
+++ b/js/src/jit-test/tests/debug/Memory-allocationsLogOverflowed-01.js
@@ -1,11 +1,11 @@
 // Test basic usage of `Debugger.Memory.prototype.allocationsLogOverflowed`.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger(root);
 dbg.memory.trackingAllocationSites = true;
 dbg.memory.maxAllocationsLogLength = 1;
 
 root.eval("(" + function immediate() {
   // Allocate more than the max log length.
   this.objs = [{}, {}, {}, {}];
 } + "());");
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-01.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-01.js
@@ -1,11 +1,11 @@
 // Test basic usage of drainAllocationsLog()
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root)
 dbg.memory.trackingAllocationSites = true;
 
 root.eval("(" + function immediate() {
   this.tests = [
     ({}),
     [],
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-03.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-03.js
@@ -1,11 +1,11 @@
 // Test when there are more allocations than the maximum log length.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 dbg.addDebuggee(root)
 
 dbg.memory.maxAllocationsLogLength = 3;
 dbg.memory.trackingAllocationSites = true;
 
 root.eval([
   "this.alloc1 = {};", // line 1
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-04.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-04.js
@@ -1,12 +1,12 @@
 // Test that when we shorten the maximum log length, we won't get a longer log
 // than that new maximum afterwards.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 dbg.addDebuggee(root)
 
 dbg.memory.trackingAllocationSites = true;
 
 root.eval([
   "this.alloc1 = {};", // line 1
   "this.alloc2 = {};", // line 2
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-05.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-05.js
@@ -1,9 +1,9 @@
 // Test an empty allocation log.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 dbg.addDebuggee(root)
 
 dbg.memory.trackingAllocationSites = true;
 const allocs = dbg.memory.drainAllocationsLog();
 assertEq(allocs.length, 0);
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-06.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-06.js
@@ -1,11 +1,11 @@
 // Test doing a GC while we have a non-empty log.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 dbg.addDebuggee(root)
 dbg.memory.trackingAllocationSites = true;
 
 root.eval("(" + function immediate() {
   this.tests = [
     ({}),
     [],
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-07.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-07.js
@@ -1,10 +1,10 @@
 // Test retrieving the log when allocation tracking hasn't ever been enabled.
 
 load(libdir + 'asserts.js');
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 dbg.addDebuggee(root)
 
 assertThrowsInstanceOf(() => dbg.memory.drainAllocationsLog(),
                        Error);
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-08.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-08.js
@@ -1,11 +1,11 @@
 // Test retrieving the log multiple times.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 dbg.addDebuggee(root)
 
 root.eval([
   "this.allocs = [];",
   "this.doFirstAlloc = " + function () {
     this.allocs.push({});           this.firstAllocLine = Error().lineNumber;
   },
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-09.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-09.js
@@ -1,15 +1,15 @@
 // Test logs that contain allocations from many debuggee compartments.
 
 const dbg = new Debugger();
 
-const root1 = newGlobal();
-const root2 = newGlobal();
-const root3 = newGlobal();
+const root1 = newGlobal({newCompartment: true});
+const root2 = newGlobal({newCompartment: true});
+const root3 = newGlobal({newCompartment: true});
 
 dbg.addDebuggee(root1);
 dbg.addDebuggee(root2);
 dbg.addDebuggee(root3);
 
 dbg.memory.trackingAllocationSites = true;
 
 root1.eval("this.alloc = {}");
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-10.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-10.js
@@ -1,21 +1,21 @@
 // Test logs that contain allocations from debuggee compartments added as we are
 // logging.
 
 const dbg = new Debugger();
 
 dbg.memory.trackingAllocationSites = true;
 
-const root1 = newGlobal();
+const root1 = newGlobal({newCompartment: true});
 dbg.addDebuggee(root1);
 root1.eval("this.alloc = {}");
 
-const root2 = newGlobal();
+const root2 = newGlobal({newCompartment: true});
 dbg.addDebuggee(root2);
 root2.eval("this.alloc = {}");
 
-const root3 = newGlobal();
+const root3 = newGlobal({newCompartment: true});
 dbg.addDebuggee(root3);
 root3.eval("this.alloc = {}");
 
 const allocs = dbg.memory.drainAllocationsLog();
 assertEq(allocs.length >= 3, true);
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-11.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-11.js
@@ -1,18 +1,18 @@
 // Test logs that shouldn't contain allocations from debuggee compartments
 // removed as we are logging.
 
 const dbg = new Debugger();
 
-const root1 = newGlobal();
+const root1 = newGlobal({newCompartment: true});
 dbg.addDebuggee(root1);
-const root2 = newGlobal();
+const root2 = newGlobal({newCompartment: true});
 dbg.addDebuggee(root2);
-const root3 = newGlobal();
+const root3 = newGlobal({newCompartment: true});
 dbg.addDebuggee(root3);
 
 dbg.memory.trackingAllocationSites = true;
 
 dbg.removeDebuggee(root1);
 root1.eval("this.alloc = {}");
 
 dbg.removeDebuggee(root2);
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-12.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-12.js
@@ -1,14 +1,14 @@
 // Test that disabling the debugger disables allocation tracking.
 
 load(libdir + "asserts.js");
 
 const dbg = new Debugger();
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 dbg.addDebuggee(root);
 
 dbg.memory.trackingAllocationSites = true;
 dbg.enabled = false;
 
 root.eval("this.alloc = {}");
 
 // We shouldn't accumulate allocations in our log while the debugger is
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-13.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-13.js
@@ -1,15 +1,15 @@
 // |jit-test| skip-if: helperThreadCount() === 0
 
 // Test that we don't crash while logging allocations and there is
 // off-main-thread compilation. OMT compilation will allocate functions and
 // regexps, but we just punt on measuring that accurately.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 root.eval("this.dbg = new Debugger()");
 root.dbg.addDebuggee(this);
 root.dbg.memory.trackingAllocationSites = true;
 
 offThreadCompileScript(
   "function foo() {\n" +
   "  print('hello world');\n" +
   "}"
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-14.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-14.js
@@ -1,17 +1,17 @@
 // Test that drainAllocationsLog returns some timestamps.
 
 load(libdir + 'asserts.js');
 
 var allocTimes = [];
 
 allocTimes.push(timeSinceCreation());
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger(root);
 
 dbg.memory.trackingAllocationSites = true;
 root.eval("this.alloc1 = {}");
 allocTimes.push(timeSinceCreation());
 root.eval("this.alloc2 = {}");
 allocTimes.push(timeSinceCreation());
 root.eval("this.alloc3 = {}");
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-15.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-15.js
@@ -1,10 +1,10 @@
 // Test drainAllocationsLog() and [[Class]] names.
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root)
 
 root.eval(
   `
   this.tests = [
     { expected: "Object",    test: () => new Object    },
     { expected: "Array",     test: () => []            },
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
@@ -1,11 +1,11 @@
 // Test drainAllocationsLog() and constructor names.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root);
 
 root.eval(
   `
   function Ctor() {}
 
   var nested = {};
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-17.js
@@ -1,11 +1,11 @@
 // Test drainAllocationsLog() and byte sizes.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root);
 
 root.eval(
   `
   function AsmModule(stdlib, foreign, heap) {
     "use asm";
 
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js
@@ -1,11 +1,11 @@
 // Test drainAllocationsLog() entries' inNursery flag.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root);
 
 dbg.memory.trackingAllocationSites = true;
 
 root.eval(
   `
   for (let i = 0; i < 10; i++)
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-01.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-01.js
@@ -13,11 +13,11 @@ function checkProperties(census) {
       checkProperties(desc.value);
     else
       assertEq(typeof desc.value, 'number');
   }
 }
 
 checkProperties(dbg.memory.takeCensus());
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 dbg.addDebuggee(g);
 checkProperties(dbg.memory.takeCensus());
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-02.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-02.js
@@ -11,17 +11,17 @@
 load(libdir + 'census.js');
 
 // A Debugger with no debuggees had better not find anything.
 var dbg = new Debugger;
 var census0 = dbg.memory.takeCensus();
 Census.walkCensus(census0, "census0", Census.assertAllZeros);
 
 function newGlobalWithDefs() {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   g.eval(`
          function times(n, fn) {
            var a=[];
            for (var i = 0; i<n; i++)
              a.push(fn());
            return a;
          }`);
   return g;
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-03.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-03.js
@@ -2,22 +2,22 @@
 
 load(libdir + 'census.js');
 
 var dbg = new Debugger;
 
 var census0 = dbg.memory.takeCensus();
 Census.walkCensus(census0, "census0", Census.assertAllZeros);
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 dbg.addDebuggee(g1);
 var census1 = dbg.memory.takeCensus();
 Census.walkCensus(census1, "census1", Census.assertAllNotLessThan(census0));
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 dbg.addDebuggee(g2);
 var census2 = dbg.memory.takeCensus();
 Census.walkCensus(census2, "census2", Census.assertAllNotLessThan(census1), new Set(["bytes"]));
 
 dbg.removeDebuggee(g2);
 var census3 = dbg.memory.takeCensus();
 Census.walkCensus(census3, "census3", Census.assertAllEqual(census1), new Set(["bytes"]));
 
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-04.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-04.js
@@ -1,12 +1,12 @@
 // Test that Debugger.Memory.prototype.takeCensus finds GC roots that are on the
 // stack.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 g.eval(`
   function withAllocationMarkerOnStack(f) {
     (function () {
       var onStack = allocationMarker();
       f();
     }())
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-05.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-05.js
@@ -1,12 +1,12 @@
 // Test that Debugger.Memory.prototype.takeCensus finds cross compartment
 // wrapper GC roots.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 assertEq("AllocationMarker" in dbg.memory.takeCensus().objects, false,
          "There shouldn't exist any allocation markers in the census.");
 
 this.ccw = g.allocationMarker();
 
 assertEq(dbg.memory.takeCensus().objects.AllocationMarker.count, 1,
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-06.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-06.js
@@ -1,14 +1,14 @@
 // Check Debugger.Memory.prototype.takeCensus handling of 'breakdown' argument.
 
 load(libdir + 'match.js');
 var Pattern = Match.Pattern;
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 Pattern({ count: Pattern.NATURAL,
           bytes: Pattern.NATURAL })
   .assert(dbg.memory.takeCensus({ breakdown: { by: 'count' } }));
 
 let census = dbg.memory.takeCensus({ breakdown: { by: 'count', count: false, bytes: false } });
 assertEq('count' in census, false);
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-07.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-07.js
@@ -1,14 +1,14 @@
 // Debugger.Memory.prototype.takeCensus breakdown: check error handling on
 // property gets.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 assertThrowsValue(() => {
   dbg.memory.takeCensus({
     breakdown: { get by() { throw "ಠ_ಠ" } }
   });
 }, "ಠ_ಠ");
 
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-08.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-08.js
@@ -1,11 +1,11 @@
 // Debugger.Memory.prototype.takeCensus: test by: 'count' breakdown
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 g.eval(`
        var stuff = [];
        function add(n, c) {
          for (let i = 0; i < n; i++)
            stuff.push(c());
        }
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-09.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-09.js
@@ -1,11 +1,11 @@
 // Debugger.Memory.prototype.takeCensus: by: allocationStack breakdown
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 g.evaluate(`
            var log = [];
            function f() { log.push(allocationMarker()); }
            function g() { f(); }
            function h() { f(); }
            `,
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-10.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-10.js
@@ -1,11 +1,11 @@
 // Check byte counts produced by takeCensus.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 let sizeOfAM = byteSize(allocationMarker());
 
 // Allocate a single allocation marker, and check that we can find it.
 g.eval('var hold = allocationMarker();');
 let census = dbg.memory.takeCensus({ breakdown: { by: 'objectClass' } });
 assertEq(census.AllocationMarker.count, 1);
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-11.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-11.js
@@ -1,11 +1,11 @@
 // Check byte counts produced by takeCensus.
 
-const g = newGlobal();
+const g = newGlobal({newCompartment: true});
 g.eval("setLazyParsingDisabled(true)");
 g.eval("setJitCompilerOption('ion.warmup.trigger', 1000)");
 
 const dbg = new Debugger(g);
 
 g.evaluate("function one() {}", { fileName: "one.js" });
 g.evaluate(`function two1() {}
             function two2() {}`,
--- a/js/src/jit-test/tests/debug/Memory-takeCensus-12.js
+++ b/js/src/jit-test/tests/debug/Memory-takeCensus-12.js
@@ -1,11 +1,11 @@
 // Sanity test that we can accumulate matching individuals in a bucket.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 var bucket = { by: "bucket" };
 var count = { by: "count", count: true, bytes: false };
 
 var all = dbg.memory.takeCensus({ breakdown: bucket });
 var allCount = dbg.memory.takeCensus({ breakdown: count }).count;
 
--- a/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-01.js
+++ b/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-01.js
@@ -1,13 +1,13 @@
 // Test that we can track allocation sites by setting
 // Debugger.Memory.prototype.trackingAllocationSites to true and then get the
 // allocation site via Debugger.Object.prototype.allocationSite.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root);
 
 assertEq(dbg.memory.trackingAllocationSites, false);
 dbg.memory.trackingAllocationSites = true;
 assertEq(dbg.memory.trackingAllocationSites, true);
 
--- a/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js
+++ b/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-02.js
@@ -1,11 +1,11 @@
 // Test that we don't get allocation sites when nobody has asked for them.
 
-const root = newGlobal();
+const root = newGlobal({newCompartment: true});
 
 const dbg = new Debugger();
 const wrappedRoot = dbg.addDebuggee(root);
 
 dbg.memory.trackingAllocationSites = true;
 root.eval("this.obj = {};");
 dbg.memory.trackingAllocationSites = false;
 root.eval("this.obj2 = {};");
--- a/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-03.js
+++ b/js/src/jit-test/tests/debug/Memory-trackingAllocationSites-03.js
@@ -12,18 +12,18 @@ function isTrackingAllocations(global, d
   return !!site;
 }
 
 function test(name, fn) {
   print();
   print(name);
 
   // Reset state.
-  root1 = newGlobal();
-  root2 = newGlobal();
+  root1 = newGlobal({newCompartment: true});
+  root2 = newGlobal({newCompartment: true});
   dbg1 = new Debugger;
   dbg2 = new Debugger;
 
   // Run the test.
   fn();
 
   print("  OK");
 }
--- a/js/src/jit-test/tests/debug/Object-01.js
+++ b/js/src/jit-test/tests/debug/Object-01.js
@@ -1,11 +1,11 @@
 // Debugger.Object basics
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.arguments[0], frame.callee);
     assertEq(Object.getPrototypeOf(frame.arguments[0]), Debugger.Object.prototype);
     assertEq(frame.arguments[0] instanceof Debugger.Object, true);
     assertEq(frame.arguments[0] !== frame.arguments[1], true);
     assertEq(Object.getPrototypeOf(frame.arguments[1]), Debugger.Object.prototype);
--- a/js/src/jit-test/tests/debug/Object-02.js
+++ b/js/src/jit-test/tests/debug/Object-02.js
@@ -1,11 +1,11 @@
 // Debugger.Object referents can be transparent wrappers of objects in the debugger compartment.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.f = function (a, b) { return a + "/" + b; };
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var f = frame.eval("f").return;
     assertEq(f.call(null, "a", "b").return, "a/b");
     hits++;
 };
--- a/js/src/jit-test/tests/debug/Object-apply-01.js
+++ b/js/src/jit-test/tests/debug/Object-apply-01.js
@@ -1,13 +1,13 @@
 // tests calling script functions via Debugger.Object.prototype.apply/call
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; }");
 var dbg = new Debugger(g);
 
 var hits = 0;
 function test(usingApply) {
     dbg.onDebuggerStatement = function (frame) {
         var fn = frame.arguments[0];
         var cv = usingApply ? fn.apply(null, [9, 16]) : fn.call(null, 9, 16);
--- a/js/src/jit-test/tests/debug/Object-apply-02.js
+++ b/js/src/jit-test/tests/debug/Object-apply-02.js
@@ -1,13 +1,13 @@
 // tests calling native functions via Debugger.Object.prototype.apply/call
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; }");
 var dbg = new Debugger(g);
 
 function test(usingApply) {
     dbg.onDebuggerStatement = function (frame) {
         var max = frame.arguments[0];
         var cv = usingApply ? max.apply(null, [9, 16]) : max.call(null, 9, 16);
         assertEq(cv.return, 16);
--- a/js/src/jit-test/tests/debug/Object-apply-03.js
+++ b/js/src/jit-test/tests/debug/Object-apply-03.js
@@ -1,11 +1,11 @@
 // reentering the debugger several times via onDebuggerStatement and apply/call on a single stack
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 
 function test(usingApply) {
     dbg.onDebuggerStatement = function (frame) {
         var n = frame.arguments[0];
         if (n > 1) {
             var result = usingApply ? frame.callee.apply(null, [n - 1])
                 : frame.callee.call(null, n - 1);
--- a/js/src/jit-test/tests/debug/Object-apply-04.js
+++ b/js/src/jit-test/tests/debug/Object-apply-04.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.apply/call works with function proxies
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; }");
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var proxy = frame.arguments[0];
     assertEq(proxy.name, undefined);
     assertEq(proxy.apply(null, [33]).return, 34);
     assertEq(proxy.call(null, 33).return, 34);
--- a/js/src/jit-test/tests/debug/Object-asEnvironment-01.js
+++ b/js/src/jit-test/tests/debug/Object-asEnvironment-01.js
@@ -1,11 +1,11 @@
 // Tests D.O.asEnvironment() returning the global lexical scope.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 g.evaluate(`
   var x = 42;
   let y = "foo"
 `);
 
--- a/js/src/jit-test/tests/debug/Object-boundTargetFunction-01.js
+++ b/js/src/jit-test/tests/debug/Object-boundTargetFunction-01.js
@@ -1,11 +1,11 @@
 // Smoke tests for bound function things.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var arrw = gw.executeInGlobal("var arr = []; arr;").return;
 var pushw = gw.executeInGlobal("var push = arr.push.bind(arr); push;").return;
 assertEq(pushw.isBoundFunction, true);
 assertEq(pushw.boundThis, arrw);
 assertEq(pushw.boundArguments.length, 0);
 
--- a/js/src/jit-test/tests/debug/Object-boundTargetFunction-02.js
+++ b/js/src/jit-test/tests/debug/Object-boundTargetFunction-02.js
@@ -1,14 +1,14 @@
 // Test that bound function accessors work on:
 // - an ordinary non-bound function;
 // - a native function;
 // - and an object that isn't a function at all.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var fw = gw.executeInGlobal("function f() {}; f").return;
 assertEq(fw.isBoundFunction, false);
 assertEq(fw.boundThis, undefined);
 assertEq(fw.boundArguments, undefined);
 assertEq(fw.boundTargetFunction, undefined);
 
--- a/js/src/jit-test/tests/debug/Object-boundTargetFunction-03.js
+++ b/js/src/jit-test/tests/debug/Object-boundTargetFunction-03.js
@@ -1,12 +1,12 @@
 // Test that inspecting a bound function that was bound again does the right
 // thing.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var expr = "function f() { return this; }; var bf = f.bind(1, 2).bind(3, 4); bf";
 var bfw = gw.executeInGlobal(expr).return;
 
 assertEq(bfw.isBoundFunction, true);
 assertEq(bfw.boundThis, 3);
 var args = bfw.boundArguments;
--- a/js/src/jit-test/tests/debug/Object-callable.js
+++ b/js/src/jit-test/tests/debug/Object-callable.js
@@ -1,11 +1,11 @@
 // Test Debugger.Object.prototype.callable.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.arguments[0].callable, frame.arguments[1]);
     hits++;
 };
 
 g.eval("function f(obj, iscallable) { debugger; }");
--- a/js/src/jit-test/tests/debug/Object-class.js
+++ b/js/src/jit-test/tests/debug/Object-class.js
@@ -1,10 +1,10 @@
 // Basic tests for Debugger.Object.prototype.class.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 g.eval('function f() { debugger; }');
 
 dbg.onDebuggerStatement = function (frame) {
     var arr = frame.arguments;
     assertEq(arr[0].class, "Object");
     assertEq(arr[1].class, "Array");
--- a/js/src/jit-test/tests/debug/Object-defineProperties-01.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperties-01.js
@@ -1,11 +1,11 @@
 // Debug.Object.prototype.defineProperties.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 var descProps = ['configurable', 'enumerable', 'writable', 'value', 'get', 'set'];
 function test(objexpr, descs) {
     g.eval("obj = (" + objexpr + ");");
     var gobjw = gw.getOwnPropertyDescriptor("obj").value;
     gobjw.defineProperties(descs);
--- a/js/src/jit-test/tests/debug/Object-defineProperties-02.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperties-02.js
@@ -1,11 +1,11 @@
 // Exceptions thrown by obj.defineProperties are copied into the debugger compartment.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 function test(objexpr, descs) {
     var exca, excb;
 
     g.eval("obj = (" + objexpr + ");");
     var gobjw = gw.getOwnPropertyDescriptor("obj").value;
--- a/js/src/jit-test/tests/debug/Object-defineProperties-03.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperties-03.js
@@ -1,11 +1,11 @@
 // obj.defineProperties can define accessor properties.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 g.value = undefined;
 g.eval("function gf() { return 12; }\n" +
        "function sf(v) { value = v; }\n");
 var gfw = gw.getOwnPropertyDescriptor("gf").value;
 var sfw = gw.getOwnPropertyDescriptor("sf").value;
 gw.defineProperties({x: {configurable: true, get: gfw, set: sfw}});
--- a/js/src/jit-test/tests/debug/Object-defineProperty-01.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-01.js
@@ -1,11 +1,11 @@
 // obj.defineProperty can define simple data properties.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gobj = dbg.addDebuggee(g);
 gobj.defineProperty("x", {configurable: true, enumerable: true, writable: true, value: 'ok'});
 assertEq(g.x, 'ok');
 
 var desc = g.Object.getOwnPropertyDescriptor(g, "x");
 assertEq(desc.configurable, true);
 assertEq(desc.enumerable, true);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-02.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-02.js
@@ -1,10 +1,10 @@
 // obj.defineProperty can define a data property with object value.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var a = {};");
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var desc = gw.getOwnPropertyDescriptor("a");
 assertEq(desc.value instanceof Debugger.Object, true);
 gw.defineProperty("b", desc);
 assertEq(g.a, g.b);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-03.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-03.js
@@ -1,11 +1,11 @@
 // defineProperty can set array elements
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.a = g.Array(0, 1, 2);
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var aw = gw.getOwnPropertyDescriptor("a").value;
 
 aw.defineProperty(0, {value: 'ok0'});  // by number
 assertEq(g.a[0], 'ok0');
 var desc = g.Object.getOwnPropertyDescriptor(g.a, "0");
--- a/js/src/jit-test/tests/debug/Object-defineProperty-04.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-04.js
@@ -1,9 +1,9 @@
 // defineProperty can add array elements, bumping length
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.a = g.Array(0, 1, 2);
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var aw = gw.getOwnPropertyDescriptor("a").value;
 aw.defineProperty(3, {configurable: true, enumerable: true, writable: true, value: 3});
 assertEq(g.a.length, 4);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-05.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-05.js
@@ -1,11 +1,11 @@
 // defineProperty can define accessor properties.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 g.value = undefined;
 g.eval("function gf() { return 12; }\n" +
        "function sf(v) { value = v; }\n");
 var gfw = gw.getOwnPropertyDescriptor("gf").value;
 var sfw = gw.getOwnPropertyDescriptor("sf").value;
 gw.defineProperty("x", {configurable: true, get: gfw, set: sfw});
--- a/js/src/jit-test/tests/debug/Object-defineProperty-06.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-06.js
@@ -1,11 +1,11 @@
 // obj.defineProperty with vague descriptors works like Object.defineProperty
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 gw.defineProperty("p", {configurable: true, enumerable: true});
 assertEq(g.p, undefined);
 var desc = g.Object.getOwnPropertyDescriptor(g, "p");
 assertEq(desc.configurable, true);
 assertEq(desc.enumerable, true);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-07.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-07.js
@@ -1,10 +1,10 @@
 // obj.defineProperty throws if a value, getter, or setter is not a debuggee value.
 
 load(libdir + "asserts.js");
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gobj = dbg.addDebuggee(g);
 assertThrowsInstanceOf(function () { gobj.defineProperty('x', {value: {}}); }, TypeError);
 assertThrowsInstanceOf(function () { gobj.defineProperty('x', {get: Number}); }, TypeError);
 assertThrowsInstanceOf(function () { gobj.defineProperty('x', {get: gobj, set: Number}) },
                        TypeError);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-08.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-08.js
@@ -1,10 +1,10 @@
 // obj.defineProperty throws if a value, getter, or setter is in a different compartment than obj
 
 load(libdir + "asserts.js");
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var g1w = dbg.addDebuggee(g1);
 var g2w = dbg.addDebuggee(g2);
 assertThrowsInstanceOf(function () { g1w.defineProperty('x', {value: g2w}); }, TypeError);
 assertThrowsInstanceOf(function () { g1w.defineProperty('x', {get: g1w, set: g2w}); }, TypeError);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-09.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-09.js
@@ -1,13 +1,13 @@
 // defineProperty can't re-define non-configurable properties.
 // Also: when defineProperty throws, the exception is native to the debugger
 // compartment, not a wrapper.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 gw.defineProperty("p", {value: 1});
 g.p = 4;
 assertEq(g.p, 1);
 
 var threw;
 try {
--- a/js/src/jit-test/tests/debug/Object-defineProperty-10.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-10.js
@@ -1,10 +1,10 @@
 // defineProperty can make a non-configurable writable property non-writable
 
 load(libdir + "asserts.js");
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 gw.defineProperty("p", {writable: true, value: 1});
 gw.defineProperty("p", {writable: false});
 g.p = 4;
 assertEq(g.p, 1);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-11.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-11.js
@@ -1,12 +1,12 @@
 // obj.defineProperty works when obj's referent is a wrapper.
 
 var x = {};
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.x = x;
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var xw = gw.getOwnPropertyDescriptor("x").value;
 xw.defineProperty("p", {configurable: true, enumerable: true, writable: true, value: gw});
 assertEq(x.p, g);
 
 var desc = Object.getOwnPropertyDescriptor(x, "p");
--- a/js/src/jit-test/tests/debug/Object-defineProperty-12.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-12.js
@@ -1,11 +1,11 @@
 // obj.defineProperty redefining an existing property leaves unspecified attributes unchanged.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.p = 1;
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 gw.defineProperty("p", {value: 2});
 assertEq(g.p, 2);
 
 var desc = Object.getOwnPropertyDescriptor(g, "p");
--- a/js/src/jit-test/tests/debug/Object-defineProperty-13.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-13.js
@@ -1,13 +1,13 @@
 // defineProperty throws if a getter or setter is neither undefined nor callable.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 for (let v of [null, false, 'bad', 0, 2.76, {}]) {
     assertThrowsInstanceOf(function () {
         gw.defineProperty("p", {configurable: true, get: v});
     }, TypeError);
     assertThrowsInstanceOf(function () {
--- a/js/src/jit-test/tests/debug/Object-defineProperty-14.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-14.js
@@ -1,13 +1,13 @@
 // defineProperty accepts undefined for desc.get/set.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 gw.defineProperty("p", {get: undefined, set: undefined});
 
 var desc = g.eval("Object.getOwnPropertyDescriptor(this, 'p')");
 assertEq("get" in desc, true);
 assertEq("set" in desc, true);
--- a/js/src/jit-test/tests/debug/Object-defineProperty-surfaces-01.js
+++ b/js/src/jit-test/tests/debug/Object-defineProperty-surfaces-01.js
@@ -1,8 +1,8 @@
 // Debugger.Object.prototype.defineProperty with too few arguments throws.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 assertThrowsInstanceOf(function () { gw.defineProperty("x"); }, TypeError);
--- a/js/src/jit-test/tests/debug/Object-deleteProperty-01.js
+++ b/js/src/jit-test/tests/debug/Object-deleteProperty-01.js
@@ -1,11 +1,11 @@
 // Basic deleteProperty tests.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 assertEq(gw.deleteProperty("no such property"), true);
 
 g.Object.defineProperty(g, "p", {configurable: true, value: 0});
 assertEq(gw.deleteProperty("p"), true);
 
--- a/js/src/jit-test/tests/debug/Object-deleteProperty-error-01.js
+++ b/js/src/jit-test/tests/debug/Object-deleteProperty-error-01.js
@@ -1,11 +1,11 @@
 // Don't crash when a scripted proxy handler throws Error.prototype.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     try {
         frame.arguments[0].deleteProperty("x");
     } catch (exc) {
         return;
     }
     throw new Error("deleteProperty should throw");
--- a/js/src/jit-test/tests/debug/Object-deleteProperty-error-02.js
+++ b/js/src/jit-test/tests/debug/Object-deleteProperty-error-02.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     try {
         frame.arguments[0].deleteProperty("x");
     } catch (exc) {
         assertEq(exc instanceof Debugger.DebuggeeWouldRun, true);
         return;
     }
--- a/js/src/jit-test/tests/debug/Object-displayName-01.js
+++ b/js/src/jit-test/tests/debug/Object-displayName-01.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.displayName
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var name;
 dbg.onDebuggerStatement = function (frame) { name = frame.callee.displayName; };
 
 g.eval("(function f() { debugger; })();");
 assertEq(name, "f");
 g.eval("(function () { debugger; })();");
 assertEq(name, undefined);
--- a/js/src/jit-test/tests/debug/Object-environment-01.js
+++ b/js/src/jit-test/tests/debug/Object-environment-01.js
@@ -1,11 +1,11 @@
 // obj.environment is undefined when the referent is not a JS function.
 
-var g = newGlobal()
+var g = newGlobal({newCompartment: true})
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 assertEq(gw.environment, undefined);
 
 g.eval("var r = /x/;");
 var rw = gw.getOwnPropertyDescriptor("r").value;
 assertEq(rw.class, "RegExp");
 assertEq(rw.environment, undefined);
--- a/js/src/jit-test/tests/debug/Object-environment-02.js
+++ b/js/src/jit-test/tests/debug/Object-environment-02.js
@@ -1,11 +1,11 @@
 // The .environment of a function Debugger.Object is an Environment object.
 
-var g = newGlobal()
+var g = newGlobal({newCompartment: true})
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 
 function check(expr) {
   print("checking " + uneval(expr));
   let completion = gDO.executeInGlobal(expr);
   if (completion.throw)
     throw completion.throw.unsafeDereference();
--- a/js/src/jit-test/tests/debug/Object-errorLineNumber-errorColumnNumber.js
+++ b/js/src/jit-test/tests/debug/Object-errorLineNumber-errorColumnNumber.js
@@ -1,12 +1,12 @@
 // Debugger.Object.prototype.{errorLineNumber,errorColumnNumber} return the
 // line number and column number associated with some error object.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 var syntaxError = gw.executeInGlobal("\nlet a, a;").throw;
 assertEq(syntaxError.errorLineNumber, 2);
 assertEq(syntaxError.errorColumnNumber, 7);
 
 var typeError = gw.executeInGlobal("\n1 + f();").throw;
@@ -22,17 +22,17 @@ customError = gw.executeInGlobal("\nthro
 assertEq(customError.errorLineNumber, undefined);
 assertEq(customError.errorColumnNumber, undefined);
 
 customError = gw.executeInGlobal("\nthrow { lineNumber: 10, columnNumber: 20 };").throw;
 assertEq(customError.errorLineNumber, undefined);
 assertEq(customError.errorColumnNumber, undefined);
 
 // Ensure that the method works across globals.
-g.eval(`var g = newGlobal();
+g.eval(`var g = newGlobal({newCompartment: true});
         g.eval('var err; \\n' +
                'try {\\n' +
                '  f();\\n' +
                '} catch (e) {\\n' +
                '  err = e;\\n' +
                '}');
         var err2 = g.err;`);
 var otherGlobalError = gw.executeInGlobal("throw err2").throw;
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-01.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-01.js
@@ -1,12 +1,12 @@
 // Debugger.Object.prototype.executeInGlobal basics
 
-var g = newGlobal();
-var h = newGlobal();
+var g = newGlobal({newCompartment: true});
+var h = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var hw = dbg.addDebuggee(h);
 
 g.y = "Bitte Orca";
 h.y = "Visiter";
 var y = "W H O K I L L";
 assertEq(gw.executeInGlobal('y').return, "Bitte Orca");
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-02.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-02.js
@@ -1,13 +1,13 @@
 // Debugger.Object.prototype.executeInGlobal argument validation
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var gobj = gw.makeDebuggeeValue(g.eval("({})"));
 
 assertThrowsInstanceOf(function () { gw.executeInGlobal(); }, TypeError);
 assertThrowsInstanceOf(function () { gw.executeInGlobal(10); }, TypeError);
 assertThrowsInstanceOf(function () { gobj.executeInGlobal('42'); }, TypeError);
 assertEq(gw.executeInGlobal('42').return, 42);
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-03.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-03.js
@@ -1,12 +1,12 @@
 // Debugger.Object.prototype.executeInGlobal: closures capturing the global
 
-var g = newGlobal();
-var h = newGlobal();
+var g = newGlobal({newCompartment: true});
+var h = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var hw = dbg.addDebuggee(h);
 
 g.x = "W H O K I L L";
 h.x = "No Color";
 var c1 = gw.executeInGlobal('(function () { return x; })').return;
 var c2 = hw.executeInGlobal('(function () { return x; })').return;
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-04.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-04.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.executeInGlobal: nested evals
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 assertEq(gw.executeInGlobal("eval('\"Awake\"');").return, "Awake");
 
 // Evaluating non-strict-mode code uses the given global as its variable
 // environment.
 g.x = "Swing Lo Magellan";
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-05.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-05.js
@@ -1,18 +1,18 @@
 // Debugger.Object.prototype.executeInGlobal throws when asked to evaluate in a CCW of a global.
 
 load(libdir + 'asserts.js');
 
 var dbg = new Debugger();
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 var dg1 = dbg.addDebuggee(g1);
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 var dg2 = dbg.addDebuggee(g2);
 
 // Generate a Debugger.Object viewing g2 from g1's compartment.
 var dg1wg2 = dg1.makeDebuggeeValue(g2);
 assertEq(dg1wg2.unwrap(), dg2);
 assertThrowsInstanceOf(function () { dg1wg2.executeInGlobal('1'); }, TypeError);
 assertThrowsInstanceOf(function () { dg1wg2.executeInGlobalWithBindings('x', { x: 1 }); }, TypeError);
 
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-06.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-06.js
@@ -1,8 +1,8 @@
 // Debugger.Object.prototype.executeInGlobal sets 'this' to the global.
 
 var dbg = new Debugger;
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 var g1w = dbg.addDebuggee(g1);
 
 assertEq(g1w.executeInGlobal('this').return, g1w);
 assertEq(g1w.executeInGlobalWithBindings('this', { x:42 }).return, g1w);
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-07.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-07.js
@@ -1,10 +1,10 @@
 // executeInGlobal correctly handles optional custom url option
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var debuggee = dbg.getDebuggees()[0];
 var count = 0;
 
 function testUrl (options, expected) {
     count++;
     dbg.onNewScript = function(script){
         dbg.onNewScript = undefined;
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-08.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-08.js
@@ -1,10 +1,10 @@
 // executeInGlobal correctly handles optional lineNumber option
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var debuggee = dbg.getDebuggees()[0];
 var count = 0;
 
 function testLineNumber (options, expected) {
     count++;
     dbg.onNewScript = function(script){
         dbg.onNewScript = undefined;
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-09.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-09.js
@@ -1,9 +1,9 @@
 // The frame created for executeInGlobal is never marked as a 'FUNCTION' frame.
 
 (function () {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
   var gw = dbg.addDebuggee(g);
   gw.executeInGlobalWithBindings("eval('Math')",{}).return
 })();
 
--- a/js/src/jit-test/tests/debug/Object-executeInGlobal-10.js
+++ b/js/src/jit-test/tests/debug/Object-executeInGlobal-10.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 // executeInGlobal should be able to introduce and persist lexical bindings.
 assertEq(gw.executeInGlobal(`let x = 42; x;`).return, 42);
 assertEq(gw.executeInGlobal(`x;`).return, 42);
 
 // By contrast, Debugger.Frame.eval is like direct eval, and shouldn't be able
--- a/js/src/jit-test/tests/debug/Object-forceLexicalInitializationByName.js
+++ b/js/src/jit-test/tests/debug/Object-forceLexicalInitializationByName.js
@@ -1,11 +1,11 @@
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 let errorOne, errorTwo;
 
 function evalErrorStr(global, evalString) {
     try {
         global.evaluate(evalString);
--- a/js/src/jit-test/tests/debug/Object-gc-01.js
+++ b/js/src/jit-test/tests/debug/Object-gc-01.js
@@ -1,11 +1,11 @@
 // Debugger.Objects keep their referents alive.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var arr = [];
 dbg.onDebuggerStatement = function (frame) { arr.push(frame.eval("[]").return); };
 g.eval("for (var i = 0; i < 10; i++) debugger;");
 assertEq(arr.length, 10);
 
 gc();
 
--- a/js/src/jit-test/tests/debug/Object-getErrorMessageName.js
+++ b/js/src/jit-test/tests/debug/Object-getErrorMessageName.js
@@ -1,22 +1,22 @@
 // Debugger.Object.prototype.getErrorMessageName returns the error message name
 // associated with some error object.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 assertEq(gw.executeInGlobal("(42).toString(0)").throw.errorMessageName, "JSMSG_BAD_RADIX");
 
 // Custom errors have no error message name.
 assertEq(gw.executeInGlobal("throw new Error()").throw.errorMessageName, undefined);
 
 // Ensure that the method works across globals.
-g.eval(`var g = newGlobal();
+g.eval(`var g = newGlobal({newCompartment: true});
         g.eval('var err; try { (42).toString(0); } catch (e) { err = e; }');
         var err2 = g.err;`);
 assertEq(gw.executeInGlobal("throw err2").throw.errorMessageName, "JSMSG_BAD_RADIX");
 
 // Ensure that non-error objects return undefined.
 const Args = [
     "1",
     "'blah'",
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-01.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-01.js
@@ -1,11 +1,11 @@
 // getOwnPropertyDescriptor works with simple data properties.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits;
 var expected;
 dbg.onDebuggerStatement = function (frame) {
     var args = frame.arguments;
     var obj = args[0], id = args[1];
     var desc = obj.getOwnPropertyDescriptor(id);
     if (expected === undefined) {
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-02.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-02.js
@@ -1,8 +1,8 @@
 // Property values that are objects are reflected as Debugger.Objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger();
 var gobj = dbg.addDebuggee(g);
 g.self = g;
 var desc = gobj.getOwnPropertyDescriptor("self");
 assertEq(desc.value, gobj);
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-03.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-03.js
@@ -1,11 +1,11 @@
 // obj.getOwnPropertyDescriptor works on global objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var v;");
 this.eval("var v;");
 
 var dbg = Debugger();
 var obj = dbg.addDebuggee(g);
 
 function test(name) {
     var desc = obj.getOwnPropertyDescriptor(name);
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-04.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-04.js
@@ -1,11 +1,11 @@
 // obj.getOwnPropertyDescriptor works on accessor properties.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gdo = dbg.addDebuggee(g);
 
 g.called = false;
 g.eval("var a = {get x() { called = true; }};");
 
 var desc = gdo.getOwnPropertyDescriptor("a").value.getOwnPropertyDescriptor("x");
 assertEq(g.called, false);
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-05.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-05.js
@@ -1,11 +1,11 @@
 // obj.getOwnPropertyDescriptor presents getters and setters as Debugger.Object objects.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.S = function foreignFunction(v) {};
 g.eval("var a = {};\n" +
        "function G() {}\n" +
        "Object.defineProperty(a, 'p', {get: G, set: S})");
 
 var dbg = new Debugger;
 var gdo = dbg.addDebuggee(g);
 var desc = gdo.getOwnPropertyDescriptor("a").value.getOwnPropertyDescriptor("p");
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-06.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-06.js
@@ -1,12 +1,12 @@
 // obj.getOwnPropertyDescriptor works when obj is a transparent cross-compartment wrapper.
 
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 g1.next = g2;
 
 // This test is a little hard to follow, especially the !== assertions.
 //
 // Bottom line: the value of a property of g1 can only be an object in g1's
 // compartment, so any Debugger.Objects obtained by calling
 // g1obj.getOwnPropertyDescriptor should all have referents in g1's
 // compartment.
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-surfaces-01.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-surfaces-01.js
@@ -1,11 +1,11 @@
 // The argument to Debugger.Object.prototype.getOwnPropertyDescriptor can be omitted.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var obj = {};");
 
 var dbg = Debugger(g);
 var obj;
 dbg.onDebuggerStatement = function (frame) { obj = frame.eval("obj").return; };
 g.eval("debugger;");
 
 assertEq(obj.getOwnPropertyDescriptor(), undefined);
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-surfaces-02.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyDescriptor-surfaces-02.js
@@ -1,10 +1,10 @@
 // The argument to Debugger.Object.prototype.getOwnPropertyDescriptor can be an object.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var obj = {};");
 
 var dbg = Debugger(g);
 var obj;
 dbg.onDebuggerStatement = function (frame) { obj = frame.eval("obj").return; };
 g.eval("debugger;");
 
 var nameobj = {toString: function () { return 'x'; }};
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js
@@ -1,11 +1,11 @@
 // Basic getOwnPropertyNames tests.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger();
 var gobj = dbg.addDebuggee(g);
 
 function test(code) {
     code = "(" + code + ");";
     var expected = Object.getOwnPropertyNames(eval(code));
     g.eval("obj = " + code);
     var actual = gobj.getOwnPropertyDescriptor("obj").value.getOwnPropertyNames();
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-02.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-02.js
@@ -1,11 +1,11 @@
 // obj.getOwnPropertyNames() works when obj's referent is itself a cross-compartment wrapper.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger();
 var gobj = dbg.addDebuggee(g);
 g.p = {xyzzy: 8};  // makes a cross-compartment wrapper
 g.p[Symbol.for("plugh")] = 9;
 var wp = gobj.getOwnPropertyDescriptor("p").value;
 var names = wp.getOwnPropertyNames();
 assertEq(names.length, 1);
 assertEq(names[0], "xyzzy");
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertySymbols-01.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertySymbols-01.js
@@ -1,11 +1,11 @@
 // Basic getOwnPropertSymbols tests.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger();
 var gobj = dbg.addDebuggee(g);
 
 function test(code) {
     code = "(" + code + ");";
     var expected = Object.getOwnPropertySymbols(eval(code));
     g.eval("obj = " + code);
     var actual = gobj.getOwnPropertyDescriptor("obj").value.getOwnPropertySymbols();
--- a/js/src/jit-test/tests/debug/Object-getOwnPropertySymbols-02.js
+++ b/js/src/jit-test/tests/debug/Object-getOwnPropertySymbols-02.js
@@ -1,11 +1,11 @@
 // obj.getOwnPropertySymbols() works when obj's referent is itself a cross-compartment wrapper.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger();
 var gobj = dbg.addDebuggee(g);
 g.p = {xyzzy: 8};  // makes a cross-compartment wrapper
 var sym = Symbol("plugh");
 g.p[sym] = 9;
 var wp = gobj.getOwnPropertyDescriptor("p").value;
 var names = wp.getOwnPropertySymbols();
 assertEq(names.length, 1);
--- a/js/src/jit-test/tests/debug/Object-getProperty-01.js
+++ b/js/src/jit-test/tests/debug/Object-getProperty-01.js
@@ -1,12 +1,12 @@
 // tests calling script functions via Debugger.Object.prototype.getProperty
 "use strict";
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 var dbg = new Debugger(global);
 dbg.onDebuggerStatement = onDebuggerStatement;
 
 global.eval(`
 const normalObj = { };
 const abruptObj = { };
 const sym = Symbol("a symbol key");
 
--- a/js/src/jit-test/tests/debug/Object-getProperty-02.js
+++ b/js/src/jit-test/tests/debug/Object-getProperty-02.js
@@ -1,13 +1,13 @@
 // tests calling script functions via Debugger.Object.prototype.getProperty
 // to see if they trigger debugger traps
 "use strict";
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 var dbg = new Debugger(global);
 dbg.onDebuggerStatement = onDebuggerStatement;
 
 let obj;
 global.eval(`
 const obj = {
     get prop() {
         debugger;
--- a/js/src/jit-test/tests/debug/Object-getProperty-03.js
+++ b/js/src/jit-test/tests/debug/Object-getProperty-03.js
@@ -1,14 +1,14 @@
 // tests calling script functions via Debugger.Object.prototype.getProperty
 // with different receiver objects.
 "use strict";
 load(libdir + "/asserts.js");
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var globalDO = dbg.addDebuggee(global);
 dbg.onDebuggerStatement = onDebuggerStatement;
 
 global.eval(`
 const sloppy = {
   get getter() { return this; },
 };
--- a/js/src/jit-test/tests/debug/Object-identity-01.js
+++ b/js/src/jit-test/tests/debug/Object-identity-01.js
@@ -1,10 +1,10 @@
 // Two references to the same object get the same Debugger.Object wrapper.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.arguments[0], frame.arguments[1]);
     hits++;
 };
 g.eval("var obj = {}; function f(a, b) { debugger; } f(obj, obj);");
 assertEq(hits, 1);
--- a/js/src/jit-test/tests/debug/Object-identity-02.js
+++ b/js/src/jit-test/tests/debug/Object-identity-02.js
@@ -1,10 +1,10 @@
 // Different objects get different Debugger.Object wrappers.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.arguments[0] === frame.arguments[1], false);
     hits++;
 };
 g.eval("function f(a, b) { debugger; } f({}, {});");
 assertEq(hits, 1);
--- a/js/src/jit-test/tests/debug/Object-identity-03.js
+++ b/js/src/jit-test/tests/debug/Object-identity-03.js
@@ -1,13 +1,13 @@
 // The same object gets the same Debugger.Object wrapper at different times, if the difference would be observable.
 
 var N = 12;
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var wrappers = [];
 
 dbg.onDebuggerStatement = function (frame) { wrappers.push(frame.arguments[0]); };
 g.eval("var originals = []; function f(x) { originals.push(x); debugger; }");
 for (var i = 0; i < N; i++)
     g.eval("f({});");
 assertEq(wrappers.length, N);
--- a/js/src/jit-test/tests/debug/Object-isArrowFunction.js
+++ b/js/src/jit-test/tests/debug/Object-isArrowFunction.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.isArrowFunction recognizes arrow functions.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 var hits = 0;
 
 function checkIsArrow(shouldBe, expr) {
   print(expr);
   assertEq(gDO.executeInGlobal(expr).return.isArrowFunction, shouldBe);
 }
--- a/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-01.js
+++ b/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-01.js
@@ -1,12 +1,12 @@
 // Debugger.Object.prototype.makeDebuggeeValue creates only one
 // Debugger.Object instance for each debuggee object.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 g.eval("var x = { 'now playing': 'Joy Division' };");
 g.eval("var y = { 'mood': 'bleak' };");
 
 wx = gw.makeDebuggeeValue(g.x);
 assertEq(wx, gw.makeDebuggeeValue(g.x));
--- a/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-02.js
+++ b/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-02.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.makeDebuggeeValue returns the object wrapped
 // the same way as Debugger.Frame.prototype.eval, etc.
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f() { debugger; }");
 var dbg = Debugger();
 var gw = dbg.addDebuggee(g);
 var jsonw;
 dbg.onDebuggerStatement = function (frame) {
     jsonw = frame.eval("JSON").return;
 };
 g.eval("debugger;");
--- a/js/src/jit-test/tests/debug/Object-name-01.js
+++ b/js/src/jit-test/tests/debug/Object-name-01.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.name
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var name;
 dbg.onDebuggerStatement = function (frame) { name = frame.callee.name; };
 
 g.eval("(function f() { debugger; })();");
 assertEq(name, "f");
 g.eval("(function () { debugger; })();");
 assertEq(name, undefined);
--- a/js/src/jit-test/tests/debug/Object-name-02.js
+++ b/js/src/jit-test/tests/debug/Object-name-02.js
@@ -1,11 +1,11 @@
 // The .name of a non-function object is undefined.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var hits = 0;
 var dbg = new Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.arguments[0].name, undefined);
     hits++;
 };
 g.eval("function f(nonfunction) { debugger; }");
 
--- a/js/src/jit-test/tests/debug/Object-parameterNames.js
+++ b/js/src/jit-test/tests/debug/Object-parameterNames.js
@@ -1,11 +1,11 @@
 load(libdir + 'array-compare.js');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 var hits = 0;
 
 function check(expr, expected) {
   print("checking " + uneval(expr));
 
   let completion = gDO.executeInGlobal(expr);
--- a/js/src/jit-test/tests/debug/Object-preventExtensions-01.js
+++ b/js/src/jit-test/tests/debug/Object-preventExtensions-01.js
@@ -1,11 +1,11 @@
 // Basic preventExtensions test.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var obj = g.eval("({x: 1})");
 assertEq(g.Object.isExtensible(obj), true);
 
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var objw = gw.makeDebuggeeValue(obj);
 assertEq(objw.isExtensible(), true);
 
--- a/js/src/jit-test/tests/debug/Object-promiseDependentPromises-realms.js
+++ b/js/src/jit-test/tests/debug/Object-promiseDependentPromises-realms.js
@@ -1,16 +1,16 @@
 // Bug 1475669 - Cross-compartment dependent promises.
 
 // Create a promise in realm 1.
-let g1 = newGlobal();
+let g1 = newGlobal({newCompartment: true});
 let p1 = new g1.Promise((_resolve, _reject) => {});
 
 // Add a dependent promise in realm 2.
-let g2 = newGlobal();
+let g2 = newGlobal({newCompartment: true});
 let p2 = g2.Promise.prototype.then.call(p1, g2.eval(`value => {}`));
 
 // Use debugger to find p2 from p1.
 let dbg = new Debugger;
 let g1w = dbg.addDebuggee(g1);
 let g2w = dbg.addDebuggee(g2);
 let dependents = g1w.makeDebuggeeValue(p1).promiseDependentPromises;
 assertEq(dependents.length, 1);
--- a/js/src/jit-test/tests/debug/Object-proto.js
+++ b/js/src/jit-test/tests/debug/Object-proto.js
@@ -1,10 +1,10 @@
 // Debugger.Object.prototype.proto
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbgeval = function () {
         var dbg = new Debugger(g);
         var hits = 0;
         g.eval("function f() { debugger; }");
         var lastval;
         dbg.onDebuggerStatement = function (frame) { lastval = frame.arguments[0]; };
         return function dbgeval(s) {
             g.eval("f(" + s + ");");
--- a/js/src/jit-test/tests/debug/Object-proxy.js
+++ b/js/src/jit-test/tests/debug/Object-proxy.js
@@ -1,13 +1,13 @@
 // Debugger.Object.prototype.isProxy recognizes (scripted) proxies.
 // Debugger.Object.prototype.proxyTarget exposes the [[Proxytarget]] of a proxy.
 // Debugger.Object.prototype.proxyHandler exposes the [[ProxyHandler]] of a proxy.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 
 g.eval('var target = [1,2,3];');
 g.eval('var handler = {has: ()=>false};');
 g.eval('var proxy = new Proxy(target, handler);');
 g.eval('var proxyProxy = new Proxy(proxy, proxy);');
 g.eval('var revoker = Proxy.revocable(target, handler);');
--- a/js/src/jit-test/tests/debug/Object-script-AsmJSNative.js
+++ b/js/src/jit-test/tests/debug/Object-script-AsmJSNative.js
@@ -1,15 +1,15 @@
 function test(stdlib, foreign) {
     "use asm"
     function f(y) {
         y = +y;
     }
     return f;
 };
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval(`
   var dbg = new Debugger();
   var parentw = dbg.addDebuggee(parent);
   var testw = parentw.makeDebuggeeValue(parent.test);
   var scriptw = testw.script;
 `);
--- a/js/src/jit-test/tests/debug/Object-script-environment-nondebuggee.js
+++ b/js/src/jit-test/tests/debug/Object-script-environment-nondebuggee.js
@@ -1,11 +1,11 @@
 // The script and environment of a non-debuggee function are null.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('function f() { return "from f"; }');
 
 var dbg = new Debugger;
 var gw = dbg.makeGlobalObjectReference(g);
 var fw = gw.getOwnPropertyDescriptor('f').value;
 
 // g is not a debuggee, so we can't fetch f's script or environment.
 assertEq(fw.script, null);
--- a/js/src/jit-test/tests/debug/Object-script-lazy.js
+++ b/js/src/jit-test/tests/debug/Object-script-lazy.js
@@ -5,23 +5,23 @@
 // putting a compartment in debug mode automatically de-lazifies all its
 // functions. (This ensures that findScripts works, too.)
 //
 // So here we create a reference to a non-debuggee function, verify that we
 // can't access its interesting properties, make it a debuggee, and verify
 // that everything becomes available.
 
 // Create functions f, g in a non-debuggee compartment.
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 g1.eval('function f() { return "from f"; }');
 g1.eval('function g() { return "from g"; }');
 g1.eval('this.h = f.bind(g, 42, "foo");');
 
 // Create a debuggee compartment with CCWs referring to f and g.
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var g2w = dbg.addDebuggee(g2);
 g2.f = g1.f;
 g2.g = g1.g;
 g2.h = g1.h;
 
 // At this point, g1.f should still be a lazy function. Unwrapping a D.O
 // referring to g2's CCW of f should yield a D.O referring to f directly.
--- a/js/src/jit-test/tests/debug/Object-script.js
+++ b/js/src/jit-test/tests/debug/Object-script.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 
 function check(expr, expected) {
   print("checking " + uneval(expr) + ", expecting " +
         (expected ? "script" : "no script"));
 
   let completion = gDO.executeInGlobal(expr);
--- a/js/src/jit-test/tests/debug/Object-seal-01.js
+++ b/js/src/jit-test/tests/debug/Object-seal-01.js
@@ -1,11 +1,11 @@
 // Basic tests for obj.{seal,freeze,preventExtensions,isSealed,isFrozen,isExtensible}.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 g.eval("function compareObjects() {\n" +
        "    assertEq(Object.isExtensible(x), Object.isExtensible(y));\n" +
        "    var xnames = Object.getOwnPropertyNames(x).sort();\n" +
        "    var ynames = Object.getOwnPropertyNames(y).sort();\n" +
        "    assertEq(xnames.length, ynames.length);\n" +
--- a/js/src/jit-test/tests/debug/Object-setProperty-01.js
+++ b/js/src/jit-test/tests/debug/Object-setProperty-01.js
@@ -1,12 +1,12 @@
 // tests calling script functions via Debugger.Object.prototype.setProperty
 "use strict";
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 var dbg = new Debugger(global);
 dbg.onDebuggerStatement = onDebuggerStatement;
 
 global.eval(`
 const sym = Symbol("a symbol key");
 
 const arr = [];
 const obj = {
--- a/js/src/jit-test/tests/debug/Object-setProperty-02.js
+++ b/js/src/jit-test/tests/debug/Object-setProperty-02.js
@@ -1,13 +1,13 @@
 // tests calling script functions via Debugger.Object.prototype.setProperty
 // to see if they trigger debugger traps
 "use strict";
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 var dbg = new Debugger(global);
 dbg.onDebuggerStatement = onDebuggerStatement;
 
 let obj;
 global.eval(`
 const obj = {
     set prop(val) {
         debugger;
--- a/js/src/jit-test/tests/debug/Object-setProperty-03.js
+++ b/js/src/jit-test/tests/debug/Object-setProperty-03.js
@@ -1,14 +1,14 @@
 // tests calling script functions via Debugger.Object.prototype.setProperty
 // with different receiver objects.
 "use strict";
 load(libdir + "/asserts.js");
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var globalDO = dbg.addDebuggee(global);
 dbg.onDebuggerStatement = onDebuggerStatement;
 
 global.eval(`
 let receiver;
 function check(value, thisVal) {
   receiver = thisVal;
--- a/js/src/jit-test/tests/debug/Object-unsafeDereference-01.js
+++ b/js/src/jit-test/tests/debug/Object-unsafeDereference-01.js
@@ -1,10 +1,10 @@
 // Debugger.Object.prototype.unsafeDereference returns the referent directly.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 assertEq(gw.getOwnPropertyDescriptor('Math').value.unsafeDereference(), g.Math);
 
 g.eval('var obj = {}');
 assertEq(gw.getOwnPropertyDescriptor('obj').value.unsafeDereference(), g.obj);
--- a/js/src/jit-test/tests/debug/Object-unwrap-01.js
+++ b/js/src/jit-test/tests/debug/Object-unwrap-01.js
@@ -1,14 +1,14 @@
 // Check Debugger.Object.prototype.unwrap surfaces.
 
 load(libdir + 'asserts.js');
 
 var dbg = new Debugger();
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var gw = dbg.addDebuggee(g);
 
 assertEq(Object.getOwnPropertyDescriptor(gw, 'unwrap'), undefined);
 var d = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(gw), 'unwrap');
 assertEq(d.enumerable, false);
 assertEq(d.configurable, true);
 assertEq(d.writable, true);
 
--- a/js/src/jit-test/tests/debug/Object-unwrap-02.js
+++ b/js/src/jit-test/tests/debug/Object-unwrap-02.js
@@ -1,18 +1,18 @@
 // Debugger.Object.prototype.unwrap unwraps Debugger.Objects referring to
 // cross-compartment wrappers.
 
 var dbg = new Debugger();
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 var dg1 = dbg.addDebuggee(g1);
 assertEq(dg1.unwrap(), dg1);
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 var dg2 = dbg.addDebuggee(g2);
 
 var dg1g2 = dg1.makeDebuggeeValue(g2);
 assertEq(dg1g2.unwrap(), dg2);
 
 // Try an ordinary object, not a global.
 var g2o = g2.Object();
 var dg2o = dg2.makeDebuggeeValue(g2o);
--- a/js/src/jit-test/tests/debug/Object-unwrap-03.js
+++ b/js/src/jit-test/tests/debug/Object-unwrap-03.js
@@ -1,14 +1,14 @@
 // Debugger.Object.prototype.unwrap should not let us see things in
 // invisible-to-Debugger compartments.
 
 load(libdir + 'asserts.js');
 
-var g = newGlobal({ invisibleToDebugger: true });
+var g = newGlobal({ newCompartment: true, invisibleToDebugger: true });
 
 var dbg = new Debugger;
 
 // Create a wrapper in our compartment for the global.
 // Note that makeGlobalObjectReference won't do: it tries to dereference as far
 // as it can go.
 var /* yo */ DOwg = dbg.makeGlobalObjectReference(this).makeDebuggeeValue(g);
 
--- a/js/src/jit-test/tests/debug/Promise-race-dependent-promises.js
+++ b/js/src/jit-test/tests/debug/Promise-race-dependent-promises.js
@@ -1,15 +1,15 @@
 // Promise.race(...) may add a dummy PromiseReaction which is only used for the
 // debugger.
 //
 // See BlockOnPromise when called from PerformPromiseRace for when this dummy
 // reaction is created.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 
 function test(withFastPath) {
     g.eval(`
         function newPromiseCapability() {
             var resolve, reject, promise = new Promise(function(r1, r2) {
                 resolve = r1;
--- a/js/src/jit-test/tests/debug/RematerializedFrame-retval.js
+++ b/js/src/jit-test/tests/debug/RematerializedFrame-retval.js
@@ -2,17 +2,17 @@
 // Make sure that return values we store in RematerializedFrames via resumption
 // values get propagated to the BaselineFrames we build from them.
 //
 // Test case from bug 1285939; there's another in bug 1282518, but this one
 // takes less time to run, when it doesn't crash.
 
 var lfLogBuffer = `
 function testResumptionVal(resumptionVal, turnOffDebugMode) {
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = new Debugger;
   setInterruptCallback(function () {
     dbg.addDebuggee(g);
     var frame = dbg.getNewestFrame();
     frame.onStep = function () {
       frame.onStep = undefined;
       return resumptionVal;
     };
--- a/js/src/jit-test/tests/debug/Script-01.js
+++ b/js/src/jit-test/tests/debug/Script-01.js
@@ -1,11 +1,11 @@
 // We get the same Debugger.Script object instance each time we ask.
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 global.eval('function f() { debugger; }');
 global.eval('function g() { debugger; }');
 
 var debug = new Debugger(global);
 
 function evalAndNoteScripts(prog) {
     var scripts = {};
     debug.onDebuggerStatement = function(frame) {
--- a/js/src/jit-test/tests/debug/Script-clearBreakpoint-01.js
+++ b/js/src/jit-test/tests/debug/Script-clearBreakpoint-01.js
@@ -1,11 +1,11 @@
 // A breakpoint handler may clear itself.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var bphits = 0;
 var handler = {hit: function (frame) { frame.script.clearBreakpoint(this); bphits++; }};
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var offs = frame.script.getLineOffsets(g.line0 + 3);
     for (var i = 0; i < offs.length; i++)
         frame.script.setBreakpoint(offs[i], handler);
--- a/js/src/jit-test/tests/debug/Script-clearBreakpoint-02.js
+++ b/js/src/jit-test/tests/debug/Script-clearBreakpoint-02.js
@@ -1,12 +1,12 @@
 // A breakpoint cleared during dispatch does not fire.
 // (Breakpoint dispatch is well-behaved even when breakpoint handlers clear other breakpoints.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
     var s = frame.script;
     function handler(i) {
         if (i === 1)
             return function () { log += i; s.clearBreakpoint(h[1]); s.clearBreakpoint(h[2]); };
         return function () { log += i; };
--- a/js/src/jit-test/tests/debug/Script-clearBreakpoint-03.js
+++ b/js/src/jit-test/tests/debug/Script-clearBreakpoint-03.js
@@ -1,11 +1,11 @@
 // Clearing a breakpoint by handler can clear multiple breakpoints.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var s;
 dbg.onDebuggerStatement = function (frame) {
     s = frame.eval("f").return.script;
 };
 g.eval("var line0 = Error().lineNumber;\n" +
        "function f(a, b) {\n" +     // line0 + 1
        "    return a + b;\n" +      // line0 + 2
--- a/js/src/jit-test/tests/debug/Script-clearBreakpoint-04.js
+++ b/js/src/jit-test/tests/debug/Script-clearBreakpoint-04.js
@@ -1,11 +1,11 @@
 // clearBreakpoint clears breakpoints for the current Debugger object only.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 var hits = 0;
 var handler = {
     hit: function (frame) {
         hits++;
         frame.script.clearBreakpoint(handler);
     }
 };
--- a/js/src/jit-test/tests/debug/Script-displayName-01.js
+++ b/js/src/jit-test/tests/debug/Script-displayName-01.js
@@ -1,11 +1,11 @@
 // Debugger.Script.prototype.displayName
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var name;
 dbg.onDebuggerStatement = f => { name = f.callee.script.displayName; };
 
 g.eval("(function f() { debugger; })();");
 assertEq(name, "f");
 g.eval("(function () { debugger; })();");
 assertEq(name, undefined);
--- a/js/src/jit-test/tests/debug/Script-format-01.js
+++ b/js/src/jit-test/tests/debug/Script-format-01.js
@@ -1,14 +1,14 @@
 // |jit-test| skip-if: !wasmDebuggingIsSupported()
 
 // Tests that JavaScript scripts have a "js" format and wasm scripts have a
 // "wasm" format.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 var gotScript;
 dbg.onNewScript = (script) => {
   gotScript = script;
 };
 
 g.eval(`(() => {})()`);
--- a/js/src/jit-test/tests/debug/Script-gc-01.js
+++ b/js/src/jit-test/tests/debug/Script-gc-01.js
@@ -1,12 +1,12 @@
 // Debugger.Script instances with live referents stay alive.
 
 var N = 4;
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var i;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(frame.script instanceof Debugger.Script, true);
     frame.script.id = i;
 };
 
 g.eval('var arr = [];')
--- a/js/src/jit-test/tests/debug/Script-gc-02.js
+++ b/js/src/jit-test/tests/debug/Script-gc-02.js
@@ -1,11 +1,11 @@
 // Debugger.Scripts keep their referents alive.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var arr = [];
 dbg.onDebuggerStatement = function (frame) { arr.push(frame.script); };
 g.eval("for (var i = 0; i < 10; i++) Function('debugger;')();");
 assertEq(arr.length, 10);
 
 gc();
 
--- a/js/src/jit-test/tests/debug/Script-gc-03.js
+++ b/js/src/jit-test/tests/debug/Script-gc-03.js
@@ -1,11 +1,11 @@
 // Referents of Debugger.Scripts in other compartments always survive per-compartment GC.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var arr = [];
 dbg.onDebuggerStatement = function (frame) { arr.push(frame.script); };
 g.eval("for (var i = 0; i < 100; i++) Function('debugger;')();");
 assertEq(arr.length, 100);
 
 gc(g);
 
--- a/js/src/jit-test/tests/debug/Script-getBreakpoints-01.js
+++ b/js/src/jit-test/tests/debug/Script-getBreakpoints-01.js
@@ -1,11 +1,11 @@
 // Basic Script.prototype.getBreakpoints tests.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var line0 = Error().lineNumber;\n" +
        "function f(x) {\n" +        // line0 + 1
        "    if (x < 0)\n" +         // line0 + 2
        "        return -x;\n" +     // line0 + 3
        "    return x;\n" +
        "}");
 
 var s;
--- a/js/src/jit-test/tests/debug/Script-getBreakpoints-02.js
+++ b/js/src/jit-test/tests/debug/Script-getBreakpoints-02.js
@@ -1,11 +1,11 @@
 // Script.prototype.getBreakpoints returns breakpoints for the current Debugger object only.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 var debuggers = [];
 var hits = 0;
 function attach(g, i) {
     var dbg = Debugger(g);
     dbg.onDebuggerStatement = function (frame) {
         var s = frame.script;
         var offs = s.getLineOffsets(g.line0 + 2);
--- a/js/src/jit-test/tests/debug/Script-getChildScripts-01.js
+++ b/js/src/jit-test/tests/debug/Script-getChildScripts-01.js
@@ -1,11 +1,11 @@
 // Basic getChildScripts tests.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var log;
 function note(s) {
     assertEq(s instanceof Debugger.Script, true);
     log += 'S';
     var c = s.getChildScripts();
     if (c.length > 0) {
         log += '[';
--- a/js/src/jit-test/tests/debug/Script-getChildScripts-02.js
+++ b/js/src/jit-test/tests/debug/Script-getChildScripts-02.js
@@ -1,11 +1,11 @@
 // getChildScripts returns scripts in source order.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var scripts = [];
 var cs;
 dbg.onDebuggerStatement = function (frame) {
     scripts.push(frame.script);
     if (scripts.length === 1)
         cs = frame.script.getChildScripts();
 };
--- a/js/src/jit-test/tests/debug/Script-getChildScripts-03.js
+++ b/js/src/jit-test/tests/debug/Script-getChildScripts-03.js
@@ -1,12 +1,12 @@
 // getChildScripts on a direct eval script returns the right scripts.
 // (A bug had it also returning the script for the calling function.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var arr = frame.script.getChildScripts();
     assertEq(arr.length, 1);
     assertEq(arr[0], frame.eval("h").return.script);
     hits++;
 };
--- a/js/src/jit-test/tests/debug/Script-getChildScripts-04.js
+++ b/js/src/jit-test/tests/debug/Script-getChildScripts-04.js
@@ -1,12 +1,12 @@
 // script.getChildScripts() works correctly during the newScript hook.
 // (A bug had it including the script for the calling function.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function h(a) { eval(a); }");
 
 var dbg = Debugger(g);
 var arr, kscript;
 dbg.onNewScript = function (script) { arr = script.getChildScripts(); };
 dbg.onDebuggerStatement = function (frame) { kscript = frame.callee.script; };
 
 g.h("function k(a) { debugger; return a + 1; } k(-1);");
--- a/js/src/jit-test/tests/debug/Script-getChildScripts-05.js
+++ b/js/src/jit-test/tests/debug/Script-getChildScripts-05.js
@@ -1,12 +1,12 @@
 // Test that lazy inner functions inside eval are tagged properly so we don't
 // incorrectly do NAME -> GNAME optimization.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onNewScript = function delazify(script, global) {
   // Force delazification of inner functions.
   script.getChildScripts();
 };
 
 g.eval("" + function f() {
   var $;
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-01.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-01.js
@@ -1,11 +1,11 @@
 // getLineOffsets on a line that is definitely outside a script returns an empty array.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var offs = frame.script.getLineOffsets(g.line0 + 2);
     assertEq(Array.isArray(offs), true);
     assertEq(offs.length, 0);
     hits++;
 };
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-02.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-02.js
@@ -1,11 +1,11 @@
 // getLineOffsets correctly places the various parts of a ForStatement.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     function handler(line) {
         return {hit: function (frame) { g.log += "" + line; }};
     }
 
     var s = frame.eval("f").return.script;
     for (var line = 2; line <= 6; line++) {
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-03.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-03.js
@@ -1,12 +1,12 @@
 // getLineOffsets treats one-line compound statements as having only one entry-point.
 // (A breakpoint on a line that only executes once will only hit once.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.line0 = null;
 var dbg = Debugger(g);
 var log;
 dbg.onDebuggerStatement = function (frame) {
     var s = frame.script;
     var lineno = g.line0 + 2;
     var offs = s.getLineOffsets(lineno);
     for (var i = 0; i < offs.length; i++) {
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-04.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-04.js
@@ -1,11 +1,11 @@
 // getLineOffsets works with instructions reachable only by breaking out of a loop or switch.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.line0 = null;
 var dbg = Debugger(g);
 var where;
 dbg.onDebuggerStatement = function (frame) {
     var s = frame.eval("f").return.script;
     var lineno = g.line0 + where;
     var offs = s.getLineOffsets(lineno);
     for (var i = 0; i < offs.length; i++) {
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-05.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-05.js
@@ -1,11 +1,11 @@
 // getLineOffsets identifies multiple ways to land on a line.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.line0 = null;
 var dbg = Debugger(g);
 var where;
 dbg.onDebuggerStatement = function (frame) {
     var s = frame.script, lineno, offs;
 
     lineno = g.line0 + where;
     offs = s.getLineOffsets(lineno);
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-06.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-06.js
@@ -1,11 +1,11 @@
 // getLineOffsets works with extended instructions, such as JSOP_GOTOX.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.line0 = null;
 var dbg = Debugger(g);
 var where;
 dbg.onDebuggerStatement = function (frame) {
     var s = frame.script;
     var offs;
     var lineno = g.line0 + where;
     offs = s.getLineOffsets(lineno);
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-07.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-07.js
@@ -1,11 +1,11 @@
 // Lazy scripts should correctly report line offsets
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 
 g.eval("// Header comment\n" +   // <- line 6 in this file
        "\n" +
        "\n" +
        "function f(n) {\n" +     // <- line 9 in this file
        "    var foo = '!';\n" +
        "}");
--- a/js/src/jit-test/tests/debug/Script-getLineOffsets-08.js
+++ b/js/src/jit-test/tests/debug/Script-getLineOffsets-08.js
@@ -1,11 +1,11 @@
 // A "while" or a "for" loop should have a single entry point.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = function(frame) {
   var s = frame.eval('f').return.script;
 
   // There should be just a single entry point for the first line of
   // the function.  See below to understand the "+2".
   assertEq(s.getLineOffsets(g.line0 + 2).length, 1);
--- a/js/src/jit-test/tests/debug/Script-getOffsetLine-01.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetLine-01.js
@@ -1,11 +1,11 @@
 // Basic getOffsetLocation test, using Error.lineNumber as the gold standard.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits;
 dbg.onDebuggerStatement = function (frame) {
     var knownLine = frame.eval("line").return;
     assertEq(frame.script.getOffsetLocation(frame.offset).lineNumber, knownLine);
     hits++;
 };
 
--- a/js/src/jit-test/tests/debug/Script-getOffsetLine-02.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetLine-02.js
@@ -1,11 +1,11 @@
 // Frame.script/offset and Script.getOffsetLocation work in non-top frames.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     var a = [];
     for (; frame.type == "call"; frame = frame.older)
         a.push(frame.script.getOffsetLocation(frame.offset).lineNumber - g.line0);
     assertEq(a.join(","), "1,2,3,4");
     hits++;
--- a/js/src/jit-test/tests/debug/Script-getOffsetLocation.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetLocation.js
@@ -1,11 +1,11 @@
 // getOffsetLocation agrees with getAllColumnOffsets
 
-var global = newGlobal();
+var global = newGlobal({newCompartment: true});
 Debugger(global).onDebuggerStatement = function (frame) {
     var script = frame.script;
     var byOffset = [];
     script.getAllColumnOffsets().forEach(function (entry) {
         var {lineNumber, columnNumber, offset} = entry;
         byOffset[offset] = {lineNumber, columnNumber};
     });
 
--- a/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-01.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-01.js
@@ -61,17 +61,17 @@ function checkGetOffsetsCoverage(fun) {
     var deltaBraces = line.split('{').length - line.split('}').length;
     currFun[currFun.length - 1].braces += deltaBraces;
     if (currFun[currFun.length - 1].braces == 0)
       currFun.pop();
   }
 
   // Create a new global and instrument it with a debugger, to find all scripts,
   // created in the current global.
-  var g = newGlobal();
+  var g = newGlobal({newCompartment: true});
   var dbg = Debugger(g);
   dbg.collectCoverageInfo = true;
 
   var topLevel = null;
   dbg.onNewScript = function (s) {
     topLevel = s;
     dbg.onNewScript = function () {};
   };
--- a/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-02.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-02.js
@@ -1,14 +1,14 @@
 // |jit-test| --ion-pgo=off;
 
 // This script check that when we enable / disable the code coverage collection,
 // then we have different results for the getOffsetsCoverage methods.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var coverageInfo = [];
 var num = 20;
 function loop(i) {
   var n = 0;
   for (n = 0; n < i; n++)
     debugger;
 }
--- a/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-03.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-03.js
@@ -1,11 +1,11 @@
 // |jit-test| error: Error: can't start debugging: a debuggee script is on the stack
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 function loop(i) {
   var n = 0;
   for (n = 0; n < i; n++)
     debugger;
 }
 g.eval(loop.toSource());
 
--- a/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-04.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-04.js
@@ -1,11 +1,11 @@
 // |jit-test| error: Error: can't start debugging: a debuggee script is on the stack
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 
 function loop(i) {
   var n = 0;
   for (n = 0; n < i; n++)
     debugger;
 }
 g.eval(loop.toSource());
--- a/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-05.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-05.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 function f(x) {
   while (x) {
     interruptIf(true);
     x -= 1;
   }
 }
 g.eval(f.toSource());
--- a/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-bug1233178.js
+++ b/js/src/jit-test/tests/debug/Script-getOffsetsCoverage-bug1233178.js
@@ -1,10 +1,10 @@
 gczeal(2);
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 dbg = Debugger(g);
 function loop() {
   for (var i = 0; i < 10; i++)
     debugger;
 }
 g.eval(loop.toSource());
 dbg.onDebuggerStatement = function(f) {
   f.script.getOffsetsCoverage();
--- a/js/src/jit-test/tests/debug/Script-getSuccessorOrPredecessorOffsets-01.js
+++ b/js/src/jit-test/tests/debug/Script-getSuccessorOrPredecessorOffsets-01.js
@@ -6,17 +6,17 @@
 
 var scripts = [
   "n = 1",
   "if (n == 0) return; else n = 2",
   "while (n < 5) n++",
   "switch (n) { case 4: break; case 5: return 0; }",
 ];
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 for (var n in scripts) {
   g.eval("function f" + n + "() { " + scripts[n] + " }");
 }
 
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
   for (var n in scripts) {
     var compares = 0;
--- a/js/src/jit-test/tests/debug/Script-global-01.js
+++ b/js/src/jit-test/tests/debug/Script-global-01.js
@@ -1,11 +1,11 @@
 // Debugger.Script.prototype.script returns the global the script runs in.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
   log += 'd';
   assertEq(frame.script.global, gw);
 }
--- a/js/src/jit-test/tests/debug/Script-global-02.js
+++ b/js/src/jit-test/tests/debug/Script-global-02.js
@@ -1,20 +1,20 @@
 // Debugger.Script.prototype.script returns the global the script runs in.
 // Multi-global version.
 
 var dbg = new Debugger;
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 var g1w = dbg.addDebuggee(g1);
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 var g2w = dbg.addDebuggee(g2);
 
-var g3 = newGlobal();
+var g3 = newGlobal({newCompartment: true});
 var g3w = dbg.addDebuggee(g3);
 
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
   log += 'd';
   assertEq(frame.script.global, g1w);
   assertEq(frame.older.script.global, g2w);
   assertEq(frame.older.older.script.global, g3w);
--- a/js/src/jit-test/tests/debug/Script-isInCatchScope.js
+++ b/js/src/jit-test/tests/debug/Script-isInCatchScope.js
@@ -1,11 +1,11 @@
 // Test if isInCatchScope properly detects catch blocks.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 function test(string, mustBeCaught) {
     let index = 0;
     dbg.onExceptionUnwind = function (frame) {
         let willBeCaught = false;
         do {
             if (frame.script.isInCatchScope(frame.offset)) {
--- a/js/src/jit-test/tests/debug/Script-isModule-01.js
+++ b/js/src/jit-test/tests/debug/Script-isModule-01.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.isModule
 
-const g = newGlobal();
+const g = newGlobal({newCompartment: true});
 const dbg = Debugger(g);
 let count = 0;
 dbg.onNewScript = function (script) {
     count += 1;
     assertEq(script.isModule, true);
 };
 const m = g.parseModule("");
 m.declarationInstantiation();
--- a/js/src/jit-test/tests/debug/Script-isModule-02.js
+++ b/js/src/jit-test/tests/debug/Script-isModule-02.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.isModule
 
-const g = newGlobal();
+const g = newGlobal({newCompartment: true});
 const dbg = Debugger(g);
 let count = 0;
 dbg.onNewScript = function (script) {
     count += 1;
     assertEq(script.isModule, false);
 };
 const m = g.eval("");
 assertEq(count, 1);
--- a/js/src/jit-test/tests/debug/Script-isModule-03.js
+++ b/js/src/jit-test/tests/debug/Script-isModule-03.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.isModule
 
-const g = newGlobal();
+const g = newGlobal({newCompartment: true});
 const dbg = Debugger(g);
 let count = 0;
 dbg.onNewScript = function (script) {
     count += 1;
     assertEq(script.isModule, true);
 
     dbg.onNewScript = function (script) {
         count += 1;
--- a/js/src/jit-test/tests/debug/Script-isModule-04.js
+++ b/js/src/jit-test/tests/debug/Script-isModule-04.js
@@ -1,11 +1,11 @@
 // Debugger.Object.prototype.isModule
 
-const g = newGlobal();
+const g = newGlobal({newCompartment: true});
 const dbg = Debugger(g);
 let count = 0;
 dbg.onNewScript = function (script) {
     count += 1;
     assertEq(script.isModule, true);
 };
 dbg.onDebuggerStatement = function (frame) {
     const { script } = frame;
--- a/js/src/jit-test/tests/debug/Script-lineCount.js
+++ b/js/src/jit-test/tests/debug/Script-lineCount.js
@@ -1,11 +1,11 @@
 // Test Script.lineCount.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 
 function test(scriptText, expectedLineCount) {
   let found = false;
 
   dbg.onNewScript = function(script, global) {
     assertEq(script.lineCount, expectedLineCount);
     found = true;
--- a/js/src/jit-test/tests/debug/Script-mainOffset-01.js
+++ b/js/src/jit-test/tests/debug/Script-mainOffset-01.js
@@ -1,12 +1,12 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2; js-indent-level: 2 -*- */
 // The main offset of a script should be hit before it performs any actions.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var n = 0; function foo() { n = 1; }");
 var dbg = Debugger(g);
 
 var hits = 0;
 function breakpointHit(frame) {
   hits++;
   assertEq(frame.eval("n").return, 0);
 }
--- a/js/src/jit-test/tests/debug/Script-source-01.js
+++ b/js/src/jit-test/tests/debug/Script-source-01.js
@@ -1,13 +1,13 @@
 /*
  * Script.prototype.source should be an object. Moreover, it should be the
  * same object for each child script within the same debugger.
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 let count = 0;
 dbg.onNewScript = function (script) {
     assertEq(typeof script.source, "object");
     function traverse(script) {
         ++count;
         script.getChildScripts().forEach(function (child) {
--- a/js/src/jit-test/tests/debug/Script-source-02.js
+++ b/js/src/jit-test/tests/debug/Script-source-02.js
@@ -1,13 +1,13 @@
 /*
  * Script.prototype.source should be the same object for both the top-level
  * script and the script of functions accessed as debuggee values on the global
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger();
 let gw = dbg.addDebuggee(g);
 
 let count = 0;
 dbg.onDebuggerStatement = function (frame) {
     ++count;
     assertEq(frame.script.source, gw.makeDebuggeeValue(g.f).script.source);
 }
--- a/js/src/jit-test/tests/debug/Script-source-03.js
+++ b/js/src/jit-test/tests/debug/Script-source-03.js
@@ -1,13 +1,13 @@
 /*
  * Script.prototype.source should be a different object for the same script
  * within different debuggers.
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg1 = new Debugger(g);
 let dbg2 = new Debugger(g);
 
 var count = 0;
 var source;
 function test(script) {
     ++count;
     if (!source)
--- a/js/src/jit-test/tests/debug/Script-sourceStart-01.js
+++ b/js/src/jit-test/tests/debug/Script-sourceStart-01.js
@@ -1,13 +1,13 @@
 /*
  * Script.prototype.sourceStart and Script.prototype.sourceLength should both be
  * a number.
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 var count = 0;
 function test(string, range) {
     dbg.onNewScript = function (script) {
         ++count;
         assertEq(script.sourceStart, range[0]);
         assertEq(script.sourceLength, range[1]);
--- a/js/src/jit-test/tests/debug/Script-sourceStart-02.js
+++ b/js/src/jit-test/tests/debug/Script-sourceStart-02.js
@@ -1,14 +1,14 @@
 /*
  * For function statements, Script.prototype.sourceStart and
  * Script.prototype.sourceLength should comprise both the opening '(' and the
  * closing '}'.
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 function test(string, ranges) {
     var index = 0;
     dbg.onNewScript = function (script) {
         function traverse(script) {
             script.getChildScripts().forEach(function (script) {
                 assertEq(script.sourceStart, ranges[index][0]);
--- a/js/src/jit-test/tests/debug/Script-sourceStart-03.js
+++ b/js/src/jit-test/tests/debug/Script-sourceStart-03.js
@@ -1,14 +1,14 @@
 /*
  * For arrow functions, Script.prototype.sourceStart and
  * Script.prototype.sourceLength should comprise the entire function expression
  * (including arguments)
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 function test(string, ranges) {
     var index = 0;
     dbg.onNewScript = function (script) {
         function traverse(script) {
             script.getChildScripts().forEach(function (script) {
                 assertEq(script.sourceStart, ranges[index][0]);
--- a/js/src/jit-test/tests/debug/Script-sourceStart-04.js
+++ b/js/src/jit-test/tests/debug/Script-sourceStart-04.js
@@ -1,14 +1,14 @@
 /*
  * For eval and Function constructors, Script.prototype.sourceStart and
  * Script.prototype.sourceLength should comprise the entire script (excluding
  * arguments in the case of Function constructors)
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 var count = 0;
 function test(string, range) {
     dbg.onNewScript = function (script) {
         ++count;
         if (count % 2 == 0) {
             assertEq(script.sourceStart, range[0]);
--- a/js/src/jit-test/tests/debug/Script-startLine.js
+++ b/js/src/jit-test/tests/debug/Script-startLine.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var start, count;
 dbg.onDebuggerStatement = function (frame) {
     assertEq(start, undefined);
     start = frame.script.startLine;
     count = frame.script.lineCount;
     assertEq(typeof frame.script.url, 'string');
 };
--- a/js/src/jit-test/tests/debug/Script-url.js
+++ b/js/src/jit-test/tests/debug/Script-url.js
@@ -1,10 +1,10 @@
 // Script.prototype.url can be a string or null.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 for (var fileName of ['file:///var/foo.js', null]) {
     g.evaluate("function f(x) { return 2*x; }", {fileName: fileName});
     var fw = gw.getOwnPropertyDescriptor('f').value;
     assertEq(fw.script.url, fileName);
 }
--- a/js/src/jit-test/tests/debug/Source-displayURL-deprecated.js
+++ b/js/src/jit-test/tests/debug/Source-displayURL-deprecated.js
@@ -1,12 +1,12 @@
 /* -*- js-indent-level: 4; indent-tabs-mode: nil -*- */
 // Source.prototype.displayURL can be a string or null.
 
-let g = newGlobal('new-compartment');
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger;
 let gw = dbg.addDebuggee(g);
 
 function getDisplayURL() {
     let fw = gw.makeDebuggeeValue(g.f);
     return fw.script.source.displayURL;
 }
 
--- a/js/src/jit-test/tests/debug/Source-displayURL.js
+++ b/js/src/jit-test/tests/debug/Source-displayURL.js
@@ -1,12 +1,12 @@
 /* -*- js-indent-level: 4; indent-tabs-mode: nil -*- */
 // Source.prototype.displayURL can be a string or null.
 
-let g = newGlobal('new-compartment');
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger;
 let gw = dbg.addDebuggee(g);
 
 function getDisplayURL() {
     let fw = gw.makeDebuggeeValue(g.f);
     return fw.script.source.displayURL;
 }
 
--- a/js/src/jit-test/tests/debug/Source-element-01.js
+++ b/js/src/jit-test/tests/debug/Source-element-01.js
@@ -1,11 +1,11 @@
 // Source.prototype.element can be an object or undefined.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 g.evaluate("function f(x) { return 2*x; }", {element: { foo: "bar" }});
 var fw = gw.getOwnPropertyDescriptor('f').value;
 assertEq(typeof fw.script.source.element, "object");
 assertEq(fw.script.source.element instanceof Debugger.Object, true);
 assertEq(fw.script.source.element.getOwnPropertyDescriptor("foo").value, "bar");
 g.evaluate("function f(x) { return 2*x; }");
--- a/js/src/jit-test/tests/debug/Source-element-03.js
+++ b/js/src/jit-test/tests/debug/Source-element-03.js
@@ -1,14 +1,14 @@
 // |jit-test| skip-if: helperThreadCount() === 0
 
 // Owning elements and attribute names are attached to scripts compiled
 // off-thread.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 
 var elt = new g.Object;
 var eltDO = gDO.makeDebuggeeValue(elt);
 
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
--- a/js/src/jit-test/tests/debug/Source-elementAttributeName.js
+++ b/js/src/jit-test/tests/debug/Source-elementAttributeName.js
@@ -1,11 +1,11 @@
 // Source.prototype.elementAttributeName can be a string or undefined.
 
-var g = newGlobal('new-compartment');
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 g.evaluate("function f(x) { return 2*x; }", {elementAttributeName: "src"});
 var fw = gw.getOwnPropertyDescriptor('f').value;
 assertEq(fw.script.source.elementAttributeName, "src");
 g.evaluate("function f(x) { return 2*x; }");
 var fw = gw.getOwnPropertyDescriptor('f').value;
 assertEq(fw.script.source.elementAttributeName, undefined);
--- a/js/src/jit-test/tests/debug/Source-introductionScript-01.js
+++ b/js/src/jit-test/tests/debug/Source-introductionScript-01.js
@@ -1,12 +1,12 @@
 // Dynamically generated sources should have their introduction script and
 // offset set correctly.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 var log;
 
 // Direct eval, while the frame is live.
 dbg.onDebuggerStatement = function (frame) {
   log += 'd';
   var source = frame.script.source;
--- a/js/src/jit-test/tests/debug/Source-introductionScript-02.js
+++ b/js/src/jit-test/tests/debug/Source-introductionScript-02.js
@@ -1,12 +1,12 @@
 // Calls to 'eval', etc. by JS primitives get attributed to the point of
 // the primitive's call.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gDO = dbg.addDebuggee(g);
 var log = '';
 
 function outerHandler(frame) {
   log += 'o';
   var outerScript = frame.script;
 
--- a/js/src/jit-test/tests/debug/Source-introductionScript-03.js
+++ b/js/src/jit-test/tests/debug/Source-introductionScript-03.js
@@ -1,18 +1,18 @@
 // We don't record introduction scripts in a different global from the
 // introduced script, even if they're both debuggees.
 
 var dbg = new Debugger;
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 g1.g1 = g1;
 var g1DO = dbg.addDebuggee(g1);
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 g2.g1 = g1;
 
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
   log += 'd';
   assertEq(frame.script.source.introductionScript, undefined);
   assertEq(frame.script.source.introductionOffset, undefined);
 };
--- a/js/src/jit-test/tests/debug/Source-introductionType.js
+++ b/js/src/jit-test/tests/debug/Source-introductionType.js
@@ -1,13 +1,13 @@
 // |jit-test| skip-if: helperThreadCount() === 0
 
 // Check that scripts' introduction types are properly marked.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gDO = dbg.addDebuggee(g);
 var log;
 
 // (Indirect) eval.
 dbg.onDebuggerStatement = function (frame) {
   log += 'd';
   assertEq(frame.script.source.introductionType, 'eval');
--- a/js/src/jit-test/tests/debug/Source-invisible.js
+++ b/js/src/jit-test/tests/debug/Source-invisible.js
@@ -1,12 +1,12 @@
 // Looking at ScriptSourceObjects in invisible-to-debugger compartments is okay.
 
-var gi = newGlobal({ invisibleToDebugger: true });
+var gi = newGlobal({ newCompartment: true, invisibleToDebugger: true });
 gi.eval('function f() {}');
 
-var gv = newGlobal();
+var gv = newGlobal({newCompartment: true});
 gv.f = gi.f;
 gv.eval('f = clone(f);');
 
 var dbg = new Debugger;
 var gvw = dbg.addDebuggee(gv);
 gvw.getOwnPropertyDescriptor('f').value.script.source;
--- a/js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js
+++ b/js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js
@@ -1,11 +1,11 @@
 // Source.prototype.sourceMapURL can be a string or null.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger;
 let gw = dbg.addDebuggee(g);
 
 function getSourceMapURL() {
     let fw = gw.makeDebuggeeValue(g.f);
     return fw.script.source.sourceMapURL;
 }
 
--- a/js/src/jit-test/tests/debug/Source-sourceMapURL.js
+++ b/js/src/jit-test/tests/debug/Source-sourceMapURL.js
@@ -1,11 +1,11 @@
 // Source.prototype.sourceMapURL can be a string or null.
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger;
 let gw = dbg.addDebuggee(g);
 
 function getSourceMapURL() {
     let fw = gw.makeDebuggeeValue(g.f);
     return fw.script.source.sourceMapURL;
 }
 
--- a/js/src/jit-test/tests/debug/Source-text-01.js
+++ b/js/src/jit-test/tests/debug/Source-text-01.js
@@ -1,14 +1,14 @@
 /*
  * Debugger.Source.prototype.text should return a string. Moreover, it
  * should be the same string for each child script sharing that
  * Debugger.Source.
  */
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 var count = 0;
 dbg.onNewScript = function (script) {
     var text = script.source.text;
     assertEq(typeof text, "string");
     function traverse(script) {
         ++count;
--- a/js/src/jit-test/tests/debug/Source-text-02.js
+++ b/js/src/jit-test/tests/debug/Source-text-02.js
@@ -1,11 +1,11 @@
 // Nested compilation units (say, an eval with in an eval) should have the
 // correct sources attributed to them.
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 var text;
 var count = 0;
 dbg.onNewScript = function (script) {
     ++count;
     if (count % 2 == 0)
         assertEq(script.source.text, text);
--- a/js/src/jit-test/tests/debug/Source-text-lazy.js
+++ b/js/src/jit-test/tests/debug/Source-text-lazy.js
@@ -2,17 +2,17 @@
 // withSourceHook isn't defined if you pass the shell the --fuzzing-safe
 // option. Skip this test silently, to avoid spurious failures.
 
 /*
  * Debugger.Source.prototype.text should correctly retrieve the source for
  * code compiled with CompileOptions::LAZY_SOURCE.
  */
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 
 function test(source) {
   // To ensure that we're getting the value the source hook returns, make
   // it differ from the actual source.
   let frobbed = source.replace(/debugger/, 'reggubed');
   let log = '';
 
--- a/js/src/jit-test/tests/debug/Source-url-01.js
+++ b/js/src/jit-test/tests/debug/Source-url-01.js
@@ -1,10 +1,10 @@
 // Source.prototype.url returns a synthesized URL for eval code.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('function double() { return 2*x }');
 
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 var fw = gw.getOwnPropertyDescriptor('double').value;
 assertEq(!!fw.script.source.url.match(/Source-url-01.js line [0-9]+ > eval/), true);
--- a/js/src/jit-test/tests/debug/Source-url-02.js
+++ b/js/src/jit-test/tests/debug/Source-url-02.js
@@ -1,11 +1,11 @@
 // Source.prototype.url returns a synthesized URL for Function code.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval('var double = Function("x", "return 2*x;");');
 
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 
 var fw = gw.getOwnPropertyDescriptor('double').value;
 print(fw.script.source.url);
 assertEq(!!fw.script.source.url.match(/Source-url-02.js .* > Function/), true);
--- a/js/src/jit-test/tests/debug/Source-url.js
+++ b/js/src/jit-test/tests/debug/Source-url.js
@@ -1,10 +1,10 @@
 // Source.prototype.url can be a string or null.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 for (var fileName of ['file:///var/foo.js', null]) {
     g.evaluate("function f(x) { return 2*x; }", {fileName: fileName});
     var fw = gw.getOwnPropertyDescriptor('f').value;
     assertEq(fw.script.source.url, fileName);
 }
--- a/js/src/jit-test/tests/debug/breakpoint-01.js
+++ b/js/src/jit-test/tests/debug/breakpoint-01.js
@@ -1,11 +1,11 @@
 // Basic breakpoint test.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.s = '';
 var handler = {
     hit: function (frame) {
         assertEq(this, handler);
         g.s += '1';
     }
 };
 var dbg = Debugger(g);
--- a/js/src/jit-test/tests/debug/breakpoint-02.js
+++ b/js/src/jit-test/tests/debug/breakpoint-02.js
@@ -1,13 +1,13 @@
 // Setting a breakpoint in a non-debuggee Script is an error.
 
 load(libdir + "asserts.js");
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 var g2 = g1.eval("newGlobal('same-compartment')");
 g2.eval("function f() { return 2; }");
 g1.f = g2.f;
 
 var dbg = Debugger(g1);
 var s;
 dbg.onDebuggerStatement = function (frame) { s = frame.eval("f").return.script; };
 g1.eval("debugger;");
--- a/js/src/jit-test/tests/debug/breakpoint-03.js
+++ b/js/src/jit-test/tests/debug/breakpoint-03.js
@@ -1,13 +1,13 @@
 // Setting a breakpoint in a script we are no longer debugging is an error.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger();
 var gobj = dbg.addDebuggee(g);
 g.eval("function f() { return 2; }");
 
 var s;
 dbg.onDebuggerStatement = function (frame) { s = frame.eval("f").return.script; };
 g.eval("debugger;");
 s.setBreakpoint(0, {});  // ok
--- a/js/src/jit-test/tests/debug/breakpoint-04.js
+++ b/js/src/jit-test/tests/debug/breakpoint-04.js
@@ -1,11 +1,11 @@
 // Hitting a breakpoint with no hit method does nothing.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.s = '';
 g.eval("var line0 = Error().lineNumber;\n" +
        "function f() {\n" +   // line0 + 1
        "    debugger;\n" +  // line0 + 2
        "    s += 'x';\n" +  // line0 + 3
        "}\n")
 var dbg = Debugger(g);
 var bp = [];
--- a/js/src/jit-test/tests/debug/breakpoint-05.js
+++ b/js/src/jit-test/tests/debug/breakpoint-05.js
@@ -1,13 +1,13 @@
 // If the offset parameter to setBreakpoint is invalid, throw an error.
 
 load(libdir + "asserts.js");
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame) {
     // We assume at least one offset between 0 and frame.offset is invalid.
     assertThrowsInstanceOf(
         function () {
             for (var i = 0; i < frame.offset; i++)
                 frame.script.setBreakpoint(i, {});
--- a/js/src/jit-test/tests/debug/breakpoint-06.js
+++ b/js/src/jit-test/tests/debug/breakpoint-06.js
@@ -1,11 +1,11 @@
 // The argument to a breakpoint hit method is a frame.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var hits = 0;
 dbg.onDebuggerStatement = function (frame1) {
     function hit(frame2) {
         assertEq(frame2, frame1);
         hits++;
     }
     var s = frame1.script;
--- a/js/src/jit-test/tests/debug/breakpoint-07.js
+++ b/js/src/jit-test/tests/debug/breakpoint-07.js
@@ -1,11 +1,11 @@
 // Code runs fine if do-nothing breakpoints are set on every line.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var src = ("var line0 = Error().lineNumber;\n" +
            "function gcd(a, b) {\n" +       // line0 + 1
            "    if (a > b)\n" +             // line0 + 2
            "            return gcd(b, a);\n" +  // line0 + 3
            "    var c = b % a;\n" +         // line0 + 4
            "    if (c === 0)\n" +           // line0 + 5
            "            return a;\n" +          // line0 + 6
            "    return gcd(c, a);\n" +      // line0 + 7
--- a/js/src/jit-test/tests/debug/breakpoint-08.js
+++ b/js/src/jit-test/tests/debug/breakpoint-08.js
@@ -1,12 +1,12 @@
 // Breakpoints are dropped from eval scripts when they finish executing.
 // (The eval cache doesn't cache breakpoints.)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 
 g.line0 = undefined;
 g.eval("function f() {\n" +
        "    return eval(s);\n" +
        "}\n");
 g.s = ("line0 = Error().lineNumber;\n" +
        "debugger;\n" +          // line0 + 1
        "result = 'ok';\n");     // line0 + 2
--- a/js/src/jit-test/tests/debug/breakpoint-09.js
+++ b/js/src/jit-test/tests/debug/breakpoint-09.js
@@ -1,13 +1,13 @@
 // Setting a breakpoint in an eval script that is not on the stack. Bug 746973.
 // We don't assert that the breakpoint actually hits because that depends on
 // the eval cache, an implementation detail.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 g.eval("function f() { return eval('2+2'); }");
 var s;
 dbg.onNewScript = function (script) { s = script; };
 g.f();
 for (var offset of s.getLineOffsets(s.startLine))
     s.setBreakpoint(offset, {hit: function () {}});
 assertEq(g.f(), 4);
--- a/js/src/jit-test/tests/debug/breakpoint-10.js
+++ b/js/src/jit-test/tests/debug/breakpoint-10.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 var fscript = null;
 dbg.onNewScript = function(script) {
     dbg.onNewScript = undefined;
     fscript = script.getChildScripts()[0];
 }
 
--- a/js/src/jit-test/tests/debug/breakpoint-11.js
+++ b/js/src/jit-test/tests/debug/breakpoint-11.js
@@ -1,13 +1,13 @@
 // Setting a breakpoint in a generator function works, and we can
 // traverse the stack and evaluate expressions in the context of older
 // generator frames.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     function hit(frame) {
         assertEq(frame.generator, true);
         assertEq(frame.older.generator, true);
         frame.older.eval("q += 16");
     }
 
--- a/js/src/jit-test/tests/debug/breakpoint-12.js
+++ b/js/src/jit-test/tests/debug/breakpoint-12.js
@@ -2,28 +2,28 @@
 
 
 var dbgA = new Debugger;
 var logA = '';
 
 var dbgB = new Debugger;
 var logB = '';
 
-var g1 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
 g1.eval('function g1f() { print("Weltuntergang"); }');
 var DOAg1 = dbgA.addDebuggee(g1);
 var DOAg1f = DOAg1.getOwnPropertyDescriptor('g1f').value;
 DOAg1f.script.setBreakpoint(0, { hit: () => { logA += '1'; } });
 
 var DOBg1 = dbgB.addDebuggee(g1);
 var DOBg1f = DOBg1.getOwnPropertyDescriptor('g1f').value;
 DOBg1f.script.setBreakpoint(0, { hit: () => { logB += '1'; } });
 
 
-var g2 = newGlobal();
+var g2 = newGlobal({newCompartment: true});
 g2.eval('function g2f() { print("Mokushi"); }');
 
 var DOAg2 = dbgA.addDebuggee(g2);
 var DOAg2f = DOAg2.getOwnPropertyDescriptor('g2f').value;
 DOAg2f.script.setBreakpoint(0, { hit: () => { logA += '2'; } });
 
 var DOBg2 = dbgB.addDebuggee(g2);
 var DOBg2f = DOBg2.getOwnPropertyDescriptor('g2f').value;
--- a/js/src/jit-test/tests/debug/breakpoint-13.js
+++ b/js/src/jit-test/tests/debug/breakpoint-13.js
@@ -1,11 +1,11 @@
 // Breakpoints should be hit on scripts gotten not via Debugger.Frame.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(x) { return x + 1; }");
 // Warm up so f gets OSRed into the jits.
 g.eval("for (var i = 0; i < 10000; i++) f(i);");
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var fw = gw.getOwnPropertyDescriptor("f").value;
 var hits = 0;
 fw.script.setBreakpoint(0, { hit: function(frame) { hits++; } });
--- a/js/src/jit-test/tests/debug/breakpoint-14.js
+++ b/js/src/jit-test/tests/debug/breakpoint-14.js
@@ -1,11 +1,11 @@
 // Breakpoints should be hit on scripts gotten not via Debugger.Frame.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("function f(x) { return x + 1; }");
 g.eval("function g(x) { f(x); }");
 // Warm up so f gets OSRed into the jits and g inlines f.
 g.eval("for (var i = 0; i < 10000; i++) g(i);");
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 var fw = gw.getOwnPropertyDescriptor("f").value;
 var hits = 0;
--- a/js/src/jit-test/tests/debug/breakpoint-gc-01.js
+++ b/js/src/jit-test/tests/debug/breakpoint-gc-01.js
@@ -1,11 +1,11 @@
 // Handlers for breakpoints in an eval script are live as long as the script is on the stack.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
     function handler(i) {
         return {hit: function () { log += '' + i; }};
     }
 
     var s = frame.script;
--- a/js/src/jit-test/tests/debug/breakpoint-gc-02.js
+++ b/js/src/jit-test/tests/debug/breakpoint-gc-02.js
@@ -1,11 +1,11 @@
 // A Debugger with live breakpoints is live.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var line0 = Error().lineNumber;\n" +
        "function f() {\n" +     // line0 + 1
        "    return 2;\n" +      // line0 + 2
        "}\n");
 
 var N = 4;
 var hits = 0;
 for (var i = 0; i < N; i++) {
--- a/js/src/jit-test/tests/debug/breakpoint-gc-04.js
+++ b/js/src/jit-test/tests/debug/breakpoint-gc-04.js
@@ -1,11 +1,11 @@
 // Enabled debuggers keep breakpoint handlers alive.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var line0 = Error().lineNumber;\n" +
        "function f() {\n" +     // line0 + 1
        "    return 2;\n" +      // line0 + 2
        "}\n");
 var N = 4;
 var hits = 0;
 for (var i = 0; i < N; i++) {
     var dbg = Debugger(g);
--- a/js/src/jit-test/tests/debug/breakpoint-gc-05.js
+++ b/js/src/jit-test/tests/debug/breakpoint-gc-05.js
@@ -1,11 +1,11 @@
 // Disabled debuggers keep breakpoint handlers alive.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("var line0 = Error().lineNumber;\n" +
        "function f() {\n" +     // line0 + 1
        "    return 2;\n" +      // line0 + 2
        "}\n");
 var N = 4;
 var hits = 0;
 for (var i = 0; i < N; i++) {
     var dbg = Debugger(g);
--- a/js/src/jit-test/tests/debug/breakpoint-multi-01.js
+++ b/js/src/jit-test/tests/debug/breakpoint-multi-01.js
@@ -1,11 +1,11 @@
 // A single Debugger object can set multiple breakpoints at an instruction.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var log = '';
 dbg.onDebuggerStatement = function (frame) {
     log += 'D';
     function handler(i) {
         return {hit: function (frame) { log += '' + i; }};
     }
     var f = frame.eval("f").return;
--- a/js/src/jit-test/tests/debug/breakpoint-multi-02.js
+++ b/js/src/jit-test/tests/debug/breakpoint-multi-02.js
@@ -1,11 +1,11 @@
 // After clearing one breakpoint, another breakpoint at the same instruction still works.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 var script = null;
 var handlers = [];
 dbg.onDebuggerStatement = function (frame) {
     function handler(i) {
         return {hit: function (frame) { g.log += '' + i; }};
     }
     var f = frame.eval("f").return;
--- a/js/src/jit-test/tests/debug/breakpoint-multi-03.js
+++ b/js/src/jit-test/tests/debug/breakpoint-multi-03.js
@@ -1,11 +1,11 @@
 // Multiple Debugger objects can set breakpoints at the same instruction.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 function attach(g, i) {
     var dbg = Debugger(g);
     dbg.onDebuggerStatement = function (frame) {
         var s = frame.eval("f").return.script;
         var offs = s.getLineOffsets(g.line0 + 3);
         for (var j = 0; j < offs.length; j++)
             s.setBreakpoint(offs[j], {hit: function () { g.log += "" + i; }});
     };
--- a/js/src/jit-test/tests/debug/breakpoint-multi-04.js
+++ b/js/src/jit-test/tests/debug/breakpoint-multi-04.js
@@ -1,12 +1,12 @@
 // After clearing one breakpoint, another breakpoint from a different Debugger object at the same instruction still works.
 
 function test(which) {
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     g.eval("var line0 = Error().lineNumber;\n" +
            "function f() {\n" +             // line0 + 1
            "    return " + which + ";\n" +  // line0 + 2
            "}\n");
 
     var log;
     var scripts = [];
     var handlers = [];
--- a/js/src/jit-test/tests/debug/breakpoint-noncng.js
+++ b/js/src/jit-test/tests/debug/breakpoint-noncng.js
@@ -1,11 +1,11 @@
 // Breakpoints work in non-compile-and-go code. Bug 738479.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.s = '';
 var dbg = new Debugger;
 var gw = dbg.addDebuggee(g);
 g.evaluate(
     "function f() {\n" +  // fscript.startLine
     "    s += 'a';\n" +   // fscript.startLine + 1
     "    s += 'b';\n" +   // fscript.startLine + 2
     "}\n");
--- a/js/src/jit-test/tests/debug/breakpoint-oom-01.js
+++ b/js/src/jit-test/tests/debug/breakpoint-oom-01.js
@@ -1,16 +1,16 @@
 // |jit-test| skip-if: !('oomTest' in this)
 
 // Test for OOM hitting a breakpoint in a generator.
 //
 // (The purpose is to test OOM-handling in the code that creates the
 // Debugger.Frame object and associates it with the generator object.)
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 g.eval(`\
     function* gen(x) {  // line 1
         x++;            // 2
         yield x;        // 3
     }                   // 4
 `);
 
 let dbg = new Debugger;
--- a/js/src/jit-test/tests/debug/breakpoint-resume-01.js
+++ b/js/src/jit-test/tests/debug/breakpoint-resume-01.js
@@ -1,11 +1,11 @@
 // A breakpoint handler hit method can return {throw: exc} to throw an exception.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     function hit(frame) {
         return {throw: frame.eval("new Error('PASS')").return};
     }
 
     var s = frame.script;
     var offs = s.getLineOffsets(g.line0 + 3);
--- a/js/src/jit-test/tests/debug/breakpoint-resume-02.js
+++ b/js/src/jit-test/tests/debug/breakpoint-resume-02.js
@@ -1,11 +1,11 @@
 // A breakpoint handler hit method can return null to raise an uncatchable error.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     g.log += 'D';
 
     function hit(frame) {
         g.log += 'H';
         return null;
     }
--- a/js/src/jit-test/tests/debug/breakpoint-resume-03.js
+++ b/js/src/jit-test/tests/debug/breakpoint-resume-03.js
@@ -1,11 +1,11 @@
 // A breakpoint handler hit method can return {return: val} to force the frame to return.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onDebuggerStatement = function (frame) {
     g.log += 'D';
 
     function hit(frame) {
         g.log += 'H';
         return {return: 'ok'};
     }
--- a/js/src/jit-test/tests/debug/bug-1102549.js
+++ b/js/src/jit-test/tests/debug/bug-1102549.js
@@ -1,9 +1,9 @@
 // |jit-test| error: log is not defined
 
 if (!this.Promise)
     throw new Error('log is not defined');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onPromiseSettled = function (g) { log += 's'; throw "foopy"; };
 g.settlePromiseNow(new g.Promise(function (){}));
--- a/js/src/jit-test/tests/debug/bug-1103386.js
+++ b/js/src/jit-test/tests/debug/bug-1103386.js
@@ -2,9 +2,9 @@ load(libdir + "immutable-prototype.js");
 
 // Random chosen test: js/src/jit-test/tests/auto-regress/bug700295.js
 if (globalPrototypeChainIsMutable()) {
   __proto__ = null;
   Object.prototype.__proto__ = this;
 }
 
 // Random chosen test: js/src/jit-test/tests/debug/Memory-takeCensus-05.js
-Debugger(newGlobal()).memory.takeCensus();
+Debugger(newGlobal({newCompartment: true})).memory.takeCensus();
--- a/js/src/jit-test/tests/debug/bug-1103813.js
+++ b/js/src/jit-test/tests/debug/bug-1103813.js
@@ -1,6 +1,7 @@
 // Random chosen test: js/src/jit-test/tests/debug/Source-invisible.js
 newGlobal({
+    newCompartment: true,
     invisibleToDebugger: true
 })
 // Random chosen test: js/src/jit-test/tests/debug/Debugger-findObjects-05.js
 x = (new Debugger).findObjects()
--- a/js/src/jit-test/tests/debug/bug-1103817.js
+++ b/js/src/jit-test/tests/debug/bug-1103817.js
@@ -1,5 +1,5 @@
 // Random chosen test: js/src/jit-test/tests/debug/Source-introductionScript-04.js
-x = (new Debugger).addDebuggee(newGlobal());
+x = (new Debugger).addDebuggee(newGlobal({newCompartment: true}));
 print(x.getOwnPropertyDescriptor('Function').value.proto.script);
 // Random chosen test: js/src/jit-test/tests/debug/Memory-takeCensus-03.js
 (new Debugger).memory.takeCensus();
--- a/js/src/jit-test/tests/debug/bug-1110327.js
+++ b/js/src/jit-test/tests/debug/bug-1110327.js
@@ -1,5 +1,5 @@
 // Randomly chosen test: js/src/jit-test/tests/debug/Debugger-debuggees-10.js
-x = newGlobal()
+x = newGlobal({newCompartment: true})
 x.t = this
 // Randomly chosen test: js/src/jit-test/tests/debug/Debugger-findObjects-06.js
 Debugger(x).findObjects()
--- a/js/src/jit-test/tests/debug/bug-1240090.js
+++ b/js/src/jit-test/tests/debug/bug-1240090.js
@@ -1,10 +1,10 @@
 gczeal(2);
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 dbg = Debugger(g);
 dbg.onNewScript = function() { return function() { return this; } };
 schedulegc(10);
 g.eval("setLazyParsingDisabled(true)");
 g.evaluate("function one() {}");
 g.evaluate(`
            function target () {}
            function two2() {}
--- a/js/src/jit-test/tests/debug/bug-1444604-reduced.js
+++ b/js/src/jit-test/tests/debug/bug-1444604-reduced.js
@@ -1,11 +1,11 @@
 // LiveSavedFrameCache should not be confused by eval-in-frame-prev links.
 
-const g = newGlobal();
+const g = newGlobal({newCompartment: true});
 const dbg = new Debugger();
 const gDO = dbg.addDebuggee(g);
 
 g.evaluate(`
   function inner() { debugger; }
   function outer() { inner(); }
 `);
 
--- a/js/src/jit-test/tests/debug/bug-1444604.js
+++ b/js/src/jit-test/tests/debug/bug-1444604.js
@@ -1,13 +1,13 @@
 // Fuzz test: LiveSavedFrameCache should not be confused by eval-in-frame-prev links.
 // See bug-144604-reduced.js for a more direct version.
 
 var evalInFrame = (function (global) {
-  var dbgGlobal = newGlobal();
+  var dbgGlobal = newGlobal({newCompartment: true});
   var dbg = new dbgGlobal.Debugger();
   return function evalInFrame(upCount, code) {
     dbg.addDebuggee(global);
     var frame = dbg.getNewestFrame().older;
     for (var i = 0; i < upCount; i++) {
     }
     var completion = frame.eval(code);
   };
--- a/js/src/jit-test/tests/debug/bug-725733.js
+++ b/js/src/jit-test/tests/debug/bug-725733.js
@@ -1,9 +1,9 @@
 // |jit-test|
 // Adding a debuggee must leave its scripts in a safe state.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval(
     "function f(x) { return {q: x}; }\n" +
     "var n = f('').q;\n");
 var dbg = new Debugger(g);
 g.eval("f(0)");
--- a/js/src/jit-test/tests/debug/bug-800586.js
+++ b/js/src/jit-test/tests/debug/bug-800586.js
@@ -1,7 +1,7 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 dbg.onDebuggerStatement = function (f) {
 	gw.executeInGlobal("eval('var x = \"A Brief History of Love\"');\n")
 };
 g.eval('debugger');
--- a/js/src/jit-test/tests/debug/bug-826669.js
+++ b/js/src/jit-test/tests/debug/bug-826669.js
@@ -1,7 +1,7 @@
 gczeal(9, 2)
-var g1 = newGlobal();
-var g2 = newGlobal();
+var g1 = newGlobal({newCompartment: true});
+var g2 = newGlobal({newCompartment: true});
 var dbg = new Debugger();
 var g1w = dbg.addDebuggee(g1);
 g1.eval('function f() {}');
 scripts = dbg.findScripts({});
--- a/js/src/jit-test/tests/debug/bug-858170.js
+++ b/js/src/jit-test/tests/debug/bug-858170.js
@@ -1,7 +1,7 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = Debugger(g);
 dbg.onNewScript = function (s) {
     throw new Error();
 };
 dbg.uncaughtExceptionHook = function () {}
 g.eval("2 * 3");
--- a/js/src/jit-test/tests/debug/bug-876654.js
+++ b/js/src/jit-test/tests/debug/bug-876654.js
@@ -1,13 +1,13 @@
 // |jit-test| 
 // Exercise finding a DebuggerSource cross compartment wrapper in
 // Compartment::findOutgoingEdges()
 
-let g = newGlobal();
+let g = newGlobal({newCompartment: true});
 let dbg = new Debugger(g);
 dbg.onNewScript = function (script) {
   var text = script.source.text;
 }
 g.eval("function f() { function g() {} }");
 gczeal(9, 1)
 var a = {}
 var b = {}
--- a/js/src/jit-test/tests/debug/bug1001372.js
+++ b/js/src/jit-test/tests/debug/bug1001372.js
@@ -7,15 +7,15 @@ lfcode.push("");
 lfcode.push("");
 lfcode.push("");
 lfcode.push("");
 lfcode.push("4");
 lfcode.push("");
 lfcode.push("0");
 lfcode.push("gczeal(2);");
 lfcode.push("\
-    var g = newGlobal();\
+    var g = newGlobal({newCompartment: true});\
     g.parent = this;\
     g.eval('new Debugger(parent).onExceptionUnwind = function() {};');\
     ");
 function loadFile(lfVarx) {
   evaluate(lfVarx);
 }
--- a/js/src/jit-test/tests/debug/bug1004447.js
+++ b/js/src/jit-test/tests/debug/bug1004447.js
@@ -1,11 +1,11 @@
 // Tests that earlier try notes don't interfere with later exception handling.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.debuggeeGlobal = this;
 g.eval("(" + function () {
   dbg = new Debugger(debuggeeGlobal);
 } + ")();");
 var myObj = { p1: 'a', }
 try {
   with(myObj) {
     do {
--- a/js/src/jit-test/tests/debug/bug1006205.js
+++ b/js/src/jit-test/tests/debug/bug1006205.js
@@ -1,20 +1,20 @@
 var lfcode = new Array();
 lfcode.push = loadFile;
 lfcode.push("\
-var g = newGlobal();\
+var g = newGlobal({newCompartment: true});\
 g.debuggeeGlobal = this;\
 g.eval(\"(\" + function () {\
         dbg = new Debugger(debuggeeGlobal);\
     } + \")();\");\
 ");
 lfcode.push("gc();");
 lfcode.push("\
-var g = newGlobal();\
+var g = newGlobal({newCompartment: true});\
 g.debuggeeGlobal = this;\
 g.eval(\"(\" + function () {\
   dbg = new Debugger(debuggeeGlobal);\
 } + \")();\");\
 ");
 function loadFile(lfVarx) {
 function newFunc(x) { new Function(x)(); }; newFunc(lfVarx);
 }
--- a/js/src/jit-test/tests/debug/bug1006473.js
+++ b/js/src/jit-test/tests/debug/bug1006473.js
@@ -1,15 +1,15 @@
 // |jit-test| error: ReferenceError
 
 var lfcode = new Array();
 lfcode.push("gczeal(4);");
 lfcode.push("setJitCompilerOption('ion.warmup.trigger', 30);");
 lfcode.push("\
-var g = newGlobal();\
+var g = newGlobal({newCompartment: true});\
 g.parent = this;\
 g.eval('function f(frame, exc) { f2 = function () { return exc; }; exc = 123; }');\
 g.eval('new Debugger(parent).onExceptionUnwind = f;');\
 var obj = int8  ('oops');\
 ");
 while (true) {
     var file = lfcode.shift(); if (file == undefined) { break; }
     loadFile(file)
--- a/js/src/jit-test/tests/debug/bug1106164.js
+++ b/js/src/jit-test/tests/debug/bug1106164.js
@@ -1,10 +1,10 @@
 // |jit-test| error: ReferenceError
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("new Debugger(parent).onExceptionUnwind = function () { };");
 evaluate("\
         var tokenCodes  = {};\
         tokenCodes.continue = 0;\
         var arr = [\
             (0.E87  ), \
         ];\
--- a/js/src/jit-test/tests/debug/bug1106719.js
+++ b/js/src/jit-test/tests/debug/bug1106719.js
@@ -1,11 +1,11 @@
 // |jit-test| allow-oom; allow-unhandlable-oom; allow-overrecursed
 
-g = newGlobal()
+g = newGlobal({newCompartment: true})
 g.parent = this
 g.eval("Debugger(parent).onExceptionUnwind=(function(){})")
 gcparam("maxBytes", gcparam("gcBytes"))
 function f() {
     f()
     y(arguments)
 }
 f()
--- a/js/src/jit-test/tests/debug/bug1107525.js
+++ b/js/src/jit-test/tests/debug/bug1107525.js
@@ -1,9 +1,9 @@
 // |jit-test| error: InternalError
 enableGeckoProfiling();
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("new Debugger(parent).onExceptionUnwind = function () { hits++; };");
 function f() {
     var x = f();
 }
 f();
--- a/js/src/jit-test/tests/debug/bug1108556.js
+++ b/js/src/jit-test/tests/debug/bug1108556.js
@@ -1,10 +1,10 @@
 // |jit-test| error: ReferenceError
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("new Debugger(parent).onExceptionUnwind = function () { hits++; };");
 evaluate('\
 var fe="v";\
 for (i=0; String.fromCharCode(0x004E); i++)\
   fe += fe;\
 ', { isRunOnce: true });
--- a/js/src/jit-test/tests/debug/bug1109328.js
+++ b/js/src/jit-test/tests/debug/bug1109328.js
@@ -1,8 +1,8 @@
 try {
     gcslice(0)(""());
 } catch (e) {}
-g = newGlobal()
+g = newGlobal({newCompartment: true})
 g.parent = this
 g.eval("Debugger(parent).onExceptionUnwind=(function(){})");
 gcparam("maxBytes", gcparam("maxBytes") - 8);
 gc();
--- a/js/src/jit-test/tests/debug/bug1109915.js
+++ b/js/src/jit-test/tests/debug/bug1109915.js
@@ -1,10 +1,10 @@
 var evalInFrame = (function (global) {
-  var dbgGlobal = newGlobal();
+  var dbgGlobal = newGlobal({newCompartment: true});
   var dbg = new dbgGlobal.Debugger();
   return function evalInFrame(upCount, code) {
     dbg.addDebuggee(global);
     var frame = dbg.getNewestFrame().older;
     var completion = frame.eval(code);
   };
 })(this);
 function g1(x, args) {}
--- a/js/src/jit-test/tests/debug/bug1109964.js
+++ b/js/src/jit-test/tests/debug/bug1109964.js
@@ -1,9 +1,9 @@
-var dbgGlobal = newGlobal();
+var dbgGlobal = newGlobal({newCompartment: true});
 var dbg = new dbgGlobal.Debugger();
 dbg.addDebuggee(this);
 function f() {
   var a = arguments;
   a[1];
   dbg.getNewestFrame().eval("a");
 }
 f();
--- a/js/src/jit-test/tests/debug/bug1111199.js
+++ b/js/src/jit-test/tests/debug/bug1111199.js
@@ -1,9 +1,9 @@
-g = newGlobal()
+g = newGlobal({newCompartment: true})
 g.parent = this
 g.eval("Debugger(parent).onExceptionUnwind=(function(){})")
 try {
 function f(code) {
     n = parseInt('', 0);
     return g("try{}catch(e){}", n)
 }
 function g(s, n) {
--- a/js/src/jit-test/tests/debug/bug1116103.js
+++ b/js/src/jit-test/tests/debug/bug1116103.js
@@ -1,11 +1,11 @@
 // |jit-test| error: ReferenceError
 
 evaluate(`
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     g.parent = this;
     g.eval('new Debugger(parent).onExceptionUnwind = function() {};');
 `)
 {
     while (x && 0) {}
     let x
 }
--- a/js/src/jit-test/tests/debug/bug1118878.js
+++ b/js/src/jit-test/tests/debug/bug1118878.js
@@ -1,11 +1,11 @@
 
 var evalInFrame = (function (global) {
-  var dbgGlobal = newGlobal();
+  var dbgGlobal = newGlobal({newCompartment: true});
   var dbg = new dbgGlobal.Debugger();
   return function evalInFrame(upCount, code) {
     dbg.addDebuggee(global);
     var frame = dbg.getNewestFrame().older;
     var completion = frame.eval(code);
   };
 })(this);
 evaluate("for (var k in 'xxx') (function g() { Math.atan2(42); evalInFrame((0), (''), true); })();", { noScriptRval : true, isRunOnce : true });
--- a/js/src/jit-test/tests/debug/bug1121083.js
+++ b/js/src/jit-test/tests/debug/bug1121083.js
@@ -1,12 +1,12 @@
 // |jit-test| error:terminated
 options('werror');
 
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("Debugger(parent).onExceptionUnwind = function () {};");
 
 function f(x) {
     if (x === 0) {
         return;
     }
     f(x - 1);
--- a/js/src/jit-test/tests/debug/bug1130756.js
+++ b/js/src/jit-test/tests/debug/bug1130756.js
@@ -1,24 +1,24 @@
 // |jit-test| error: timeout
 
 options('werror');
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("(" + function() {
 var dbg = Debugger(parent);
 var handler = {hit: function() {}};
 
 dbg.onEnterFrame = function(frame) {
     frame.onStep = function() {}
 }
 } + ")()");
 
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("Debugger(parent).onExceptionUnwind = function () {};");
 
 function f(x) {
     if (x === 0) {
         return;
     }
     f(x - 1);
--- a/js/src/jit-test/tests/debug/bug1130768.js
+++ b/js/src/jit-test/tests/debug/bug1130768.js
@@ -1,10 +1,10 @@
 // |jit-test| error:foo
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("(" + function() {
     var dbg = new Debugger(parent);
     count = 0;
     dbg.onExceptionUnwind = function(frame) {
         frame.onPop = function() { if (count++ < 30) frame.eval("x = 3"); };
     };
 } + ")()");
--- a/js/src/jit-test/tests/debug/bug1160182.js
+++ b/js/src/jit-test/tests/debug/bug1160182.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.eval("(" + function() {
     var o = {get x() {}};
     this.method = Object.getOwnPropertyDescriptor(o, "x").get;
     assertEq(isLazyFunction(method), true);
 } + ")()");
 var dbg = new Debugger();
 var gw = dbg.addDebuggee(g);
 var scripts = dbg.findScripts();
--- a/js/src/jit-test/tests/debug/bug1188334.js
+++ b/js/src/jit-test/tests/debug/bug1188334.js
@@ -1,10 +1,10 @@
 var evalInFrame = (function (global) {
-  var dbgGlobal = newGlobal();
+  var dbgGlobal = newGlobal({newCompartment: true});
   var dbg = new dbgGlobal.Debugger();
   return function evalInFrame(upCount, code) {
     dbg.addDebuggee(global);
     var frame = dbg.getNewestFrame().older;
     var completion = frame.eval(code);
   };
 })(this);
 function* f() {
--- a/js/src/jit-test/tests/debug/bug1191499.js
+++ b/js/src/jit-test/tests/debug/bug1191499.js
@@ -1,12 +1,12 @@
 
 setJitCompilerOption('ion.warmup.trigger', 2);
 setJitCompilerOption('offthread-compilation.enable', 0);
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg2 = new Debugger;
 g.toggle = function toggle(x, d) {
   if (d) {
     dbg2.addDebuggee(g);
     dbg2.getNewestFrame().environment.getVariable("x");
   }
 };
 g.eval("" + function f(x, d) { toggle(++arguments, d); });
--- a/js/src/jit-test/tests/debug/bug1219905.js
+++ b/js/src/jit-test/tests/debug/bug1219905.js
@@ -1,11 +1,11 @@
 // |jit-test| allow-oom; skip-if: !('oomTest' in this)
 
 // We need allow-oom here because the debugger reports an uncaught exception if
 // it hits OOM calling the exception unwind hook. This causes the shell to exit
 // with the OOM reason.
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("new Debugger(parent).onExceptionUnwind = function() {}");
 let finished = false;
 oomTest(() => l, false);
--- a/js/src/jit-test/tests/debug/bug1232655.js
+++ b/js/src/jit-test/tests/debug/bug1232655.js
@@ -1,5 +1,5 @@
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 g.log = "";
 Debugger(g).onDebuggerStatement = frame => frame.eval("log += this.Math.toString();");
 g.eval("(function() { with ({}) debugger })()");
 assertEq(g.log, "[object Math]");
--- a/js/src/jit-test/tests/debug/bug1240803.js
+++ b/js/src/jit-test/tests/debug/bug1240803.js
@@ -1,12 +1,12 @@
 // |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this)
 
 (function() {
-    g = newGlobal()
+    g = newGlobal({newCompartment: true})
     dbg = new Debugger
     g.toggle = function(d) {
         if (d) {
             dbg.addDebuggee(g);
             dbg.getNewestFrame();
             oomAfterAllocations(2);
             setBreakpoint;
         }
--- a/js/src/jit-test/tests/debug/bug1242798.js
+++ b/js/src/jit-test/tests/debug/bug1242798.js
@@ -1,10 +1,10 @@
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 g.eval("" + function f(c) {
   if (c == 0)
     return;
   if (c == 2)
     debugger;
   f(c-1);
   for (var i = 0; i < 100; i++)
--- a/js/src/jit-test/tests/debug/bug1245862.js
+++ b/js/src/jit-test/tests/debug/bug1245862.js
@@ -1,11 +1,11 @@
 // |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this)
 
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger;
 g.h = function h(d) {
   if (d) {
     dbg.addDebuggee(g);
     var f = dbg.getNewestFrame().older;
     f.st_p1((oomAfterAllocations(10)) + "foo = 'string of 42'");
   }
 }
--- a/js/src/jit-test/tests/debug/bug1246605.js
+++ b/js/src/jit-test/tests/debug/bug1246605.js
@@ -1,9 +1,9 @@
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 dbg = Debugger(g);
 dbg.onNewScript = function(script) { fscript = script.getChildScripts()[0]; }
 g.eval("function f() { arguments[0]; }");
 var hitBreakpoint = false;
 fscript.setBreakpoint(0, {
     hit: function() {
 	getBacktrace({ args: 1 });
 	hitBreakpoint = true;
--- a/js/src/jit-test/tests/debug/bug1252464.js
+++ b/js/src/jit-test/tests/debug/bug1252464.js
@@ -1,11 +1,11 @@
 // |jit-test| error: ReferenceError
 
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 dbg = Debugger(g);
 hits = 0;
 dbg.onNewScript = function () { return hits++; };
 assertEq(g.eval("eval('2 + 3')"), 5);
 this.gczeal(hits,1);
 dbg = Debugger(g);
 g.h = function () {
   var env = dbg.getNewestFrame().environment;
--- a/js/src/jit-test/tests/debug/bug1253246.js
+++ b/js/src/jit-test/tests/debug/bug1253246.js
@@ -1,5 +1,5 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 
 dbg.onDebuggerStatement = (frame) => { frame.eval("c = 42;"); };
 g.evalReturningScope("'use strict'; debugger;");
--- a/js/src/jit-test/tests/debug/bug1257045.js
+++ b/js/src/jit-test/tests/debug/bug1257045.js
@@ -1,10 +1,10 @@
 // |jit-test| skip-if: !wasmDebuggingIsSupported()
 
 fullcompartmentchecks(true);
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
 dbg.onNewScript = (function(script) {
     s = script;
 })
 g.eval(`new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (func) (export "" 0))')));`);
 s.source;
--- a/js/src/jit-test/tests/debug/bug1263899.js
+++ b/js/src/jit-test/tests/debug/bug1263899.js
@@ -6,17 +6,17 @@ try {
     }
     Object.defineProperty(this, "x", { value: 0 });
     setJitCompilerOption("ion.warmup.trigger", 0)
   `)
   evaluate(`function f() {} f(x)`)
   runTestCase()
 } catch (exc) {}
 evaluate(`
-  g = newGlobal()
+  g = newGlobal({newCompartment: true})
   g.parent = this
   g.eval("(" + function() {
     Debugger(parent).onExceptionUnwind = function(frame) {
       frame.older
     }
   } + ")()")
   try { $ERROR() } catch(e){}
 `)
--- a/js/src/jit-test/tests/debug/bug1266434.js
+++ b/js/src/jit-test/tests/debug/bug1266434.js
@@ -1,8 +1,8 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 var dbg = new Debugger(g);
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});
 g.evaluate("function f(x) { return x + 1; }");
 var gw = dbg.addDebuggee(g);
 gczeal(2, 1);
 var s = dbg.findScripts();
 gczeal(0);
--- a/js/src/jit-test/tests/debug/bug1275001.js
+++ b/js/src/jit-test/tests/debug/bug1275001.js
@@ -1,10 +1,10 @@
 
-g = newGlobal();
+g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("(" + function() {
     Debugger(parent).onExceptionUnwind = function(frame) {
         frame.older
     }
 } + ")()")
 function check_one(expected, f, err) {
     try {
--- a/js/src/jit-test/tests/debug/bug1282741.js
+++ b/js/src/jit-test/tests/debug/bug1282741.js
@@ -1,16 +1,16 @@
 
 function removeAdd(dbg, g) {
     dbg.removeDebuggee(g);
     dbg.addDebuggee(g);
     switch (dbg.removeDebuggee(g)) {}
 }
 function newGlobalDebuggerPair(toggleSeq) {
-    var g = newGlobal();
+    var g = newGlobal({newCompartment: true});
     var dbg = new Debugger;
     dbg.addDebuggee(g);
     g.eval("" + function f() {
         for (var i = 0; i < 100; i++) interruptIf(i == 95);
     });
     setInterruptCallback(function() {
         return true;
     });
--- a/js/src/jit-test/tests/debug/bug1299121.js
+++ b/js/src/jit-test/tests/debug/bug1299121.js
@@ -1,9 +1,9 @@
-var g = newGlobal();
+var g = newGlobal({newCompartment: true});