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

Add reset() to plugin API and fix callback collisions on all platforms

    XMLWordPrintableJSON

Details

    Description

      There are three parts to this bug.

      First, platform-specific: we should add a reset() function to the plugin API which is called on top-level navigation or refresh, so that plugins can know to cancel any long-running requests and reinitialize themselves. This won't be relevant to some platforms

      Second, platform-independent: the callback IDs generated on the Javascript side should be randomized in some way to prevent collisions after navigation. Otherwise a request might get the ID "Service1", and before it has a chance to complete we navigate and a new request is made, also receiving "Service1". Then the first response comes back and the new Service1 callback is handed the old results.

      Third, we should add a test for this to Mobile Spec, if possible. This is a tricky thing to reproduce reliably, unfortunately.

      I'll tackle the second and third parts, and Android for the first part. It would be great if people who work on other platforms would add the reset() logic, or close the platform bugs if the platform is all-Javascript and fully reloaded on navigation.

      Attachments

        Issue Links

          Activity

            People

              shepheb Braden Shepherdson
              shepheb Braden Shepherdson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: