Phedenskog has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344915 )

Change subject: Use ResourceTiming to get image size in Firefox
......................................................................

Use ResourceTiming to get image size in Firefox

Since Firefox 49 Performance Inspector isn't working, some change
in FF broke how we fetch image sizes uses Ajax requests.

Lets use the resource timing API even though we now we miss images
that are cached in the browser. It's better that it works and that
we get info about images from upload.

Bug: T159943
Change-Id: I2bf471368a0f736298dc9fc845d69a2f121bf402
---
M modules/collectors/ext.PerformanceInspector.imagesize.js
1 file changed, 7 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PerformanceInspector 
refs/changes/15/344915/1

diff --git a/modules/collectors/ext.PerformanceInspector.imagesize.js 
b/modules/collectors/ext.PerformanceInspector.imagesize.js
index 81ce34f..263c41c 100644
--- a/modules/collectors/ext.PerformanceInspector.imagesize.js
+++ b/modules/collectors/ext.PerformanceInspector.imagesize.js
@@ -12,18 +12,14 @@
 
                function isResourceTimingWithSizeSupported() {
                        var wp = window.performance;
-                       // Right now we don't support Firefox, we did try it 
out but Firefox
-                       // has a bug where local cached assets are not 
included, meaning using it
-                       // we would miss images for Firefox users:
+                       // Firefox has a bug where local cached assets are not 
included, meaning
+                       // we miss some images for Firefox users:
                        // https://bugzilla.mozilla.org/show_bug.cgi?id=1113676
-                       // we have have at least Resource Timing V1
-                       if ( wp && wp.getEntriesByType && wp.getEntriesByType( 
'resource' ).length > 0 ) {
-                               // do we have support size but not nextHop?
-                               // Then we are sure we are not FF but in the 
long run this
-                               // check is evil, Chrome and others will 
support nextHop soon.
-                               if ( wp.getEntriesByType( 'resource' )[ 0 
].encodedBodySize && !wp.getEntriesByType( 'resource' )[ 0 ].nextHopProtocol ) {
-                                       return true;
-                               }
+                       // but since FF49 the Ajax request to get the size 
don't work in FF
+                       // https://phabricator.wikimedia.org/T159943
+                       if ( wp && wp.getEntriesByType && wp.getEntriesByType( 
'resource' ).length > 0 &&
+                               wp.getEntriesByType( 'resource' )[ 0 
].encodedBodySize ) {
+                               return true;
                        }
                        return false;
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bf471368a0f736298dc9fc845d69a2f121bf402
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PerformanceInspector
Gerrit-Branch: master
Gerrit-Owner: Phedenskog <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to