Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-2845

CompassError, PositionError constants not attached to prototype as specified in W3C document

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      CompassError.js PositionError.js do not define the error constants on the prototype of the object. Hence the constants are not passed into the error function as specified in the W3C document http://dev.w3.org/geo/api/spec-source.html#position_error_interface (see: interface PositionError { const unsigned short PERMISSION_DENIED = 1; ...)

      Fix: define in the library PositionError.js and Compass.js constants additionally like this:
      PositionError.prototype.PERMISSION_DENIED = 1;

      https://github.com/apache/incubator-cordova-js/blob/master/lib/common/plugin/PositionError.js#L34
      https://github.com/apache/incubator-cordova-js/blob/master/lib/common/plugin/CompassError.js#L31

      W3C compatible code is:
      positionError = function(gpsError)
      {
      switch(gpsError.code)
      {
      case gpsError.PERMISSION_DENIED:
      errorMessage = "Access to GPS denied!";
      break;
      ...

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            katzlbt Thomas K.
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment