Skip to content

Commit

Permalink
[BUGFIX release] [Fixes #15492] WorkAround WebKit/JSC JIT WorkARound
Browse files Browse the repository at this point in the history
Affected version: 10.1.1 (12603.2.4)
Unaffected version: Safari 11.0, WebKit 12604.1.29

Which suggests the issue has been addressed upstream.

---

The following commit 986710f#diff-7e13eecefe753df1d82ce67b32bc4366R566 remove an implicit toBoolean conversion in WeakMap_peekParentMeta which apparently trips up Webkit…

Simply reversing the expression addressed the issue.

failed: `if (meta === null || meta !== undefined) { … }`
passed: `if (meta !== undefined || meta === null) { … }`

We also, confirmed that reverting the one line in question to `meta === null || !meta) {` fixed Safari.

This PR removes the need for the an unused feature which avoids the expression entirely.

@krisselden / @stefanpenner
  • Loading branch information
stefanpenner committed Jul 14, 2017
1 parent bd6c5d3 commit 83ea077
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions packages/ember-metal/lib/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,7 @@ if (HAS_NATIVE_WEAKMAP) {
if (DEBUG) {
counters.peekCalls++;
}
// stop if we find a `null` value, since
// that means the meta was deleted
// any other truthy value is a "real" meta
if (meta === null || meta !== undefined) {
if (meta !== undefined) {
return meta;
}

Expand All @@ -530,14 +527,10 @@ if (HAS_NATIVE_WEAKMAP) {
};
} else {
setMeta = function Fallback_setMeta(obj, meta) {
// if `null` already, just set it to the new value
// otherwise define property first
if (obj[META_FIELD] !== null) {
if (obj.__defineNonEnumerable) {
obj.__defineNonEnumerable(EMBER_META_PROPERTY);
} else {
Object.defineProperty(obj, META_FIELD, META_DESC);
}
if (obj.__defineNonEnumerable) {
obj.__defineNonEnumerable(EMBER_META_PROPERTY);
} else {
Object.defineProperty(obj, META_FIELD, META_DESC);
}

obj[META_FIELD] = meta;
Expand Down Expand Up @@ -586,7 +579,7 @@ export function meta(obj) {
let parent;

// remove this code, in-favor of explicit parent
if (maybeMeta !== undefined && maybeMeta !== null) {
if (maybeMeta !== undefined) {
if (maybeMeta.source === obj) {
return maybeMeta;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-runtime/lib/mixins/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ const ArrayMixin = Mixin.create(Enumerable, {
function EachProxy(content) {
this._content = content;
this._keys = undefined;
this.__ember_meta__ = null;
this.__ember_meta__ = undefined;
}

EachProxy.prototype = {
Expand Down

0 comments on commit 83ea077

Please sign in to comment.