Skip to content

Commit

Permalink
[Bugfix beta] keep the try/catch deopt isolated.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Jul 23, 2014
1 parent 1d41c62 commit 89242ce
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/ember-runtime/lib/system/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ function processNamespace(paths, root, seen) {

var STARTS_WITH_UPPERCASE = /^[A-Z]/;

function tryIsNamespace(lookup, prop) {
try {
var obj = lookup[prop];
return obj && obj.isNamespace && obj;
} catch (e) {
// continue
}
}

function findNamespaces() {
var lookup = Ember.lookup, obj, isNamespace;

Expand All @@ -137,14 +146,8 @@ function findNamespaces() {

// At times we are not allowed to access certain properties for security reasons.
// There are also times where even if we can access them, we are not allowed to access their properties.
try {
obj = lookup[prop];
isNamespace = obj && obj.isNamespace;
} catch (e) {
continue;
}

if (isNamespace) {
obj = tryIsNamespace(lookup, prop);
if (obj) {
obj[NAME_KEY] = prop;
}
}
Expand Down

0 comments on commit 89242ce

Please sign in to comment.