Commit graph

101 commits

Author SHA1 Message Date
Gilles Dubuc bfa530cc21 Wait for CSS to be truly loaded before opening the viewer
This is a workaround for core bug #61852

Change-Id: If7d830866993eddbf5784694514ff89aece56c5b
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/258
2014-02-24 19:13:04 +00:00
jenkins-bot de9d10ce06 Merge "Better way to detect CORS support" 2014-02-24 19:13:06 +00:00
Gilles Dubuc 75dbc72e6c Better way to detect CORS support
The old technique doesn't work in Firefox and
doesn't always work in Chrome depending on
when you call it.

https://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/

Also fixes some tests that weren't overloading
the right function and were hitting the real
feature detection check

Change-Id: I0a9d6b5654efb169860ddf7e5e0551efb825920c
2014-02-24 18:53:01 +00:00
Gilles Dubuc ce58597b3b Fix hash self-reaction
* Fixes bug where the mmv would react to its own hash changes
* Adds jquery.hashchange for older browser support

Change-Id: I2d23699bb444d9eb533d239e25bc47fa96c902a9
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/254
2014-02-24 19:14:45 +01:00
Zeljko Filipin 006353fd24 Cloudbees Jenkins jobs are now created using Jenkins Job Builder
All Jenkins jobs will fail until this commit is merged:

https://wmf.ci.cloudbees.com/view/mv/

Bug: 61778
Change-Id: I5fb37946bbb15cb1b70045f85aa11ba48ecd2260
2014-02-24 16:46:20 +00:00
jenkins-bot 79d72d391d Merge "Use cross-origin img attribute instead of data URI" 2014-02-24 09:46:59 +00:00
Gilles Dubuc e37c9b809c Fixes hash handling issues
* Fixes the bug where the browser hash would get nuked on
foreign anchor clicks
* Moves the hash handling back into the mmv itself
* Adds test coverage for the hash nuking bug

Change-Id: Iea57d0f4b9090f96e622418223d3f774923e8038
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/254
2014-02-24 08:45:08 +00:00
Gilles Dubuc 28b8f5095e Use cross-origin img attribute instead of data URI
After lots of experimenting with Wireshark and
current Chrome + Firefox on Ubuntu 13.10, this is my
current understanding of the caching when preloading images
with AJAX requests:

* on Chrome, the image request always comes from browser cache
* Firefox makes two separate requests by default
* Firefox with img.crossOrigin = 'anonymous' makes two separate
  requests, but the second one is a 304 (does not load the
  image twice)
* when the image has already been cached by the browser (but not in
  this session), Chrome skips both requests; Firefox skips the AJAX
  request, but sends the normal one, and it returns with 304.

"wish I knew this when I started" things:
* the Chrome DevTools has an option to disable cache. When this is
  enabled, requests in the same document context still come from
  cache (so if I load the page, fire an AJAX request, then without
  reloading the page, fire an AJAX request to the same URL, then the
  second request will be cached), but an AJAX request - image request
  pair is an exception from this.
* when using Ctrl-F5 in Firefox, requests on that page will never hit
  the cache (even AJAX request fired after user activity; even if
  two identical requests follow each other). When using clear cache
  + normal reload, this is not the case.
* if the image does not have an Allow-Origin header and is loaded
  with crossOrigin=true, Firefox will refuse to load it. Chrome will
  log an error in the console saying it refused to load it, but will
  actually load it.
* Wireshark rocks.

Pushed some tech debt (browser + domain whitelist) into other tickets:
https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/232
https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/233

Reverted commits:
    8a8d74f01d.
    63021d0b0e.

Change-Id: I84ab2f3ac0a9706926adf7fe8726ecd9e9f843e0
Bug: 61542
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/207
2014-02-24 07:56:40 +00:00
Aaron Arcos 8a1bf00ef0 Remove fire_event("onfocus") from next/previous/exit actions, not needed
As suggested by Chrismcmahon, I confirmed that there is no need
to fire the onfocus event. We also remove the convenient functions
around this logic.

