Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311902

Change subject: mediawiki.requestIdleCallback: Avoid native 
window.requestIdleCallback
......................................................................

mediawiki.requestIdleCallback: Avoid native window.requestIdleCallback

Follows-up 482ad8d9fb.

This currently has bugs in Chrome that can cause it to not get called
for up to 30 seconds.

https://bugs.chromium.org/p/chromium/issues/detail?id=647870

Change-Id: I221cd6c2bcdbee89bc7401c071f2ab1865a738ed
---
M resources/src/mediawiki/mediawiki.requestIdleCallback.js
M tests/qunit/suites/resources/mediawiki/mediawiki.requestIdleCallback.test.js
2 files changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/311902/1

diff --git a/resources/src/mediawiki/mediawiki.requestIdleCallback.js 
b/resources/src/mediawiki/mediawiki.requestIdleCallback.js
index dfc98ad..b58cb69 100644
--- a/resources/src/mediawiki/mediawiki.requestIdleCallback.js
+++ b/resources/src/mediawiki/mediawiki.requestIdleCallback.js
@@ -24,8 +24,12 @@
         * @member mw
         * @param {Function} callback
         */
+       mw.requestIdleCallback = mw.requestIdleCallbackInternal;
+       /*
+       // XXX: Polyfill disabled due to 
https://bugs.chromium.org/p/chromium/issues/detail?id=647870
        mw.requestIdleCallback = window.requestIdleCallback
                // Bind because it throws TypeError if context is not window
                ? window.requestIdleCallback.bind( window )
                : mw.requestIdleCallbackInternal;
+       */
 }( mediaWiki ) );
diff --git 
a/tests/qunit/suites/resources/mediawiki/mediawiki.requestIdleCallback.test.js 
b/tests/qunit/suites/resources/mediawiki/mediawiki.requestIdleCallback.test.js
index 7a09964..df02693 100644
--- 
a/tests/qunit/suites/resources/mediawiki/mediawiki.requestIdleCallback.test.js
+++ 
b/tests/qunit/suites/resources/mediawiki/mediawiki.requestIdleCallback.test.js
@@ -95,8 +95,9 @@
        if ( window.requestIdleCallback ) {
                QUnit.test( 'native', function ( assert ) {
                        var done = assert.async();
-                       // Remove polyfill
+                       // Remove polyfill and clock stub
                        mw.requestIdleCallback.restore();
+                       this.clock.restore();
                        mw.requestIdleCallback( function () {
                                assert.expect( 0 );
                                done();

-- 
To view, visit https://gerrit.wikimedia.org/r/311902
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I221cd6c2bcdbee89bc7401c071f2ab1865a738ed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.19
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to