1.1.4 scenario runner does not work in IE (8 -> 10) #2370

Closed
ryanzec opened this Issue Apr 11, 2013 · 7 comments

Projects

None yet

6 participants

@ryanzec
ryanzec commented Apr 11, 2013

First let me just mention that this seems to be a specific issue with 1.1.4 as I have tested the same code against 1.0.6 and it works in IE fine.

Here is a very simple angular scenario runner : code for this site can be found here https://github.com/ryanzec/angular-seed :

http://seed.ryanzec.com/scripts/tests/e2e/runner.html

If you load this in Chrome, Firefox, or Safari, its passes without any issues. If you try to run this in IE 8, 9, or 10 (tested in IE 10 using compatible mode to test 8/9) you will get the following error (native IE 8 shows a similar error but does not specify the resumeBootstrap is the property/method that does not exist):

TypeError: Object doesn't support property or method 'resumeBootstrap'

Now while both the angular.js and angular-scenario.js files add the resumeBootstrap method to the angular object, base on my debugging of this issue, this is the location where the resumeBootstrap method gets added to the angular object (lines 975 -> 1008 from angular.js):

function bootstrap(element, modules) {
  var resumeBootstrapInternal = function() {
    element = jqLite(element);
    modules = modules || [];
    modules.unshift(['$provide', function($provide) {
      $provide.value('$rootElement', element);
    }]);
    modules.unshift('ng');
    var injector = createInjector(modules);
    injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
       function(scope, element, compile, injector) {
        scope.$apply(function() {
          element.data('$injector', injector);
          compile(element)(scope);
        });
      }]
    );
    return injector;
  };

  var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;

  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
    return resumeBootstrapInternal();
  }

  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
  angular.resumeBootstrap = function(extraModules) {
    forEach(extraModules, function(module) {
      modules.push(module);
    });
    resumeBootstrapInternal();
  };
}

I have verified that both Chrome and IE are getting the code block executed however the issue for IE is that the varaible window.name is an empty string and Chrome shows it as NG_DEFER_BOOTSTRAP!. From here I looked to see where the name was getting set and that seems to happen here (lines 26212 -> 26255 in angular-scenario.js):

angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorFn) {
  var self = this;
  var frame = self.getFrame_();
  //TODO(esprehn): Refactor to use rethrow()
  errorFn = errorFn || function(e) { throw e; };
  if (url === 'about:blank') {
    errorFn('Sandbox Error: Navigating to about:blank is not allowed.');
  } else if (url.charAt(0) === '#') {
    url = frame.attr('src').split('#')[0] + url;
    frame.attr('src', url);
    self.executeAction(loadFn);
  } else {
    frame.remove();
    self.context.find('#test-frames').append('<iframe>');
    frame = self.getFrame_();

    frame[0].contentWindow.name = "NG_DEFER_BOOTSTRAP!";

    frame.load(function() {
      frame.unbind();
      try {
        var $window = self.getWindow_();

        if ($window.angular) {
          // Disable animations

          // TODO(i): this doesn't disable javascript animations
          //          we don't need that for our tests, but it should be done
          $window.angular.resumeBootstrap([['$provide', function($provide) {
            $provide.decorator('$sniffer', function($delegate) {
              $delegate.supportsTransitions = false;
              return $delegate;
            });
          }]]);
        }

        self.executeAction(loadFn);
      } catch (e) {
        errorFn(e);
      }
    }).attr('src', url);
  }
  self.context.find('> h2 a').attr('href', url).text(url);
};

The weird thing is that this line

frame[0].contentWindow.name = "NG_DEFER_BOOTSTRAP!"; 

Seems to be running properly for both Chrome and IE (the console.log()'s I put there output the same) so I am not quite sure why IE is not working. There are only 2 possibilities I can think of (unless this is just an IE bug). One is there is another place that is setting the name that I can't seem to find that IE is not executing. The other is that the value for

frame[0]

Is different for Chrome and IE, maybe IE is not pulling the frame properly, however I don't see any why I can test that.

Now inside the block of code from the angular-scenario.js file, if I change:

if ($window.angular) {

to

if ($window.angular.resumeBootstrap) {

The scenarios run properly on IE however I don't know if this would create other bugs in the scenario runner (at least I know it won't effect my actual production code) so not sure if this is a proper fix (my gut tells me it is not).

Does anyone see what might be the issue here?

@ryanzec
ryanzec commented Apr 25, 2013

Anyone running into this issue?

@DemonShi

I also experience the error "TypeError: Object doesn't support property or method 'resumeBootstrap'"
. I tried versions 1.1.4 and 1.0.6 and I'm getting the error in both of them

@zachsnow
Contributor

We ran into the issue; we used the same tweak (if($window.angular.resumeBootstrap){ ... }) to get it working, but would love to be able to run a standard AngularJS release. We saw it in IE10, not sure about other versions.

@hansrwindhoff

Same issue for me:
Object doesn't support property or method 'resumeBootstrap

@alonbardavid
Contributor

Same issue here, trying to run angular.js's own e2e tests on IE9 fails (with latest version- 097947f).
It appears that the Jenkins CI doesn't run the e2e tests on IE (only the unit tests), so this issue should have stopped the version release.

@btford btford closed this Aug 24, 2013
@btford
Contributor
btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

@ryanzec
ryanzec commented Aug 26, 2013

Considering this deals with the now old end-2-end tester and the fact that Protractor is going to replace it (and the fact that I now am using DalekJS), I am no longer concerned about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment