зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1360715 - Part 2: Modify instanceofs in tests to non-cross-context r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D106662
This commit is contained in:
Родитель
933c060bcd
Коммит
a9417a719e
|
@ -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 Window,
|
||||
ok(frames[0][0] instanceof frames[0][0].Window,
|
||||
"Should have a subframe window for a root iframe");
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -1126,7 +1126,7 @@ TestArray.addTest(
|
|||
|
||||
return Promise.all([p1, p2, p3]).then(complete(that, keys => {
|
||||
return keys.every(key => {
|
||||
if (key instanceof CryptoKey) {
|
||||
if (key instanceof frames[0].CryptoKey) {
|
||||
return checkPrototypes(key, "CryptoKey");
|
||||
}
|
||||
|
||||
|
|
|
@ -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.unwrap(evt.originalTarget) instanceof HTMLDivElement,
|
||||
ok(SpecialPowers.call_Instanceof(evt.originalTarget, 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,
|
||||
|
|
|
@ -44,12 +44,13 @@ function startTest(frameid) {
|
|||
is(childUnloaded, false, "Child not unloaded yet");
|
||||
|
||||
var doc = $(frameid).contentDocument;
|
||||
ok(doc instanceof Document, "doc should be a document");
|
||||
var win = $(frameid).contentWindow;
|
||||
ok(doc instanceof win.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 nodes[i][1], id + " should be a " + nodes[i][1]);
|
||||
ok(node instanceof win[nodes[i][1].name], 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");
|
||||
|
@ -67,7 +68,8 @@ function startTest(frameid) {
|
|||
function continueTest(frameid) {
|
||||
is(childUnloaded, true, "Unload handler should have fired");
|
||||
var doc = $(frameid).contentDocument;
|
||||
ok(doc instanceof Document, "doc should be a document");
|
||||
var win = $(frameid).contentWindow;
|
||||
ok(doc instanceof win.Document, "doc should be a document");
|
||||
|
||||
for (var i = 0; i < nodes.length; ++i) {
|
||||
var id = nodes[i][0];
|
||||
|
@ -100,12 +102,13 @@ function flipper(a, b, c) {
|
|||
|
||||
function finishTest(frameid) {
|
||||
var doc = $(frameid).contentDocument;
|
||||
ok(doc instanceof Document, "doc should be a document");
|
||||
var win = $(frameid).contentWindow;
|
||||
ok(doc instanceof win.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 nodes[i][1], id + " should be a " + nodes[i][1]);
|
||||
ok(node instanceof win[nodes[i][1].name], id + " should be a " + nodes[i][1]);
|
||||
//testIs(node.disabled, true, "check for " + id + " state restore");
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,13 @@ async function test_nativeStream_continue(r, that) {
|
|||
|
||||
let blob = await r.blob();
|
||||
|
||||
that.ok(blob instanceof Blob, "We have a blob");
|
||||
that.ok(blob instanceof that.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 Blob, "We have a blob");
|
||||
that.ok(blob instanceof that.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 Blob, "We have a blob");
|
||||
that.ok(blob instanceof that.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 Blob, "We have a blob");
|
||||
that.ok(blob instanceof that.Blob, "We have a blob");
|
||||
that.is(blob.size, data.buffer.byteLength, "Blob size matches");
|
||||
}
|
||||
|
||||
|
|
|
@ -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 instanceof Window) {
|
||||
if (aTarget.Window && aTarget instanceof aTarget.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 instanceof Window) {
|
||||
if (aTarget.Window && aTarget instanceof aTarget.Window) {
|
||||
return aTarget.document.documentElement;
|
||||
}
|
||||
return aTarget;
|
||||
|
|
|
@ -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 HTMLFrameElement))
|
||||
if (!(elem instanceof elem.ownerDocument.defaultView.HTMLFrameElement))
|
||||
is(elem.getSVGDocument(), null, "null cross-origin getSVGDocument() for " + desc);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ function run() {
|
|||
mql: subwin.matchMedia(str),
|
||||
notifyCount: 0,
|
||||
listener: function(event) {
|
||||
ok(event instanceof MediaQueryListEvent,
|
||||
ok(event instanceof subwin.MediaQueryListEvent,
|
||||
"correct argument to listener: " + obj.str);
|
||||
is(event.media, obj.mql.media,
|
||||
"correct media in the event: " + obj.str);
|
||||
|
|
|
@ -1106,9 +1106,9 @@ class AccessibilityTest : BaseSessionTest() {
|
|||
$doc.querySelector('${entry.key}').addEventListener(
|
||||
'input', event => {
|
||||
let eventInterface =
|
||||
event instanceof InputEvent ? "InputEvent" :
|
||||
event instanceof UIEvent ? "UIEvent" :
|
||||
event instanceof Event ? "Event" : "Unknown";
|
||||
event instanceof $doc.defaultView.InputEvent ? "InputEvent" :
|
||||
event instanceof $doc.defaultView.UIEvent ? "UIEvent" :
|
||||
event instanceof $doc.defaultView.Event ? "Event" : "Unknown";
|
||||
resolve([event.target.value, '${entry.value}', eventInterface]);
|
||||
}, { once: true }))""")
|
||||
}
|
||||
|
|
|
@ -172,9 +172,9 @@ class AutofillDelegateTest : BaseSessionTest() {
|
|||
$doc.querySelector('${entry.key}').addEventListener(
|
||||
'input', event => {
|
||||
let eventInterface =
|
||||
event instanceof InputEvent ? "InputEvent" :
|
||||
event instanceof UIEvent ? "UIEvent" :
|
||||
event instanceof Event ? "Event" : "Unknown";
|
||||
event instanceof $doc.defaultView.InputEvent ? "InputEvent" :
|
||||
event instanceof $doc.defaultView.UIEvent ? "UIEvent" :
|
||||
event instanceof $doc.defaultView.Event ? "Event" : "Unknown";
|
||||
resolve([
|
||||
'${entry.key}',
|
||||
event.target.value,
|
||||
|
|
|
@ -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 Window, "The object element should represent a nested browsing context.")
|
||||
assert_true(obj.contentWindow instanceof obj.contentWindow.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.");
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
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
|
||||
|
@ -25,7 +26,7 @@
|
|||
doc.write("<div id=beer></div>");
|
||||
|
||||
let elem = doc.getElementById("beer");
|
||||
top.postMessage(elem instanceof HTMLDivElement ? "ok" : "fail",
|
||||
top.postMessage(elem instanceof win.HTMLDivElement ? "ok" : "fail",
|
||||
"*");
|
||||
|
||||
doc.close();
|
||||
|
|
|
@ -78,8 +78,8 @@ const sandboxScript = function(shadowRoot) {
|
|||
SpecialPowers.Cu.evalInSandbox("this.script = " + sandboxScript.toString(), sandbox);
|
||||
sandbox.script(div.shadowRoot);
|
||||
|
||||
ok(window.spanElementFromUAWidget instanceof HTMLSpanElement, "<span> exposed");
|
||||
ok(window.divElementFromUAWidget instanceof HTMLDivElement, "<div> exposed");
|
||||
ok(SpecialPowers.call_Instanceof(window.spanElementFromUAWidget, HTMLSpanElement), "<span> exposed");
|
||||
ok(SpecialPowers.call_Instanceof(window.divElementFromUAWidget, HTMLDivElement), "<div> exposed");
|
||||
|
||||
try {
|
||||
window.spanElementFromUAWidget.textContent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче