Skip to content

"TypeError: Cannot read property 'elementBinders' of undefined" with angular2 and http SFX bundles #3890

@nweedon

Description

@nweedon

Using: alpha.35
Plnkr: http://plnkr.co/edit/SKDoDfEQJNEhjb1FZYfG?p=preview

Using the following SFX scripts and creating a simple component causes the titular error:
angular2: https://code.angularjs.org/2.0.0-alpha.35/angular2.sfx.dev.js
http: https://code.angularjs.org/2.0.0-alpha.35/http.sfx.dev.js

Full trace:

EXCEPTION: RangeError: Maximum call stack size exceeded
angular.sfx.dev.js:27039 STACKTRACE:
angular.sfx.dev.js:27039 RangeError: Maximum call stack size exceeded
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
    at assert (http.sfx.dev.js:8075)
angular.sfx.dev.js:27043 EXCEPTION: TypeError: Cannot read property 'elementBinders' of undefined
angular.sfx.dev.js:27039 STACKTRACE:
angular.sfx.dev.js:27039 TypeError: Cannot read property 'elementBinders' of undefined
    at _collectNestedProtoViews (angular.sfx.dev.js:18529)
    at System.register.execute.ProtoViewFactory.createAppProtoViews (angular.sfx.dev.js:18880)
    at angular.sfx.dev.js:35765
    at Zone.run (angular.sfx.dev.js:136)
    at Zone.System.register.execute.NgZone._createInnerZone.zone.fork.fork.$run [as run] (angular.sfx.dev.js:20109)
    at zoneBoundFn (angular.sfx.dev.js:109)
    at lib$es6$promise$$internal$$tryCatch (angular.sfx.dev.js:1359)
    at lib$es6$promise$$internal$$invokeCallback (angular.sfx.dev.js:1371)
    at lib$es6$promise$$internal$$publish (angular.sfx.dev.js:1342)
    at angular.sfx.dev.js:187

I can't really see what's going on at a grander scale, but I've deduced that global.assert gets defined in both SFX scripts, metioned above. (Potential problematic code below):

assertionsEnabled_ = typeof _global['assert'] !== 'undefined';
_global.assert = function assert(condition) {
  if (assertionsEnabled_) {
    _global['assert'].call(condition);
  }
};

This code seems fine for the first definition (as assertionsEnabled_ resolves to false), however, the second time around it resolves to true, therefore, whenever window.assert is called, Angular seems to get itself caught in an infinite loop, exceeding the maximum stack size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions