Backed out 3 changesets (bug 1360715) for mochitest failures at test_WebCrypto.html. CLOSED TREE

Backed out changeset b4a14c42313d (bug 1360715)
Backed out changeset 0e4b1b65fcbe (bug 1360715)
Backed out changeset fb8b9841d82b (bug 1360715)
This commit is contained in:
Brindusan Cristian 2021-03-04 21:15:16 +02:00
parent 5ccecbfac2
commit b926d96be6
20 changed files with 59 additions and 72 deletions

View File

@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=511084
/** Test for Bug 511084 **/
var doc = frames[0].document;
doc.replaceChild(doc.createElement("iframe"), doc.documentElement);
ok(frames[0][0] instanceof frames[0][0].Window,
ok(frames[0][0] instanceof Window,
"Should have a subframe window for a root iframe");
</script>
</pre>

View File

@ -837,16 +837,13 @@ static JSObject* CreateInterfaceObject(
if (DOMIfaceAndProtoJSClass::FromJSClass(constructorClass)
->wantsInterfaceHasInstance) {
if (isChrome ||
StaticPrefs::dom_webidl_crosscontext_hasinstance_enabled()) {
JS::Rooted<jsid> hasInstanceId(cx, SYMBOL_TO_JSID(JS::GetWellKnownSymbol(
cx, JS::SymbolCode::hasInstance)));
if (!JS_DefineFunctionById(
cx, constructor, hasInstanceId, InterfaceHasInstance, 1,
// Flags match those of Function[Symbol.hasInstance]
JSPROP_READONLY | JSPROP_PERMANENT)) {
return nullptr;
}
JS::Rooted<jsid> hasInstanceId(cx, SYMBOL_TO_JSID(JS::GetWellKnownSymbol(
cx, JS::SymbolCode::hasInstance)));
if (!JS_DefineFunctionById(
cx, constructor, hasInstanceId, InterfaceHasInstance, 1,
// Flags match those of Function[Symbol.hasInstance]
JSPROP_READONLY | JSPROP_PERMANENT)) {
return nullptr;
}
if (isChrome && !JS_DefineFunction(cx, constructor, "isInstance",

View File

@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=328885
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=328885">Mozilla Bug 328885</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<input type="text" id="inputelement"
style="position: absolute; left: 0px; top: 0px;">
@ -37,11 +37,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=328885
inputelement.addEventListener("DOMNodeInsertedIntoDocument", mutationListener);
inputelement.addEventListener("DOMAttrModified", mutationListener);
inputelement.addEventListener("DOMCharacterDataModified", mutationListener);
inputelement.addEventListener('click',
inputelement.addEventListener('click',
function(event) {
var evt = SpecialPowers.wrap(event);
ok(SpecialPowers.call_Instanceof(evt.originalTarget, HTMLDivElement),
ok(SpecialPowers.unwrap(evt.originalTarget) instanceof HTMLDivElement,
"(1) Wrong originalTarget!");
is(SpecialPowers.unwrap(evt.originalTarget.parentNode), inputelement,
"(2) Wront parent node!");
@ -92,7 +92,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=328885
ok(mutationCount == 12, "(16) Mutation listener should have been called! ["+ mutationCount + "]");
// Then try some mixed mutations. The mutation handler of non-native-a
inputelement.addEventListener("DOMAttrModified",
inputelement.addEventListener("DOMAttrModified",
function (evt2) {
evt.originalTarget.setAttribute("foo", "bar" + mutationCount);
ok(evt.originalTarget.getAttribute("foo") == "bar" + mutationCount,

View File

@ -44,13 +44,12 @@ function startTest(frameid) {
is(childUnloaded, false, "Child not unloaded yet");
var doc = $(frameid).contentDocument;
var win = $(frameid).contentWindow;
ok(doc instanceof win.Document, "doc should be a document");
ok(doc instanceof Document, "doc should be a document");
for (var i = 0; i < nodes.length; ++i) {
var id = nodes[i][0];
var node = doc.getElementById(id);
ok(node instanceof win[nodes[i][1].name], id + " should be a " + nodes[i][1]);
ok(node instanceof nodes[i][1], id + " should be a " + nodes[i][1]);
is(node.disabled, false, "check for " + id + " state");
node.disabled = true;
is(node.disabled, true, "check for " + id + " state change");
@ -68,8 +67,7 @@ function startTest(frameid) {
function continueTest(frameid) {
is(childUnloaded, true, "Unload handler should have fired");
var doc = $(frameid).contentDocument;
var win = $(frameid).contentWindow;
ok(doc instanceof win.Document, "doc should be a document");
ok(doc instanceof Document, "doc should be a document");
for (var i = 0; i < nodes.length; ++i) {
var id = nodes[i][0];
@ -102,13 +100,12 @@ function flipper(a, b, c) {
function finishTest(frameid) {
var doc = $(frameid).contentDocument;
var win = $(frameid).contentWindow;
ok(doc instanceof win.Document, "doc should be a document");
ok(doc instanceof Document, "doc should be a document");
for (var i = 0; i < nodes.length; ++i) {
var id = nodes[i][0];
var node = doc.getElementById(id);
ok(node instanceof win[nodes[i][1].name], id + " should be a " + nodes[i][1]);
ok(node instanceof nodes[i][1], id + " should be a " + nodes[i][1]);
//testIs(node.disabled, true, "check for " + id + " state restore");
}

View File

@ -6,7 +6,7 @@ function expectException(func, exceptionCode) {
func();
} catch (ex) {
threw = true;
is(ex.constructor.name, "DOMException", "Expect a DOM exception");
ok(ex instanceof DOMException, "Expect a DOM exception");
is(ex.code, exceptionCode, "Expect the correct exception code");
}
ok(threw, "The exception was thrown");

View File

@ -52,13 +52,13 @@ async function test_nativeStream_continue(r, that) {
let blob = await r.blob();
that.ok(blob instanceof that.Blob, "We have a blob");
that.ok(blob instanceof Blob, "We have a blob");
let d = await a.body.getReader().read();
that.ok(!d.done, "We have read something!");
blob = await b.blob();
that.ok(blob instanceof that.Blob, "We have a blob");
that.ok(blob instanceof Blob, "We have a blob");
}
async function test_timeout(compartment) {
@ -123,13 +123,13 @@ async function test_nonNativeStream_continue(data, that) {
let blob = await data.r.blob();
that.ok(blob instanceof that.Blob, "We have a blob");
that.ok(blob instanceof Blob, "We have a blob");
let d = await a.body.getReader().read();
that.ok(!d.done, "We have read something!");
blob = await b.blob();
that.ok(blob instanceof that.Blob, "We have a blob");
that.ok(blob instanceof Blob, "We have a blob");
that.is(blob.size, data.buffer.byteLength, "Blob size matches");
}

View File

@ -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}`);
is(aEvent.constructor.name, "InputEvent",
ok(aEvent instanceof 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}`);
is(aEvent.constructor.name, "InputEvent",
ok(aEvent instanceof 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`);

View File

@ -65,7 +65,7 @@ function nativeHorizontalWheelEventMsg() {
// Given an event target which may be a window or an element, get the associated window.
function windowForTarget(aTarget) {
if (aTarget.Window && aTarget instanceof aTarget.Window) {
if (aTarget instanceof Window) {
return aTarget;
}
return aTarget.ownerDocument.defaultView;
@ -73,7 +73,7 @@ function windowForTarget(aTarget) {
// Given an event target which may be a window or an element, get the associated element.
function elementForTarget(aTarget) {
if (aTarget.Window && aTarget instanceof aTarget.Window) {
if (aTarget instanceof Window) {
return aTarget.document.documentElement;
}
return aTarget;
@ -202,11 +202,7 @@ 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) {
return rect;
}
if (aTarget.Window && aTarget instanceof aTarget.Window) {
// iframe window
// FIXME: Compute proper rect against the root content window
// FIXME: Assert that it's not an iframe window.
return rect;
}

View File

@ -23,7 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=829872
is(elem.contentDocument, null, "null cross-origin contentDocument for " + desc);
ok(await SpecialPowers.spawn(elem, [], () => this.content.eval('frameElement === null;')),
"null cross-origin frameElement for " + desc);
if (!(elem instanceof elem.ownerDocument.defaultView.HTMLFrameElement))
if (!(elem instanceof HTMLFrameElement))
is(elem.getSVGDocument(), null, "null cross-origin getSVGDocument() for " + desc);
}

View File

@ -13,9 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=870423
/** Test for cross-scope instanceof. **/
SimpleTest.waitForExplicitFinish();
async function go() {
await SpecialPowers.pushPrefEnv({ set: [["dom.webidl.crosscontext_hasinstance.enabled", false]] });
function go() {
var sowin = $('soifr').contentWindow;
var xowin = $('xoifr').contentWindow;
var xosswin = $('xossifr').contentWindow;
@ -25,21 +23,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 fail");
ok(!(xowin.location instanceof Location), "Cross-origin instanceof should fail");
ok(xowin instanceof Window, "Cross-origin instanceof should work");
ok(xowin.location instanceof Location, "Cross-origin instanceof should work");
// cross-origin same-site.
ok(!(xosswin instanceof Window), "Cross-origin instanceof should fail");
ok(!(xosswin.location instanceof Location), "Cross-origin instanceof should fail");
ok(xosswin instanceof Window, "Cross-origin instanceof should work");
ok(xosswin.location instanceof Location, "Cross-origin instanceof should work");
SimpleTest.finish();
}
function check(win1, win2, constructorName, getInstance) {
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);
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);
}
</script>

View File

@ -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 winA.Window, "same-origin named access works");
ok(winA instanceof Window, "same-origin named access works");
ok('winB' in window, "cross-origin named access works when iframe name matches");
is(winB.parent, window, "cross-origin named access works when iframe name matches");
ok(winB instanceof 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");
is(foo.parent, window, "names are dynamic if updated via setAttribute");
ok(foo instanceof Window, "names are dynamic if updated via setAttribute");
// Setting window.name on the subframe should not propagate to the attribute.
await SpecialPowers.spawn(ifrB, [], () => {

View File

@ -42,7 +42,7 @@ function run() {
mql: subwin.matchMedia(str),
notifyCount: 0,
listener: function(event) {
ok(event instanceof subwin.MediaQueryListEvent,
ok(event instanceof MediaQueryListEvent,
"correct argument to listener: " + obj.str);
is(event.media, obj.mql.media,
"correct media in the event: " + obj.str);

View File

@ -1106,9 +1106,9 @@ class AccessibilityTest : BaseSessionTest() {
$doc.querySelector('${entry.key}').addEventListener(
'input', event => {
let eventInterface =
event instanceof $doc.defaultView.InputEvent ? "InputEvent" :
event instanceof $doc.defaultView.UIEvent ? "UIEvent" :
event instanceof $doc.defaultView.Event ? "Event" : "Unknown";
event instanceof InputEvent ? "InputEvent" :
event instanceof UIEvent ? "UIEvent" :
event instanceof Event ? "Event" : "Unknown";
resolve([event.target.value, '${entry.value}', eventInterface]);
}, { once: true }))""")
}

View File

@ -172,9 +172,9 @@ class AutofillDelegateTest : BaseSessionTest() {
$doc.querySelector('${entry.key}').addEventListener(
'input', event => {
let eventInterface =
event instanceof $doc.defaultView.InputEvent ? "InputEvent" :
event instanceof $doc.defaultView.UIEvent ? "UIEvent" :
event instanceof $doc.defaultView.Event ? "Event" : "Unknown";
event instanceof InputEvent ? "InputEvent" :
event instanceof UIEvent ? "UIEvent" :
event instanceof Event ? "Event" : "Unknown";
resolve([
'${entry.key}',
event.target.value,

View File

@ -3513,11 +3513,6 @@
value: true
mirror: always
- name: dom.webidl.crosscontext_hasinstance.enabled
type: RelaxedAtomicBool
value: @IS_NOT_NIGHTLY_BUILD@
mirror: always
# WebShare API - exposes navigator.share()
- name: dom.webshare.enabled
type: bool

View File

@ -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.constructor.name === "HTMLTemplateElement") {
if (walker.currentNode instanceof HTMLTemplateElement) {
buf += indent + " content\n";
// Walk through the template content.
var templateWalker = createFragmentWalker(walker.currentNode.content);

View File

@ -1,2 +1,7 @@
[has-instance.html]
prefs: [dom.webidl.crosscontext_hasinstance.enabled:false]
[instanceof must return false across different globals, for platform objects]
expected: FAIL
[platform objects do not have Symbol.hasInstance installed]
expected: FAIL

View File

@ -62,7 +62,7 @@ async_test(function(t) {
async_test(function(t) {
var obj = document.createElement("object");
obj.onload = t.step_func_done(function(e){
assert_true(obj.contentWindow instanceof obj.contentWindow.Window, "The object element should represent a nested browsing context.")
assert_true(obj.contentWindow instanceof Window, "The object element should represent a nested browsing context.")
assert_equals(Object.getPrototypeOf(e).constructor, Event, "The load event should use the Event interface.");
assert_true(e.isTrusted, "The load event should be a trusted event.");
assert_false(e.cancelable, "The load event should not be a cancelable event.");

View File

@ -16,7 +16,6 @@
let iframe = document.getElementById("iframe");
let doc = iframe.contentDocument;
let win = iframe.contentWindow;
doc.open("text/html");
// We need to do two writes here. The first creates the document element,
// which normally triggers parser blocking. The second triggers the
@ -26,7 +25,7 @@
doc.write("<div id=beer></div>");
let elem = doc.getElementById("beer");
top.postMessage(elem instanceof win.HTMLDivElement ? "ok" : "fail",
top.postMessage(elem instanceof HTMLDivElement ? "ok" : "fail",
"*");
doc.close();

View File

@ -78,8 +78,8 @@ const sandboxScript = function(shadowRoot) {
SpecialPowers.Cu.evalInSandbox("this.script = " + sandboxScript.toString(), sandbox);
sandbox.script(div.shadowRoot);
ok(SpecialPowers.call_Instanceof(window.spanElementFromUAWidget, HTMLSpanElement), "<span> exposed");
ok(SpecialPowers.call_Instanceof(window.divElementFromUAWidget, HTMLDivElement), "<div> exposed");
ok(window.spanElementFromUAWidget instanceof HTMLSpanElement, "<span> exposed");
ok(window.divElementFromUAWidget instanceof HTMLDivElement, "<div> exposed");
try {
window.spanElementFromUAWidget.textContent;