diff --git a/dom/media/webaudio/test/webaudio.js b/dom/media/webaudio/test/webaudio.js index f60e8e740420..2ee382ee4eb4 100644 --- a/dom/media/webaudio/test/webaudio.js +++ b/dom/media/webaudio/test/webaudio.js @@ -6,7 +6,7 @@ function expectException(func, exceptionCode) { func(); } catch (ex) { threw = true; - ok(ex instanceof DOMException, "Expect a DOM exception"); + is(ex.constructor.name, "DOMException", "Expect a DOM exception"); is(ex.code, exceptionCode, "Expect the correct exception code"); } ok(threw, "The exception was thrown"); diff --git a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html index 05c3edcd1afd..38f9b654795b 100644 --- a/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html +++ b/editor/libeditor/tests/test_dom_input_event_on_htmleditor.html @@ -129,7 +129,7 @@ async function runTests() { `${aDescription}"beforeinput" event at ${aTestData.action} must be trusted`); is(aEvent.target, eventTarget, `${aDescription}"beforeinput" event at ${aTestData.action} is fired on unexpected element: ${aEvent.target.tagName}`); - ok(aEvent instanceof InputEvent, + is(aEvent.constructor.name, "InputEvent", `${aDescription}"beforeinput" event at ${aTestData.action} should be dispatched with InputEvent interface`); ok(aEvent.bubbles, `${aDescription}"beforeinput" event at ${aTestData.action} must be bubbles`); @@ -148,7 +148,7 @@ async function runTests() { `${aDescription}"input" event at ${aTestData.action} must be trusted`); is(aEvent.target, eventTarget, `${aDescription}"input" event at ${aTestData.action} is fired on unexpected element: ${aEvent.target.tagName}`); - ok(aEvent instanceof InputEvent, + is(aEvent.constructor.name, "InputEvent", `${aDescription}"input" event at ${aTestData.action} should be dispatched with InputEvent interface`); ok(!aEvent.cancelable, `${aDescription}"input" event at ${aTestData.action} must not be cancelable`); diff --git a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js index a9e17af3c4ed..02f9553cd9ae 100644 --- a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js +++ b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js @@ -202,7 +202,11 @@ function getTargetRect(aTarget) { // If the target is the root content window, its origin relative // to the visual viewport is (0, 0). if (aTarget instanceof Window) { - // FIXME: Assert that it's not an iframe window. + return rect; + } + if (aTarget.Window && aTarget instanceof aTarget.Window) { + // iframe window + // FIXME: Compute proper rect against the root content window return rect; } diff --git a/js/xpconnect/tests/mochitest/test_bug870423.html b/js/xpconnect/tests/mochitest/test_bug870423.html index 0d2c6b5ca06c..753f20f6a72a 100644 --- a/js/xpconnect/tests/mochitest/test_bug870423.html +++ b/js/xpconnect/tests/mochitest/test_bug870423.html @@ -13,7 +13,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=870423 /** Test for cross-scope instanceof. **/ SimpleTest.waitForExplicitFinish(); - function go() { + async function go() { + await SpecialPowers.pushPrefEnv({ set: [["dom.webidl.crosscontext_hasinstance.enabled", false]] }); + var sowin = $('soifr').contentWindow; var xowin = $('xoifr').contentWindow; var xosswin = $('xossifr').contentWindow; @@ -23,21 +25,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=870423 check(window, sowin, 'Window', function(win) { return win; }); check(window, sowin, 'Location', function(win) { return win.location; }); - ok(xowin instanceof Window, "Cross-origin instanceof should work"); - ok(xowin.location instanceof Location, "Cross-origin instanceof should work"); + ok(!(xowin instanceof Window), "Cross-origin instanceof should fail"); + ok(!(xowin.location instanceof Location), "Cross-origin instanceof should fail"); // cross-origin same-site. - ok(xosswin instanceof Window, "Cross-origin instanceof should work"); - ok(xosswin.location instanceof Location, "Cross-origin instanceof should work"); + ok(!(xosswin instanceof Window), "Cross-origin instanceof should fail"); + ok(!(xosswin.location instanceof Location), "Cross-origin instanceof should fail"); SimpleTest.finish(); } function check(win1, win2, constructorName, getInstance) { - ok(getInstance(win1) instanceof win2[constructorName], - "Cross-Scope instanceof works: " + constructorName + ", " + win1.location + ", " + win2.location); - ok(getInstance(win2) instanceof win1[constructorName], - "Cross-Scope instanceof works: " + constructorName + ", " + win2.location + ", " + win1.location); + ok(!(getInstance(win1) instanceof win2[constructorName]), + "Cross-Scope instanceof fails: " + constructorName + ", " + win1.location + ", " + win2.location); + ok(!(getInstance(win2) instanceof win1[constructorName]), + "Cross-Scope instanceof fails: " + constructorName + ", " + win2.location + ", " + win1.location); } diff --git a/js/xpconnect/tests/mochitest/test_bug916945.html b/js/xpconnect/tests/mochitest/test_bug916945.html index 4e481563fcb3..01c342eea16f 100644 --- a/js/xpconnect/tests/mochitest/test_bug916945.html +++ b/js/xpconnect/tests/mochitest/test_bug916945.html @@ -22,9 +22,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=916945 // Both same-origin and cross-origin names should be visible if they're set // on the iframe element. ok('winA' in window, "same-origin named access works"); - ok(winA instanceof Window, "same-origin named access works"); + ok(winA instanceof winA.Window, "same-origin named access works"); ok('winB' in window, "cross-origin named access works when iframe name matches"); - ok(winB instanceof Window, "cross-origin named access works when iframe name matches"); + is(winB.parent, window, "cross-origin named access works when iframe name matches"); // Setting the 'name' attribute should propagate to the docshell. var ifrB = document.getElementById('ifrB'); @@ -39,7 +39,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=916945 'attribute sets propagate to the docshell'); }); ok('foo' in window, "names are dynamic if updated via setAttribute"); - ok(foo instanceof Window, "names are dynamic if updated via setAttribute"); + is(foo.parent, window, "names are dynamic if updated via setAttribute"); // Setting window.name on the subframe should not propagate to the attribute. await SpecialPowers.spawn(ifrB, [], () => { diff --git a/parser/htmlparser/tests/mochitest/parser_datreader.js b/parser/htmlparser/tests/mochitest/parser_datreader.js index de310371500f..3ce4557c583d 100644 --- a/parser/htmlparser/tests/mochitest/parser_datreader.js +++ b/parser/htmlparser/tests/mochitest/parser_datreader.js @@ -202,7 +202,7 @@ function addLevels(walker, buf, indent) { // In the case of template elements, children do not get inserted as // children of the template element, instead they are inserted // as children of the template content (which is a document fragment). - if (walker.currentNode instanceof HTMLTemplateElement) { + if (walker.currentNode.constructor.name === "HTMLTemplateElement") { buf += indent + " content\n"; // Walk through the template content. var templateWalker = createFragmentWalker(walker.currentNode.content);