Bug 1596056 - Format reftest harness files with Prettier. r=tnikkel

Depends on D189056

Differential Revision: https://phabricator.services.mozilla.com/D189057
This commit is contained in:
Mark Banner 2023-09-24 10:38:55 +00:00
parent 3dd3f97545
commit b8dcda2dd2
16 changed files with 6189 additions and 5213 deletions

View file

@ -1000,6 +1000,8 @@ uriloader/exthandler/tests/mochitest/save_filenames.html
# Also ignore reftest - specially crafted to produce expected output. # Also ignore reftest - specially crafted to produce expected output.
**/reftest/ **/reftest/
**/reftests/ **/reftests/
# Don't ignore the reftest harness files.
!/layout/tools/reftest/
# Exclude expected objdirs. # Exclude expected objdirs.
obj*/ obj*/

View file

@ -1,20 +1,28 @@
var EXPORTED_SYMBOLS = ["ReftestFissionChild"]; var EXPORTED_SYMBOLS = ["ReftestFissionChild"];
class ReftestFissionChild extends JSWindowActorChild { class ReftestFissionChild extends JSWindowActorChild {
forwardAfterPaintEventToParent(
forwardAfterPaintEventToParent(rects, originalTargetUri, dispatchToSelfAsWell) { rects,
originalTargetUri,
dispatchToSelfAsWell
) {
if (dispatchToSelfAsWell) { if (dispatchToSelfAsWell) {
let event = new this.contentWindow.CustomEvent("Reftest:MozAfterPaintFromChild", let event = new this.contentWindow.CustomEvent(
{bubbles: true, detail: {rects, originalTargetUri}}); "Reftest:MozAfterPaintFromChild",
{ bubbles: true, detail: { rects, originalTargetUri } }
);
this.contentWindow.dispatchEvent(event); this.contentWindow.dispatchEvent(event);
} }
let parentContext = this.browsingContext.parent; let parentContext = this.browsingContext.parent;
if (parentContext) { if (parentContext) {
try { try {
this.sendAsyncMessage("ForwardAfterPaintEvent", this.sendAsyncMessage("ForwardAfterPaintEvent", {
{toBrowsingContext: parentContext, fromBrowsingContext: this.browsingContext, toBrowsingContext: parentContext,
rects, originalTargetUri}); fromBrowsingContext: this.browsingContext,
rects,
originalTargetUri,
});
} catch (e) { } catch (e) {
// |this| can be destroyed here and unable to send messages, which is // |this| can be destroyed here and unable to send messages, which is
// not a problem, the reftest harness probably torn down the page and // not a problem, the reftest harness probably torn down the page and
@ -32,24 +40,33 @@ class ReftestFissionChild extends JSWindowActorChild {
// code (reftest-content.js) will process it and update the canvas. // code (reftest-content.js) will process it and update the canvas.
var rects = []; var rects = [];
for (let r of evt.clientRects) { for (let r of evt.clientRects) {
rects.push({ left: r.left, top: r.top, right: r.right, bottom: r.bottom }); rects.push({
left: r.left,
top: r.top,
right: r.right,
bottom: r.bottom,
});
} }
this.forwardAfterPaintEventToParent(rects, this.document.documentURI, /* dispatchToSelfAsWell */ false); this.forwardAfterPaintEventToParent(
rects,
this.document.documentURI,
/* dispatchToSelfAsWell */ false
);
break; break;
} }
} }
transformRect(transform, rect) { transformRect(transform, rect) {
let p1 = transform.transformPoint({x: rect.left, y: rect.top}); let p1 = transform.transformPoint({ x: rect.left, y: rect.top });
let p2 = transform.transformPoint({x: rect.right, y: rect.top}); let p2 = transform.transformPoint({ x: rect.right, y: rect.top });
let p3 = transform.transformPoint({x: rect.left, y: rect.bottom}); let p3 = transform.transformPoint({ x: rect.left, y: rect.bottom });
let p4 = transform.transformPoint({x: rect.right, y: rect.bottom}); let p4 = transform.transformPoint({ x: rect.right, y: rect.bottom });
let quad = new DOMQuad(p1, p2, p3, p4); let quad = new DOMQuad(p1, p2, p3, p4);
return quad.getBounds(); return quad.getBounds();
} }
SetupDisplayportRoot() { SetupDisplayportRoot() {
let returnStrings = {infoStrings: [], errorStrings: []}; let returnStrings = { infoStrings: [], errorStrings: [] };
let contentRootElement = this.contentWindow.document.documentElement; let contentRootElement = this.contentWindow.document.documentElement;
if (!contentRootElement) { if (!contentRootElement) {
@ -60,31 +77,43 @@ class ReftestFissionChild extends JSWindowActorChild {
// the root element for potential display ports to set. // the root element for potential display ports to set.
if (!contentRootElement.hasAttribute("reftest-async-scroll")) { if (!contentRootElement.hasAttribute("reftest-async-scroll")) {
let winUtils = this.contentWindow.windowUtils; let winUtils = this.contentWindow.windowUtils;
this.setupDisplayportForElement(contentRootElement, winUtils, returnStrings); this.setupDisplayportForElement(
contentRootElement,
winUtils,
returnStrings
);
return Promise.resolve(returnStrings); return Promise.resolve(returnStrings);
} }
// Send a msg to the parent side to get the parent side to tell all // Send a msg to the parent side to get the parent side to tell all
// process roots to do the displayport setting. // process roots to do the displayport setting.
let browsingContext = this.browsingContext; let browsingContext = this.browsingContext;
let promise = this.sendQuery("TellChildrenToSetupDisplayport", {browsingContext}); let promise = this.sendQuery("TellChildrenToSetupDisplayport", {
return promise.then(function(result) { browsingContext,
for (let errorString of result.errorStrings) {
returnStrings.errorStrings.push(errorString);
}
for (let infoString of result.infoStrings) {
returnStrings.infoStrings.push(infoString);
}
return returnStrings;
},
function(reason) {
returnStrings.errorStrings.push("SetupDisplayport SendQuery to parent promise rejected: " + reason);
return returnStrings;
}); });
return promise.then(
function (result) {
for (let errorString of result.errorStrings) {
returnStrings.errorStrings.push(errorString);
}
for (let infoString of result.infoStrings) {
returnStrings.infoStrings.push(infoString);
}
return returnStrings;
},
function (reason) {
returnStrings.errorStrings.push(
"SetupDisplayport SendQuery to parent promise rejected: " + reason
);
return returnStrings;
}
);
} }
attrOrDefault(element, attr, def) { attrOrDefault(element, attr, def) {
return element.hasAttribute(attr) ? Number(element.getAttribute(attr)) : def; return element.hasAttribute(attr)
? Number(element.getAttribute(attr))
: def;
} }
setupDisplayportForElement(element, winUtils, returnStrings) { setupDisplayportForElement(element, winUtils, returnStrings) {
@ -93,7 +122,17 @@ class ReftestFissionChild extends JSWindowActorChild {
var dpx = this.attrOrDefault(element, "reftest-displayport-x", 0); var dpx = this.attrOrDefault(element, "reftest-displayport-x", 0);
var dpy = this.attrOrDefault(element, "reftest-displayport-y", 0); var dpy = this.attrOrDefault(element, "reftest-displayport-y", 0);
if (dpw !== 0 || dph !== 0 || dpx != 0 || dpy != 0) { if (dpw !== 0 || dph !== 0 || dpx != 0 || dpy != 0) {
returnStrings.infoStrings.push("Setting displayport to <x="+ dpx +", y="+ dpy +", w="+ dpw +", h="+ dph +">"); returnStrings.infoStrings.push(
"Setting displayport to <x=" +
dpx +
", y=" +
dpy +
", w=" +
dpw +
", h=" +
dph +
">"
);
winUtils.setDisplayPortForElement(dpx, dpy, dpw, dph, element, 1); winUtils.setDisplayPortForElement(dpx, dpy, dpw, dph, element, 1);
} }
} }
@ -103,87 +142,140 @@ class ReftestFissionChild extends JSWindowActorChild {
for (let c = element.firstElementChild; c; c = c.nextElementSibling) { for (let c = element.firstElementChild; c; c = c.nextElementSibling) {
this.setupDisplayportForElementSubtree(c, winUtils, returnStrings); this.setupDisplayportForElementSubtree(c, winUtils, returnStrings);
} }
if (typeof element.contentDocument !== "undefined" && if (
element.contentDocument) { typeof element.contentDocument !== "undefined" &&
returnStrings.infoStrings.push("setupDisplayportForElementSubtree descending into subdocument"); element.contentDocument
this.setupDisplayportForElementSubtree(element.contentDocument.documentElement, ) {
element.contentWindow.windowUtils, returnStrings); returnStrings.infoStrings.push(
"setupDisplayportForElementSubtree descending into subdocument"
);
this.setupDisplayportForElementSubtree(
element.contentDocument.documentElement,
element.contentWindow.windowUtils,
returnStrings
);
} }
} }
setupAsyncScrollOffsetsForElement(element, winUtils, allowFailure, returnStrings) { setupAsyncScrollOffsetsForElement(
let sx = this.attrOrDefault(element, "reftest-async-scroll-x", 0); element,
let sy = this.attrOrDefault(element, "reftest-async-scroll-y", 0); winUtils,
if (sx != 0 || sy != 0) { allowFailure,
try { returnStrings
// This might fail when called from RecordResult since layers ) {
// may not have been constructed yet let sx = this.attrOrDefault(element, "reftest-async-scroll-x", 0);
winUtils.setAsyncScrollOffset(element, sx, sy); let sy = this.attrOrDefault(element, "reftest-async-scroll-y", 0);
return true; if (sx != 0 || sy != 0) {
} catch (e) { try {
if (allowFailure) { // This might fail when called from RecordResult since layers
returnStrings.infoStrings.push("setupAsyncScrollOffsetsForElement error calling setAsyncScrollOffset: " + e); // may not have been constructed yet
} else { winUtils.setAsyncScrollOffset(element, sx, sy);
returnStrings.errorStrings.push("setupAsyncScrollOffsetsForElement error calling setAsyncScrollOffset: " + e); return true;
} } catch (e) {
if (allowFailure) {
returnStrings.infoStrings.push(
"setupAsyncScrollOffsetsForElement error calling setAsyncScrollOffset: " +
e
);
} else {
returnStrings.errorStrings.push(
"setupAsyncScrollOffsetsForElement error calling setAsyncScrollOffset: " +
e
);
} }
} }
return false;
} }
return false;
}
setupAsyncScrollOffsetsForElementSubtree(element, winUtils, allowFailure, returnStrings) { setupAsyncScrollOffsetsForElementSubtree(
let updatedAny = this.setupAsyncScrollOffsetsForElement(element, winUtils, returnStrings); element,
for (let c = element.firstElementChild; c; c = c.nextElementSibling) { winUtils,
if (this.setupAsyncScrollOffsetsForElementSubtree(c, winUtils, allowFailure, returnStrings)) { allowFailure,
updatedAny = true; returnStrings
} ) {
let updatedAny = this.setupAsyncScrollOffsetsForElement(
element,
winUtils,
returnStrings
);
for (let c = element.firstElementChild; c; c = c.nextElementSibling) {
if (
this.setupAsyncScrollOffsetsForElementSubtree(
c,
winUtils,
allowFailure,
returnStrings
)
) {
updatedAny = true;
} }
if (typeof element.contentDocument !== "undefined" &&
element.contentDocument) {
returnStrings.infoStrings.push("setupAsyncScrollOffsetsForElementSubtree Descending into subdocument");
if (this.setupAsyncScrollOffsetsForElementSubtree(element.contentDocument.documentElement,
element.contentWindow.windowUtils, allowFailure, returnStrings)) {
updatedAny = true;
}
}
return updatedAny;
} }
if (
typeof element.contentDocument !== "undefined" &&
element.contentDocument
) {
returnStrings.infoStrings.push(
"setupAsyncScrollOffsetsForElementSubtree Descending into subdocument"
);
if (
this.setupAsyncScrollOffsetsForElementSubtree(
element.contentDocument.documentElement,
element.contentWindow.windowUtils,
allowFailure,
returnStrings
)
) {
updatedAny = true;
}
}
return updatedAny;
}
async receiveMessage(msg) { async receiveMessage(msg) {
switch (msg.name) { switch (msg.name) {
case "ForwardAfterPaintEventToSelfAndParent": case "ForwardAfterPaintEventToSelfAndParent": {
{
// The embedderElement can be null if the child we got this from was removed. // The embedderElement can be null if the child we got this from was removed.
// Not much we can do to transform the rects, but it doesn't matter, the rects // Not much we can do to transform the rects, but it doesn't matter, the rects
// won't reach reftest-content.js. // won't reach reftest-content.js.
if (msg.data.fromBrowsingContext.embedderElement == null) { if (msg.data.fromBrowsingContext.embedderElement == null) {
this.forwardAfterPaintEventToParent(msg.data.rects, msg.data.originalTargetUri, this.forwardAfterPaintEventToParent(
/* dispatchToSelfAsWell */ true); msg.data.rects,
msg.data.originalTargetUri,
/* dispatchToSelfAsWell */ true
);
return; return;
} }
// Transform the rects from fromBrowsingContext to us. // Transform the rects from fromBrowsingContext to us.
// We first translate from the content rect to the border rect of the iframe. // We first translate from the content rect to the border rect of the iframe.
let style = this.contentWindow.getComputedStyle(msg.data.fromBrowsingContext.embedderElement); let style = this.contentWindow.getComputedStyle(
msg.data.fromBrowsingContext.embedderElement
);
let translate = new DOMMatrixReadOnly().translate( let translate = new DOMMatrixReadOnly().translate(
parseFloat(style.paddingLeft) + parseFloat(style.borderLeftWidth), parseFloat(style.paddingLeft) + parseFloat(style.borderLeftWidth),
parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth)); parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth)
);
// Then we transform from the iframe to our root frame. // Then we transform from the iframe to our root frame.
// We are guaranteed to be the process with the embedderElement for fromBrowsingContext. // We are guaranteed to be the process with the embedderElement for fromBrowsingContext.
let transform = msg.data.fromBrowsingContext.embedderElement.getTransformToViewport(); let transform =
msg.data.fromBrowsingContext.embedderElement.getTransformToViewport();
let combined = translate.multiply(transform); let combined = translate.multiply(transform);
let newrects = msg.data.rects.map(r => this.transformRect(combined, r)) let newrects = msg.data.rects.map(r => this.transformRect(combined, r));
this.forwardAfterPaintEventToParent(newrects, msg.data.originalTargetUri, /* dispatchToSelfAsWell */ true); this.forwardAfterPaintEventToParent(
newrects,
msg.data.originalTargetUri,
/* dispatchToSelfAsWell */ true
);
break; break;
} }
case "EmptyMessage": case "EmptyMessage":
return undefined; return undefined;
case "UpdateLayerTree": case "UpdateLayerTree": {
{
let errorStrings = []; let errorStrings = [];
try { try {
if (this.manager.isProcessRoot) { if (this.manager.isProcessRoot) {
@ -192,22 +284,23 @@ class ReftestFissionChild extends JSWindowActorChild {
} catch (e) { } catch (e) {
errorStrings.push("updateLayerTree failed: " + e); errorStrings.push("updateLayerTree failed: " + e);
} }
return {errorStrings}; return { errorStrings };
} }
case "FlushRendering": case "FlushRendering": {
{
let errorStrings = []; let errorStrings = [];
let warningStrings = []; let warningStrings = [];
let infoStrings = []; let infoStrings = [];
try { try {
let {ignoreThrottledAnimations, needsAnimationFrame} = msg.data; let { ignoreThrottledAnimations, needsAnimationFrame } = msg.data;
if (this.manager.isProcessRoot) { if (this.manager.isProcessRoot) {
var anyPendingPaintsGeneratedInDescendants = false; var anyPendingPaintsGeneratedInDescendants = false;
if (needsAnimationFrame) { if (needsAnimationFrame) {
await new Promise(resolve => this.contentWindow.requestAnimationFrame(resolve)); await new Promise(resolve =>
this.contentWindow.requestAnimationFrame(resolve)
);
} }
function flushWindow(win) { function flushWindow(win) {
@ -228,7 +321,10 @@ class ReftestFissionChild extends JSWindowActorChild {
} }
if (!afterPaintWasPending && utils.isMozAfterPaintPending) { if (!afterPaintWasPending && utils.isMozAfterPaintPending) {
infoStrings.push("FlushRendering generated paint for window " + win.location.href); infoStrings.push(
"FlushRendering generated paint for window " +
win.location.href
);
anyPendingPaintsGeneratedInDescendants = true; anyPendingPaintsGeneratedInDescendants = true;
} }
@ -249,32 +345,37 @@ class ReftestFissionChild extends JSWindowActorChild {
flushWindow(this.contentWindow); flushWindow(this.contentWindow);
} }
if (anyPendingPaintsGeneratedInDescendants && if (
!this.contentWindow.windowUtils.isMozAfterPaintPending) { anyPendingPaintsGeneratedInDescendants &&
warningStrings.push("Internal error: descendant frame generated a MozAfterPaint event, but the root document doesn't have one!"); !this.contentWindow.windowUtils.isMozAfterPaintPending
) {
warningStrings.push(
"Internal error: descendant frame generated a MozAfterPaint event, but the root document doesn't have one!"
);
} }
} }
} catch (e) { } catch (e) {
errorStrings.push("flushWindow failed: " + e); errorStrings.push("flushWindow failed: " + e);
} }
return {errorStrings, warningStrings, infoStrings}; return { errorStrings, warningStrings, infoStrings };
} }
case "SetupDisplayport": case "SetupDisplayport": {
{
let contentRootElement = this.document.documentElement; let contentRootElement = this.document.documentElement;
let winUtils = this.contentWindow.windowUtils; let winUtils = this.contentWindow.windowUtils;
let returnStrings = {infoStrings: [], errorStrings: []}; let returnStrings = { infoStrings: [], errorStrings: [] };
if (contentRootElement) { if (contentRootElement) {
this.setupDisplayportForElementSubtree(contentRootElement, winUtils, returnStrings); this.setupDisplayportForElementSubtree(
contentRootElement,
winUtils,
returnStrings
);
} }
return returnStrings; return returnStrings;
} }
case "SetupAsyncScrollOffsets": case "SetupAsyncScrollOffsets": {
{ let returns = { infoStrings: [], errorStrings: [], updatedAny: false };
let returns = {infoStrings: [], errorStrings: [], updatedAny: false};
let contentRootElement = this.document.documentElement; let contentRootElement = this.document.documentElement;
if (!contentRootElement) { if (!contentRootElement) {
@ -283,10 +384,14 @@ class ReftestFissionChild extends JSWindowActorChild {
let winUtils = this.contentWindow.windowUtils; let winUtils = this.contentWindow.windowUtils;
returns.updatedAny = this.setupAsyncScrollOffsetsForElementSubtree(contentRootElement, winUtils, msg.data.allowFailure, returns); returns.updatedAny = this.setupAsyncScrollOffsetsForElementSubtree(
contentRootElement,
winUtils,
msg.data.allowFailure,
returns
);
return returns; return returns;
} }
} }
} }
} }

View file

@ -1,25 +1,46 @@
var EXPORTED_SYMBOLS = ["ReftestFissionParent"]; var EXPORTED_SYMBOLS = ["ReftestFissionParent"];
class ReftestFissionParent extends JSWindowActorParent { class ReftestFissionParent extends JSWindowActorParent {
tellChildrenToFlushRendering(
tellChildrenToFlushRendering(browsingContext, ignoreThrottledAnimations, needsAnimationFrame) { browsingContext,
ignoreThrottledAnimations,
needsAnimationFrame
) {
let promises = []; let promises = [];
this.tellChildrenToFlushRenderingRecursive(browsingContext, ignoreThrottledAnimations, needsAnimationFrame, promises); this.tellChildrenToFlushRenderingRecursive(
browsingContext,
ignoreThrottledAnimations,
needsAnimationFrame,
promises
);
return Promise.allSettled(promises); return Promise.allSettled(promises);
} }
tellChildrenToFlushRenderingRecursive(browsingContext, ignoreThrottledAnimations, needsAnimationFrame, promises) { tellChildrenToFlushRenderingRecursive(
browsingContext,
ignoreThrottledAnimations,
needsAnimationFrame,
promises
) {
let cwg = browsingContext.currentWindowGlobal; let cwg = browsingContext.currentWindowGlobal;
if (cwg && cwg.isProcessRoot) { if (cwg && cwg.isProcessRoot) {
let a = cwg.getActor("ReftestFission"); let a = cwg.getActor("ReftestFission");
if (a) { if (a) {
let responsePromise = a.sendQuery("FlushRendering", {ignoreThrottledAnimations, needsAnimationFrame}); let responsePromise = a.sendQuery("FlushRendering", {
ignoreThrottledAnimations,
needsAnimationFrame,
});
promises.push(responsePromise); promises.push(responsePromise);
} }
} }
for (let context of browsingContext.children) { for (let context of browsingContext.children) {
this.tellChildrenToFlushRenderingRecursive(context, ignoreThrottledAnimations, needsAnimationFrame, promises); this.tellChildrenToFlushRenderingRecursive(
context,
ignoreThrottledAnimations,
needsAnimationFrame,
promises
);
} }
} }
@ -51,14 +72,16 @@ class ReftestFissionParent extends JSWindowActorParent {
let cwg = browsingContext.currentWindowGlobal; let cwg = browsingContext.currentWindowGlobal;
if (!cwg || !cwg.isProcessRoot) { if (!cwg || !cwg.isProcessRoot) {
if (cwg) { if (cwg) {
errorStrings.push("tellChildrenToUpdateLayerTree called on a non process root?"); errorStrings.push(
"tellChildrenToUpdateLayerTree called on a non process root?"
);
} }
return {errorStrings, infoStrings}; return { errorStrings, infoStrings };
} }
let actor = cwg.getActor("ReftestFission"); let actor = cwg.getActor("ReftestFission");
if (!actor) { if (!actor) {
return {errorStrings, infoStrings}; return { errorStrings, infoStrings };
} }
// When we paint a document we also update the EffectsInfo visible rect in // When we paint a document we also update the EffectsInfo visible rect in
@ -77,22 +100,31 @@ class ReftestFissionParent extends JSWindowActorParent {
let result = await actor.sendQuery("UpdateLayerTree"); let result = await actor.sendQuery("UpdateLayerTree");
errorStrings.push(...result.errorStrings); errorStrings.push(...result.errorStrings);
} catch (e) { } catch (e) {
infoStrings.push("tellChildrenToUpdateLayerTree UpdateLayerTree msg to child rejected: " + e); infoStrings.push(
"tellChildrenToUpdateLayerTree UpdateLayerTree msg to child rejected: " +
e
);
} }
let descendants = actor.getNearestProcessRootProperDescendants(browsingContext); let descendants =
actor.getNearestProcessRootProperDescendants(browsingContext);
for (let context of descendants) { for (let context of descendants) {
let cwg2 = context.currentWindowGlobal; let cwg2 = context.currentWindowGlobal;
if (cwg2) { if (cwg2) {
if (!cwg2.isProcessRoot) { if (!cwg2.isProcessRoot) {
errorStrings.push("getNearestProcessRootProperDescendants returned a non process root?"); errorStrings.push(
"getNearestProcessRootProperDescendants returned a non process root?"
);
} }
let actor2 = cwg2.getActor("ReftestFission"); let actor2 = cwg2.getActor("ReftestFission");
if (actor2) { if (actor2) {
try { try {
await actor2.sendQuery("EmptyMessage"); await actor2.sendQuery("EmptyMessage");
} catch(e) { } catch (e) {
infoStrings.push("tellChildrenToUpdateLayerTree EmptyMessage msg to child rejected: " + e); infoStrings.push(
"tellChildrenToUpdateLayerTree EmptyMessage msg to child rejected: " +
e
);
} }
try { try {
@ -100,14 +132,16 @@ class ReftestFissionParent extends JSWindowActorParent {
errorStrings.push(...result2.errorStrings); errorStrings.push(...result2.errorStrings);
infoStrings.push(...result2.infoStrings); infoStrings.push(...result2.infoStrings);
} catch (e) { } catch (e) {
errorStrings.push("tellChildrenToUpdateLayerTree recursive tellChildrenToUpdateLayerTree call rejected: " + e); errorStrings.push(
"tellChildrenToUpdateLayerTree recursive tellChildrenToUpdateLayerTree call rejected: " +
e
);
} }
} }
} }
} }
return {errorStrings, infoStrings}; return { errorStrings, infoStrings };
} }
tellChildrenToSetupDisplayport(browsingContext, promises) { tellChildrenToSetupDisplayport(browsingContext, promises) {
@ -125,38 +159,52 @@ class ReftestFissionParent extends JSWindowActorParent {
} }
} }
tellChildrenToSetupAsyncScrollOffsets(browsingContext, allowFailure, promises) { tellChildrenToSetupAsyncScrollOffsets(
browsingContext,
allowFailure,
promises
) {
let cwg = browsingContext.currentWindowGlobal; let cwg = browsingContext.currentWindowGlobal;
if (cwg && cwg.isProcessRoot) { if (cwg && cwg.isProcessRoot) {
let a = cwg.getActor("ReftestFission"); let a = cwg.getActor("ReftestFission");
if (a) { if (a) {
let responsePromise = a.sendQuery("SetupAsyncScrollOffsets", {allowFailure}); let responsePromise = a.sendQuery("SetupAsyncScrollOffsets", {
allowFailure,
});
promises.push(responsePromise); promises.push(responsePromise);
} }
} }
for (let context of browsingContext.children) { for (let context of browsingContext.children) {
this.tellChildrenToSetupAsyncScrollOffsets(context, allowFailure, promises); this.tellChildrenToSetupAsyncScrollOffsets(
context,
allowFailure,
promises
);
} }
} }
receiveMessage(msg) { receiveMessage(msg) {
switch (msg.name) { switch (msg.name) {
case "ForwardAfterPaintEvent": case "ForwardAfterPaintEvent": {
{
let cwg = msg.data.toBrowsingContext.currentWindowGlobal; let cwg = msg.data.toBrowsingContext.currentWindowGlobal;
if (cwg) { if (cwg) {
let a = cwg.getActor("ReftestFission"); let a = cwg.getActor("ReftestFission");
if (a) { if (a) {
a.sendAsyncMessage("ForwardAfterPaintEventToSelfAndParent", msg.data); a.sendAsyncMessage(
"ForwardAfterPaintEventToSelfAndParent",
msg.data
);
} }
} }
break; break;
} }
case "FlushRendering": case "FlushRendering": {
{ let promise = this.tellChildrenToFlushRendering(
let promise = this.tellChildrenToFlushRendering(msg.data.browsingContext, msg.data.ignoreThrottledAnimations, msg.data.needsAnimationFrame); msg.data.browsingContext,
msg.data.ignoreThrottledAnimations,
msg.data.needsAnimationFrame
);
return promise.then(function (results) { return promise.then(function (results) {
let errorStrings = []; let errorStrings = [];
let warningStrings = []; let warningStrings = [];
@ -164,11 +212,16 @@ class ReftestFissionParent extends JSWindowActorParent {
for (let r of results) { for (let r of results) {
if (r.status != "fulfilled") { if (r.status != "fulfilled") {
if (r.status == "pending") { if (r.status == "pending") {
errorStrings.push("FlushRendering sendQuery to child promise still pending?"); errorStrings.push(
"FlushRendering sendQuery to child promise still pending?"
);
} else { } else {
// We expect actors to go away causing sendQuery's to fail, so // We expect actors to go away causing sendQuery's to fail, so
// just note it. // just note it.
infoStrings.push("FlushRendering sendQuery to child promise rejected: " + r.reason); infoStrings.push(
"FlushRendering sendQuery to child promise rejected: " +
r.reason
);
} }
continue; continue;
} }
@ -177,15 +230,13 @@ class ReftestFissionParent extends JSWindowActorParent {
warningStrings.push(...r.value.warningStrings); warningStrings.push(...r.value.warningStrings);
infoStrings.push(...r.value.infoStrings); infoStrings.push(...r.value.infoStrings);
} }
return {errorStrings, warningStrings, infoStrings}; return { errorStrings, warningStrings, infoStrings };
}); });
} }
case "UpdateLayerTree": case "UpdateLayerTree": {
{
return this.tellChildrenToUpdateLayerTree(msg.data.browsingContext); return this.tellChildrenToUpdateLayerTree(msg.data.browsingContext);
} }
case "TellChildrenToSetupDisplayport": case "TellChildrenToSetupDisplayport": {
{
let promises = []; let promises = [];
this.tellChildrenToSetupDisplayport(msg.data.browsingContext, promises); this.tellChildrenToSetupDisplayport(msg.data.browsingContext, promises);
return Promise.allSettled(promises).then(function (results) { return Promise.allSettled(promises).then(function (results) {
@ -195,21 +246,27 @@ class ReftestFissionParent extends JSWindowActorParent {
if (r.status != "fulfilled") { if (r.status != "fulfilled") {
// We expect actors to go away causing sendQuery's to fail, so // We expect actors to go away causing sendQuery's to fail, so
// just note it. // just note it.
infoStrings.push("SetupDisplayport sendQuery to child promise rejected: " + r.reason); infoStrings.push(
"SetupDisplayport sendQuery to child promise rejected: " +
r.reason
);
continue; continue;
} }
errorStrings.push(...r.value.errorStrings); errorStrings.push(...r.value.errorStrings);
infoStrings.push(...r.value.infoStrings); infoStrings.push(...r.value.infoStrings);
} }
return {errorStrings, infoStrings} return { errorStrings, infoStrings };
}); });
} }
case "SetupAsyncScrollOffsets": case "SetupAsyncScrollOffsets": {
{
let promises = []; let promises = [];
this.tellChildrenToSetupAsyncScrollOffsets(this.manager.browsingContext, msg.data.allowFailure, promises); this.tellChildrenToSetupAsyncScrollOffsets(
this.manager.browsingContext,
msg.data.allowFailure,
promises
);
return Promise.allSettled(promises).then(function (results) { return Promise.allSettled(promises).then(function (results) {
let errorStrings = []; let errorStrings = [];
let infoStrings = []; let infoStrings = [];
@ -218,7 +275,10 @@ class ReftestFissionParent extends JSWindowActorParent {
if (r.status != "fulfilled") { if (r.status != "fulfilled") {
// We expect actors to go away causing sendQuery's to fail, so // We expect actors to go away causing sendQuery's to fail, so
// just note it. // just note it.
infoStrings.push("SetupAsyncScrollOffsets sendQuery to child promise rejected: " + r.reason); infoStrings.push(
"SetupAsyncScrollOffsets sendQuery to child promise rejected: " +
r.reason
);
continue; continue;
} }
@ -228,11 +288,9 @@ class ReftestFissionParent extends JSWindowActorParent {
updatedAny = true; updatedAny = true;
} }
} }
return {errorStrings, infoStrings, updatedAny}; return { errorStrings, infoStrings, updatedAny };
}); });
} }
} }
} }
} }

View file

@ -33,7 +33,7 @@ function processTerminated() {
function startAndroid(win) { function startAndroid(win) {
// Add setTimeout here because windows.innerWidth/Height are not set yet. // Add setTimeout here because windows.innerWidth/Height are not set yet.
win.setTimeout(function() { win.setTimeout(function () {
OnRefTestLoad(win); OnRefTestLoad(win);
}, 0); }, 0);
} }
@ -125,7 +125,7 @@ this.reftest = class extends ExtensionAPI {
"chrome,dialog=no,left=800,height=200,width=200,all", "chrome,dialog=no,left=800,height=200,width=200,all",
null null
); );
dummy.onload = async function() { dummy.onload = async function () {
// Close pre-existing window // Close pre-existing window
win.close(); win.close();

View file

@ -17,16 +17,16 @@ for (let [key, val] of Object.entries({
NS_DIRECTORY_SERVICE_CONTRACTID: "@mozilla.org/file/directory_service;1", NS_DIRECTORY_SERVICE_CONTRACTID: "@mozilla.org/file/directory_service;1",
NS_OBSERVER_SERVICE_CONTRACTID: "@mozilla.org/observer-service;1", NS_OBSERVER_SERVICE_CONTRACTID: "@mozilla.org/observer-service;1",
TYPE_REFTEST_EQUAL: '==', TYPE_REFTEST_EQUAL: "==",
TYPE_REFTEST_NOTEQUAL: '!=', TYPE_REFTEST_NOTEQUAL: "!=",
TYPE_LOAD: 'load', // test without a reference (just test that it does TYPE_LOAD: "load", // test without a reference (just test that it does
// not assert, crash, hang, or leak) // not assert, crash, hang, or leak)
TYPE_SCRIPT: 'script', // test contains individual test results TYPE_SCRIPT: "script", // test contains individual test results
TYPE_PRINT: 'print', // test and reference will be printed to PDF's and TYPE_PRINT: "print", // test and reference will be printed to PDF's and
// compared structurally // compared structurally
// keep this in sync with reftest-content.js // keep this in sync with reftest-content.js
URL_TARGET_TYPE_TEST: 0, // first url URL_TARGET_TYPE_TEST: 0, // first url
URL_TARGET_TYPE_REFERENCE: 1, // second url, if any URL_TARGET_TYPE_REFERENCE: 1, // second url, if any
// The order of these constants matters, since when we have a status // The order of these constants matters, since when we have a status
@ -50,7 +50,8 @@ for (let [key, val] of Object.entries({
FOCUS_FILTER_NON_NEEDS_FOCUS_TESTS: "non-needs-focus", FOCUS_FILTER_NON_NEEDS_FOCUS_TESTS: "non-needs-focus",
// "<!--CLEAR-->" // "<!--CLEAR-->"
BLANK_URL_FOR_CLEARING: "data:text/html;charset=UTF-8,%3C%21%2D%2DCLEAR%2D%2D%3E", BLANK_URL_FOR_CLEARING:
"data:text/html;charset=UTF-8,%3C%21%2D%2DCLEAR%2D%2D%3E",
/* Globals */ /* Globals */
g: { g: {
@ -73,11 +74,11 @@ for (let [key, val] of Object.entries({
browser: undefined, browser: undefined,
// Are we testing web content loaded in a separate process? // Are we testing web content loaded in a separate process?
browserIsRemote: undefined, // bool browserIsRemote: undefined, // bool
// Are we using <iframe mozbrowser>? // Are we using <iframe mozbrowser>?
browserIsIframe: undefined, // bool browserIsIframe: undefined, // bool
browserMessageManager: undefined, // bool browserMessageManager: undefined, // bool
useDrawSnapshot: undefined, // bool useDrawSnapshot: undefined, // bool
canvas1: undefined, canvas1: undefined,
canvas2: undefined, canvas2: undefined,
// gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next // gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next
@ -100,9 +101,9 @@ for (let [key, val] of Object.entries({
AssertionUnexpected: 0, AssertionUnexpected: 0,
AssertionUnexpectedFixed: 0, AssertionUnexpectedFixed: 0,
// Known problems... // Known problems...
KnownFail : 0, KnownFail: 0,
AssertionKnown: 0, AssertionKnown: 0,
Random : 0, Random: 0,
Skip: 0, Skip: 0,
Slow: 0, Slow: 0,
}, },
@ -159,7 +160,7 @@ for (let [key, val] of Object.entries({
// Only dump the sandbox once, because it doesn't depend on the // Only dump the sandbox once, because it doesn't depend on the
// manifest URL (yet!). // manifest URL (yet!).
dumpedConditionSandbox: false, dumpedConditionSandbox: false,
} },
})) { })) {
this[key] = val; this[key] = val;
EXPORTED_SYMBOLS.push(key); EXPORTED_SYMBOLS.push(key);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,12 +1,14 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public <!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" <window
id="reftest-window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
hidechrome="true" id="reftest-window"
onload="OnRefTestLoad();" hidechrome="true"
onunload="OnRefTestUnload();" onload="OnRefTestLoad();"
style="background:white; overflow:hidden"> onunload="OnRefTestUnload();"
<script type="application/ecmascript" src="resource://reftest/reftest.jsm" /> style="background: white; overflow: hidden"
<!-- The reftest browser element is dynamically created, here --> >
<script type="application/ecmascript" src="resource://reftest/reftest.jsm" />
<!-- The reftest browser element is dynamically created, here -->
</window> </window>

View file

@ -1,7 +1,7 @@
<script> <script>
const Cc = SpecialPowers.Cc; const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci; const Ci = SpecialPowers.Ci;
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2); let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
debug.assertion('failed assertion check', 'false', 'assert.html', 6); debug.assertion("failed assertion check", "false", "assert.html", 6);
</script> </script>

View file

@ -1,7 +1,7 @@
<script> <script>
const Cc = SpecialPowers.Cc; const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci; const Ci = SpecialPowers.Ci;
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2); let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
debug.abort('crash.html', 6); debug.abort("crash.html", 6);
</script> </script>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<div style="color: green">Text</div> <div style="color: green">Text</div>
</body> </body>
</html> </html>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<div style="color: red">Text</div> <div style="color: red">Text</div>
</body> </body>
</html> </html>

View file

@ -1,17 +1,23 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>scripttest-pass</title> <title>scripttest-pass</title>
<script type="text/javascript"> <script type="text/javascript">
function getTestCases() function getTestCases() {
{ return [
return [ {
{ testPassed: (function () { return true; }), testDescription: (function () { return "passed"; }) } testPassed: function () {
]; return true;
} },
</script> testDescription: function () {
</head> return "passed";
<body> },
<h1>scripttest-pass</h1> },
</body> ];
}
</script>
</head>
<body>
<h1>scripttest-pass</h1>
</body>
</html> </html>