Added workaround for Firefox performance bug
This commit is contained in:
parent
2ecd4edcb7
commit
36951432cf
@ -166,20 +166,30 @@ function restoreScrollability() {
|
|||||||
*/
|
*/
|
||||||
function startConstantVigilance() {
|
function startConstantVigilance() {
|
||||||
// console.log("startConstantVigilance");
|
// console.log("startConstantVigilance");
|
||||||
var observer = new MutationObserver((mutationsList, observer) => {
|
var observer;
|
||||||
|
var starter = function() {
|
||||||
|
observer.observe(document.querySelector("html"), {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
observer = new MutationObserver((mutationsList, observer) => {
|
||||||
|
// Workaround for Firefox performance bug. Firefox does not properly
|
||||||
|
// coalesce mutations into the mutationsList, instead calling the
|
||||||
|
// callback potentially thousands of times. Therefore we must
|
||||||
|
// disconnect the observer, wait for the main thread to become idle,
|
||||||
|
// and then restart it.
|
||||||
|
observer.disconnect();
|
||||||
window.requestIdleCallback(() => {
|
window.requestIdleCallback(() => {
|
||||||
for (var mutation of mutationsList) {
|
killSticky();
|
||||||
killSticky(mutation.target);
|
starter();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Commencing vigilance for stickies!");
|
console.log("Commencing vigilance for stickies!");
|
||||||
observer.observe(document.querySelector("html"), {
|
starter();
|
||||||
attributes: true,
|
|
||||||
childList: true,
|
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user