diff --git a/devtools/docs/user/debugger-api/tutorial-breakpoint/index.rst b/devtools/docs/user/debugger-api/tutorial-breakpoint/index.rst index ac2a91d924c0..3985794f9319 100644 --- a/devtools/docs/user/debugger-api/tutorial-breakpoint/index.rst +++ b/devtools/docs/user/debugger-api/tutorial-breakpoint/index.rst @@ -49,7 +49,7 @@ This tutorial was tested against Firefox 58 Beta and Nightly. It does not work i // This defines 'Debugger' in this Scratchpad; // it doesn't actually start debugging anything. - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); // Create a 'Debugger' instance. var dbg = new Debugger; diff --git a/devtools/server/tests/chrome/test_Debugger.Script.prototype.global.html b/devtools/server/tests/chrome/test_Debugger.Script.prototype.global.html index 7009f9eae265..dda20a12ec4f 100644 --- a/devtools/server/tests/chrome/test_Debugger.Script.prototype.global.html +++ b/devtools/server/tests/chrome/test_Debugger.Script.prototype.global.html @@ -17,7 +17,7 @@ Debugger.Script.prototype.global should return innerize globals, not WindowProxi "use strict"; const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/devtools/server/tests/chrome/test_Debugger.Source.prototype.elementAttribute.html b/devtools/server/tests/chrome/test_Debugger.Source.prototype.elementAttribute.html index 1f42f6077e29..7704764a6ab0 100644 --- a/devtools/server/tests/chrome/test_Debugger.Source.prototype.elementAttribute.html +++ b/devtools/server/tests/chrome/test_Debugger.Source.prototype.elementAttribute.html @@ -18,7 +18,7 @@ element to which code is attached (if any), and how. "use strict"; const {addSandboxedDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addSandboxedDebuggerToGlobal(this); +addSandboxedDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionScript.html b/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionScript.html index 9a338a62aa0c..fde093fc60f7 100644 --- a/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionScript.html +++ b/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionScript.html @@ -18,7 +18,7 @@ behave when 'eval' is called with no scripted frames active at all. "use strict"; const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionType.html b/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionType.html index b72522e6f596..d2df439651fb 100644 --- a/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionType.html +++ b/devtools/server/tests/chrome/test_Debugger.Source.prototype.introductionType.html @@ -19,7 +19,7 @@ JavaScrip appearing in an inline event handler attribute. "use strict"; const {addSandboxedDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addSandboxedDebuggerToGlobal(this); +addSandboxedDebuggerToGlobal(globalThis); let dbg; let iframeDO, doc; diff --git a/devtools/server/tests/chrome/test_executeInGlobal-outerized_this.html b/devtools/server/tests/chrome/test_executeInGlobal-outerized_this.html index f16ab33a77e5..9b3312e2601f 100644 --- a/devtools/server/tests/chrome/test_executeInGlobal-outerized_this.html +++ b/devtools/server/tests/chrome/test_executeInGlobal-outerized_this.html @@ -19,7 +19,7 @@ object. "use strict"; const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/devtools/server/tests/chrome/test_makeGlobalObjectReference.html b/devtools/server/tests/chrome/test_makeGlobalObjectReference.html index c9b26fc86e8b..a59f52c818a1 100644 --- a/devtools/server/tests/chrome/test_makeGlobalObjectReference.html +++ b/devtools/server/tests/chrome/test_makeGlobalObjectReference.html @@ -18,7 +18,7 @@ Debugger.prototype.makeGlobalObjectReference should dereference WindowProxy "use strict"; const {addSandboxedDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addSandboxedDebuggerToGlobal(this); +addSandboxedDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/devtools/server/tests/chrome/test_unsafeDereference.html b/devtools/server/tests/chrome/test_unsafeDereference.html index 72069572bdad..e41668fb315b 100644 --- a/devtools/server/tests/chrome/test_unsafeDereference.html +++ b/devtools/server/tests/chrome/test_unsafeDereference.html @@ -19,7 +19,7 @@ xray wrapper. "use strict"; const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/devtools/server/tests/xpcshell/test_getyoungestframe.js b/devtools/server/tests/xpcshell/test_getyoungestframe.js index ec3b52524b77..9dcb27784a41 100644 --- a/devtools/server/tests/xpcshell/test_getyoungestframe.js +++ b/devtools/server/tests/xpcshell/test_getyoungestframe.js @@ -7,7 +7,7 @@ function run_test() { const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); const xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService( Ci.nsIJSInspector ); diff --git a/devtools/server/tests/xpcshell/test_nativewrappers.js b/devtools/server/tests/xpcshell/test_nativewrappers.js index 629b050e3264..da35b2f281de 100644 --- a/devtools/server/tests/xpcshell/test_nativewrappers.js +++ b/devtools/server/tests/xpcshell/test_nativewrappers.js @@ -7,7 +7,7 @@ function run_test() { const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); const g = createTestGlobal("test1"); const dbg = makeDebugger(); diff --git a/devtools/server/tests/xpcshell/test_safe-getter.js b/devtools/server/tests/xpcshell/test_safe-getter.js index 1c78e96cb6d2..18571a3eb3da 100644 --- a/devtools/server/tests/xpcshell/test_safe-getter.js +++ b/devtools/server/tests/xpcshell/test_safe-getter.js @@ -7,7 +7,7 @@ function run_test() { const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); const g = createTestGlobal("test", { wantGlobalProperties: ["ChromeUtils"], }); diff --git a/devtools/server/tests/xpcshell/test_unsafeDereference.js b/devtools/server/tests/xpcshell/test_unsafeDereference.js index e601c320a6d4..f0eea91f31fb 100644 --- a/devtools/server/tests/xpcshell/test_unsafeDereference.js +++ b/devtools/server/tests/xpcshell/test_unsafeDereference.js @@ -11,7 +11,7 @@ // cross-compartment wrappers with interesting properties, and this is the // xpcshell test directory most closely related to the JS Debugger API. -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); // Add a method to Debugger.Object for fetching value properties // conveniently. diff --git a/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot.js b/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot.js index 3b529fdd0cf5..0371fe8a315f 100644 --- a/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot.js +++ b/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot.js @@ -7,7 +7,7 @@ if (typeof Debugger != "function") { const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); } function run_test() { diff --git a/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot_with_allocations.js b/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot_with_allocations.js index 5c77c568b985..4b5a36d577cb 100644 --- a/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot_with_allocations.js +++ b/devtools/shared/heapsnapshot/tests/xpcshell/test_ReadHeapSnapshot_with_allocations.js @@ -9,7 +9,7 @@ if (typeof Debugger != "function") { const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); } function run_test() { diff --git a/devtools/shared/heapsnapshot/tests/xpcshell/test_SaveHeapSnapshot.js b/devtools/shared/heapsnapshot/tests/xpcshell/test_SaveHeapSnapshot.js index 79a19cb201cf..dce842a3c8cd 100644 --- a/devtools/shared/heapsnapshot/tests/xpcshell/test_SaveHeapSnapshot.js +++ b/devtools/shared/heapsnapshot/tests/xpcshell/test_SaveHeapSnapshot.js @@ -7,7 +7,7 @@ if (typeof Debugger != "function") { const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); } function run_test() { diff --git a/devtools/shared/loader/worker-loader.js b/devtools/shared/loader/worker-loader.js index f0cdc7dee9f9..d47527262cee 100644 --- a/devtools/shared/loader/worker-loader.js +++ b/devtools/shared/loader/worker-loader.js @@ -397,7 +397,7 @@ var { const { addDebuggerToGlobal } = ChromeUtils.import( 'resource://gre/modules/jsdebugger.jsm' ); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); `, sandbox ); diff --git a/devtools/shared/tests/xpcshell/test_invisible_loader.js b/devtools/shared/tests/xpcshell/test_invisible_loader.js index 6af93f98c05b..81cafb1718c1 100644 --- a/devtools/shared/tests/xpcshell/test_invisible_loader.js +++ b/devtools/shared/tests/xpcshell/test_invisible_loader.js @@ -6,7 +6,7 @@ const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); /** * Ensure that sandboxes created via the Dev Tools loader respect the diff --git a/devtools/shared/webconsole/test/xpcshell/test_js_property_provider.js b/devtools/shared/webconsole/test/xpcshell/test_js_property_provider.js index 77f02b61b770..3cc51e762a75 100644 --- a/devtools/shared/webconsole/test/xpcshell/test_js_property_provider.js +++ b/devtools/shared/webconsole/test/xpcshell/test_js_property_provider.js @@ -9,7 +9,7 @@ const { const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); function run_test() { Services.prefs.setBoolPref( diff --git a/dom/base/test/chrome/test_bug1346936.html b/dom/base/test/chrome/test_bug1346936.html index 2521b43dc54e..c0f6e012928a 100644 --- a/dom/base/test/chrome/test_bug1346936.html +++ b/dom/base/test/chrome/test_bug1346936.html @@ -26,7 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1346936 /** Test for Bug 1346936 **/ const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/dom/base/test/chrome/test_bug765993.html b/dom/base/test/chrome/test_bug765993.html index 8cac34b8ad04..5a7ac4d13082 100644 --- a/dom/base/test/chrome/test_bug765993.html +++ b/dom/base/test/chrome/test_bug765993.html @@ -26,7 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=765993 /** Test for Bug 765993 **/ const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); window.onload = function() { SimpleTest.waitForExplicitFinish(); diff --git a/dom/base/test/jsmodules/iframe_extractIntroType.html b/dom/base/test/jsmodules/iframe_extractIntroType.html index bd3fc89ec000..e0182338777a 100644 --- a/dom/base/test/jsmodules/iframe_extractIntroType.html +++ b/dom/base/test/jsmodules/iframe_extractIntroType.html @@ -5,7 +5,7 @@ // Hook up the debugger statement to extract the calling script's // introductionType and set it in a property on the parent global. const {addSandboxedDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); - addSandboxedDebuggerToGlobal(this); + addSandboxedDebuggerToGlobal(globalThis); var dbg = new Debugger; dbg.addDebuggee(parent); dbg.onDebuggerStatement = function (frame) { diff --git a/js/ductwork/debugger/jsdebugger.jsm b/js/ductwork/debugger/jsdebugger.jsm index e0d7e2de98b2..ed5e9f66f7b0 100644 --- a/js/ductwork/debugger/jsdebugger.jsm +++ b/js/ductwork/debugger/jsdebugger.jsm @@ -10,7 +10,7 @@ var EXPORTED_SYMBOLS = [ "addDebuggerToGlobal", "addSandboxedDebuggerToGlobal" ] * const { addDebuggerToGlobal } = ChromeUtils.import( * "resource://gre/modules/jsdebugger.jsm" * ); - * addDebuggerToGlobal(this); + * addDebuggerToGlobal(globalThis); * * This will create a 'Debugger' object, which provides an interface to debug * JavaScript code running in other compartments in the same process, on the diff --git a/js/ductwork/debugger/tests/test_nativewrappers.js b/js/ductwork/debugger/tests/test_nativewrappers.js index cf3570f08095..3523121164d2 100644 --- a/js/ductwork/debugger/tests/test_nativewrappers.js +++ b/js/ductwork/debugger/tests/test_nativewrappers.js @@ -7,7 +7,7 @@ function run_test() Services.prefs.clearUserPref("security.allow_eval_with_system_principal"); }); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); var g = testGlobal("test1"); var dbg = new Debugger(); diff --git a/js/src/doc/Debugger/Tutorial-Breakpoint.md b/js/src/doc/Debugger/Tutorial-Breakpoint.md index c972aaac2740..4a607cf68c55 100644 --- a/js/src/doc/Debugger/Tutorial-Breakpoint.md +++ b/js/src/doc/Debugger/Tutorial-Breakpoint.md @@ -53,7 +53,7 @@ This tutorial was tested against Firefox 58 Beta and Nightly. It does not work i // This simply defines 'Debugger' in this Scratchpad; // it doesn't actually start debugging anything. - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); // Create a 'Debugger' instance. var dbg = new Debugger; diff --git a/js/xpconnect/tests/chrome/test_evalInSandbox.xhtml b/js/xpconnect/tests/chrome/test_evalInSandbox.xhtml index d4a2ea20fe89..d622feccf48b 100644 --- a/js/xpconnect/tests/chrome/test_evalInSandbox.xhtml +++ b/js/xpconnect/tests/chrome/test_evalInSandbox.xhtml @@ -178,7 +178,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596 Cu.evalInSandbox('checkExplicitVersions();', outerSB); const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); - addDebuggerToGlobal(this); + addDebuggerToGlobal(globalThis); try { let dbg = new Debugger(); diff --git a/js/xpconnect/tests/chrome/test_onGarbageCollection.html b/js/xpconnect/tests/chrome/test_onGarbageCollection.html index c179c7a5d0de..42d2ea851fb4 100644 --- a/js/xpconnect/tests/chrome/test_onGarbageCollection.html +++ b/js/xpconnect/tests/chrome/test_onGarbageCollection.html @@ -27,7 +27,7 @@ const { addDebuggerToGlobal } = ChromeUtils.import( 'resource://gre/modules/jsdebugger.jsm' ); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); `, sandbox ); diff --git a/js/xpconnect/tests/unit/test_xray_SavedFrame-02.js b/js/xpconnect/tests/unit/test_xray_SavedFrame-02.js index 6996c846ea97..8c62733bbe67 100644 --- a/js/xpconnect/tests/unit/test_xray_SavedFrame-02.js +++ b/js/xpconnect/tests/unit/test_xray_SavedFrame-02.js @@ -2,7 +2,7 @@ // un-privileged globals. const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); const lowP = Services.scriptSecurityManager.createNullPrincipal({}); const highP = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal); diff --git a/js/xpconnect/tests/unit/test_xray_SavedFrame.js b/js/xpconnect/tests/unit/test_xray_SavedFrame.js index c9b4e330d1c0..b1d22f71a153 100644 --- a/js/xpconnect/tests/unit/test_xray_SavedFrame.js +++ b/js/xpconnect/tests/unit/test_xray_SavedFrame.js @@ -2,7 +2,7 @@ // that frame's principals. const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); -addDebuggerToGlobal(this); +addDebuggerToGlobal(globalThis); const lowP = Services.scriptSecurityManager.createNullPrincipal({}); const midP = [lowP, "http://other.com"];