var windowWidth = window.innerWidth - 25; variframe; iframe = document.createElement("iframe"); iframe.id = "test-iframe-" + this.url; iframe.height = "10px"; iframe.width = windowWidth + "px"; iframe.style.visibility = "hidden"; iframe.src = this.url;
// Here is where the magic happens... add a listener to the
// frame's onload event - it will call handleEvent iframe.addEventListener("load", this, true);
// append to the end of the page
window.document.body.appendChild(iframe);
};
RemoteCanvas.prototype.handleEvent = function() {
// Look back up the iframe by id var ldrFrame = document.getElementById("test-iframe-" + this.url);
// Get a reference to the window object you need for the canvas
// SpecialPowers.snapshotRect method var remoteWindow = ldrFrame.contentWindow;
// The .sjs that serves the iframe-1 image runs in a host xpcshell on Android
// and can't see the up-to-date prefs, so we pass image.jxl.enabled through to
// it via the iframe's query string.
function jxlQueryString()
{
return SpecialPowers.getBoolPref("image.jxl.enabled", false) ? "?jxl=1" : "";
}
function loadFirst()
{
ref = canvas.toDataURL();
var remoteCanvas = new RemoteCanvas("bug496292-iframe-1.html" + jxlQueryString());
remoteCanvas.load(checkFirst);
}
function checkFirst()
{
first = canvas.toDataURL();
is(first, ref, "The default Accept header used by image loader is correct");
SpecialPowers.setCharPref("image.http.accept", "image/png");
SpecialPowers.pushPrefEnv({"set": [["image.http.accept", "image/png"]]}, function() { var remoteCanvas = new RemoteCanvas("bug496292-iframe-2.html");
remoteCanvas.load(checkSecond);
});
}
function checkSecond()
{
second = canvas.toDataURL();
is(second, ref, "The modified Accept header used by image loader is correct");
SpecialPowers.pushPrefEnv({"clear": [["image.http.accept"]]}, function() { var remoteCanvas = new RemoteCanvas("bug496292-iframe-1.html" + jxlQueryString());
remoteCanvas.load(checkThird);
});
}
function checkThird() {
third = canvas.toDataURL();
is(third, ref, "The Accept header used by image loader should be correctly reset");
SimpleTest.finish();
}
var refCanvas = new RemoteCanvas("bug496292-iframe-ref.html");
refCanvas.load(loadFirst);
</script>
</pre>
</body>
</html>
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet am 2026-09-30)
¤
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.