#371 ✓ staged
annasob

googleMap failing on FF 3.6

Reported by annasob | February 25th, 2011 @ 12:06 PM | in 0.5

With the new plugin structure, googleMaps is failing on FF 3.6 with an error: document.body not defined This needs to be fixed.

Comments and changes to this ticket

  • annasob

    annasob February 25th, 2011 @ 12:06 PM

    • State changed from “new” to “assigned”
    • Milestone set to 0.4
    • Assigned user set to “db48x”
    • Milestone order changed from “39” to “0”

    db48x can you take this on?

  • annasob

    annasob March 17th, 2011 @ 02:50 PM

    • Milestone changed from 0.4 to 0.5
    • Milestone order changed from “29” to “0”
  • annasob
  • annasob
  • annasob

    annasob March 21st, 2011 @ 09:10 PM

    • State changed from “assigned” to “peer-review-requested”

    Ok so the good news:
    The googleMaps plugin and tests is now working on FF 3.6 FF 4.0RC and Chrome!!! Yay

    The bad news:
    Too many timeouts
    - since google maps api needs document.body I need to wait for it before i use getSctipt to initiate loading - then google has a lot of different function needed for maps like Geocoder and LatLng so i have to ensure that these are loaded - in setup before i can start initializing the actual map I have to wait for the above to finish loading - in start I have to ensure setup finished

    The code also had a lot of

    if (!loaded) {
      setTimeout...
    }else { //do stuff}
    

    I change this to

    if (loaded){
     //do stuff
    } else { 
      setTimeout...
    }
    
  • Rick

    Rick March 23rd, 2011 @ 03:21 PM

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

    Looks great!

    You can tighten this one part up:

    
    // This condition:
    typeof google !== 'undefined'  && google.maps && typeof google.maps.Geocoder !== 'undefined' &&
             typeof google.maps.LatLng !== 'undefined'
    
    // Can be written more succinctly as (this will also save you the 3 typeof calls): 
    google && google.maps && google.maps.Geocoder && google.maps.LatLng
    

    As for setTimeout - Don't be so critical - your use here actually shows a deft and creative solution to handling a potentially too-early early asynchronous remote resource request - nice work!

    Tested in: Chrome 10, 11, 12; Firefox 3.6.16, 4b13pre, 4

    Tested with: Googlemap Plugin suite; popcorn.complete.js test runner

  • Scott Downe

    Scott Downe March 24th, 2011 @ 10:14 PM

    • State changed from “super-review-requested” to “review-looks-good”

    I think we are going to have to use:

    typeof google !== "undefined" && google.maps && google.maps.Geocoder && google.maps.LatLng
    

    google at this time may or may not exist in the global scope. It is the same as:

    if ( !doesnotexist ) {
      console.log("safe");
    }
    

    Which will never exist, and throw an error to the console, if I am correct.

    Anyway, the bug is fixed, and demos etc still work in chrome/firefox.

    SR+ with the above fix.

  • Scott Downe

    Scott Downe March 24th, 2011 @ 10:15 PM

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

    annasob March 28th, 2011 @ 03:34 PM

    • State changed from “review-looks-good” to “staged”

    Fix done!
    Staged in annasob/popcorn-js commit

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

Referenced by

Pages