зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
3dd3f97545
Коммит
b8dcda2dd2
|
@ -1000,6 +1000,8 @@ uriloader/exthandler/tests/mochitest/save_filenames.html
|
|||
# Also ignore reftest - specially crafted to produce expected output.
|
||||
**/reftest/
|
||||
**/reftests/
|
||||
# Don't ignore the reftest harness files.
|
||||
!/layout/tools/reftest/
|
||||
|
||||
# Exclude expected objdirs.
|
||||
obj*/
|
||||
|
|
|
@ -1,20 +1,28 @@
|
|||
var EXPORTED_SYMBOLS = ["ReftestFissionChild"];
|
||||
|
||||
class ReftestFissionChild extends JSWindowActorChild {
|
||||
|
||||
forwardAfterPaintEventToParent(rects, originalTargetUri, dispatchToSelfAsWell) {
|
||||
forwardAfterPaintEventToParent(
|
||||
rects,
|
||||
originalTargetUri,
|
||||
dispatchToSelfAsWell
|
||||
) {
|
||||
if (dispatchToSelfAsWell) {
|
||||
let event = new this.contentWindow.CustomEvent("Reftest:MozAfterPaintFromChild",
|
||||
{bubbles: true, detail: {rects, originalTargetUri}});
|
||||
let event = new this.contentWindow.CustomEvent(
|
||||
"Reftest:MozAfterPaintFromChild",
|
||||
{ bubbles: true, detail: { rects, originalTargetUri } }
|
||||
);
|
||||
this.contentWindow.dispatchEvent(event);
|
||||
}
|
||||
|
||||
let parentContext = this.browsingContext.parent;
|
||||
if (parentContext) {
|
||||
try {
|
||||
this.sendAsyncMessage("ForwardAfterPaintEvent",
|
||||
{toBrowsingContext: parentContext, fromBrowsingContext: this.browsingContext,
|
||||
rects, originalTargetUri});
|
||||
this.sendAsyncMessage("ForwardAfterPaintEvent", {
|
||||
toBrowsingContext: parentContext,
|
||||
fromBrowsingContext: this.browsingContext,
|
||||
rects,
|
||||
originalTargetUri,
|
||||
});
|
||||
} catch (e) {
|
||||
// |this| can be destroyed here and unable to send messages, which is
|
||||
// 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.
|
||||
var rects = [];
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
transformRect(transform, rect) {
|
||||
let p1 = transform.transformPoint({x: rect.left, y: rect.top});
|
||||
let p2 = transform.transformPoint({x: rect.right, y: rect.top});
|
||||
let p3 = transform.transformPoint({x: rect.left, y: rect.bottom});
|
||||
let p4 = transform.transformPoint({x: rect.right, y: rect.bottom});
|
||||
let p1 = transform.transformPoint({ x: rect.left, y: rect.top });
|
||||
let p2 = transform.transformPoint({ x: rect.right, y: rect.top });
|
||||
let p3 = transform.transformPoint({ x: rect.left, y: rect.bottom });
|
||||
let p4 = transform.transformPoint({ x: rect.right, y: rect.bottom });
|
||||
let quad = new DOMQuad(p1, p2, p3, p4);
|
||||
return quad.getBounds();
|
||||
}
|
||||
|
||||
SetupDisplayportRoot() {
|
||||
let returnStrings = {infoStrings: [], errorStrings: []};
|
||||
let returnStrings = { infoStrings: [], errorStrings: [] };
|
||||
|
||||
let contentRootElement = this.contentWindow.document.documentElement;
|
||||
if (!contentRootElement) {
|
||||
|
@ -60,31 +77,43 @@ class ReftestFissionChild extends JSWindowActorChild {
|
|||
// the root element for potential display ports to set.
|
||||
if (!contentRootElement.hasAttribute("reftest-async-scroll")) {
|
||||
let winUtils = this.contentWindow.windowUtils;
|
||||
this.setupDisplayportForElement(contentRootElement, winUtils, returnStrings);
|
||||
this.setupDisplayportForElement(
|
||||
contentRootElement,
|
||||
winUtils,
|
||||
returnStrings
|
||||
);
|
||||
return Promise.resolve(returnStrings);
|
||||
}
|
||||
|
||||
// Send a msg to the parent side to get the parent side to tell all
|
||||
// process roots to do the displayport setting.
|
||||
let browsingContext = this.browsingContext;
|
||||
let promise = this.sendQuery("TellChildrenToSetupDisplayport", {browsingContext});
|
||||
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;
|
||||
let promise = this.sendQuery("TellChildrenToSetupDisplayport", {
|
||||
browsingContext,
|
||||
});
|
||||
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) {
|
||||
return element.hasAttribute(attr) ? Number(element.getAttribute(attr)) : def;
|
||||
return element.hasAttribute(attr)
|
||||
? Number(element.getAttribute(attr))
|
||||
: def;
|
||||
}
|
||||
|
||||
setupDisplayportForElement(element, winUtils, returnStrings) {
|
||||
|
@ -93,7 +122,17 @@ class ReftestFissionChild extends JSWindowActorChild {
|
|||
var dpx = this.attrOrDefault(element, "reftest-displayport-x", 0);
|
||||
var dpy = this.attrOrDefault(element, "reftest-displayport-y", 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);
|
||||
}
|
||||
}
|
||||
|
@ -103,87 +142,140 @@ class ReftestFissionChild extends JSWindowActorChild {
|
|||
for (let c = element.firstElementChild; c; c = c.nextElementSibling) {
|
||||
this.setupDisplayportForElementSubtree(c, winUtils, returnStrings);
|
||||
}
|
||||
if (typeof element.contentDocument !== "undefined" &&
|
||||
element.contentDocument) {
|
||||
returnStrings.infoStrings.push("setupDisplayportForElementSubtree descending into subdocument");
|
||||
this.setupDisplayportForElementSubtree(element.contentDocument.documentElement,
|
||||
element.contentWindow.windowUtils, returnStrings);
|
||||
if (
|
||||
typeof element.contentDocument !== "undefined" &&
|
||||
element.contentDocument
|
||||
) {
|
||||
returnStrings.infoStrings.push(
|
||||
"setupDisplayportForElementSubtree descending into subdocument"
|
||||
);
|
||||
this.setupDisplayportForElementSubtree(
|
||||
element.contentDocument.documentElement,
|
||||
element.contentWindow.windowUtils,
|
||||
returnStrings
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
setupAsyncScrollOffsetsForElement(element, winUtils, allowFailure, returnStrings) {
|
||||
let sx = this.attrOrDefault(element, "reftest-async-scroll-x", 0);
|
||||
let sy = this.attrOrDefault(element, "reftest-async-scroll-y", 0);
|
||||
if (sx != 0 || sy != 0) {
|
||||
try {
|
||||
// This might fail when called from RecordResult since layers
|
||||
// may not have been constructed yet
|
||||
winUtils.setAsyncScrollOffset(element, sx, sy);
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (allowFailure) {
|
||||
returnStrings.infoStrings.push("setupAsyncScrollOffsetsForElement error calling setAsyncScrollOffset: " + e);
|
||||
} else {
|
||||
returnStrings.errorStrings.push("setupAsyncScrollOffsetsForElement error calling setAsyncScrollOffset: " + e);
|
||||
}
|
||||
setupAsyncScrollOffsetsForElement(
|
||||
element,
|
||||
winUtils,
|
||||
allowFailure,
|
||||
returnStrings
|
||||
) {
|
||||
let sx = this.attrOrDefault(element, "reftest-async-scroll-x", 0);
|
||||
let sy = this.attrOrDefault(element, "reftest-async-scroll-y", 0);
|
||||
if (sx != 0 || sy != 0) {
|
||||
try {
|
||||
// This might fail when called from RecordResult since layers
|
||||
// may not have been constructed yet
|
||||
winUtils.setAsyncScrollOffset(element, sx, sy);
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
setupAsyncScrollOffsetsForElementSubtree(
|
||||
element,
|
||||
winUtils,
|
||||
allowFailure,
|
||||
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) {
|
||||
switch (msg.name) {
|
||||
case "ForwardAfterPaintEventToSelfAndParent":
|
||||
{
|
||||
case "ForwardAfterPaintEventToSelfAndParent": {
|
||||
// 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
|
||||
// won't reach reftest-content.js.
|
||||
if (msg.data.fromBrowsingContext.embedderElement == null) {
|
||||
this.forwardAfterPaintEventToParent(msg.data.rects, msg.data.originalTargetUri,
|
||||
/* dispatchToSelfAsWell */ true);
|
||||
this.forwardAfterPaintEventToParent(
|
||||
msg.data.rects,
|
||||
msg.data.originalTargetUri,
|
||||
/* dispatchToSelfAsWell */ true
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Transform the rects from fromBrowsingContext to us.
|
||||
// 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(
|
||||
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.
|
||||
// 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 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;
|
||||
}
|
||||
|
||||
case "EmptyMessage":
|
||||
return undefined;
|
||||
case "UpdateLayerTree":
|
||||
{
|
||||
case "UpdateLayerTree": {
|
||||
let errorStrings = [];
|
||||
try {
|
||||
if (this.manager.isProcessRoot) {
|
||||
|
@ -192,22 +284,23 @@ class ReftestFissionChild extends JSWindowActorChild {
|
|||
} catch (e) {
|
||||
errorStrings.push("updateLayerTree failed: " + e);
|
||||
}
|
||||
return {errorStrings};
|
||||
return { errorStrings };
|
||||
}
|
||||
case "FlushRendering":
|
||||
{
|
||||
case "FlushRendering": {
|
||||
let errorStrings = [];
|
||||
let warningStrings = [];
|
||||
let infoStrings = [];
|
||||
|
||||
try {
|
||||
let {ignoreThrottledAnimations, needsAnimationFrame} = msg.data;
|
||||
let { ignoreThrottledAnimations, needsAnimationFrame } = msg.data;
|
||||
|
||||
if (this.manager.isProcessRoot) {
|
||||
var anyPendingPaintsGeneratedInDescendants = false;
|
||||
|
||||
if (needsAnimationFrame) {
|
||||
await new Promise(resolve => this.contentWindow.requestAnimationFrame(resolve));
|
||||
await new Promise(resolve =>
|
||||
this.contentWindow.requestAnimationFrame(resolve)
|
||||
);
|
||||
}
|
||||
|
||||
function flushWindow(win) {
|
||||
|
@ -228,7 +321,10 @@ class ReftestFissionChild extends JSWindowActorChild {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -249,32 +345,37 @@ class ReftestFissionChild extends JSWindowActorChild {
|
|||
flushWindow(this.contentWindow);
|
||||
}
|
||||
|
||||
if (anyPendingPaintsGeneratedInDescendants &&
|
||||
!this.contentWindow.windowUtils.isMozAfterPaintPending) {
|
||||
warningStrings.push("Internal error: descendant frame generated a MozAfterPaint event, but the root document doesn't have one!");
|
||||
if (
|
||||
anyPendingPaintsGeneratedInDescendants &&
|
||||
!this.contentWindow.windowUtils.isMozAfterPaintPending
|
||||
) {
|
||||
warningStrings.push(
|
||||
"Internal error: descendant frame generated a MozAfterPaint event, but the root document doesn't have one!"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
errorStrings.push("flushWindow failed: " + e);
|
||||
}
|
||||
return {errorStrings, warningStrings, infoStrings};
|
||||
return { errorStrings, warningStrings, infoStrings };
|
||||
}
|
||||
|
||||
case "SetupDisplayport":
|
||||
{
|
||||
case "SetupDisplayport": {
|
||||
let contentRootElement = this.document.documentElement;
|
||||
let winUtils = this.contentWindow.windowUtils;
|
||||
let returnStrings = {infoStrings: [], errorStrings: []};
|
||||
let returnStrings = { infoStrings: [], errorStrings: [] };
|
||||
if (contentRootElement) {
|
||||
this.setupDisplayportForElementSubtree(contentRootElement, winUtils, returnStrings);
|
||||
this.setupDisplayportForElementSubtree(
|
||||
contentRootElement,
|
||||
winUtils,
|
||||
returnStrings
|
||||
);
|
||||
}
|
||||
return returnStrings;
|
||||
}
|
||||
|
||||
case "SetupAsyncScrollOffsets":
|
||||
{
|
||||
let returns = {infoStrings: [], errorStrings: [], updatedAny: false};
|
||||
case "SetupAsyncScrollOffsets": {
|
||||
let returns = { infoStrings: [], errorStrings: [], updatedAny: false };
|
||||
let contentRootElement = this.document.documentElement;
|
||||
|
||||
if (!contentRootElement) {
|
||||
|
@ -283,10 +384,14 @@ class ReftestFissionChild extends JSWindowActorChild {
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,46 @@
|
|||
var EXPORTED_SYMBOLS = ["ReftestFissionParent"];
|
||||
|
||||
class ReftestFissionParent extends JSWindowActorParent {
|
||||
|
||||
tellChildrenToFlushRendering(browsingContext, ignoreThrottledAnimations, needsAnimationFrame) {
|
||||
tellChildrenToFlushRendering(
|
||||
browsingContext,
|
||||
ignoreThrottledAnimations,
|
||||
needsAnimationFrame
|
||||
) {
|
||||
let promises = [];
|
||||
this.tellChildrenToFlushRenderingRecursive(browsingContext, ignoreThrottledAnimations, needsAnimationFrame, promises);
|
||||
this.tellChildrenToFlushRenderingRecursive(
|
||||
browsingContext,
|
||||
ignoreThrottledAnimations,
|
||||
needsAnimationFrame,
|
||||
promises
|
||||
);
|
||||
return Promise.allSettled(promises);
|
||||
}
|
||||
|
||||
tellChildrenToFlushRenderingRecursive(browsingContext, ignoreThrottledAnimations, needsAnimationFrame, promises) {
|
||||
tellChildrenToFlushRenderingRecursive(
|
||||
browsingContext,
|
||||
ignoreThrottledAnimations,
|
||||
needsAnimationFrame,
|
||||
promises
|
||||
) {
|
||||
let cwg = browsingContext.currentWindowGlobal;
|
||||
if (cwg && cwg.isProcessRoot) {
|
||||
let a = cwg.getActor("ReftestFission");
|
||||
if (a) {
|
||||
let responsePromise = a.sendQuery("FlushRendering", {ignoreThrottledAnimations, needsAnimationFrame});
|
||||
let responsePromise = a.sendQuery("FlushRendering", {
|
||||
ignoreThrottledAnimations,
|
||||
needsAnimationFrame,
|
||||
});
|
||||
promises.push(responsePromise);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
if (!cwg || !cwg.isProcessRoot) {
|
||||
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");
|
||||
if (!actor) {
|
||||
return {errorStrings, infoStrings};
|
||||
return { errorStrings, infoStrings };
|
||||
}
|
||||
|
||||
// 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");
|
||||
errorStrings.push(...result.errorStrings);
|
||||
} 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) {
|
||||
let cwg2 = context.currentWindowGlobal;
|
||||
if (cwg2) {
|
||||
if (!cwg2.isProcessRoot) {
|
||||
errorStrings.push("getNearestProcessRootProperDescendants returned a non process root?");
|
||||
errorStrings.push(
|
||||
"getNearestProcessRootProperDescendants returned a non process root?"
|
||||
);
|
||||
}
|
||||
let actor2 = cwg2.getActor("ReftestFission");
|
||||
if (actor2) {
|
||||
try {
|
||||
await actor2.sendQuery("EmptyMessage");
|
||||
} catch(e) {
|
||||
infoStrings.push("tellChildrenToUpdateLayerTree EmptyMessage msg to child rejected: " + e);
|
||||
} catch (e) {
|
||||
infoStrings.push(
|
||||
"tellChildrenToUpdateLayerTree EmptyMessage msg to child rejected: " +
|
||||
e
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -100,14 +132,16 @@ class ReftestFissionParent extends JSWindowActorParent {
|
|||
errorStrings.push(...result2.errorStrings);
|
||||
infoStrings.push(...result2.infoStrings);
|
||||
} 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) {
|
||||
|
@ -125,38 +159,52 @@ class ReftestFissionParent extends JSWindowActorParent {
|
|||
}
|
||||
}
|
||||
|
||||
tellChildrenToSetupAsyncScrollOffsets(browsingContext, allowFailure, promises) {
|
||||
tellChildrenToSetupAsyncScrollOffsets(
|
||||
browsingContext,
|
||||
allowFailure,
|
||||
promises
|
||||
) {
|
||||
let cwg = browsingContext.currentWindowGlobal;
|
||||
if (cwg && cwg.isProcessRoot) {
|
||||
let a = cwg.getActor("ReftestFission");
|
||||
if (a) {
|
||||
let responsePromise = a.sendQuery("SetupAsyncScrollOffsets", {allowFailure});
|
||||
let responsePromise = a.sendQuery("SetupAsyncScrollOffsets", {
|
||||
allowFailure,
|
||||
});
|
||||
promises.push(responsePromise);
|
||||
}
|
||||
}
|
||||
|
||||
for (let context of browsingContext.children) {
|
||||
this.tellChildrenToSetupAsyncScrollOffsets(context, allowFailure, promises);
|
||||
this.tellChildrenToSetupAsyncScrollOffsets(
|
||||
context,
|
||||
allowFailure,
|
||||
promises
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
receiveMessage(msg) {
|
||||
switch (msg.name) {
|
||||
case "ForwardAfterPaintEvent":
|
||||
{
|
||||
case "ForwardAfterPaintEvent": {
|
||||
let cwg = msg.data.toBrowsingContext.currentWindowGlobal;
|
||||
if (cwg) {
|
||||
let a = cwg.getActor("ReftestFission");
|
||||
if (a) {
|
||||
a.sendAsyncMessage("ForwardAfterPaintEventToSelfAndParent", msg.data);
|
||||
a.sendAsyncMessage(
|
||||
"ForwardAfterPaintEventToSelfAndParent",
|
||||
msg.data
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "FlushRendering":
|
||||
{
|
||||
let promise = this.tellChildrenToFlushRendering(msg.data.browsingContext, msg.data.ignoreThrottledAnimations, msg.data.needsAnimationFrame);
|
||||
case "FlushRendering": {
|
||||
let promise = this.tellChildrenToFlushRendering(
|
||||
msg.data.browsingContext,
|
||||
msg.data.ignoreThrottledAnimations,
|
||||
msg.data.needsAnimationFrame
|
||||
);
|
||||
return promise.then(function (results) {
|
||||
let errorStrings = [];
|
||||
let warningStrings = [];
|
||||
|
@ -164,11 +212,16 @@ class ReftestFissionParent extends JSWindowActorParent {
|
|||
for (let r of results) {
|
||||
if (r.status != "fulfilled") {
|
||||
if (r.status == "pending") {
|
||||
errorStrings.push("FlushRendering sendQuery to child promise still pending?");
|
||||
errorStrings.push(
|
||||
"FlushRendering sendQuery to child promise still pending?"
|
||||
);
|
||||
} else {
|
||||
// We expect actors to go away causing sendQuery's to fail, so
|
||||
// just note it.
|
||||
infoStrings.push("FlushRendering sendQuery to child promise rejected: " + r.reason);
|
||||
infoStrings.push(
|
||||
"FlushRendering sendQuery to child promise rejected: " +
|
||||
r.reason
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -177,15 +230,13 @@ class ReftestFissionParent extends JSWindowActorParent {
|
|||
warningStrings.push(...r.value.warningStrings);
|
||||
infoStrings.push(...r.value.infoStrings);
|
||||
}
|
||||
return {errorStrings, warningStrings, infoStrings};
|
||||
return { errorStrings, warningStrings, infoStrings };
|
||||
});
|
||||
}
|
||||
case "UpdateLayerTree":
|
||||
{
|
||||
case "UpdateLayerTree": {
|
||||
return this.tellChildrenToUpdateLayerTree(msg.data.browsingContext);
|
||||
}
|
||||
case "TellChildrenToSetupDisplayport":
|
||||
{
|
||||
case "TellChildrenToSetupDisplayport": {
|
||||
let promises = [];
|
||||
this.tellChildrenToSetupDisplayport(msg.data.browsingContext, promises);
|
||||
return Promise.allSettled(promises).then(function (results) {
|
||||
|
@ -195,21 +246,27 @@ class ReftestFissionParent extends JSWindowActorParent {
|
|||
if (r.status != "fulfilled") {
|
||||
// We expect actors to go away causing sendQuery's to fail, so
|
||||
// just note it.
|
||||
infoStrings.push("SetupDisplayport sendQuery to child promise rejected: " + r.reason);
|
||||
infoStrings.push(
|
||||
"SetupDisplayport sendQuery to child promise rejected: " +
|
||||
r.reason
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
errorStrings.push(...r.value.errorStrings);
|
||||
infoStrings.push(...r.value.infoStrings);
|
||||
}
|
||||
return {errorStrings, infoStrings}
|
||||
return { errorStrings, infoStrings };
|
||||
});
|
||||
}
|
||||
|
||||
case "SetupAsyncScrollOffsets":
|
||||
{
|
||||
case "SetupAsyncScrollOffsets": {
|
||||
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) {
|
||||
let errorStrings = [];
|
||||
let infoStrings = [];
|
||||
|
@ -218,7 +275,10 @@ class ReftestFissionParent extends JSWindowActorParent {
|
|||
if (r.status != "fulfilled") {
|
||||
// We expect actors to go away causing sendQuery's to fail, so
|
||||
// just note it.
|
||||
infoStrings.push("SetupAsyncScrollOffsets sendQuery to child promise rejected: " + r.reason);
|
||||
infoStrings.push(
|
||||
"SetupAsyncScrollOffsets sendQuery to child promise rejected: " +
|
||||
r.reason
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -228,11 +288,9 @@ class ReftestFissionParent extends JSWindowActorParent {
|
|||
updatedAny = true;
|
||||
}
|
||||
}
|
||||
return {errorStrings, infoStrings, updatedAny};
|
||||
return { errorStrings, infoStrings, updatedAny };
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ function processTerminated() {
|
|||
|
||||
function startAndroid(win) {
|
||||
// Add setTimeout here because windows.innerWidth/Height are not set yet.
|
||||
win.setTimeout(function() {
|
||||
win.setTimeout(function () {
|
||||
OnRefTestLoad(win);
|
||||
}, 0);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ this.reftest = class extends ExtensionAPI {
|
|||
"chrome,dialog=no,left=800,height=200,width=200,all",
|
||||
null
|
||||
);
|
||||
dummy.onload = async function() {
|
||||
dummy.onload = async function () {
|
||||
// Close pre-existing window
|
||||
win.close();
|
||||
|
||||
|
|
|
@ -17,16 +17,16 @@ for (let [key, val] of Object.entries({
|
|||
NS_DIRECTORY_SERVICE_CONTRACTID: "@mozilla.org/file/directory_service;1",
|
||||
NS_OBSERVER_SERVICE_CONTRACTID: "@mozilla.org/observer-service;1",
|
||||
|
||||
TYPE_REFTEST_EQUAL: '==',
|
||||
TYPE_REFTEST_NOTEQUAL: '!=',
|
||||
TYPE_LOAD: 'load', // test without a reference (just test that it does
|
||||
// not assert, crash, hang, or leak)
|
||||
TYPE_SCRIPT: 'script', // test contains individual test results
|
||||
TYPE_PRINT: 'print', // test and reference will be printed to PDF's and
|
||||
// compared structurally
|
||||
TYPE_REFTEST_EQUAL: "==",
|
||||
TYPE_REFTEST_NOTEQUAL: "!=",
|
||||
TYPE_LOAD: "load", // test without a reference (just test that it does
|
||||
// not assert, crash, hang, or leak)
|
||||
TYPE_SCRIPT: "script", // test contains individual test results
|
||||
TYPE_PRINT: "print", // test and reference will be printed to PDF's and
|
||||
// compared structurally
|
||||
|
||||
// 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
|
||||
|
||||
// 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",
|
||||
|
||||
// "<!--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 */
|
||||
g: {
|
||||
|
@ -73,11 +74,11 @@ for (let [key, val] of Object.entries({
|
|||
|
||||
browser: undefined,
|
||||
// Are we testing web content loaded in a separate process?
|
||||
browserIsRemote: undefined, // bool
|
||||
browserIsRemote: undefined, // bool
|
||||
// Are we using <iframe mozbrowser>?
|
||||
browserIsIframe: undefined, // bool
|
||||
browserMessageManager: undefined, // bool
|
||||
useDrawSnapshot: undefined, // bool
|
||||
browserIsIframe: undefined, // bool
|
||||
browserMessageManager: undefined, // bool
|
||||
useDrawSnapshot: undefined, // bool
|
||||
canvas1: undefined,
|
||||
canvas2: undefined,
|
||||
// gCurrentCanvas is non-null between InitCurrentCanvasWithSnapshot and the next
|
||||
|
@ -100,9 +101,9 @@ for (let [key, val] of Object.entries({
|
|||
AssertionUnexpected: 0,
|
||||
AssertionUnexpectedFixed: 0,
|
||||
// Known problems...
|
||||
KnownFail : 0,
|
||||
KnownFail: 0,
|
||||
AssertionKnown: 0,
|
||||
Random : 0,
|
||||
Random: 0,
|
||||
Skip: 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
|
||||
// manifest URL (yet!).
|
||||
dumpedConditionSandbox: false,
|
||||
}
|
||||
},
|
||||
})) {
|
||||
this[key] = val;
|
||||
EXPORTED_SYMBOLS.push(key);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,12 +1,14 @@
|
|||
<!-- 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
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="reftest-window"
|
||||
hidechrome="true"
|
||||
onload="OnRefTestLoad();"
|
||||
onunload="OnRefTestUnload();"
|
||||
style="background:white; overflow:hidden">
|
||||
<script type="application/ecmascript" src="resource://reftest/reftest.jsm" />
|
||||
<!-- The reftest browser element is dynamically created, here -->
|
||||
<window
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="reftest-window"
|
||||
hidechrome="true"
|
||||
onload="OnRefTestLoad();"
|
||||
onunload="OnRefTestUnload();"
|
||||
style="background: white; overflow: hidden"
|
||||
>
|
||||
<script type="application/ecmascript" src="resource://reftest/reftest.jsm" />
|
||||
<!-- The reftest browser element is dynamically created, here -->
|
||||
</window>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
|
||||
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
|
||||
debug.assertion('failed assertion check', 'false', 'assert.html', 6);
|
||||
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
|
||||
debug.assertion("failed assertion check", "false", "assert.html", 6);
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
|
||||
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
|
||||
debug.abort('crash.html', 6);
|
||||
let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
|
||||
debug.abort("crash.html", 6);
|
||||
</script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div style="color: green">Text</div>
|
||||
</body>
|
||||
<body>
|
||||
<div style="color: green">Text</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div style="color: red">Text</div>
|
||||
</body>
|
||||
<body>
|
||||
<div style="color: red">Text</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>scripttest-pass</title>
|
||||
<script type="text/javascript">
|
||||
function getTestCases()
|
||||
{
|
||||
return [
|
||||
{ testPassed: (function () { return true; }), testDescription: (function () { return "passed"; }) }
|
||||
];
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>scripttest-pass</h1>
|
||||
</body>
|
||||
<head>
|
||||
<title>scripttest-pass</title>
|
||||
<script type="text/javascript">
|
||||
function getTestCases() {
|
||||
return [
|
||||
{
|
||||
testPassed: function () {
|
||||
return true;
|
||||
},
|
||||
testDescription: function () {
|
||||
return "passed";
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>scripttest-pass</h1>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче