瀏覽代碼

avoid infinite calls to requestAnimationFrames when loading deferred images

Former-commit-id: 44bf5d2fe66c0b521f7125e7d19b416849248f1c
Gildas 6 年之前
父節點
當前提交
d7a1fca1da
共有 1 個文件被更改,包括 3 次插入1 次删除
  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;
 	};