Ver código fonte

avoid infinite calls to requestAnimationFrames when loading deferred images

Gildas 6 anos atrás
pai
commit
44bf5d2fe6
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      lib/hooks/content/content-hooks-frames-web.js

+ 3 - 1
lib/hooks/content/content-hooks-frames-web.js

@@ -222,7 +222,9 @@
 				lastTimestamp = timestamp;
 				callback(timestamp);
 			});
-			pendingRequestAnimationFrameCalls.set(requestId, callback);
+			if (!loadDeferredImages || pendingRequestAnimationFrameCalls.length < 128) {
+				pendingRequestAnimationFrameCalls.set(requestId, callback);
+			}
 		}
 		return requestId;
 	};