diff --git a/browser/base/content/test/general/browser_gZipOfflineChild.js b/browser/base/content/test/general/browser_gZipOfflineChild.js index 5312e8a9b5a8..d21e338c03ca 100644 --- a/browser/base/content/test/general/browser_gZipOfflineChild.js +++ b/browser/base/content/test/general/browser_gZipOfflineChild.js @@ -18,6 +18,8 @@ registerCleanupFunction(function() { // offline cache events. // function contentTask() { + ChromeUtils.import("resource://gre/modules/Timer.jsm"); + let resolve; let promise = new Promise(r => { resolve = r; }); diff --git a/browser/base/content/test/popupNotifications/browser_displayURI.js b/browser/base/content/test/popupNotifications/browser_displayURI.js index c27299efb2e7..ebdbaf6cdb4d 100644 --- a/browser/base/content/test/popupNotifications/browser_displayURI.js +++ b/browser/base/content/test/popupNotifications/browser_displayURI.js @@ -92,6 +92,7 @@ add_task(async function test_displayURI_camera() { add_task(async function test_displayURI_geo_blob() { await check(async function() { + Cu.importGlobalProperties(["Blob"]); let text = ""; let blob = new Blob([text], {type: "text/html"}); let url = content.URL.createObjectURL(blob); @@ -101,6 +102,7 @@ add_task(async function test_displayURI_geo_blob() { add_task(async function test_displayURI_camera_blob() { await check(async function() { + Cu.importGlobalProperties(["Blob"]); let text = ""; let blob = new Blob([text], {type: "text/html"}); let url = content.URL.createObjectURL(blob); diff --git a/browser/base/content/test/webrtc/get_user_media_content_script.js b/browser/base/content/test/webrtc/get_user_media_content_script.js index ffb51b94ea39..ede230855d8b 100644 --- a/browser/base/content/test/webrtc/get_user_media_content_script.js +++ b/browser/base/content/test/webrtc/get_user_media_content_script.js @@ -3,6 +3,7 @@ /* eslint-env mozilla/frame-script */ +ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "MediaManagerService", "@mozilla.org/mediaManagerService;1", diff --git a/browser/components/newtab/test/browser/browser_topsites_section.js b/browser/components/newtab/test/browser/browser_topsites_section.js index d6a8b6dae628..e726c1d32ff6 100644 --- a/browser/components/newtab/test/browser/browser_topsites_section.js +++ b/browser/components/newtab/test/browser/browser_topsites_section.js @@ -65,7 +65,7 @@ test_newtab({ // it should be able to click the topsites edit button to reveal the edit topsites modal and overlay. test: async function topsites_add() { let nativeInputValueSetter = Object.getOwnPropertyDescriptor(content.window.HTMLInputElement.prototype, "value").set; - let event = new Event("input", {bubbles: true}); + let event = new content.Event("input", {bubbles: true}); // Find the add topsites button content.document.querySelector(".top-sites .section-top-bar .context-menu-button").click(); diff --git a/browser/components/payments/content/paymentDialogFrameScript.js b/browser/components/payments/content/paymentDialogFrameScript.js index 3e92bca88f74..2159f4ffad85 100644 --- a/browser/components/payments/content/paymentDialogFrameScript.js +++ b/browser/components/payments/content/paymentDialogFrameScript.js @@ -90,12 +90,12 @@ let PaymentFrameScript = { }, getDefaultPreferences() { - let prefValues = { + let prefValues = Cu.cloneInto({ saveCreditCardDefaultChecked: Services.prefs.getBoolPref(SAVE_CREDITCARD_DEFAULT_PREF, false), saveAddressDefaultChecked: Services.prefs.getBoolPref(SAVE_ADDRESS_DEFAULT_PREF, false), - }; + }, waivedContent); return prefValues; }, }; diff --git a/browser/components/uitour/test/head.js b/browser/components/uitour/test/head.js index 7203ead58f40..b8990ab9b2ef 100644 --- a/browser/components/uitour/test/head.js +++ b/browser/components/uitour/test/head.js @@ -323,7 +323,7 @@ function loadUITourTestPage(callback, host = "https://example.org/") { let callbacksCalled = 0; let resolveCallbackPromise; let allCallbacksCalledPromise = new Promise(resolve => resolveCallbackPromise = resolve); - let argumentsWithFunctions = contentArgs.args.map((arg, index) => { + let argumentsWithFunctions = Cu.cloneInto(contentArgs.args.map((arg, index) => { if (arg === "" && contentArgs.fnIndices.includes(index)) { return function() { callbacksCalled++; @@ -334,9 +334,9 @@ function loadUITourTestPage(callback, host = "https://example.org/") { }; } return arg; - }); + }), content, {cloneFunctions: true}); let rv = contentWin.Mozilla.UITour[contentArgs.methodName].apply(contentWin.Mozilla.UITour, - argumentsWithFunctions); + argumentsWithFunctions); if (contentArgs.fnIndices.length) { await allCallbacksCalledPromise; } diff --git a/devtools/client/debugger/test/mochitest/code_frame-script.js b/devtools/client/debugger/test/mochitest/code_frame-script.js index da1e9c40d03e..d55bc1db37ea 100644 --- a/devtools/client/debugger/test/mochitest/code_frame-script.js +++ b/devtools/client/debugger/test/mochitest/code_frame-script.js @@ -23,7 +23,7 @@ this.call = function (name, args) { dump("Calling function with name " + name + ".\n"); dump("args " + JSON.stringify(args) + "\n"); - return XPCNativeWrapper.unwrap(content)[name].apply(undefined, args); + return XPCNativeWrapper.unwrap(content)[name].apply(undefined, Cu.cloneInto(args, content)); }; this._eval = function (string) { diff --git a/dom/cache/test/mochitest/browser_cache_pb_window.js b/dom/cache/test/mochitest/browser_cache_pb_window.js index 09ac5c45df23..8395f81c1a24 100644 --- a/dom/cache/test/mochitest/browser_cache_pb_window.js +++ b/dom/cache/test/mochitest/browser_cache_pb_window.js @@ -72,6 +72,8 @@ function testKeys(browser) { function testOpen_worker(browser) { return ContentTask.spawn(browser, {}, function() { + Cu.importGlobalProperties(["Blob"]); + let workerFunctionString = function () { caches.open("pb-worker-cache").then(function(cacheObject) { postMessage(cacheObject.toString()); diff --git a/dom/file/ipc/tests/browser_ipcBlob.js b/dom/file/ipc/tests/browser_ipcBlob.js index d8b5ac725747..f622a8a6918f 100644 --- a/dom/file/ipc/tests/browser_ipcBlob.js +++ b/dom/file/ipc/tests/browser_ipcBlob.js @@ -11,6 +11,7 @@ add_task(async function test_CtoPtoC_big() { let browser1 = gBrowser.getBrowserForTab(tab1); let blob = await ContentTask.spawn(browser1, null, function() { + Cu.importGlobalProperties(["Blob"]); let blob = new Blob([new Array(1024*1024).join('123456789ABCDEF')]); return blob; }); @@ -43,6 +44,7 @@ add_task(async function test_CtoPtoC_small() { let browser1 = gBrowser.getBrowserForTab(tab1); let blob = await ContentTask.spawn(browser1, null, function() { + Cu.importGlobalProperties(["Blob"]); let blob = new Blob(["hello world!"]); return blob; }); @@ -75,6 +77,7 @@ add_task(async function test_CtoPtoC_bc_big() { let browser1 = gBrowser.getBrowserForTab(tab1); await ContentTask.spawn(browser1, null, function() { + Cu.importGlobalProperties(["Blob"]); var bc = new content.BroadcastChannel('test'); bc.onmessage = function() { bc.postMessage(new Blob([new Array(1024*1024).join('123456789ABCDEF')])); @@ -111,6 +114,7 @@ add_task(async function test_CtoPtoC_bc_small() { let browser1 = gBrowser.getBrowserForTab(tab1); await ContentTask.spawn(browser1, null, function() { + Cu.importGlobalProperties(["Blob"]); var bc = new content.BroadcastChannel('test'); bc.onmessage = function() { bc.postMessage(new Blob(["hello world!"])); @@ -147,6 +151,7 @@ add_task(async function test_CtoPtoC_bc_small() { let browser1 = gBrowser.getBrowserForTab(tab1); let blobURL = await ContentTask.spawn(browser1, null, function() { + Cu.importGlobalProperties(["Blob"]); return content.URL.createObjectURL(new content.Blob(["hello world!"])); }); @@ -177,6 +182,7 @@ add_task(async function test_CtoPtoC_multipart() { let browser1 = gBrowser.getBrowserForTab(tab1); let blob = await ContentTask.spawn(browser1, null, function() { + Cu.importGlobalProperties(["Blob"]); return new Blob(["!"]); }); @@ -189,6 +195,7 @@ add_task(async function test_CtoPtoC_multipart() { let browser2 = gBrowser.getBrowserForTab(tab2); let status = await ContentTask.spawn(browser2, newBlob, function(blob) { + Cu.importGlobalProperties(["Blob"]); return new Promise(resolve => { let fr = new content.FileReader(); fr.readAsText(new Blob(["hello ", blob])); diff --git a/dom/html/test/browser_fullscreen-api-keys.js b/dom/html/test/browser_fullscreen-api-keys.js index 0d8d61a063f6..63e4552d6465 100644 --- a/dom/html/test/browser_fullscreen-api-keys.js +++ b/dom/html/test/browser_fullscreen-api-keys.js @@ -18,7 +18,7 @@ function frameScript() { }); addMessageListener("Test:DispatchUntrustedKeyEvents", msg => { var evt = new content.CustomEvent("Test:DispatchKeyEvents", { - detail: { code: msg.data } + detail: Cu.cloneInto({ code: msg.data }, content), }); content.dispatchEvent(evt); }); diff --git a/dom/tests/browser/browser_localStorage_e10s.js b/dom/tests/browser/browser_localStorage_e10s.js index 403cd1570d73..a2314a52b330 100644 --- a/dom/tests/browser/browser_localStorage_e10s.js +++ b/dom/tests/browser/browser_localStorage_e10s.js @@ -160,7 +160,7 @@ async function mutateTabStorage(knownTab, mutations, sentinelValue) { knownTab.tab.linkedBrowser, { mutations, sentinelValue }, function(args) { - return content.wrappedJSObject.mutateStorage(args); + return content.wrappedJSObject.mutateStorage(Cu.cloneInto(args, content)); }); } diff --git a/js/xpconnect/tests/mochitest/test_bug628410.html b/js/xpconnect/tests/mochitest/test_bug628410.html index 1708ae39352a..b4ef84a2c3b9 100644 --- a/js/xpconnect/tests/mochitest/test_bug628410.html +++ b/js/xpconnect/tests/mochitest/test_bug628410.html @@ -19,7 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=628410