Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12883] BlackBerry: closing a child window with Ti.UI.Window.close() closes the application

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-02-27T05:48:20.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.1.0, 2013 Sprint 05 BB, 2013 Sprint 05
ComponentsBlackBerry
Labelsblackberry, module_window, qe-testadded
ReporterMatthias Kroeger
AssigneeJosh Roesslein
Created2013-02-25T11:03:12.000+0000
Updated2013-09-24T09:44:11.000+0000

Description

Problem

When closing a child window with Ti.UI.Window.close(), the whole application get closed.

actual behavior

application close

expected behavior

close child window only

Test case

var win = Ti.UI.createWindow();

function initWebViewWindow(url, timeout) {
    var self = Ti.UI.createWindow({
        backgroundColor : 'white'
    });

    var view = Ti.UI.createView({
        top : '90%',
        left : 0,
        height : '10%',
        backgroundColor : '#08A7DC'
    });

    var backView = Ti.UI.createView({
        left : 0,
        top : 0,
        width : '100%',
        bottom : 0
    });

    var backLabel = Ti.UI.createLabel({
        top : 4,
        left : 10,
        right : 0,
        bottom : 0,
        text : 'Back',
        color : 'white',
        font : {
            fontSize : 16,
            fontFamily : 'Helvetica Neue'
        },
        textAlign : 'center',
        touchEnabled : false
    });

    backView.add(backLabel);
    view.add(backView);

    backView.addEventListener("click", function(e) {
        Ti.API.info('-------------------> backView click');
        self.close();     // <<<<==== This accidentially closes the whole Application!!!
    });

    self.add(view);

    var webview = Ti.UI.createWebView({
        top : 0,
        left : 0,
        right : 0,
        height : '90%',
        url : url
    });

    // TODO: timeout not there yet
    // webview.setTimeout(timeout);

    webview.addEventListener('load', function(e) {
        Ti.API.info('-------------------> webview load');
        Ti.API.info(e);
    });

    webview.addEventListener('beforeload', function(e) {
        Ti.API.info('-------------------> webview beforeload');
        Ti.API.info(e);
    });

    webview.addEventListener('error', function(e) {
        Ti.API.info('-------------------> webview error');
        Ti.API.info(e);
    });

    self.add(webview)
    return self;

}

var button = Ti.UI.createButton({
    title : 'open WebView Window'
});

button.addEventListener('click', function(e) {
    var webViewWindow = initWebViewWindow('http://www.google.com', 5000);
    webViewWindow.open();
});

win.add(button);
win.open();

Discussions

Link to [Google Groups: Appc Ti Mobile BlackBerry](https://groups.google.com/forum/?fromgroups=#!topic/appc-ti-mobile-blackberry/SJ1bqFyk88w)

Comments

  1. Matthias Kroeger 2013-02-26

    Is there any workaround I can use instead of self.close() ? This Bug is really a showstopper for me now. Thank you very much.
  2. Josh Roesslein 2013-02-27

    It looks like the application is crashing when close is called on the window. Debugging now and will try to get a fix once I have found a solution.
  3. Matthias Kroeger 2013-02-27

    Josh, thank you very much for the quick response. I tested with mobilesdk-3.1.0.v20130226221017-osx and it works as expected.
  4. Lokesh Choudhary 2013-02-27

    Verified the issue & working as expected.Thus closing. Environment: Ti Studio : 3.1.0.201302221817 Ti BB SDK : 3.1.0.v20130227112907 Mac OSX : 10.8.2 win 7 Win 8 BB simulator : 10.0.10.261 Dev alpha B 10 device

JSON Source