Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fix PageView cache re-insertions. #4936
Conversation
|
Trivial. Thanks |
Fix PageView cache re-insertions.
|
Yury, do you think the splice(i) calls in src/shared/util.js are buggy? |
Maybe, but there are not that important -- there are related to the unhandled rejections in the Promise polyfill. |
If a PageView is re-inserted into the cache, there's a splice() call done which I'm pretty sure is supposed to just remove the existing copy. But in Firefox a.splice(n) has a special behaviour -- it causes every element after the nth to be removed. (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice for details. I don't know what it does in other browsers.) This causes pages to be removed from the cache without having destroy() called on them.
This patch changes it to a.splice(n, 1), which always removes just the single element.
(BTW, there are two splice(i) calls in src/shared/util.js that may also be buggy.)