/** *ThisissimilartothehitTestfunctioninapz_test_utils.js,inthatit *doesahit-testforapointandreturnstheresult.Thedifferenceisthat *inthefissionworld,thehit-testmaylandonanOOPIF,whichmeansthe *resultinformationwillbeintheAPZtestdatafortheOOPIFprocess.This *functionchecksboththecurrentprocessandOOPIFprocesstoseewhichone *gotahitresult,andreturnstheresultregardlessofwhichprocessgotit. *Thecallerisexpectedtocheckthelayersidwhichwillallowdistinguishing *thetwocases.
*/
async function hitTestOOPIF(point, iframeElement) {
let getIframeCompositorTestData = async iframe => {
let data = await SpecialPowers.spawn(iframe, [], () => {
let utils = SpecialPowers.getDOMWindowUtils(content.window); return JSON.stringify(utils.getCompositorAPZTestData());
});
return JSON.parse(data);
};
let utils = SpecialPowers.getDOMWindowUtils(window);
// Get the test data before doing the actual hit-test, to get a baseline // of what we can ignore.
let oldParentTestData = utils.getCompositorAPZTestData();
let oldIframeTestData = await getIframeCompositorTestData(iframeElement);
// Now do the hit-test
dump(`Hit-testing point (${point.x}, ${point.y}) in fission context\n`);
SpecialPowers.wrap(window).synthesizeMouseEvent( "MozMouseHittest",
point.x,
point.y,
{},
{ ignoreRootScrollFrame: true }
);
await hittestPromise;
// Collect the new test data
let newParentTestData = utils.getCompositorAPZTestData();
let newIframeTestData = await getIframeCompositorTestData(iframeElement);
// See which test data has new hit results
let hitResultCount = testData => { return Object.keys(testData.hitResults).length;
};
let hitIframe =
hitResultCount(newIframeTestData) > hitResultCount(oldIframeTestData);
let hitParent =
hitResultCount(newParentTestData) > hitResultCount(oldParentTestData);
// Extract the results from the appropriate test data
let lastHitResult = testData => {
let lastHit =
testData.hitResults[Object.keys(testData.hitResults).length - 1]; return {
hitInfo: lastHit.hitResult,
scrollId: lastHit.scrollId,
layersId: lastHit.layersId,
};
}; if (hitIframe && hitParent) { thrownew Error( "Both iframe and parent got hit-results, that is unexpected!"
);
} elseif (hitIframe) { return lastHitResult(newIframeTestData);
} elseif (hitParent) { return lastHitResult(newParentTestData);
} else { thrownew Error( "Neither iframe nor parent got the hit-result, that is unexpected!"
);
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-08-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.