mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=514334; add option to disable canvas cache in reftests (intermittent crash when running reftests on low memory devices); r=roc
This commit is contained in:
parent
1a2a2812ac
commit
f492ca4132
@ -80,14 +80,14 @@ RefTestCmdLineHandler.prototype =
|
||||
|
||||
/* nsICommandLineHandler */
|
||||
handle : function handler_handle(cmdLine) {
|
||||
var args = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(nsISupportsString);
|
||||
var args = { };
|
||||
args.wrappedJSObject = args;
|
||||
try {
|
||||
var uristr = cmdLine.handleFlagWithParam("reftest", false);
|
||||
if (uristr == null)
|
||||
return;
|
||||
try {
|
||||
args.data = cmdLine.resolveURI(uristr).spec;
|
||||
args.uri = cmdLine.resolveURI(uristr).spec;
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
@ -97,6 +97,13 @@ RefTestCmdLineHandler.prototype =
|
||||
cmdLine.handleFlag("reftest", true);
|
||||
}
|
||||
|
||||
try {
|
||||
var nocache = cmdLine.handleFlag("reftestnocache", false);
|
||||
args.nocache = nocache;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
/* Ignore the platform's online/offline status while running reftests. */
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService2);
|
||||
|
@ -121,6 +121,9 @@ const EXPECTED_DEATH = 3; // test must be skipped to avoid e.g. crash/hang
|
||||
var HTTP_SERVER_PORT = 4444;
|
||||
const HTTP_SERVER_PORTS_TO_TRY = 50;
|
||||
|
||||
// whether we should skip caching canvases
|
||||
var gNoCanvasCache = false;
|
||||
|
||||
var gRecycledCanvases = new Array();
|
||||
|
||||
function AllocateCanvas()
|
||||
@ -133,12 +136,15 @@ function AllocateCanvas()
|
||||
var canvas = document.createElementNS(XHTML_NS, "canvas");
|
||||
canvas.setAttribute("width", windowElem.getAttribute("width"));
|
||||
canvas.setAttribute("height", windowElem.getAttribute("height"));
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function ReleaseCanvas(canvas)
|
||||
{
|
||||
gRecycledCanvases.push(canvas);
|
||||
// store a maximum of 2 canvases, if we're not caching
|
||||
if (!gNoCanvasCache || gRecycledCanvases.length < 2)
|
||||
gRecycledCanvases.push(canvas);
|
||||
}
|
||||
|
||||
function OnRefTestLoad()
|
||||
@ -207,7 +213,12 @@ function StartTests()
|
||||
{
|
||||
try {
|
||||
// Need to read the manifest once we have the final HTTP_SERVER_PORT.
|
||||
ReadTopManifest(window.arguments[0]);
|
||||
args = window.arguments[0].wrappedJSObject;
|
||||
|
||||
if ("nocache" in args && args["nocache"])
|
||||
gNoCanvasCache = true;
|
||||
|
||||
ReadTopManifest(args.uri);
|
||||
BuildUseCounts();
|
||||
gTotalTests = gURLs.length;
|
||||
|
||||
@ -790,7 +801,8 @@ function UpdateCanvasCache(url, canvas)
|
||||
var spec = url.spec;
|
||||
|
||||
--gURIUseCounts[spec];
|
||||
if (gURIUseCounts[spec] == 0) {
|
||||
|
||||
if (gNoCanvasCache || gURIUseCounts[spec] == 0) {
|
||||
ReleaseCanvas(canvas);
|
||||
delete gURICanvases[spec];
|
||||
} else if (gURIUseCounts[spec] > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user