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

inappbrowser/plugins fail with no exception if iframe.src is set after the location.hash is changed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.0
    • 3.4.0
    • xcode 5.02, ios 6, ios 7, simulator Version 7.0 (463.9.4.2)

    Description

      tldr; Inappbrowser dies – but only if both the hash is changed and then an iframe source is loaded. Seems to kill plugins.

      Wow this took a while to figure out how to reproduce. There are five steps, and it can be reproduced in the example cordova project. Execute the JS through the safari remote debugger, or include it in the app.init after deviceready. Oh and this exact code requires jquery, is that fine?

      1) Execute code:

      $body = $("body");
      $body.empty();
      $iframe = $("<iframe />");
      $iframe.appendTo($body);
      $iframe.attr('src', 'http://apache.org');
      

      And the result is as expected – iframe displays with content.

      2) Execute code:

      var ref = window.open('http://apache.org', '_blank', 'location=yes');
      ref.addEventListener('loadstart', function(evt) { alert('start: ' + evt.url); });
      ref.addEventListener('loadstop', function(evt) { alert('stop: ' + evt.url); });
      ref.addEventListener('exit', function(evt) { alert(evt.type); });
      

      And the result is as expected – events fire and browser pops in with content as expected. Click "Done" to dismiss the browser.

      3) Execute code:

      window.location.hash = 'test';
      

      4) Repeat steps 1 – another iframe will again display as expected.

      5) Repeat steps 2 – but this time, no events fire and browser doesn't pop up.

      Conclusion: Inappbrowser dies if both the hash is changed and then an iframe source is loaded.

      Seems to be related to:
      https://issues.apache.org/jira/browse/CB-2602
      https://issues.apache.org/jira/browse/CB-2102 (maybe?)

      What can I do to help with this?

      Attachments

        Issue Links

          Activity

            People

              agrieve Andrew Grieve
              codydjango Cody Redmond
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: