none
Bug in MapTypeCollectionChanged ? (code typo) RRS feed

  • Question

  • There seem to be an issue with the following code, which I "got" from querying this URL (I'm posting it so you can find where it is, as this is minified code.)

    https://www.bing.com/rms/MapDelayPluginBundle/cj,nj/ab503430/95c453e9.js?bu=rms+answers+MapsSDK+AnonymousBegin*Navigation*MapDelay.en-ca*MapDelayPluginStart*TransitLandmarkOverlay*SharingImage*Permalink*DefaultPrimitiveCriteria*IRoutePolylineOptions*IRoutePushpinOptions*ITransitPushpinOptions*RoutePolyline*RoutePushpin*ListDataSource*KeyProvider*BrowserKeyProvider*PointerProvider*BrowserPointerProvider*MapInteractionKeyboardState*MapInteraction*MapModeStateHistory*PrintContent*BrowserHistoryManager*HashBasedHistory*HistoryWrapper*NavigationControl*AerialBirdsEyeTransitionManager*NavigationBar*MePoi*NavigationButton*NavigationButtonTemplate*NavigationHelper*RotateControl*GeochainControl*GeochainOverlay*GeochainTemplate*GeochainSegment*GeochainManager*LocateMeControl*LocateMeErrorDialog*SelectorControl*MapInteractionBehavior*OverlayManager*NavigationBarOverlay*GlobalDataEventHandler*ImageFromCssHelper*DataHandlerKeys*IDirectionsTaskState*Waypoint*CollectionEnumerators*OverlayEntity*OverlayDataEntityAction*TaskTypes*TaskDataHandlerHelper*LocalSearchEntity*RecommendationEntity*Geocoder*ReverseGeocoder*GeolocationProvider*ManipulationDelta*Inertia*PointerTrail*ManipulationDeltaTrail*SSAutoEntryBehavior*SSAutoEntryBubblePickerOverlay*SSBootstrapper*SSModeBootstrapper*SSMiniOverlay*SSMiniBootstrapper*SSDirectionsOverlay*SSDirectionsBootstrapper*SSLocalDetailsBootstrapper*SSCoverageBehavior*SSBubblePickerOverlay*SSLoggerConstants*SSPerfConstants*ZoomInButton*ZoomOutButton*MapTypeSwitcherButton*TrafficToggleButton*RadialMenu*MapTypeButton*MapTypeButtonTemplate*GeneralMapTypeButton*RoadButton*AerialButton*BirdseyeButton*StreetsideButton*OrdnanceSurveyButton*SeasonalButton*GrayscaleButton*CanvasDarkButton*CanvasLightButton*SymbolicNightButton*WinterButton*LabelToggleButton*BirdseyeV2ExitButton*BirdseyeV2InfoExitControl*LandmarksManager*LandmarksOverlay*CityPolygonManager*TravelAttractionEntity*MapDelayPluginEnd*AnonymousEnd*ExternalPromise

    Note that there is if(n.added), then f=n.added[t], and below (the else, so n.added is undefined) we have if(n.removed) but e=n.added[t] (It is probably meant to be e=n.removed[t]), for some reason, this code is called when it is accessed in China.

    (The code error is present in cn.bing.com and www.bing.com, so I linked the www one for I can test it from america), but in my tests I never ends in that function when calling bing from the US, so the error does not pop up.

    i.prototype._mapTypeCollectionChanged=
    function(n){
      var i,f,r,t,e,u;
      if(n.added){
        for(i=[],t=0;t<n.added.length;t++)
          f=n.added[t],
          r=this._resolveMapTypeButton(f),
          r&&i.push(r);
          this._mapTypeButtonCollection.insertAll(i)
        }
      else if(n.removed)
        for(t=0;t<n.removed.length;t++)
          e=n.added[t],
          u=this._resolveMapTypeButton(e),
          u&&this._mapTypeButtonCollection.remove(u)
    }

    We really have an issue with this as this causes an embedded WebControl to pop the javascript error to the user.

    I don't see how I can prevent this error from happening by looking at the minified code, so any insight would be helpful so I don't get that error (I tried change the "supportedMapTypes" at map creation in an attempt to see why that "added" and "removed" function were called, but it the call comes from disposing "something" in the pageHideHandler, but the code differs in what they do in the cn version vs the us version)

    I write here as this is where I see fit, but if I can contact someone more specific to follow up on this it would be quite helpful too.

    Thanks

    Raphael Lemieux

    Tuesday, May 29, 2018 5:42 PM

All replies

  • Followup: The dispose that is called in the pagehide handler seems to only be the map.dispose(). To "not get" the script error, I simply register a pagehide event before starting the map, and dispose of the map myself in a try/catch construct. That does not fix anything and the disposing is still potentially not completed correctly, but at least we do not have the script error.
    Thursday, May 31, 2018 12:31 PM