Change-Id: I00ce04c758e496f76bd5c2a43ad933c952acc5fb
2014-02-20 14:00:26 -08:00
Cmcmahon d6b8f6a7a3 Merge "Improve e2e tests to check metadata content" 2014-02-20 20:44:46 +00:00
Gergő Tisza f2550c0fbc Fix fileUsage test breaking behavior.
fileUsage tests were applying styles to the fixture element, which
apparently does not get cleaned between tests. This was because
fileUsage.$container had different semantics from element.$container
(widget's own container div vs. parent container div). FileUsage
now inherits from Element to make sure behavior is consistent.

Change-Id: I8fab8bcf084d8b7e480655114506d9848e9d9a49
2014-02-20 09:33:34 +01:00
Aaron Arcos bd07e7e7a6 Improve e2e tests to check metadata content
The first version of the e2e tests just checked the presence
of some DOM sections. This 2d version actually verifies the
values for most of the components in the viewer.

Change-Id: Iabfd544f05182e86a16cf6bda162bb0abc5cf260
2014-02-19 18:46:28 -08:00
Gergő Tisza 3f326bb3bc Fix image provider unit test.
Change-Id: I3a219d7c6277b1cd8332b35f9403e4d99352af41
2014-02-19 23:52:52 +00:00
Aaron Arcos 63021d0b0e Fix e2e tests to support data:URIs
We are using data:URIs to measure performace. This
change broke e2e tests that were trying to match plain urls.

Change-Id: I8220801472cde595dd6651ef2796468eba484071
2014-02-19 12:00:47 -08:00
Gilles Dubuc 8a8d74f01d Avoid double requests when measuring performance of image load
Change-Id: Ib5ec4c3e4e4a410a6ee520b11bf025d7447cb542
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/207
2014-02-18 16:45:03 -08:00
Gergő Tisza 7afbc5ce92 Use provider XHR information in performance metrics + several fixes
* more robust method of obtaining URL
* decouple performance logging from providers (mostly)
* ignore fake XHR object which jQuery returns for JSONP requests
* guard for CORS requests - apparently Chrome refuses to return
  certain information even with an Allow-Origin: * response header.
* Resource Timing is limited to 150 results, which causes fake
  misses in debug mode. There is an API to increase the limit
  but it is not implemented in Chrome. I am calling it nevertheless,
  maybe IE understands it (it is present in the MSDN docs at least).

This seems to work for AJAX, CORS, JSONP, image AJAX; CORS requests
return 0 for a lot of values, per spec a Timing-Allow-Origin: *
header might help that.

Change-Id: I8353858022f51a7e70774e65513d0fa2554a5064
2014-02-19 00:38:27 +00:00
Gilles Dubuc 035afe6d36 Make metadata animation more subtle
And stop showing when the user has opened the metadata once

Change-Id: Iefce36acf1b78301584ca8c1359fac94956a9440
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/213
2014-02-18 16:17:14 -08:00
Gilles Dubuc a5cddef17a Lazy-load mmv
Also removes the index inside the location hash

Change-Id: I9429ff0101ab891f2c4c6aa2d989fbef0813252d
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/136
2014-02-18 15:55:15 -08:00
Aaron Arcos 715cab7118 Fix failing test after refactoring.
Device pixel ratio was assumed to be '1' but was not explicitly set.

Change-Id: I5ce5e2ad988f14c1c286ae4a422150749c6fdcdd
2014-02-18 14:14:47 -08:00
Cmcmahon 3a4b659cfb Merge "Moved Ruby code that multiple repositories use to mediawiki_selenium Ruby gem" 2014-02-14 16:45:10 +00:00
Gilles Dubuc 35690bb2f1 Get rid of lightboxHooks
Delete lightboxHooks, since most of them
haven't proven to be useful.
Replace the useful ones by jQuery events.

Change-Id: I28f99ba85666ca15979feb5c637924b98bba27a8
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/176
2014-02-13 17:47:30 -08:00
Gilles Dubuc 6e127b25e2 Preload prev/next images
When the lightbox is opened, or prev/next pressed, preloads the
previous/next N images.

Technical debt introduced:
* initialization is a mess, with the viewer and the interface
  randomly setting properties on each other in different phases of
  execution. That got in the way and I shuffled things around
  until they worked, which is obviously not the way to have a
  robust system, but hopefully it will get scrapped soon anyway
  in favor of a clean top-down dependency injection.

Change-Id: Idcb5c40de1ac0b3e482decd66e56c4de8ec71b6b
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/155
2014-02-13 10:52:40 +01:00
Gergő Tisza 9881f9e7ae Add TaskQueue class
A simple task queue which can be processed or cancelled.
Will be used to handle preloading in a more robust way.

Change-Id: Ib33f9b2d814a35538f9d4f3691fce5ba5cdc82c1
2014-02-12 01:55:39 +00:00
Zeljko Filipin ad9768dfde Moved Ruby code that multiple repositories use to mediawiki_selenium Ruby gem
Bug: 56088
Change-Id: I126fe93ac511570594cfc1ba684b33bd2b356b34
2014-02-11 15:14:30 +01:00
Zeljko Filipin 8115a242da Added basic readme file to test/browser folder
Change-Id: If1710a3399abc1d0519b2714a3c67e9300e0829c
2014-02-10 15:58:01 +01:00
Mark Holmquist a62410616d Refactor button things into a separate class
https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/124

Change-Id: Ib4b54164bccbe17e42b223880179531e8d9e6123
2014-02-10 09:40:50 +01:00
Gergő Tisza 06cc6cca1a Refactor thumbnail size calculation
* moves generic logic into ThumbnailSizeCalculator class
* moves UI-specific logic into interface class
* fixes bug where non-bucketed sizes were served on devices with
  non-standard pixel density
* fixes bug where bucketed size was compared to css size instead of screen size
  for resizing

Change-Id: I8ba3380b74fcc8fb0a6ecc3f3140627411851ad0
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/196
2014-02-08 01:27:27 +00:00
Gilles Dubuc e74fc33e89 Track detailed content loading network performance
Leverages the W3C Navigation Timing API when available

Change-Id: Ief1d327d1bd8928bf5f2bf0bd4c7141a0a608a53
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/126
2014-02-07 19:37:22 +00:00
jenkins-bot 2da4c4acfe Merge "Refactor panel-related things into another class" 2014-02-07 18:11:12 +00:00
Gilles Dubuc 57434b5812 Refactor panel-related things into another class
mmv.lightboxinterface was getting way too clunky.

https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/124

Change-Id: Ie3a604b532ee853f9df673cc4d38c2c7594bdefa
2014-02-07 10:09:08 -08:00
Zeljko Filipin bede2da4a7 Renamed mediawiki-selenium Ruby gem to mediawiki_selenium
Bug: 60820
Change-Id: Ifdb2f788fd8d57599b663960adfa917c026de4fd
2014-02-07 13:35:23 +01:00
Gergő Tisza e33f2d263c Add Thumbnail model
Also refactor size calculation a bit - I found target/requested
harder to remember.

Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/155
Change-Id: I4781cdd7004e9a8e36875c152e1d3a335a55b7d7
2014-02-07 01:46:26 +00:00
jenkins-bot d1e966e903 Merge "Hide the fullscren button when fullscreen is unavailable" 2014-02-06 22:19:17 +00:00
Gilles Dubuc 4e85f31b27 Hide the fullscren button when fullscreen is unavailable
Change-Id: I72cff940cee1ad83f6bacfffdcfb9fdd0f16abcc
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/152
2014-02-06 14:02:52 -08:00
Gergő Tisza b013ddbefe Userinfo provider
* userinfo api requests are cached now
* we use jsonp only if we have to (makes gender api calls measurable on WMF wikis)
* all API calls use providers now, provider.Api constructor can be used to
  wrap mw.Api with metrics

Does not return a proper model, and gender API calls are not preloaded together
with the rest of the calls. Maybe next time.

Change-Id: I9b3ea73c65eef57e160ac8636d9e45d349150884
2014-02-06 00:37:39 +00:00
Gilles Dubuc 3dd716a3f2 Hide the controls after some time when in fullscreen mode
Also removes side-effects from several tests

Change-Id: Ifdc978f56f8c4caafadc8b192756645a9378f58a
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/150
2014-02-05 10:27:10 +01:00
Gergő Tisza 1ff0ac60cd Fix merge problem with categories
Change-Id: I628bffeb4cac16cf50def6d5562fb9e2b9fa8933
2014-02-05 01:46:55 +00:00
jenkins-bot af1c2cbeee Merge "Add provider to for actual image loading" 2014-02-05 00:15:56 +00:00
jenkins-bot cba179e79a Merge "Replace old API code with providers + fix a few provider bugs" 2014-02-05 00:15:55 +00:00
jenkins-bot f1640171e3 Merge "Renaming things for consistency: DataProvider -> Provider" 2014-02-05 00:15:54 +00:00
jenkins-bot 97e29b9e00 Merge "Add imageinfo, thumbnail info, repoinfo provider" 2014-02-05 00:14:22 +00:00
Gergő Tisza 6068ffd58d Add provider to for actual image loading
Change-Id: I9ca9bce37c97648afa07db9f004138a791c74e65
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
2014-02-05 00:02:28 +00:00
Gergő Tisza 40d1a2508a Replace old API code with providers + fix a few provider bugs
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
Change-Id: Id7952f0a0eafa34d7c8691c63c2daccff2eea64a
2014-02-04 23:52:02 +00:00
Gergő Tisza 056651ed33 Renaming things for consistency: DataProvider -> Provider
Change-Id: Ia1f022baef02b477296c9664e7280c75b1c84515
2014-02-04 23:51:48 +00:00
Gergő Tisza 85a37d0e14 Add imageinfo, thumbnail info, repoinfo provider
Change-Id: I80ffec39ee6c9e0ea0b37be2fc48315063b5ff8a
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
2014-02-04 23:46:02 +00:00
Mark Holmquist 9d043e7ddc Fix categories empty method
+test

Change-Id: I16f19dde713709b0cf8631cb1bf0ceee6ca438a7
2014-02-04 10:10:53 -08:00
Gilles Dubuc d34fec4ff2 Add categories to the interface
Also move some things around a liiiittle bit. Not too much.

Change-Id: I7a5b8d900f5173fa20142d205e4992361b9e81a3
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/41
2014-02-03 15:09:42 +01:00
jenkins-bot 9f0641c214 Merge "Make mmv handle urlencoded hashes" 2014-02-03 10:44:42 +00:00
Gilles Dubuc 67fa053687 Make mmv handle urlencoded hashes
Change-Id: Id05806be4586a3d6f04b92ace2c8195b8de016bc
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/153
2014-02-03 09:32:38 +01:00
Gergő Tisza e0edec21b2 Move providers into their own subdirectory
Also refactor MultimediaViewer.php a bit to get rid of all the globals.

Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/123
Change-Id: Ieca4263ecc7652dc6bc36db63b99d3813c4653e4
2014-02-01 03:49:30 +00:00