Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-16688

Android: Titanium Application events firing after WebView is destroyed

    Details

    • Sprint:
      2014 Sprint 12 SDK

      Description

      Issue description

      App is using application level events to communicate with WebViews - by using calls to Ti.App.fireEvent() and Ti.App.addEventListener().

      http://docs.appcelerator.com/titanium/3.0/#!/guide/Communication_Between_WebViews_and_Titanium-section-29004919_CommunicationBetweenWebViewsandTitanium-Ti.AppEvents

      Steps to reproduce
      1. Grab app.js and logging.html
      2. Click webView "fromWebView" button. Alert shows message.
      3. Click app "fromTitanium" button. Message displayed as expected.
      4. Click "cleanUp" button. Alert fires message.
      5. If you click twice the console message shows TiViewProxy released although function keeps listening event.

      Android monitor

      03-24 18:22:48.531: E/TiViewProxy(12371): (KrollRuntimeThread) [102323,132456] Add called with null child
      

      If you attempt to run it on iOS, event listener isn't available after a second time Studio output

      [INFO] :   Application started
      [INFO] :   TiAppEvents/1.0 (3.2.2.GA.96e9a07)
      [DEBUG] :  Loading: /Users/egomez/Library/Application Support/iPhone Simulator/7.1/Applications/CD516444-41E2-4BEE-BACD-ADEE0049F7ED/TiAppEvents.app/_app_props_.json, Resource: _app_props__json
      [DEBUG] :  Application booted in 122.496009 ms
      [DEBUG] :  New scheme: <NSMutableURLRequest: 0x10883db0> { URL: file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/CD516444-41E2-4BEE-BACD-ADEE0049F7ED/TiAppEvents.app/logging.html }
      [DEBUG] :  Loading: /Users/egomez/Library/Application Support/iPhone Simulator/7.1/Applications/CD516444-41E2-4BEE-BACD-ADEE0049F7ED/TiAppEvents.app/logging.html, Resource: logging_html
      [DEBUG] :  Firing app event: app:fromTitanium
      [ERROR] :  Script Error {
      [ERROR] :      backtrace = "#0 () at :0";
      [ERROR] :      line = 93;
      [ERROR] :      message = "Invalid type passed to function";
      [ERROR] :      nativeLocation = "-[TiViewProxy remove:] (TiViewProxy.m:225)";
      [ERROR] :      nativeReason = "expected: TiViewProxy, was: NSNull";
      [ERROR] :      sourceId = 267172160;
      [ERROR] :      sourceURL = "file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/CD516444-41E2-4BEE-BACD-ADEE0049F7ED/TiAppEvents.app/app.js";
      [ERROR] :  }
      

      Cleanup is called when developer want to dispose of the webview that was added to the view. That last Ti.App.removeEventListener("app:fromTitanium", fromTitanium); fails to work though since the fromTitanium function actually sits in the webView. All we want to do is ensure that the fromTitanium event listener added to the webview is removed once the webview is destroyed.

        Attachments

        1. app.js
          1 kB
          Eduardo Gomez
        2. logging.html
          0.3 kB
          Eduardo Gomez

          Issue Links

            Activity

              People

              • Assignee:
                sunila Sunila
                Reporter:
                egomez Eduardo Gomez (Inactive)
                Reviewer:
                Hieu Pham
                Tester:
                Lokesh Choudhary
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-18519
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code