#663 ✓ staged
Alex Vincent

OpenMap plugin unconditionally downloads 974KB OpenLayers.js, whether user wants it or not

Reported by Alex Vincent | July 23rd, 2011 @ 12:52 PM | in 0.8 (closed)

From plugins/openmap/popcorn.openmap.js:

if ( !_mapFired ) {

_mapFired = true;
Popcorn.getScript('http://openlayers.org/api/OpenLayers.js',
function() {
  _mapLoaded = true;
} );

}

Did anyone mention that OpenLayers.js is 974 kilobytes, minified?

This file is included directly in popcorn-complete.js. Seriously, the developer using popcorn-complete.js would not be aware that they're inducing their users to download over 1MB in JavaScript (popcorn-complete plus OpenLayers). I sure wasn't - there was no indication on the Popcorn.js website that I'd be forcing that.

Comments and changes to this ticket

  • Scott Downe

    Scott Downe July 23rd, 2011 @ 07:07 PM

    • Milestone set to 0.8
    • Milestone order changed from “71” to “0”

    Agreed, no scripts should be downloaded unless there is openlayers content existing.

    I had a look at that plugin, and it doesn't have a _setup, which is where the script should be downloaded, as setup is only run if a track event of that type exists.

    I say modify the plugin to have a setup, and move the script load into there.

  • cadecairos

    cadecairos August 22nd, 2011 @ 06:33 PM

    • State changed from “new” to “assigned”
    • Assigned user set to “cadecairos”

    I'll look into this. should be easy, I did a re-write of it that's been staged already, so I'm familiar with the code.

  • cadecairos

    cadecairos August 23rd, 2011 @ 10:39 AM

    • State changed from “assigned” to “peer-review-requested”
    • Assigned user changed from “cadecairos” to “David Seifried”

    So that was easier than i had thought, it was as easy as Scott described. The branch is t663

    Plugin passes lint, all openmap unit tests passed on firefox 6 and chrome 12.

    I made the testing directory for popcorn-complete and checked network activity when using popcorn-complete. Openlayers.js now only loads if the OpenMaps plug-in is instantiated.

  • David Seifried

    David Seifried August 23rd, 2011 @ 03:20 PM

    • State changed from “peer-review-requested” to “super-review-requested”
    • Assigned user changed from “David Seifried” to “Scott Downe”

    Awesomeeeee, I love any fix that makes me see openLayers less. Unit tests still pass and lint passes.

    PR+

  • Scott Downe

    Scott Downe August 23rd, 2011 @ 03:46 PM

    • State changed from “super-review-requested” to “review-needs-work”
    • Assigned user changed from “Scott Downe” to “cadecairos”

    Yeah, agreed this is much better.

    I did notice you pass in an empty function, when you can simply do this:

    Popcorn.getScript( "http://openlayers.org/api/OpenLayers.js" );
    

    Just fix that and we'll be good.

  • cadecairos

    cadecairos August 24th, 2011 @ 11:23 AM

    • State changed from “review-needs-work” to “super-review-requested”

    t663

    Should be good now.

    I'm getting 500's and 503's from the openmap servers, I think they might be having some server problems. but do keep an eye out for other problems if you see a bunch of those network errors.

  • cadecairos

    cadecairos August 24th, 2011 @ 11:23 AM

    • Assigned user changed from “cadecairos” to “Scott Downe”
  • Scott Downe

    Scott Downe August 25th, 2011 @ 01:37 PM

    • State changed from “super-review-requested” to “review-looks-good”
    • Assigned user changed from “Scott Downe” to “Jon Buckley”
    • Milestone order changed from “34” to “0”
  • Jon Buckley
  • Rick

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Popcorn.js is an HTML5 video framework that lets you bring elements of the web into your videos.

Popcorn.js is a project of Web Made Movies, Mozilla's Open Video Lab.

Shared Ticket Bins

Pages